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