From patchwork Mon Aug 31 17:20:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 22028 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6C18644B48A for ; Mon, 31 Aug 2020 20:30:35 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 45DDE68AAD8; Mon, 31 Aug 2020 20:30:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 13C576880D5 for ; Mon, 31 Aug 2020 20:30:29 +0300 (EEST) Received: by mail-lj1-f195.google.com with SMTP id h19so7595515ljg.13 for ; Mon, 31 Aug 2020 10:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=rmzc5o0esC3b/S3DMWIhSPjyuGbA3jx1SEuo0hwdzJw=; b=IFk6vo+kba91YC0NJmx+JGbL2yA4a8kCvs1f4EAHML75gqeJPylRQjnyNgLKI2tq+d Wkb+bZInN25UJWfiQpyUXcPC8nYQOoca++/riDGGw1QHmeaR1dwXxFbz4mXoNsHv9SVz NEYIV7z1qUyQNDm6w55TDfspKLXPjxK7VmBBjt8hP9toCNYFgdAdwRp+VAoL/I0MXHfI PrwP6Obvs1rTB/+YJZCfH8JtoHdM+NpFQ/4746tDJFIps3PNdzbYJSPzEnSo2Scpbf2X tw/0dR0ET3hDt3aZUUrkkAK7TB4UZBt5y3rUCFwi2GqJpFF9LeLoByF3WKSZHs5QvzfY O/Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=rmzc5o0esC3b/S3DMWIhSPjyuGbA3jx1SEuo0hwdzJw=; b=LCsSPc0B54f1E+zf/p7jnNh+eyp5rTQ6dFWNH2YyBU7YogaSm89V9DwcFggOoJoaI/ 2wczrjyPoS9XWQFkVGOX3uODkRhXU241uVicHXOfH3qfzznq0Rd5B6oLwC9fi/bAOo/m GTzGmZ9/aQUvChggHTGfTHE5QqTt7a97mA39t3HgRdoYbdK1FTw2m/kUska6EC4l6OFT oLI1oLV6vGFw9DCyFtj2thy2b2IqeuEugX+3wP/Vn4mJR4eIjBJLepcVXHBl/cFEYJ+M KSkJcywtL+OWCap/yFqZkYiiyUFQbNpQxdnsjOIjX12b7oE1EPgG+6dKQ+fHgyOHRsMc GiYA== X-Gm-Message-State: AOAM53346FI9R9Lw1DeAMmYQLQ8E01y5h+2D1RsvqwWrq/QO4znA2oK0 Ev9Y9DttsyrYIFfuQYmGkr46xxqGi1HFzQ== X-Google-Smtp-Source: ABdhPJzBYt48K99IGOcIXDMTzVTRmLQSezdadmBY6UbRGSnR0pfLkL/AebKg5CGu4ZTsZiMbvuGOyA== X-Received: by 2002:a50:8e58:: with SMTP id 24mr2145229edx.226.1598894556806; Mon, 31 Aug 2020 10:22:36 -0700 (PDT) Received: from localhost.localdomain ([31.45.254.223]) by smtp.gmail.com with ESMTPSA id du5sm1767338ejc.14.2020.08.31.10.22.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 10:22:36 -0700 (PDT) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Mon, 31 Aug 2020 19:20:14 +0200 Message-Id: <20200831172014.5269-1-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] avfilter/src_movie: switch to activate X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Allow to set the EOF timestamp. Signed-off-by: Paul B Mahol --- libavfilter/src_movie.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index eeb8609855..2920ec06c1 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -44,6 +44,7 @@ #include "audio.h" #include "avfilter.h" +#include "filters.h" #include "formats.h" #include "internal.h" #include "video.h" @@ -97,7 +98,6 @@ 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,7 +309,6 @@ 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; @@ -595,17 +594,28 @@ static int movie_push_frame(AVFilterContext *ctx, unsigned out_id) return pkt_out_id == out_id; } -static int movie_request_frame(AVFilterLink *outlink) +static int activate(AVFilterContext *ctx) { - AVFilterContext *ctx = outlink->src; - unsigned out_id = FF_OUTLINK_IDX(outlink); - int ret; + MovieContext *movie = ctx->priv; + int i; + + for (i = 0; i < ctx->nb_outputs; i++) { + AVFilterLink *outlink = ctx->outputs[i]; + + if (ff_outlink_frame_wanted(outlink)) { + int ret = movie_push_frame(ctx, i); - while (1) { - ret = movie_push_frame(ctx, out_id); - if (ret) - return FFMIN(ret, 0); + if (ret) { + if (ret < 0) + ff_outlink_set_status(outlink, AVERROR_EOF, movie->st[i].last_pts); + return 0; + } + } } + + ff_filter_set_ready(ctx, 100); + + return 0; } static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, @@ -666,6 +676,7 @@ AVFilter ff_avsrc_movie = { .inputs = NULL, .outputs = NULL, + .activate = activate, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, .process_command = process_command }; @@ -687,6 +698,7 @@ AVFilter ff_avsrc_amovie = { .inputs = NULL, .outputs = NULL, + .activate = activate, .priv_class = &amovie_class, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, .process_command = process_command,