---
 libavfilter/af_amix.c       |    2 +-
 libavfilter/af_join.c       |    2 +-
 libavfilter/avfilter.c      |    3 ++-
 libavfilter/avfilter.h      |   11 +++--------
 libavfilter/avfiltergraph.c |    2 +-
 libavfilter/buffersink.c    |    4 ++--
 libavfilter/internal.h      |   19 ++++++++++++++-----
 libavfilter/vf_drawbox.c    |    2 +-
 libavfilter/vf_drawtext.c   |    2 +-
 libavfilter/vf_fade.c       |    2 +-
 libavfilter/vf_fieldorder.c |    2 +-
 libavfilter/vf_overlay.c    |    5 ++---
 12 files changed, 30 insertions(+), 26 deletions(-)

diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index 925d4a6..c42d75b 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -305,7 +305,7 @@ static av_cold int init(AVFilterContext *ctx)
         pad.type           = AVMEDIA_TYPE_AUDIO;
         pad.name           = av_strdup(name);
         pad.filter_frame   = filter_frame;
-        pad.needs_fifo     = 1;
+        pad.flags          = FF_FILTERPAD_FLAG_REQUEST;
 
         ff_insert_inpad(ctx, i, &pad);
     }
diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
index e3dc5a5..250b6f5 100644
--- a/libavfilter/af_join.c
+++ b/libavfilter/af_join.c
@@ -224,7 +224,7 @@ static av_cold int join_init(AVFilterContext *ctx)
         pad.name           = av_strdup(name);
         pad.filter_frame   = filter_frame;
 
-        pad.needs_fifo = 1;
+        pad.flags          = FF_FILTERPAD_FLAG_REQUEST;
 
         ff_insert_inpad(ctx, i, &pad);
     }
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index b7913a1..47e7370 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -686,7 +686,8 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
         filter_frame = default_filter_frame;
 
     /* copy the frame if needed */
-    if (dst->needs_writable && !av_frame_is_writable(frame)) {
+    if (dst->flags & FF_FILTERPAD_FLAG_WRITABLE &&
+        !av_frame_is_writable(frame)) {
         av_log(link->dst, AV_LOG_DEBUG, "Copying data in avfilter.\n");
 
         switch (link->type) {
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 51d0fb5..6ab31a0 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -339,14 +339,9 @@ struct AVFilterPad {
     int (*config_props)(AVFilterLink *link);
 
     /**
-     * The filter expects a fifo to be inserted on its input link,
-     * typically because it has a delay.
-     *
-     * input pads only.
+     * A combination of FF_FILTERPAD_FLAG_*
      */
-    int needs_fifo;
-
-    int needs_writable;
+    int flags;
 };
 #endif
 
@@ -550,7 +545,7 @@ struct AVFilterLink {
     /**
      * Audio only, the destination filter sets this to a non-zero value to
      * request that buffers with the given number of samples should be sent to
-     * it. AVFilterPad.needs_fifo must also be set on the corresponding input
+     * it. FF_FILTERPAD_FLAG_REQUEST must also be set on the corresponding 
input
      * pad.
      * Last buffer before EOF will be padded with silence.
      */
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 9e4c407..fe4eb5b 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -726,7 +726,7 @@ static int graph_insert_fifos(AVFilterGraph *graph, AVClass 
*log_ctx)
             AVFilter *fifo;
             char name[32];
 
-            if (!link->dstpad->needs_fifo)
+            if (!(link->dstpad->flags & FF_FILTERPAD_FLAG_REQUEST))
                 continue;
 
             fifo = f->inputs[j]->type == AVMEDIA_TYPE_VIDEO ?
diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index 94e7366..c852a93 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -215,7 +215,7 @@ static const AVFilterPad avfilter_vsink_buffer_inputs[] = {
         .name        = "default",
         .type        = AVMEDIA_TYPE_VIDEO,
         .filter_frame = filter_frame,
-        .needs_fifo  = 1
+        .flags        = FF_FILTERPAD_FLAG_REQUEST,
     },
     { NULL }
 };
@@ -235,7 +235,7 @@ static const AVFilterPad avfilter_asink_abuffer_inputs[] = {
         .name           = "default",
         .type           = AVMEDIA_TYPE_AUDIO,
         .filter_frame   = filter_frame,
-        .needs_fifo     = 1
+        .flags          = FF_FILTERPAD_FLAG_REQUEST,
     },
     { NULL }
 };
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 8e8a13f..a44827d 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -26,6 +26,18 @@
 
 #include "avfilter.h"
 
+/**
+ * Input pads only.
+ * On the link corresponding to this pad, the frames should only arrive in
+ * response to the filter calling ff_request_frame().
+ */
+#define FF_FILTERPAD_FLAG_REQUEST       (1 << 0)
+/**
+ * Input pads only.
+ * Only writable frames should arrive on the link corresponding to this pad.
+ */
+#define FF_FILTERPAD_FLAG_WRITABLE      (1 << 1)
+
 #if !FF_API_AVFILTERPAD_PUBLIC
 /**
  * A filter pad used for either input or output.
@@ -108,12 +120,9 @@ struct AVFilterPad {
     int (*config_props)(AVFilterLink *link);
 
     /**
-     * The filter expects a fifo to be inserted on its input link,
-     * typically because it has a delay.
-     *
-     * input pads only.
+     * A combination of FF_FILTERPAD_FLAG_*
      */
-    int needs_fifo;
+    int flags;
 };
 #endif
 
diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c
index 773aa01..e7e9b9e 100644
--- a/libavfilter/vf_drawbox.c
+++ b/libavfilter/vf_drawbox.c
@@ -145,7 +145,7 @@ static const AVFilterPad avfilter_vf_drawbox_inputs[] = {
         .config_props     = config_input,
         .get_video_buffer = ff_null_get_video_buffer,
         .filter_frame     = filter_frame,
-        .needs_writable   = 1,
+        .flags            = FF_FILTERPAD_FLAG_WRITABLE,
     },
     { NULL }
 };
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 53340c8..cf775ed 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -854,7 +854,7 @@ static const AVFilterPad avfilter_vf_drawtext_inputs[] = {
         .get_video_buffer = ff_null_get_video_buffer,
         .filter_frame     = filter_frame,
         .config_props     = config_input,
-        .needs_writable   = 1,
+        .flags            = FF_FILTERPAD_FLAG_WRITABLE,
     },
     { NULL }
 };
diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index 9f3a602..03c53b5 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -164,7 +164,7 @@ static const AVFilterPad avfilter_vf_fade_inputs[] = {
         .config_props     = config_props,
         .get_video_buffer = ff_null_get_video_buffer,
         .filter_frame     = filter_frame,
-        .needs_writable   = 1,
+        .flags            = FF_FILTERPAD_FLAG_WRITABLE,
     },
     { NULL }
 };
diff --git a/libavfilter/vf_fieldorder.c b/libavfilter/vf_fieldorder.c
index 19b07b1..bfb277c 100644
--- a/libavfilter/vf_fieldorder.c
+++ b/libavfilter/vf_fieldorder.c
@@ -171,7 +171,7 @@ static const AVFilterPad avfilter_vf_fieldorder_inputs[] = {
         .config_props     = config_input,
         .get_video_buffer = get_video_buffer,
         .filter_frame     = filter_frame,
-        .needs_writable   = 1,
+        .flags            = FF_FILTERPAD_FLAG_WRITABLE,
     },
     { NULL }
 };
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 41940d0..6c97532 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -370,15 +370,14 @@ static const AVFilterPad avfilter_vf_overlay_inputs[] = {
         .type         = AVMEDIA_TYPE_VIDEO,
         .config_props = config_input_main,
         .filter_frame = filter_frame_main,
-        .needs_writable = 1,
-        .needs_fifo   = 1,
+        .flags        = FF_FILTERPAD_FLAG_REQUEST | FF_FILTERPAD_FLAG_WRITABLE,
     },
     {
         .name         = "overlay",
         .type         = AVMEDIA_TYPE_VIDEO,
         .config_props = config_input_overlay,
         .filter_frame = filter_frame_overlay,
-        .needs_fifo   = 1,
+        .flags        = FF_FILTERPAD_FLAG_REQUEST,
     },
     { NULL }
 };
-- 
1.7.10.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to