[FFmpeg-devel,01/17] lavfi: add ff_link_acknowledge_status().

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

Details

Message ID 20161224174149.8995-2-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 | 13 +++++++++++++
 libavfilter/internal.h |  6 ++++++
 2 files changed, 19 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 0020ee163a..c1858fb6a0 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1543,6 +1543,19 @@  int ff_filter_activate(AVFilterContext *filter)
     return ret;
 }
 
+int ff_link_acknowledge_status(AVFilterLink *link)
+{
+    if (ff_framequeue_queued_frames(&link->fifo))
+        return 0;
+    if (link->status_out)
+        return link->status_out;
+    if (!link->status_in)
+        return 0;
+    link->status_out = link->status_in;
+    ff_update_link_current_pts(link, link->status_in_pts);
+    return 1;
+}
+
 const AVClass *avfilter_get_class(void)
 {
     return &avfilter_class;
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 599be24a85..13666bc330 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -613,4 +613,10 @@  static inline int ff_norm_qscale(int qscale, int type)
  */
 int ff_filter_get_nb_threads(AVFilterContext *ctx);
 
+/**
+ * Test and acknowledge the change of status on the link.
+ * @return  >0 if status changed, 0 otherwise, <0 if status already acked
+ */
+int ff_link_acknowledge_status(AVFilterLink *link);
+
 #endif /* AVFILTER_INTERNAL_H */