[FFmpeg-devel] [PATCH 2/2] avfilter/af_amerge: do not guess an output channel layout

Marton Balint cus at passwd.hu
Thu Dec 15 05:39:19 EET 2016


This is the right thing to do, but I am afraid this will break too many
existing filter chains. How can we implement this properly? Ideas/options:

- change it, break it, users will fix it
- add a guess_output_layout option which will be true for now, false after a
  major bump, and mention this incompatible change in the next release
- add amerge2 filter, deprecate amerge filter

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavfilter/af_amerge.c      | 4 +---
 tests/ref/fate/filter-amerge | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index 3bc7d89..43a2d95 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -114,9 +114,7 @@ static int query_formats(AVFilterContext *ctx)
                "output layout will be determined by the number of distinct input channels\n");
         for (i = 0; i < nb_ch; i++)
             s->route[i] = i;
-        outlayout = av_get_default_channel_layout(nb_ch);
-        if (!outlayout && nb_ch)
-            outlayout = 0xFFFFFFFFFFFFFFFFULL >> (64 - nb_ch);
+        outlayout = FF_COUNT2LAYOUT(nb_ch);
     } else {
         int *route[SWR_CH_MAX];
         int c, out_ch_number = 0;
diff --git a/tests/ref/fate/filter-amerge b/tests/ref/fate/filter-amerge
index b3e5eb5..8118b4e 100644
--- a/tests/ref/fate/filter-amerge
+++ b/tests/ref/fate/filter-amerge
@@ -2,8 +2,8 @@
 #media_type 0: audio
 #codec_id 0: pcm_s16le
 #sample_rate 0: 44100
-#channel_layout 0: 3
-#channel_layout_name 0: stereo
+#channel_layout 0: 0
+#channel_layout_name 0: 2 channels
 0,          0,          0,     2048,     8192, 0x120efa65
 0,       2048,       2048,     2048,     8192, 0x7b3cebf7
 0,       4096,       4096,     2048,     8192, 0x0fb8ee01
-- 
2.10.2



More information about the ffmpeg-devel mailing list