[FFmpeg-devel,13/17] lavfi: add ff_link_set_frame_wanted().

Submitted by Nicolas George on Dec. 24, 2016, 5:41 p.m.

Details

Message ID 20161224174149.8995-14-george@nsup.org
State New
Headers show

Commit Message

Nicolas George Dec. 24, 2016, 5:41 p.m.
Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/avfilter.c | 8 ++++++++
 libavfilter/internal.h | 8 ++++++++
 2 files changed, 16 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 6d24f74c08..c3e30b80b7 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1645,6 +1645,14 @@  void ff_link_process_timeline(AVFilterLink *link, const AVFrame *frame)
     dstctx->is_disabled = fabs(av_expr_eval(dstctx->enable, dstctx->var_values, NULL)) < 0.5;
 }
 
+void ff_link_set_frame_wanted(AVFilterLink *link)
+{
+    av_assert1(!link->status_in);
+    av_assert1(!link->status_out);
+    link->frame_wanted_out = 1;
+    ff_filter_set_ready(link->src, 100);
+}
+
 const AVClass *avfilter_get_class(void)
 {
     return &avfilter_class;
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 9aaf585eca..44d2fa38d5 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -690,4 +690,12 @@  void ff_link_process_commands(AVFilterLink *link, const AVFrame *frame);
  */
 void ff_link_process_timeline(AVFilterLink *link, const AVFrame *frame);
 
+/**
+ * Mark that a frame is wanted on the link.
+ * Unlike ff_filter_frame(), it must not be called when the link has a
+ * non-zero status, and thus does not acknowledge it.
+ * Also it cannot fail.
+ */
+void ff_link_set_frame_wanted(AVFilterLink *link);
+
 #endif /* AVFILTER_INTERNAL_H */