[FFmpeg-cvslog] avfilter/af_asetrate: extend query_formats()

Paul B Mahol git at videolan.org
Sat May 13 12:00:22 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat May 13 10:39:41 2023 +0200| [e076d8a9b3893886e7c7abd67cf715db40788a44] | committer: Paul B Mahol

avfilter/af_asetrate: extend query_formats()

It left some formats not defined. Causing format negotiation
errors with ffplay.

Fixes #9248

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

 libavfilter/af_asetrate.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_asetrate.c b/libavfilter/af_asetrate.c
index 76f29144e5..f1e48b7087 100644
--- a/libavfilter/af_asetrate.c
+++ b/libavfilter/af_asetrate.c
@@ -49,7 +49,17 @@ AVFILTER_DEFINE_CLASS(asetrate);
 static av_cold int query_formats(AVFilterContext *ctx)
 {
     ASetRateContext *sr = ctx->priv;
-    int sample_rates[] = { sr->sample_rate, -1 };
+    int ret, sample_rates[] = { sr->sample_rate, -1 };
+
+    if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0)
+        return ret;
+
+    if ((ret = ff_set_common_all_channel_counts(ctx)) < 0)
+        return ret;
+
+    if ((ret = ff_formats_ref(ff_all_samplerates(),
+                              &ctx->inputs[0]->outcfg.samplerates)) < 0)
+        return ret;
 
     return ff_formats_ref(ff_make_format_list(sample_rates),
                           &ctx->outputs[0]->incfg.samplerates);



More information about the ffmpeg-cvslog mailing list