]> git.sesse.net Git - ffmpeg/commitdiff
swresample/rematrix: treat 22.2 as 5.1 (back) when mixing
authorJan Ekström <jeebjp@gmail.com>
Fri, 31 Jul 2020 22:55:39 +0000 (01:55 +0300)
committerJan Ekström <jeebjp@gmail.com>
Mon, 3 Aug 2020 21:17:56 +0000 (00:17 +0300)
Only this sub-set of channels actually follows the bit mask order
in the official 22.2 channel mapping. Additionally, the 5.1 channels
are there for backwards compatibility with the previous system.

This enables the utilization of 22.2 content until a proper down/up
matrix is added into swresample.

libswresample/rematrix.c

index 983355ba364de044269eab6dc65fa335f1df2c05..d0c4a212b3a8b3e3cf241d18b5bb021b461b42b4 100644 (file)
@@ -141,6 +141,16 @@ av_cold int swr_build_matrix(uint64_t in_ch_layout_param, uint64_t out_ch_layout
     )
         in_ch_layout = AV_CH_LAYOUT_STEREO;
 
+    if (in_ch_layout == AV_CH_LAYOUT_22POINT2 &&
+        out_ch_layout != AV_CH_LAYOUT_22POINT2) {
+        in_ch_layout = AV_CH_LAYOUT_5POINT1_BACK;
+        av_get_channel_layout_string(buf, sizeof(buf), -1, in_ch_layout);
+        av_log(log_context, AV_LOG_WARNING,
+               "Full-on remixing from 22.2 has not yet been implemented! "
+               "Processing the input as '%s'\n",
+               buf);
+    }
+
     if(!sane_layout(in_ch_layout)){
         av_get_channel_layout_string(buf, sizeof(buf), -1, in_ch_layout_param);
         av_log(log_context, AV_LOG_ERROR, "Input channel layout '%s' is not supported\n", buf);