summaryrefslogtreecommitdiff
path: root/libavformat/mux.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-05-15 09:36:26 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:29 -0300
commitac10e3c47cc2d252822ff5ca70fce2ef40df4277 (patch)
tree2c4462f19924c570a9d9c3172626ea4e718ab4ab /libavformat/mux.c
parentc30e22c9fb1a3d1c3b62c6bc1ff9f8b6a0f41dcc (diff)
lavf: convert the generic layer to the new channel layout
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/mux.c')
-rw-r--r--libavformat/mux.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c
index f1b5beea0a..53be37d3c4 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -282,8 +282,24 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
par->ch_layout.u.mask : 0;
}
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
+ /* if the caller is using the deprecated channel layout API,
+ * convert it to the new style */
+ if (!par->ch_layout.nb_channels &&
+ par->channels) {
+ if (par->channel_layout) {
+ av_channel_layout_from_mask(&par->ch_layout, par->channel_layout);
+ } else {
+ par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+ par->ch_layout.nb_channels = par->channels;
+ }
+ }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
if (!par->block_align)
- par->block_align = par->channels *
+ par->block_align = par->ch_layout.nb_channels *
av_get_bits_per_sample(par->codec_id) >> 3;
break;
case AVMEDIA_TYPE_VIDEO: