aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/framesync2.h
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2017-07-17 14:36:42 +0200
committerNicolas George <george@nsup.org>2017-07-30 12:24:03 +0200
commit4e0e9ce2dc67a94c98d40a46e91fe5aa53ad0376 (patch)
tree06571b685d3b6b1c382aa85115d64b6f104027ed /libavfilter/framesync2.h
parented1c884b9e0d7f63199d5d47350b1fa65374d126 (diff)
downloadffmpeg-4e0e9ce2dc67a94c98d40a46e91fe5aa53ad0376.tar.gz
lavfi/framesync2: implement "activate" design.
With this helper API, filters that used the first framesync helper API can easily be changed to use the new and more extensible design for filters with a single activate() callback.
Diffstat (limited to 'libavfilter/framesync2.h')
-rw-r--r--libavfilter/framesync2.h77
1 files changed, 14 insertions, 63 deletions
diff --git a/libavfilter/framesync2.h b/libavfilter/framesync2.h
index e19d0f37e8..2b37636ebb 100644
--- a/libavfilter/framesync2.h
+++ b/libavfilter/framesync2.h
@@ -25,7 +25,6 @@
/*
* TODO
- * Callback-based API similar to dualinput.
* Export convenient options.
*/
@@ -41,16 +40,9 @@
* 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:
- *
- * - When a frame is available on any input, add it using
- * ff_framesync2_add_frame().
- *
- * - When a frame event is ready to be processed (i.e. after adding a frame
- * or when requested on input):
- * - call ff_framesync2_next();
- * - if fs->frame_ready is true, process the frames;
- * - call ff_framesync2_drop().
+ * The basic working of this API is the following: set the on_event
+ * callback, then call ff_framesync2_activate() from the filter's activate
+ * callback.
*/
/**
@@ -83,11 +75,6 @@ enum FFFrameSyncExtMode {
typedef struct FFFrameSyncIn {
/**
- * Queue of incoming AVFrame, and NULL to mark EOF
- */
- struct FFBufQueue queue;
-
- /**
* Extrapolation mode for timestamps before the first frame
*/
enum FFFrameSyncExtMode before;
@@ -152,7 +139,11 @@ typedef struct FFFrameSyncIn {
*/
typedef struct FFFrameSync {
const AVClass *class;
- void *parent;
+
+ /**
+ * Parent filter context.
+ */
+ AVFilterContext *parent;
/**
* Number of input streams
@@ -213,11 +204,11 @@ typedef struct FFFrameSync {
* The entire structure is expected to be already set to 0.
*
* @param fs frame sync structure to initialize
- * @param parent parent object, used for logging
+ * @param parent parent AVFilterContext object
* @param nb_in number of inputs
* @return >= 0 for success or a negative error code
*/
-int ff_framesync2_init(FFFrameSync *fs, void *parent, unsigned nb_in);
+int ff_framesync2_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in);
/**
* Configure a frame sync structure.
@@ -234,29 +225,6 @@ int ff_framesync2_configure(FFFrameSync *fs);
void ff_framesync2_uninit(FFFrameSync *fs);
/**
- * Add a frame to an input
- *
- * Typically called from the filter_frame() method.
- *
- * @param fs frame sync structure
- * @param in index of the input
- * @param frame input frame, or NULL for EOF
- */
-int ff_framesync2_add_frame(FFFrameSync *fs, unsigned in, AVFrame *frame);
-
-/**
- * Prepare the next frame event.
- *
- * The status of the operation can be found in fs->frame_ready and fs->eof.
- */
-void ff_framesync2_next(FFFrameSync *fs);
-
-/**
- * Drop the current frame event.
- */
-void ff_framesync2_drop(FFFrameSync *fs);
-
-/**
* Get the current frame in an input.
*
* @param fs frame sync structure
@@ -270,28 +238,11 @@ int ff_framesync2_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe,
unsigned get);
/**
- * Process one or several frame using the on_event callback.
- *
- * @return number of frames processed or negative error code
- */
-int ff_framesync2_process_frame(FFFrameSync *fs, unsigned all);
-
-
-/**
- * Accept a frame on a filter input.
- *
- * This function can be the complete implementation of all filter_frame
- * methods of a filter using framesync.
- */
-int ff_framesync2_filter_frame(FFFrameSync *fs, AVFilterLink *inlink,
- AVFrame *in);
-
-/**
- * Request a frame on the filter output.
+ * Examine the frames in the filter's input and try to produce output.
*
- * This function can be the complete implementation of all filter_frame
- * methods of a filter using framesync if it has only one output.
+ * This function can be the complete implementation of the activate
+ * method of a filter using framesync2.
*/
-int ff_framesync2_request_frame(FFFrameSync *fs, AVFilterLink *outlink);
+int ff_framesync2_activate(FFFrameSync *fs);
#endif /* AVFILTER_FRAMESYNC2_H */