| FFmpegKit Linux API 6.0

Loading...
Searching...
No Matches
fftools_sync_queue.h
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 * Copyright (c) 2023 ARTHENICA LTD
4 *
5 * FFmpeg is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * FFmpeg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with FFmpeg; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20/*
21 * This file is the modified version of sync_queue.h file living in ffmpeg source code under the fftools folder. We
22 * manually update it each time we depend on a new ffmpeg version. Below you can see the list of changes applied
23 * by us to develop ffmpeg-kit library.
24 *
25 * ffmpeg-kit changes by ARTHENICA LTD
26 *
27 * 07.2023
28 * --------------------------------------------------------
29 * - FFmpeg 6.0 changes migrated
30 */
31
32#ifndef FFTOOLS_SYNC_QUEUE_H
33#define FFTOOLS_SYNC_QUEUE_H
34
35#include <stdint.h>
36
37#include "libavcodec/packet.h"
38
39#include "libavutil/frame.h"
40
41 enum SyncQueueType {
42 SYNC_QUEUE_PACKETS,
43 SYNC_QUEUE_FRAMES,
44};
45
46 typedef union SyncQueueFrame {
47 AVFrame *f;
48 AVPacket *p;
49} SyncQueueFrame;
50
51#define SQFRAME(frame) ((SyncQueueFrame){ .f = (frame) })
52#define SQPKT(pkt) ((SyncQueueFrame){ .p = (pkt) })
53
54 typedef struct SyncQueue SyncQueue;
55
61 SyncQueue *sq_alloc(enum SyncQueueType type, int64_t buf_size_us);
62 void sq_free(SyncQueue **sq);
63
73 int sq_add_stream(SyncQueue *sq, int limiting);
74
79 void sq_set_tb(SyncQueue *sq, unsigned int stream_idx, AVRational tb);
80
85 void sq_limit_frames(SyncQueue *sq, unsigned int stream_idx,
86 uint64_t max_frames);
87
102 int sq_send(SyncQueue *sq, unsigned int stream_idx, SyncQueueFrame frame);
103
120 int sq_receive(SyncQueue *sq, int stream_idx, SyncQueueFrame frame);
121
122#endif // FFTOOLS_SYNC_QUEUE_H
sq_alloc
SyncQueue * sq_alloc(enum SyncQueueType type, int64_t buf_size_us)
Definition fftools_sync_queue.c:419
sq_send
int sq_send(SyncQueue *sq, unsigned int stream_idx, SyncQueueFrame frame)
Definition fftools_sync_queue.c:248
sq_free
void sq_free(SyncQueue **sq)
Definition fftools_sync_queue.c:442
sq_set_tb
void sq_set_tb(SyncQueue *sq, unsigned int stream_idx, AVRational tb)
Definition fftools_sync_queue.c:392
SyncQueueType
SyncQueueType
Definition fftools_sync_queue.h:41
SYNC_QUEUE_FRAMES
@ SYNC_QUEUE_FRAMES
Definition fftools_sync_queue.h:43
SYNC_QUEUE_PACKETS
@ SYNC_QUEUE_PACKETS
Definition fftools_sync_queue.h:42
sq_receive
int sq_receive(SyncQueue *sq, int stream_idx, SyncQueueFrame frame)
Definition fftools_sync_queue.c:353
sq_limit_frames
void sq_limit_frames(SyncQueue *sq, unsigned int stream_idx, uint64_t max_frames)
Definition fftools_sync_queue.c:407
sq_add_stream
int sq_add_stream(SyncQueue *sq, int limiting)
Definition fftools_sync_queue.c:365
SyncQueue
Definition fftools_sync_queue.c:59
SyncQueue::type
enum SyncQueueType type
Definition fftools_sync_queue.c:60
SyncQueue::buf_size_us
int64_t buf_size_us
Definition fftools_sync_queue.c:71
SyncQueueFrame
Definition fftools_sync_queue.h:46
SyncQueueFrame::f
AVFrame * f
Definition fftools_sync_queue.h:47
SyncQueueFrame::p
AVPacket * p
Definition fftools_sync_queue.h:48