[FFmpeg-devel] [PATCH 01/17] lavfi: add ff_inlink_acknowledge_status().

Nicolas George george at nsup.org
Thu Dec 29 16:33:47 EET 2016


Also introduce libavfilter/filters.h for all functions needed
to implement filters.

Signed-off-by: Nicolas George <george at nsup.org>
---
 libavfilter/avfilter.c | 14 ++++++++++++++
 libavfilter/filters.h  | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)
 create mode 100644 libavfilter/filters.h


The series is still based on the series about AVFilterLink, although it does
not actually depends on it, it is just a matter of tiny conflicts in the
headers.

Still passes FATE at each step.

Changes in this commit: rename ff_link -> ff_inlink and move to filters.h,
and always return the status (avoids accessing the link directly).


diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 8d106c1ab3..47a48998e0 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -38,6 +38,7 @@
 #include "audio.h"
 #include "avfilter.h"
 #include "avfilterlink.h"
+#include "filters.h"
 #include "formats.h"
 #include "internal.h"
 
@@ -1542,6 +1543,19 @@ int ff_filter_activate(AVFilterContext *filter)
     return ret;
 }
 
+int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus)
+{
+    if (ff_framequeue_queued_frames(&link->fifo))
+        return *rstatus = 0;
+    if (link->status_out)
+        return *rstatus = link->status_out;
+    if (!link->status_in)
+        return *rstatus = 0;
+    *rstatus = 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/filters.h b/libavfilter/filters.h
new file mode 100644
index 0000000000..f4a46a023c
--- /dev/null
+++ b/libavfilter/filters.h
@@ -0,0 +1,37 @@
+/*
+ * Filters implementation helper functions
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with FFmpeg; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFILTER_FILTERS_H
+#define AVFILTER_FILTERS_H
+
+/**
+ * Filters implementation helper functions
+ */
+
+#include "avfilter.h"
+
+/**
+ * Test and acknowledge the change of status on the link.
+ * @param[out]  new or current status
+ * @return  >0 if status changed, <0 if status already acked, 0 otherwise
+ */
+int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus);
+
+#endif /* AVFILTER_FILTERS_H */
-- 
2.11.0



More information about the ffmpeg-devel mailing list