From: Marton Balint <cus@passwd.hu> To: ffmpeg-devel@ffmpeg.org Cc: Marton Balint <cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 5/7] avfilter/af_aresample: merge request_frame into activate function Date: Tue, 17 Jun 2025 00:43:55 +0200 Message-ID: <20250616224404.16142-5-cus@passwd.hu> (raw) In-Reply-To: <20250616224404.16142-1-cus@passwd.hu> No functional change. Signed-off-by: Marton Balint <cus@passwd.hu> --- libavfilter/af_aresample.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c index 58e09906e0..703fb7c92d 100644 --- a/libavfilter/af_aresample.c +++ b/libavfilter/af_aresample.c @@ -302,14 +302,26 @@ static int flush_frame(AVFilterLink *outlink, int final, AVFrame **outsamplesref return 0; } -static int request_frame(AVFilterLink *outlink) +static int activate(AVFilterContext *ctx) { - AVFilterContext *ctx = outlink->src; AVFilterLink *inlink = ctx->inputs[0]; + AVFilterLink *outlink = ctx->outputs[0]; AResampleContext *aresample = ctx->priv; int ret = 0, status; int64_t pts; + FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); + + if (!aresample->eof && ff_inlink_queued_frames(inlink)) { + AVFrame *frame = NULL; + + ret = ff_inlink_consume_frame(inlink, &frame); + if (ret < 0) + return ret; + if (ret > 0) + return filter_frame(inlink, frame); + } + // First try to get data from the internal buffers if (aresample->more_data) { AVFrame *outsamplesref; @@ -346,28 +358,6 @@ static int request_frame(AVFilterLink *outlink) return 0; } -static int activate(AVFilterContext *ctx) -{ - AResampleContext *aresample = ctx->priv; - AVFilterLink *inlink = ctx->inputs[0]; - AVFilterLink *outlink = ctx->outputs[0]; - - FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); - - if (!aresample->eof && ff_inlink_queued_frames(inlink)) { - AVFrame *frame = NULL; - int ret; - - ret = ff_inlink_consume_frame(inlink, &frame); - if (ret < 0) - return ret; - if (ret > 0) - return filter_frame(inlink, frame); - } - - return request_frame(outlink); -} - static const AVClass *resample_child_class_iterate(void **iter) { const AVClass *c = *iter ? NULL : swr_get_class(); -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2025-06-16 22:45 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-06-16 22:43 [FFmpeg-devel] [PATCH 1/7] fftools/ffmpeg_filter: simplify control flow in read_frames Marton Balint 2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 2/7] avfilter/split: consume all frames before forwarding inlink status Marton Balint 2025-06-18 11:39 ` Nicolas George 2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 3/7] avfilter/f_select: port to activate Marton Balint 2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 4/7] avfilter/avfilter: simplify processing sinks without activate callback Marton Balint 2025-06-16 22:56 ` Andreas Rheinhardt 2025-06-16 23:02 ` Marton Balint 2025-06-16 23:54 ` Andreas Rheinhardt 2025-06-17 20:07 ` Marton Balint 2025-06-16 22:43 ` Marton Balint [this message] 2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 6/7] avfilter/af_aresample: make aresample return FFERROR_NOT_READY when no progress can be made Marton Balint 2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 7/7] avfilter/af_aresample: rework activate logic to follow the advised flow more strictly Marton Balint
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20250616224404.16142-5-cus@passwd.hu \ --to=cus@passwd.hu \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git