FFmpeg
|
#include "bufferqueue.h"
Go to the source code of this file.
Data Structures | |
struct | FFFrameSyncIn |
Input stream structure. More... | |
struct | FFFrameSync |
Frame sync structure. More... | |
Enumerations | |
enum | FFFrameSyncExtMode { EXT_STOP, EXT_NULL, EXT_INFINITY } |
This API is intended as a helper for filters that have several video input and need to combine them somehow. More... | |
Functions | |
void | ff_framesync_init (FFFrameSync *fs, void *parent, unsigned nb_in) |
Initialize a frame sync structure. | |
int | ff_framesync_configure (FFFrameSync *fs) |
Configure a frame sync structure. | |
void | ff_framesync_uninit (FFFrameSync *fs) |
Free all memory currently allocated. | |
int | ff_framesync_add_frame (FFFrameSync *fs, unsigned in, AVFrame *frame) |
Add a frame to an input. | |
void | ff_framesync_next (FFFrameSync *fs) |
Prepare the next frame event. | |
void | ff_framesync_drop (FFFrameSync *fs) |
Drop the current frame event. | |
int | ff_framesync_get_frame (FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get) |
Get the current frame in an input. | |
int | ff_framesync_process_frame (FFFrameSync *fs, unsigned all) |
Process one or several frame using the on_event callback. | |
int | ff_framesync_filter_frame (FFFrameSync *fs, AVFilterLink *inlink, AVFrame *in) |
Accept a frame on a filter input. | |
int | ff_framesync_request_frame (FFFrameSync *fs, AVFilterLink *outlink) |
Request a frame on the filter output. | |
enum FFFrameSyncExtMode |
This API is intended as a helper for filters that have several video input and need to combine them somehow.
If the inputs have different or variable frame rate, getting the input frames to match requires a rather complex logic and a few user-tunable options.
In this API, when a set of synchronized input frames is ready to be procesed is called a frame event. Frame event can be generated in response to input frames on any or all inputs and the handling of situations where some stream extend beyond the beginning or the end of others can be configured.
The basic working of this API is the following:
Describe how the frames of a stream are extrapolated before the first one and after EOF to keep sync with possibly longer other streams.
EXT_STOP |
Completely stop all streams with this one. |
EXT_NULL |
Ignore this stream and continue processing the other ones. |
EXT_INFINITY |
Extend the frame to infinity. |
Definition at line 62 of file framesync.h.
void ff_framesync_init | ( | FFFrameSync * | fs, |
void * | parent, | ||
unsigned | nb_in | ||
) |
Initialize a frame sync structure.
The entire structure is expected to be already set to 0.
fs | frame sync structure to initialize |
parent | parent object, used for logging |
nb_in | number of inputs |
Definition at line 49 of file framesync.c.
Referenced by config_output(), and ff_dualinput_init().
int ff_framesync_configure | ( | FFFrameSync * | fs | ) |
Configure a frame sync structure.
Must be called after all options are set but before all use.
Definition at line 72 of file framesync.c.
Referenced by config_output(), and ff_dualinput_init().
void ff_framesync_uninit | ( | FFFrameSync * | fs | ) |
Free all memory currently allocated.
Definition at line 261 of file framesync.c.
Referenced by ff_dualinput_uninit(), and uninit().
int ff_framesync_add_frame | ( | FFFrameSync * | fs, |
unsigned | in, | ||
AVFrame * | frame | ||
) |
Add a frame to an input.
Typically called from the filter_frame() method.
fs | frame sync structure |
in | index of the input |
frame | input frame, or NULL for EOF |
Definition at line 197 of file framesync.c.
Referenced by ff_framesync_filter_frame(), and ff_framesync_request_frame().
void ff_framesync_next | ( | FFFrameSync * | fs | ) |
Prepare the next frame event.
The status of the operation can be found in fs->frame_ready and fs->eof.
Definition at line 207 of file framesync.c.
Referenced by ff_framesync_process_frame().
void ff_framesync_drop | ( | FFFrameSync * | fs | ) |
Drop the current frame event.
Definition at line 219 of file framesync.c.
Referenced by ff_framesync_process_frame().
int ff_framesync_get_frame | ( | FFFrameSync * | fs, |
unsigned | in, | ||
AVFrame ** | rframe, | ||
unsigned | get | ||
) |
Get the current frame in an input.
fs | frame sync structure |
in | index of the input |
rframe | used to return the current frame (or NULL) |
get | if not zero, the calling code needs to get ownership of the returned frame; the current frame will either be duplicated or removed from the framesync structure |
Definition at line 224 of file framesync.c.
Referenced by process_frame().
int ff_framesync_process_frame | ( | FFFrameSync * | fs, |
unsigned | all | ||
) |
Process one or several frame using the on_event callback.
Definition at line 272 of file framesync.c.
Referenced by ff_framesync_filter_frame(), and ff_framesync_request_frame().
int ff_framesync_filter_frame | ( | FFFrameSync * | fs, |
AVFilterLink * | inlink, | ||
AVFrame * | in | ||
) |
Accept a frame on a filter input.
This function can be the complete implementation of all filter_frame methods of a filter using framesync.
Definition at line 293 of file framesync.c.
Referenced by ff_dualinput_filter_frame(), and filter_frame().
int ff_framesync_request_frame | ( | FFFrameSync * | fs, |
AVFilterLink * | outlink | ||
) |
Request a frame on the filter output.
This function can be the complete implementation of all filter_frame methods of a filter using framesync if it has only one output.
Definition at line 307 of file framesync.c.
Referenced by ff_dualinput_request_frame(), and request_frame().