[FFmpeg-devel] [PATCH 096/281] mov: convert to new channel layout API
Anton Khirnov
anton at khirnov.net
Fri Jan 28 12:08:21 EET 2022
Quoting James Almer (2022-01-13 02:55:49)
> diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c
> index 349634094c..5894bb8ce2 100644
> --- a/libavformat/mov_chan.c
> +++ b/libavformat/mov_chan.c
> @@ -499,7 +499,7 @@ static uint32_t mov_get_channel_label(uint32_t label)
> }
>
> uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id,
> - uint64_t channel_layout,
> + AVChannelLayout *ch_layout,
const?
> uint32_t *bitmap)
> {
> int i, j;
> @@ -519,7 +519,7 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id,
> const struct MovChannelLayoutMap *layout_map;
>
> /* get the layout map based on the channel count */
> - channels = av_get_channel_layout_nb_channels(channel_layout);
> + channels = ch_layout->nb_channels;
> if (channels > 9)
> channels = 0;
> layout_map = mov_ch_layout_map[channels];
> @@ -530,7 +530,8 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id,
> continue;
> for (j = 0; layout_map[j].tag != 0; j++) {
> if (layout_map[j].tag == layouts[i] &&
> - layout_map[j].layout == channel_layout)
> + (ch_layout->order == AV_CHANNEL_ORDER_NATIVE &&
> + layout_map[j].layout == ch_layout->u.mask))
> break;
> }
> if (layout_map[j].tag)
> @@ -540,9 +541,9 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id,
> }
>
> /* if no tag was found, use channel bitmap as a backup if possible */
> - if (tag == 0 && channel_layout > 0 && channel_layout < 0x40000) {
> + if (tag == 0 && av_channel_layout_check(ch_layout) && ch_layout->u.mask < 0x40000) {
This should check the order is native.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list