FFmpeg
|
#include <stdatomic.h>
#include <stddef.h>
#include <stdint.h>
#include "cmdutils.h"
#include "ffmpeg_sched.h"
#include "ffmpeg_utils.h"
#include "sync_queue.h"
#include "thread_queue.h"
#include "libavcodec/packet.h"
#include "libavutil/avassert.h"
#include "libavutil/error.h"
#include "libavutil/fifo.h"
#include "libavutil/frame.h"
#include "libavutil/mem.h"
#include "libavutil/thread.h"
#include "libavutil/threadmessage.h"
#include "libavutil/time.h"
Go to the source code of this file.
Data Structures | |
struct | SchWaiter |
struct | SchTask |
struct | SchDecOutput |
struct | SchDec |
struct | SchSyncQueue |
struct | SchEnc |
struct | SchDemuxStream |
struct | SchDemux |
struct | PreMuxQueue |
struct | SchMuxStream |
struct | SchMux |
struct | SchFilterIn |
struct | SchFilterOut |
struct | SchFilterGraph |
struct | Scheduler |
Macros | |
#define | SCHEDULE_TOLERANCE (100 * 1000) |
Enumerations | |
enum | QueueType { QUEUE_PACKETS, QUEUE_FRAMES } |
enum | SchedulerState { SCH_STATE_UNINIT, SCH_STATE_STARTED, SCH_STATE_STOPPED } |
enum | { CYCLE_NODE_NEW = 0, CYCLE_NODE_STARTED, CYCLE_NODE_DONE } |
Functions | |
static int | waiter_wait (Scheduler *sch, SchWaiter *w) |
Wait until this task is allowed to proceed. More... | |
static void | waiter_set (SchWaiter *w, int choked) |
static int | waiter_init (SchWaiter *w) |
static void | waiter_uninit (SchWaiter *w) |
static int | queue_alloc (ThreadQueue **ptq, unsigned nb_streams, unsigned queue_size, enum QueueType type) |
static void * | task_wrapper (void *arg) |
static int | task_start (SchTask *task) |
static void | task_init (Scheduler *sch, SchTask *task, enum SchedulerNodeType type, unsigned idx, SchThreadFunc func, void *func_arg) |
static int64_t | trailing_dts (const Scheduler *sch, int count_finished) |
void | sch_free (Scheduler **psch) |
Scheduler * | sch_alloc (void) |
int | sch_sdp_filename (Scheduler *sch, const char *sdp_filename) |
Set the file path for the SDP. More... | |
int | sch_add_mux (Scheduler *sch, SchThreadFunc func, int(*init)(void *), void *arg, int sdp_auto, unsigned thread_queue_size) |
Add a muxer to the scheduler. More... | |
int | sch_add_mux_stream (Scheduler *sch, unsigned mux_idx) |
Add a muxed stream for a previously added muxer. More... | |
int | sch_add_demux (Scheduler *sch, SchThreadFunc func, void *ctx) |
Add a demuxer to the scheduler. More... | |
int | sch_add_demux_stream (Scheduler *sch, unsigned demux_idx) |
Add a demuxed stream for a previously added demuxer. More... | |
int | sch_add_dec_output (Scheduler *sch, unsigned dec_idx) |
Add another output to decoder (e.g. More... | |
int | sch_add_dec (Scheduler *sch, SchThreadFunc func, void *ctx, int send_end_ts) |
Add a decoder to the scheduler. More... | |
int | sch_add_enc (Scheduler *sch, SchThreadFunc func, void *ctx, int(*open_cb)(void *opaque, const AVFrame *frame)) |
int | sch_add_filtergraph (Scheduler *sch, unsigned nb_inputs, unsigned nb_outputs, SchThreadFunc func, void *ctx) |
Add a filtergraph to the scheduler. More... | |
int | sch_add_sq_enc (Scheduler *sch, uint64_t buf_size_us, void *logctx) |
Add an pre-encoding sync queue to the scheduler. More... | |
int | sch_sq_add_enc (Scheduler *sch, unsigned sq_idx, unsigned enc_idx, int limiting, uint64_t max_frames) |
int | sch_connect (Scheduler *sch, SchedulerNode src, SchedulerNode dst) |
static int | mux_task_start (SchMux *mux) |
int | print_sdp (const char *filename) |
static int | mux_init (Scheduler *sch, SchMux *mux) |
void | sch_mux_stream_buffering (Scheduler *sch, unsigned mux_idx, unsigned stream_idx, size_t data_threshold, int max_packets) |
Configure limits on packet buffering performed before the muxer task is started. More... | |
int | sch_mux_stream_ready (Scheduler *sch, unsigned mux_idx, unsigned stream_idx) |
Signal to the scheduler that the specified muxed stream is initialized and ready. More... | |
int | sch_mux_sub_heartbeat_add (Scheduler *sch, unsigned mux_idx, unsigned stream_idx, unsigned dec_idx) |
static void | unchoke_for_stream (Scheduler *sch, SchedulerNode src) |
static void | schedule_update_locked (Scheduler *sch) |
static int | check_acyclic_for_output (const Scheduler *sch, SchedulerNode src, uint8_t *filters_visited, SchedulerNode *filters_stack) |
static int | check_acyclic (Scheduler *sch) |
static int | start_prepare (Scheduler *sch) |
int | sch_start (Scheduler *sch) |
int | sch_wait (Scheduler *sch, uint64_t timeout_us, int64_t *transcode_ts) |
Wait until transcoding terminates or the specified timeout elapses. More... | |
static int | enc_open (Scheduler *sch, SchEnc *enc, const AVFrame *frame) |
static int | send_to_enc_thread (Scheduler *sch, SchEnc *enc, AVFrame *frame) |
static int | send_to_enc_sq (Scheduler *sch, SchEnc *enc, AVFrame *frame) |
static int | send_to_enc (Scheduler *sch, SchEnc *enc, AVFrame *frame) |
static int | mux_queue_packet (SchMux *mux, SchMuxStream *ms, AVPacket *pkt) |
static int | send_to_mux (Scheduler *sch, SchMux *mux, unsigned stream_idx, AVPacket *pkt) |
static int | demux_stream_send_to_dst (Scheduler *sch, const SchedulerNode dst, uint8_t *dst_finished, AVPacket *pkt, unsigned flags) |
static int | demux_send_for_stream (Scheduler *sch, SchDemux *d, SchDemuxStream *ds, AVPacket *pkt, unsigned flags) |
static int | demux_flush (Scheduler *sch, SchDemux *d, AVPacket *pkt) |
int | sch_demux_send (Scheduler *sch, unsigned demux_idx, AVPacket *pkt, unsigned flags) |
Called by demuxer tasks to communicate with their downstreams. More... | |
static int | demux_done (Scheduler *sch, unsigned demux_idx) |
int | sch_mux_receive (Scheduler *sch, unsigned mux_idx, AVPacket *pkt) |
Called by muxer tasks to obtain packets for muxing. More... | |
void | sch_mux_receive_finish (Scheduler *sch, unsigned mux_idx, unsigned stream_idx) |
Called by muxer tasks to signal that a stream will no longer accept input. More... | |
int | sch_mux_sub_heartbeat (Scheduler *sch, unsigned mux_idx, unsigned stream_idx, const AVPacket *pkt) |
static int | mux_done (Scheduler *sch, unsigned mux_idx) |
int | sch_dec_receive (Scheduler *sch, unsigned dec_idx, AVPacket *pkt) |
Called by decoder tasks to receive a packet for decoding. More... | |
static int | send_to_filter (Scheduler *sch, SchFilterGraph *fg, unsigned in_idx, AVFrame *frame) |
static int | dec_send_to_dst (Scheduler *sch, const SchedulerNode dst, uint8_t *dst_finished, AVFrame *frame) |
int | sch_dec_send (Scheduler *sch, unsigned dec_idx, unsigned out_idx, AVFrame *frame) |
Called by decoder tasks to send a decoded frame downstream. More... | |
static int | dec_done (Scheduler *sch, unsigned dec_idx) |
int | sch_enc_receive (Scheduler *sch, unsigned enc_idx, AVFrame *frame) |
Called by encoder tasks to obtain frames for encoding. More... | |
static int | enc_send_to_dst (Scheduler *sch, const SchedulerNode dst, uint8_t *dst_finished, AVPacket *pkt) |
int | sch_enc_send (Scheduler *sch, unsigned enc_idx, AVPacket *pkt) |
Called by encoder tasks to send encoded packets downstream. More... | |
static int | enc_done (Scheduler *sch, unsigned enc_idx) |
int | sch_filter_receive (Scheduler *sch, unsigned fg_idx, unsigned *in_idx, AVFrame *frame) |
Called by filtergraph tasks to obtain frames for filtering. More... | |
void | sch_filter_receive_finish (Scheduler *sch, unsigned fg_idx, unsigned in_idx) |
Called by filter tasks to signal that a filter input will no longer accept input. More... | |
int | sch_filter_send (Scheduler *sch, unsigned fg_idx, unsigned out_idx, AVFrame *frame) |
Called by filtergraph tasks to send a filtered frame or EOF to consumers. More... | |
static int | filter_done (Scheduler *sch, unsigned fg_idx) |
int | sch_filter_command (Scheduler *sch, unsigned fg_idx, AVFrame *frame) |
static int | task_cleanup (Scheduler *sch, SchedulerNode node) |
static int | task_stop (Scheduler *sch, SchTask *task) |
int | sch_stop (Scheduler *sch, int64_t *finish_ts) |
Variables | |
static const AVClass | scheduler_class |
static const AVClass | sch_mux_class |
static const AVClass | sch_demux_class |
static const AVClass | sch_dec_class |
static const AVClass | sch_enc_class |
static const AVClass | sch_fg_class |
#define SCHEDULE_TOLERANCE (100 * 1000) |
Definition at line 45 of file ffmpeg_sched.c.
enum QueueType |
Enumerator | |
---|---|
QUEUE_PACKETS | |
QUEUE_FRAMES |
Definition at line 47 of file ffmpeg_sched.c.
enum SchedulerState |
Enumerator | |
---|---|
SCH_STATE_UNINIT | |
SCH_STATE_STARTED | |
SCH_STATE_STOPPED |
Definition at line 269 of file ffmpeg_sched.c.
anonymous enum |
Enumerator | |
---|---|
CYCLE_NODE_NEW | |
CYCLE_NODE_STARTED | |
CYCLE_NODE_DONE |
Definition at line 1358 of file ffmpeg_sched.c.
Wait until this task is allowed to proceed.
0 | the caller should proceed |
1 | the caller should terminate |
Definition at line 322 of file ffmpeg_sched.c.
Referenced by sch_demux_send(), and sch_filter_receive().
|
static |
Definition at line 341 of file ffmpeg_sched.c.
Referenced by sch_stop(), and schedule_update_locked().
|
static |
Definition at line 351 of file ffmpeg_sched.c.
Referenced by sch_add_demux(), and sch_add_filtergraph().
|
static |
Definition at line 368 of file ffmpeg_sched.c.
Referenced by sch_free().
|
static |
Definition at line 374 of file ffmpeg_sched.c.
Referenced by sch_add_dec(), sch_add_enc(), sch_add_filtergraph(), and start_prepare().
|
static |
Definition at line 2527 of file ffmpeg_sched.c.
Referenced by task_start().
|
static |
Definition at line 406 of file ffmpeg_sched.c.
Referenced by mux_task_start(), and sch_start().
|
static |
Definition at line 425 of file ffmpeg_sched.c.
Referenced by sch_add_dec(), sch_add_demux(), sch_add_enc(), sch_add_filtergraph(), and sch_add_mux().
Definition at line 437 of file ffmpeg_sched.c.
Referenced by sch_stop(), and schedule_update_locked().
void sch_free | ( | Scheduler ** | psch | ) |
Definition at line 459 of file ffmpeg_sched.c.
Referenced by main(), and sch_alloc().
Scheduler* sch_alloc | ( | void | ) |
Definition at line 577 of file ffmpeg_sched.c.
Referenced by main().
int sch_sdp_filename | ( | Scheduler * | sch, |
const char * | sdp_filename | ||
) |
Set the file path for the SDP.
The SDP is written when either of the following is true:
Definition at line 611 of file ffmpeg_sched.c.
Referenced by opt_sdp_file().
int sch_add_mux | ( | Scheduler * | sch, |
SchThreadFunc | func, | ||
int(*)(void *) | init, | ||
void * | ctx, | ||
int | sdp_auto, | ||
unsigned | thread_queue_size | ||
) |
Add a muxer to the scheduler.
Note that muxer thread startup is more complicated than for other components, because
In order for the above to work, the scheduler needs to be able to invoke just writing the header, which is the reason the init parameter exists.
func | Function executed as the muxing task. |
init | Callback that is called to initialize the muxer and write the header. Called after sch_mux_stream_ready() is called for all the streams in the muxer. |
ctx | Muxer state; will be passed to func/init and used for logging. |
sdp_auto | Determines automatic SDP writing - see sch_sdp_filename(). |
thread_queue_size | number of packets that can be buffered before sending to the muxer blocks |
>=0 | Index of the newly-created muxer. |
<0 | Error code. |
Definition at line 624 of file ffmpeg_sched.c.
Referenced by of_open().
int sch_add_mux_stream | ( | Scheduler * | sch, |
unsigned | mux_idx | ||
) |
Add a muxed stream for a previously added muxer.
mux_idx | index previously returned by sch_add_mux() |
>=0 | Index of the newly-created muxed stream. |
<0 | Error code. |
Definition at line 648 of file ffmpeg_sched.c.
Referenced by ost_add().
int sch_add_demux | ( | Scheduler * | sch, |
SchThreadFunc | func, | ||
void * | ctx | ||
) |
Add a demuxer to the scheduler.
func | Function executed as the demuxer task. |
ctx | Demuxer state; will be passed to func and used for logging. |
>=0 | Index of the newly-created demuxer. |
<0 | Error code. |
Definition at line 680 of file ffmpeg_sched.c.
Referenced by ifile_open().
int sch_add_demux_stream | ( | Scheduler * | sch, |
unsigned | demux_idx | ||
) |
Add a demuxed stream for a previously added demuxer.
demux_idx | index previously returned by sch_add_demux() |
>=0 | Index of the newly-created demuxed stream. |
<0 | Error code. |
Definition at line 707 of file ffmpeg_sched.c.
Referenced by ist_use().
int sch_add_dec_output | ( | Scheduler * | sch, |
unsigned | dec_idx | ||
) |
Add another output to decoder (e.g.
for multiview video).
>=0 | Index of the newly-added decoder output. |
<0 | Error code. |
Definition at line 719 of file ffmpeg_sched.c.
Referenced by dec_request_view(), and sch_add_dec().
int sch_add_dec | ( | Scheduler * | sch, |
SchThreadFunc | func, | ||
void * | ctx, | ||
int | send_end_ts | ||
) |
Add a decoder to the scheduler.
func | Function executed as the decoder task. |
ctx | Decoder state; will be passed to func and used for logging. |
send_end_ts | The decoder will return an end timestamp after flush packets are delivered to it. See documentation for sch_dec_receive() for more details. |
>=0 | Index of the newly-created decoder. |
<0 | Error code. |
Definition at line 740 of file ffmpeg_sched.c.
Referenced by dec_alloc().
int sch_add_enc | ( | Scheduler * | sch, |
SchThreadFunc | func, | ||
void * | ctx, | ||
int(*)(void *opaque, const AVFrame *frame) | open_cb | ||
) |
Definition at line 783 of file ffmpeg_sched.c.
Referenced by ost_add().
int sch_add_filtergraph | ( | Scheduler * | sch, |
unsigned | nb_inputs, | ||
unsigned | nb_outputs, | ||
SchThreadFunc | func, | ||
void * | ctx | ||
) |
Add a filtergraph to the scheduler.
nb_inputs | Number of filtergraph inputs. |
nb_outputs | number of filtergraph outputs |
func | Function executed as the filtering task. |
ctx | Filter state; will be passed to func and used for logging. |
>=0 | Index of the newly-created filtergraph. |
<0 | Error code. |
Definition at line 821 of file ffmpeg_sched.c.
Referenced by fg_create().
int sch_add_sq_enc | ( | Scheduler * | sch, |
uint64_t | buf_size_us, | ||
void * | logctx | ||
) |
Add an pre-encoding sync queue to the scheduler.
buf_size_us | Sync queue buffering size, passed to sq_alloc(). |
logctx | Logging context for the sync queue. passed to sq_alloc(). |
>=0 | Index of the newly-created sync queue. |
<0 | Error code. |
Definition at line 863 of file ffmpeg_sched.c.
Referenced by setup_sync_queues().
int sch_sq_add_enc | ( | Scheduler * | sch, |
unsigned | sq_idx, | ||
unsigned | enc_idx, | ||
int | limiting, | ||
uint64_t | max_frames | ||
) |
Definition at line 888 of file ffmpeg_sched.c.
Referenced by setup_sync_queues().
int sch_connect | ( | Scheduler * | sch, |
SchedulerNode | src, | ||
SchedulerNode | dst | ||
) |
Definition at line 919 of file ffmpeg_sched.c.
Referenced by dec_create(), ifilter_bind_dec(), ifilter_bind_fg(), ifilter_bind_ist(), ist_use(), ofilter_bind_enc(), and ost_add().
|
static |
Definition at line 1097 of file ffmpeg_sched.c.
Referenced by mux_init().
int print_sdp | ( | const char * | filename | ) |
Definition at line 507 of file ffmpeg_mux.c.
Referenced by mux_init().
Definition at line 1161 of file ffmpeg_sched.c.
Referenced by sch_mux_stream_ready(), and sch_start().
void sch_mux_stream_buffering | ( | Scheduler * | sch, |
unsigned | mux_idx, | ||
unsigned | stream_idx, | ||
size_t | data_threshold, | ||
int | max_packets | ||
) |
Configure limits on packet buffering performed before the muxer task is started.
mux_idx | index previously returned by sch_add_mux() |
stream_idx_idx | index previously returned by sch_add_mux_stream() |
data_threshold | Total size of the buffered packets' data after which max_packets applies. |
max_packets | maximum Maximum number of buffered packets after data_threshold is reached. |
Definition at line 1197 of file ffmpeg_sched.c.
Referenced by ost_add().
int sch_mux_stream_ready | ( | Scheduler * | sch, |
unsigned | mux_idx, | ||
unsigned | stream_idx | ||
) |
Signal to the scheduler that the specified muxed stream is initialized and ready.
Muxing is started once all the streams are ready.
Definition at line 1213 of file ffmpeg_sched.c.
Referenced by of_stream_init().
int sch_mux_sub_heartbeat_add | ( | Scheduler * | sch, |
unsigned | mux_idx, | ||
unsigned | stream_idx, | ||
unsigned | dec_idx | ||
) |
Definition at line 1238 of file ffmpeg_sched.c.
Referenced by create_streams().
|
static |
Definition at line 1267 of file ffmpeg_sched.c.
Referenced by schedule_update_locked().
|
static |
Definition at line 1292 of file ffmpeg_sched.c.
Referenced by demux_done(), filter_done(), mux_done(), sch_filter_receive(), sch_mux_receive_finish(), sch_start(), send_to_enc_sq(), and send_to_mux().
|
static |
Definition at line 1365 of file ffmpeg_sched.c.
Referenced by check_acyclic().
|
static |
Definition at line 1410 of file ffmpeg_sched.c.
Referenced by start_prepare().
|
static |
Definition at line 1446 of file ffmpeg_sched.c.
Referenced by sch_start().
int sch_start | ( | Scheduler * | sch | ) |
Definition at line 1591 of file ffmpeg_sched.c.
Referenced by transcode().
Wait until transcoding terminates or the specified timeout elapses.
timeout_us | Amount of time in microseconds after which this function will timeout. |
transcode_ts | Current transcode timestamp in AV_TIME_BASE_Q, for informational purposes only. |
0 | waiting timed out, transcoding is not finished |
1 | transcoding is finished |
Definition at line 1657 of file ffmpeg_sched.c.
Referenced by transcode().
Definition at line 1682 of file ffmpeg_sched.c.
Referenced by send_to_enc().
Definition at line 1708 of file ffmpeg_sched.c.
Referenced by send_to_enc(), and send_to_enc_sq().
Definition at line 1727 of file ffmpeg_sched.c.
Referenced by send_to_enc().
Definition at line 1803 of file ffmpeg_sched.c.
Referenced by dec_send_to_dst(), filter_done(), and sch_filter_send().
|
static |
Definition at line 1823 of file ffmpeg_sched.c.
Referenced by send_to_mux().
|
static |
Definition at line 1859 of file ffmpeg_sched.c.
Referenced by demux_stream_send_to_dst(), and enc_send_to_dst().
|
static |
Definition at line 1918 of file ffmpeg_sched.c.
Referenced by demux_send_for_stream().
|
static |
Definition at line 1953 of file ffmpeg_sched.c.
Referenced by demux_done(), and sch_demux_send().
Definition at line 1985 of file ffmpeg_sched.c.
Referenced by sch_demux_send().
Called by demuxer tasks to communicate with their downstreams.
The following may be sent:
demux_idx | demuxer index |
pkt | A demuxed packet to send. When flushing (i.e. pkt->stream_index=-1 on entry to this function), on successful return pkt->pts/pkt->time_base will be set to the maximum end timestamp of any decoded audio stream, or AV_NOPTS_VALUE if no decoded audio streams are present. |
non-negative value | success |
AVERROR_EOF | all consumers for the stream are done |
AVERROR_EXIT | all consumers are done, should terminate demuxing |
anoter negative error code | other failure |
Definition at line 2029 of file ffmpeg_sched.c.
Referenced by do_send(), and input_thread().
|
static |
Definition at line 2051 of file ffmpeg_sched.c.
Referenced by task_cleanup().
Called by muxer tasks to obtain packets for muxing.
Will wait for a packet for any muxed stream to become available and return it in pkt.
mux_idx | Muxer index previously returned by sch_add_mux(). |
pkt | Newly-received packet will be stored here on success. Must be clean on entrance to this function. |
0 | A packet was successfully delivered into pkt. Its stream_index corresponds to a stream index previously returned from sch_add_mux_stream(). |
AVERROR_EOF | When pkt->stream_index is non-negative, this signals that no more packets will be delivered for this stream index. Otherwise this indicates that no more packets will be delivered for any stream and the muxer should therefore flush everything and terminate. |
Definition at line 2073 of file ffmpeg_sched.c.
Referenced by muxer_thread().
void sch_mux_receive_finish | ( | Scheduler * | sch, |
unsigned | mux_idx, | ||
unsigned | stream_idx | ||
) |
Called by muxer tasks to signal that a stream will no longer accept input.
stream_idx | Stream index previously returned from sch_add_mux_stream(). |
Definition at line 2086 of file ffmpeg_sched.c.
Referenced by muxer_thread().
int sch_mux_sub_heartbeat | ( | Scheduler * | sch, |
unsigned | mux_idx, | ||
unsigned | stream_idx, | ||
const AVPacket * | pkt | ||
) |
Definition at line 2104 of file ffmpeg_sched.c.
Referenced by mux_packet_filter().
|
static |
Definition at line 2130 of file ffmpeg_sched.c.
Referenced by task_cleanup().
Called by decoder tasks to receive a packet for decoding.
dec_idx | decoder index |
pkt | Input packet will be written here on success. An empty packet signals that the decoder should be flushed, but more packets will follow (e.g. after seeking). When a decoder created with send_end_ts=1 receives a flush packet, it must write the end timestamp of the stream after flushing to pkt->pts/time_base on the next call to this function (if any). |
non-negative value | success |
AVERROR_EOF | no more packets will arrive, should terminate decoding |
another negative error code | other failure |
Definition at line 2157 of file ffmpeg_sched.c.
Referenced by decoder_thread().
|
static |
Definition at line 2186 of file ffmpeg_sched.c.
Referenced by dec_send_to_dst(), filter_done(), sch_filter_command(), and sch_filter_send().
|
static |
Definition at line 2203 of file ffmpeg_sched.c.
Referenced by dec_done(), and sch_dec_send().
Called by decoder tasks to send a decoded frame downstream.
dec_idx | Decoder index previously returned by sch_add_dec(). |
frame | Decoded frame; on success it is consumed and cleared by this function |
>=0 | success |
AVERROR_EOF | all consumers are done, should terminate decoding |
another negative error code | other failure |
Definition at line 2233 of file ffmpeg_sched.c.
Referenced by decoder_thread(), packet_decode(), process_subtitle(), and transcode_subtitles().
|
static |
Definition at line 2277 of file ffmpeg_sched.c.
Referenced by task_cleanup().
Called by encoder tasks to obtain frames for encoding.
Will wait for a frame to become available and return it in frame.
enc_idx | Encoder index previously returned by sch_add_enc(). |
frame | Newly-received frame will be stored here on success. Must be clean on entrance to this function. |
0 | A frame was successfully delivered into frame. |
AVERROR_EOF | No more frames will be delivered, the encoder should flush everything and terminate. |
Definition at line 2302 of file ffmpeg_sched.c.
Referenced by encoder_thread().
|
static |
Definition at line 2316 of file ffmpeg_sched.c.
Referenced by enc_done(), and sch_enc_send().
Called by encoder tasks to send encoded packets downstream.
enc_idx | Encoder index previously returned by sch_add_enc(). |
pkt | An encoded packet; it will be consumed and cleared by this function on success. |
0 | success |
<0 | Error code. |
Definition at line 2346 of file ffmpeg_sched.c.
Referenced by do_subtitle_out(), and encode_frame().
|
static |
Definition at line 2379 of file ffmpeg_sched.c.
Referenced by task_cleanup().
int sch_filter_receive | ( | Scheduler * | sch, |
unsigned | fg_idx, | ||
unsigned * | in_idx, | ||
struct AVFrame * | frame | ||
) |
Called by filtergraph tasks to obtain frames for filtering.
Will wait for a frame to become available and return it in frame.
Filtergraphs that contain lavfi sources and do not currently require new input frames should call this function as a means of rate control - then in_idx should be set equal to nb_inputs on entry to this function.
fg_idx | Filtergraph index previously returned by sch_add_filtergraph(). | |
[in,out] | in_idx | On input contains the index of the input on which a frame is most desired. May be set to nb_inputs to signal that the filtergraph does not need more input currently. |
On success, will be replaced with the input index of the actually returned frame or EOF timestamp.
>=0 | Frame data or EOF timestamp was delivered into frame, in_idx contains the index of the input it belongs to. |
AVERROR(EAGAIN) | No frame was returned, the filtergraph should resume filtering. May only be returned when in_idx=nb_inputs on entry to this function. |
AVERROR_EOF | No more frames will arrive, should terminate filtering. |
Definition at line 2395 of file ffmpeg_sched.c.
Referenced by filter_thread().
void sch_filter_receive_finish | ( | Scheduler * | sch, |
unsigned | fg_idx, | ||
unsigned | in_idx | ||
) |
Called by filter tasks to signal that a filter input will no longer accept input.
fg_idx | Filtergraph index previously returned from sch_add_filtergraph(). |
in_idx | Index of the input to finish. |
Definition at line 2439 of file ffmpeg_sched.c.
Referenced by filter_thread().
Called by filtergraph tasks to send a filtered frame or EOF to consumers.
fg_idx | Filtergraph index previously returned by sch_add_filtergraph(). |
out_idx | Index of the output which produced the frame. |
frame | The frame to send to consumers. When NULL, signals that no more frames will be produced for the specified output. When non-NULL, the frame is consumed and cleared by this function on success. |
non-negative value | success |
AVERROR_EOF | all consumers are done |
anoter negative error code | other failure |
Definition at line 2460 of file ffmpeg_sched.c.
Referenced by close_output(), and fg_output_frame().
|
static |
Definition at line 2476 of file ffmpeg_sched.c.
Referenced by task_cleanup().
Definition at line 2505 of file ffmpeg_sched.c.
Referenced by fg_send_command().
|
static |
Definition at line 2515 of file ffmpeg_sched.c.
Referenced by task_stop(), and task_wrapper().
Definition at line 2559 of file ffmpeg_sched.c.
Referenced by sch_stop().
Definition at line 2575 of file ffmpeg_sched.c.
Referenced by sch_free(), sch_start(), and transcode().
|
static |
Definition at line 572 of file ffmpeg_sched.c.
Referenced by sch_alloc().
|
static |
Definition at line 618 of file ffmpeg_sched.c.
Referenced by sch_add_mux().
|
static |
Definition at line 674 of file ffmpeg_sched.c.
Referenced by sch_add_demux().
|
static |
Definition at line 734 of file ffmpeg_sched.c.
Referenced by sch_add_dec().
|
static |
Definition at line 777 of file ffmpeg_sched.c.
Referenced by sch_add_enc().
|
static |
Definition at line 815 of file ffmpeg_sched.c.
Referenced by sch_add_filtergraph().