[FFmpeg-cvslog] Revert "avfilter/src_movie: switch to activate"

Nicolas George git at videolan.org
Tue Sep 8 16:01:16 EEST 2020


ffmpeg | branch: master | Nicolas George <george at nsup.org> | Tue Sep  8 14:57:53 2020 +0200| [d1f3d721df32680e9904f3c5b2c666eb5830c89a] | committer: Nicolas George

Revert "avfilter/src_movie: switch to activate"

This reverts commit abc884bcc005c450a34e56cd1f4b8b6fa17ea768.

This patch was pushed without actual review.
An actual review would have revealed that the switch to activate
was not done correctly because the logic between request_frame()
and frame_wanted is not as direct with filters with multiple
outputs than with a single output.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1f3d721df32680e9904f3c5b2c666eb5830c89a
---

 libavfilter/src_movie.c | 37 ++++++++++---------------------------
 1 file changed, 10 insertions(+), 27 deletions(-)

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index b0294ca79b..6e210d1df0 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -44,7 +44,6 @@
 
 #include "audio.h"
 #include "avfilter.h"
-#include "filters.h"
 #include "formats.h"
 #include "internal.h"
 #include "video.h"
@@ -98,6 +97,7 @@ static const AVOption movie_options[]= {
 };
 
 static int movie_config_output_props(AVFilterLink *outlink);
+static int movie_request_frame(AVFilterLink *outlink);
 
 static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
 {
@@ -309,6 +309,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
         if (!pad.name)
             return AVERROR(ENOMEM);
         pad.config_props  = movie_config_output_props;
+        pad.request_frame = movie_request_frame;
         if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) {
             av_freep(&pad.name);
             return ret;
@@ -594,33 +595,17 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id)
     return pkt_out_id == out_id;
 }
 
-static int activate(AVFilterContext *ctx)
+static int movie_request_frame(AVFilterLink *outlink)
 {
-    MovieContext *movie = ctx->priv;
-    int nb_eofs = 0;
-
-    for (int i = 0; i < ctx->nb_outputs; i++) {
-        AVFilterLink *outlink = ctx->outputs[i];
-
-        nb_eofs += !!ff_outlink_get_status(outlink);
-        if (ff_outlink_frame_wanted(outlink)) {
-            int ret = movie_push_frame(ctx, i);
-
-            if (ret == AVERROR_EOF) {
-                ff_outlink_set_status(outlink, AVERROR_EOF, movie->st[i].last_pts);
-                return 0;
-            } else if (ret) {
-                return FFMIN(ret, 0);
-            }
-        }
-    }
+    AVFilterContext *ctx = outlink->src;
+    unsigned out_id = FF_OUTLINK_IDX(outlink);
+    int ret;
 
-    if (nb_eofs != ctx->nb_outputs) {
-        ff_filter_set_ready(ctx, 100);
-        return 0;
+    while (1) {
+        ret = movie_push_frame(ctx, out_id);
+        if (ret)
+            return FFMIN(ret, 0);
     }
-
-    return FFERROR_NOT_READY;
 }
 
 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
@@ -681,7 +666,6 @@ AVFilter ff_avsrc_movie = {
 
     .inputs    = NULL,
     .outputs   = NULL,
-    .activate  = activate,
     .flags     = AVFILTER_FLAG_DYNAMIC_OUTPUTS,
     .process_command = process_command
 };
@@ -703,7 +687,6 @@ AVFilter ff_avsrc_amovie = {
 
     .inputs     = NULL,
     .outputs    = NULL,
-    .activate   = activate,
     .priv_class = &amovie_class,
     .flags      = AVFILTER_FLAG_DYNAMIC_OUTPUTS,
     .process_command = process_command,



More information about the ffmpeg-cvslog mailing list