Go to the documentation of this file.
22 #ifndef FFTOOLS_FFMPEG_SCHED_H
23 #define FFTOOLS_FFMPEG_SCHED_H
107 #define SCH_DSTREAM(file, stream) \
108 (SchedulerNode){ .type = SCH_NODE_TYPE_DEMUX, \
109 .idx = file, .idx_stream = stream }
110 #define SCH_MSTREAM(file, stream) \
111 (SchedulerNode){ .type = SCH_NODE_TYPE_MUX, \
112 .idx = file, .idx_stream = stream }
113 #define SCH_DEC(decoder) \
114 (SchedulerNode){ .type = SCH_NODE_TYPE_DEC, \
116 #define SCH_ENC(encoder) \
117 (SchedulerNode){ .type = SCH_NODE_TYPE_ENC, \
119 #define SCH_FILTER_IN(filter, input) \
120 (SchedulerNode){ .type = SCH_NODE_TYPE_FILTER_IN, \
121 .idx = filter, .idx_stream = input }
122 #define SCH_FILTER_OUT(filter, output) \
123 (SchedulerNode){ .type = SCH_NODE_TYPE_FILTER_OUT, \
124 .idx = filter, .idx_stream = output }
235 void *
ctx,
int sdp_auto,
unsigned thread_queue_size);
241 #define DEFAULT_PACKET_THREAD_QUEUE_SIZE 8
246 #define DEFAULT_FRAME_THREAD_QUEUE_SIZE 8
270 size_t data_threshold,
int max_packets);
302 int (*open_cb)(
void *func_arg,
const struct AVFrame *
frame));
315 int limiting, uint64_t max_frames);
int(* func)(AVBPrint *dst, const char *in, const char *arg)
int sch_stop(Scheduler *sch, int64_t *finish_ts)
This structure describes decoded (raw) audio or video data.
int sch_add_demux(Scheduler *sch, SchThreadFunc func, void *ctx)
Add a demuxer to the scheduler.
int sch_dec_send(Scheduler *sch, unsigned dec_idx, struct AVFrame *frame)
Called by decoder tasks to send a decoded frame downstream.
enum SchedulerNodeType type
void sch_free(Scheduler **sch)
int(* SchThreadFunc)(void *arg)
int sch_mux_receive(Scheduler *sch, unsigned mux_idx, struct AVPacket *pkt)
Called by muxer tasks to obtain packets for muxing.
int sch_enc_send(Scheduler *sch, unsigned enc_idx, struct AVPacket *pkt)
Called by encoder tasks to send encoded packets downstream.
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.
int sch_sdp_filename(Scheduler *sch, const char *sdp_filename)
Set the file path for the SDP.
int sch_demux_send(Scheduler *sch, unsigned demux_idx, struct AVPacket *pkt, unsigned flags)
Called by demuxer tasks to communicate with their downstreams.
int sch_enc_receive(Scheduler *sch, unsigned enc_idx, struct AVFrame *frame)
Called by encoder tasks to obtain frames for encoding.
int sch_start(Scheduler *sch)
int sch_mux_sub_heartbeat(Scheduler *sch, unsigned mux_idx, unsigned stream_idx, const AVPacket *pkt)
int sch_connect(Scheduler *sch, SchedulerNode src, SchedulerNode dst)
int sch_filter_command(Scheduler *sch, unsigned fg_idx, struct AVFrame *frame)
Scheduler * sch_alloc(void)
@ DEMUX_SEND_STREAMCOPY_EOF
Treat the packet as an EOF for SCH_NODE_TYPE_MUX destinations send normally to other types.
int sch_add_demux_stream(Scheduler *sch, unsigned demux_idx)
Add a demuxed stream for a previously added demuxer.
int(* init)(AVBSFContext *ctx)
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.
int sch_add_enc(Scheduler *sch, SchThreadFunc func, void *ctx, int(*open_cb)(void *func_arg, const struct AVFrame *frame))
Add an encoder to the scheduler.
@ SCH_NODE_TYPE_FILTER_OUT
int sch_add_dec(Scheduler *sch, SchThreadFunc func, void *ctx, int send_end_ts)
Add a decoder to the scheduler.
int sch_filter_send(Scheduler *sch, unsigned fg_idx, unsigned out_idx, struct AVFrame *frame)
Called by filtergraph tasks to send a filtered frame or EOF to consumers.
int sch_add_sq_enc(Scheduler *sch, uint64_t buf_size_us, void *logctx)
Add an pre-encoding sync queue to the scheduler.
@ SCH_NODE_TYPE_FILTER_IN
int sch_wait(Scheduler *sch, uint64_t timeout_us, int64_t *transcode_ts)
Wait until transcoding terminates or the specified timeout elapses.
int sch_add_mux_stream(Scheduler *sch, unsigned mux_idx)
Add a muxed stream for a previously added muxer.
int sch_add_filtergraph(Scheduler *sch, unsigned nb_inputs, unsigned nb_outputs, SchThreadFunc func, void *ctx)
Add a filtergraph to the scheduler.
int sch_filter_receive(Scheduler *sch, unsigned fg_idx, unsigned *in_idx, struct AVFrame *frame)
Called by filtergraph tasks to obtain frames for filtering.
int sch_sq_add_enc(Scheduler *sch, unsigned sq_idx, unsigned enc_idx, int limiting, uint64_t max_frames)
int sch_mux_sub_heartbeat_add(Scheduler *sch, unsigned mux_idx, unsigned stream_idx, unsigned dec_idx)
This structure stores compressed data.
int sch_dec_receive(Scheduler *sch, unsigned dec_idx, struct AVPacket *pkt)
Called by decoder tasks to receive a packet for decoding.
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.
#define flags(name, subs,...)
int sch_add_mux(Scheduler *sch, SchThreadFunc func, int(*init)(void *), void *ctx, int sdp_auto, unsigned thread_queue_size)
Add a muxer to the scheduler.
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.