History

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.

Nicolas George committed 9 years ago

Commit 4e0e9ce1 parent ed1c8842 files · +82 −161Browse files

Showing the changes to libavfilter/framesync2.h (1 of 2 files). Show all

Unified · Split

libavfilter/framesync2.h+14−63
@@ -25,7 +25,6 @@ · 24 unmodified lines
2525
2626 /*
2727 * TODO
28− * Callback-based API similar to dualinput.
2928 * Export convenient options.
3029 */
3130
@@ -41,16 +40,9 @@ · 9 unmodified lines
4140 * situations where some stream extend beyond the beginning or the end of
4241 * others can be configured.
4342 *
44− * The basic working of this API is the following:
45− *
46− * - When a frame is available on any input, add it using
47− * ff_framesync2_add_frame().
48− *
49− * - When a frame event is ready to be processed (i.e. after adding a frame
50− * or when requested on input):
51− * - call ff_framesync2_next();
52− * - if fs->frame_ready is true, process the frames;
53− * - call ff_framesync2_drop().
43+ * The basic working of this API is the following: set the on_event
44+ * callback, then call ff_framesync2_activate() from the filter's activate
45+ * callback.
5446 */
5547
5648 /**
@@ -82,11 +74,6 @@ enum FFFrameSyncExtMode { · 25 unmodified lines
8274 */
8375 typedef struct FFFrameSyncIn {
8476
85− /**
86− * Queue of incoming AVFrame, and NULL to mark EOF
87− */
88− struct FFBufQueue queue;
89−
9077 /**
9178 * Extrapolation mode for timestamps before the first frame
9279 */
@@ -152,7 +139,11 @@ typedef struct FFFrameSyncIn { · 59 unmodified lines
152139 */
153140 typedef struct FFFrameSync {
154141 const AVClass *class;
155− void *parent;
142+
143+ /**
144+ * Parent filter context.
145+ */
146+ AVFilterContext *parent;
156147
157148 /**
158149 * Number of input streams
@@ -213,11 +204,11 @@ typedef struct FFFrameSync { · 54 unmodified lines
213204 * The entire structure is expected to be already set to 0.
214205 *
215206 * @param fs frame sync structure to initialize
216− * @param parent parent object, used for logging
207+ * @param parent parent AVFilterContext object
217208 * @param nb_in number of inputs
218209 * @return >= 0 for success or a negative error code
219210 */
220−int ff_framesync2_init(FFFrameSync *fs, void *parent, unsigned nb_in);
211+int ff_framesync2_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in);
221212
222213 /**
223214 * Configure a frame sync structure.
@@ -233,29 +224,6 @@ int ff_framesync2_configure(FFFrameSync *fs); · 9 unmodified lines
233224 */
234225 void ff_framesync2_uninit(FFFrameSync *fs);
235226
236−/**
237− * Add a frame to an input
238− *
239− * Typically called from the filter_frame() method.
240− *
241− * @param fs frame sync structure
242− * @param in index of the input
243− * @param frame input frame, or NULL for EOF
244− */
245−int ff_framesync2_add_frame(FFFrameSync *fs, unsigned in, AVFrame *frame);
246−
247−/**
248− * Prepare the next frame event.
249− *
250− * The status of the operation can be found in fs->frame_ready and fs->eof.
251− */
252−void ff_framesync2_next(FFFrameSync *fs);
253−
254−/**
255− * Drop the current frame event.
256− */
257−void ff_framesync2_drop(FFFrameSync *fs);
258−
259227 /**
260228 * Get the current frame in an input.
261229 *
@@ -270,28 +238,11 @@ int ff_framesync2_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, · 8 unmodified lines
270238 unsigned get);
271239
272240 /**
273− * Process one or several frame using the on_event callback.
274− *
275− * @return number of frames processed or negative error code
276− */
277−int ff_framesync2_process_frame(FFFrameSync *fs, unsigned all);
278−
279−
280−/**
281− * Accept a frame on a filter input.
282− *
283− * This function can be the complete implementation of all filter_frame
284− * methods of a filter using framesync.
285− */
286−int ff_framesync2_filter_frame(FFFrameSync *fs, AVFilterLink *inlink,
287− AVFrame *in);
288−
289−/**
290− * Request a frame on the filter output.
241+ * Examine the frames in the filter's input and try to produce output.
291242 *
292− * This function can be the complete implementation of all filter_frame
293− * methods of a filter using framesync if it has only one output.
243+ * This function can be the complete implementation of the activate
244+ * method of a filter using framesync2.
294245 */
295−int ff_framesync2_request_frame(FFFrameSync *fs, AVFilterLink *outlink);
246+int ff_framesync2_activate(FFFrameSync *fs);
296247
297248 #endif /* AVFILTER_FRAMESYNC2_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t