21#ifndef AVFILTER_FRAMESYNC_H
22#define AVFILTER_FRAMESYNC_H
321#define FRAMESYNC_DEFINE_PURE_CLASS(name, desc, func_prefix, options) \
322static const AVClass name##_class = { \
323 .class_name = desc, \
324 .item_name = av_default_item_name, \
326 .version = LIBAVUTIL_VERSION_INT, \
327 .category = AV_CLASS_CATEGORY_FILTER, \
328 .child_class_iterate = ff_framesync_child_class_iterate, \
329 .child_next = func_prefix##_child_next, \
335#define FRAMESYNC_AUXILIARY_FUNCS(func_prefix, context, field) \
336static int func_prefix##_framesync_preinit(AVFilterContext *ctx) \
338 context *s = ctx->priv; \
339 ff_framesync_preinit(&s->field); \
342static void *func_prefix##_child_next(void *obj, void *prev) \
345 return prev ? NULL : &s->field; \
348#define FRAMESYNC_DEFINE_CLASS_EXT(name, context, field, options) \
349FRAMESYNC_AUXILIARY_FUNCS(name, context, field) \
350FRAMESYNC_DEFINE_PURE_CLASS(name, #name, name, options)
352#define FRAMESYNC_DEFINE_CLASS(name, context, field) \
353FRAMESYNC_DEFINE_CLASS_EXT(name, context, field, name##_options)
#define fs(width, name, subs,...)
const AVClass ff_framesync_class
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
int ff_framesync_dualinput_get(FFFrameSync *fs, AVFrame **f0, AVFrame **f1)
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input.
FFFrameTSSyncMode
Timestamp synchronization mode.
int ff_framesync_init_dualinput(FFFrameSync *fs, AVFilterContext *parent)
Initialize a frame sync structure for dualinput.
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
void ff_framesync_preinit(FFFrameSync *fs)
Pre-initialize a frame sync structure.
int ff_framesync_dualinput_get_writable(FFFrameSync *fs, AVFrame **f0, AVFrame **f1)
Same as ff_framesync_dualinput_get(), but make sure that f0 is writable.
int ff_framesync_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
Initialize a frame sync structure.
const AVClass * ff_framesync_child_class_iterate(void **iter)
FFFrameSyncExtMode
This API is intended as a helper for filters that have several video input and need to combine them s...
@ EXT_INFINITY
Extend the frame to infinity.
@ TS_DEFAULT
Sync to packets from secondary input with the nearest, lower or equal timestamp to the packet event o...
@ TS_NEAREST
Sync to packets from secondary input with the absolute nearest timestamp to the packet event one.
@ EXT_STOP
Completely stop all streams with this one.
@ EXT_NULL
Ignore this stream and continue processing the other ones.
static void get(const uint8_t *pixels, int stride, int16_t *block)
Describe the class of an AVClass context structure.
This structure describes decoded (raw) audio or video data.
Rational number (pair of numerator and denominator).
int64_t pts_next
PTS of the next frame, for internal use.
enum FFFrameSyncExtMode after
Extrapolation mode for timestamps after the last frame.
uint8_t have_next
Boolean flagging the next frame, for internal use.
enum FFFrameTSSyncMode ts_mode
int64_t pts
PTS of the current frame.
uint8_t state
State: before first, in stream or after EOF, for internal use.
AVFrame * frame
Current frame, may be NULL before the first one or after EOF.
enum FFFrameSyncExtMode before
Extrapolation mode for timestamps before the first frame.
AVFrame * frame_next
Next frame, for internal use.
AVRational time_base
Time base for the incoming frames.
unsigned sync
Synchronization level: frames on input at the highest sync level will generate output frame events.
unsigned in_request
Index of the input that requires a request.
FFFrameSyncIn * in
Pointer to array of inputs.
uint8_t eof
Flag indicating that output has reached EOF.
unsigned nb_in
Number of input streams.
AVRational time_base
Time base for the output events.
uint8_t frame_ready
Flag indicating that a frame event is ready.
AVFilterContext * parent
Parent filter context.
int(* on_event)(struct FFFrameSync *fs)
Callback called when a frame event is ready.
unsigned sync_level
Synchronization level: only inputs with the same sync level are sync sources.
void * opaque
Opaque pointer, not used by the API.
int64_t pts
Timestamp of the current event.