lavf: convert the generic layer to the new channel layout

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Anton Khirnov
2019-05-15 09:36:26 +02:00
committed by James Almer
parent c30e22c9fb
commit ac10e3c47c
3 changed files with 35 additions and 3 deletions

View File

@@ -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: