@@ -311,3 +311,23 @@ int ff_framesync2_activate(FFFrameSync *fs)
return 0;
}
+
+int ff_framesync2_get_dualinput(FFFrameSync *fs, AVFrame **f0, AVFrame **f1)
+{
+ AVFilterContext *ctx = fs->parent;
+ AVFrame *mainpic = NULL, *secondpic = NULL;
+ int ret = 0;
+
+ if ((ret = ff_framesync2_get_frame(fs, 0, &mainpic, 1)) < 0 ||
+ (ret = ff_framesync2_get_frame(fs, 1, &secondpic, 0)) < 0) {
+ av_frame_free(&mainpic);
+ return ret;
+ }
+ av_assert0(mainpic);
+ mainpic->pts = av_rescale_q(fs->pts, fs->time_base, ctx->outputs[0]->time_base);
+ if (ctx->is_disabled)
+ secondpic = NULL;
+ *f0 = mainpic;
+ *f1 = secondpic;
+ return 0;
+}
@@ -245,4 +245,18 @@ int ff_framesync2_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe,
*/
int ff_framesync2_activate(FFFrameSync *fs);
+/**
+ * Get dualinput frames.
+ *
+ * Compared to generic framesync, dualinput assumes the first input is the
+ * main one and the filtering is performed on it. The first input will be
+ * the only one with sync set and generic timeline support will just pass it
+ * unchanged when disabled.
+ *
+ * @param f0 used to return the main frame
+ * @param f1 used to return the second frame, or NULL if disabled
+ * @return >=0 for success or AVERROR code
+ */
+int ff_framesync2_get_dualinput(FFFrameSync *fs, AVFrame **f0, AVFrame **f1);
+
#endif /* AVFILTER_FRAMESYNC2_H */
Signed-off-by: Nicolas George <george@nsup.org> --- libavfilter/framesync2.c | 20 ++++++++++++++++++++ libavfilter/framesync2.h | 14 ++++++++++++++ 2 files changed, 34 insertions(+) Both patches work in progress. They work, but the code needs to be enhanced, otherwise the other filters will require boilerplace code.