This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/7.0 in repository ffmpeg.
commit a99568075658c8a64560e5931ea60eb0df8e11ac Author: James Almer <[email protected]> AuthorDate: Sun May 31 13:23:06 2026 -0300 Commit: James Almer <[email protected]> CommitDate: Mon Jun 1 12:03:09 2026 -0300 avformat/mov_chan: keep the layout untouched on chan/chnl box failure Needed to keep the process going if some issue was found while parsing these boxes. Signed-off-by: James Almer <[email protected]> (cherry picked from commit fd1c8fa0e611f03681f5fce496848da7c73651a2) --- libavformat/mov_chan.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 3c7274b737..2f3e2df1b8 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -312,16 +312,22 @@ static int mov_get_channel_layout(AVChannelLayout *ch_layout, uint32_t tag) /* find the channel layout for the specified layout tag */ layout_map = find_layout_map(tag); if (layout_map) { + AVChannelLayout tmp = { 0 }; int ret; - av_channel_layout_uninit(ch_layout); - ret = av_channel_layout_custom_init(ch_layout, channels); + ret = av_channel_layout_custom_init(&tmp, channels); if (ret < 0) return ret; for (i = 0; i < channels; i++) { enum AVChannel id = layout_map[i].id; - ch_layout->u.map[i].id = (id != AV_CHAN_NONE ? id : AV_CHAN_UNKNOWN); + tmp.u.map[i].id = (id != AV_CHAN_NONE ? id : AV_CHAN_UNKNOWN); } - return av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL); + + ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL); + if (ret < 0) + return ret; + + av_channel_layout_uninit(ch_layout); + *ch_layout = tmp; } return 0; } @@ -462,6 +468,7 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, return 0; if (layout_tag == MOV_CH_LAYOUT_USE_DESCRIPTIONS) { + AVChannelLayout tmp = { 0 }; int nb_channels = ch_layout->nb_channels; if (!num_descr || num_descr < nb_channels) { @@ -481,8 +488,7 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, num_descr = nb_channels; } - av_channel_layout_uninit(ch_layout); - ret = av_channel_layout_custom_init(ch_layout, nb_channels); + ret = av_channel_layout_custom_init(&tmp, nb_channels); if (ret < 0) goto out; @@ -499,12 +505,15 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, avio_rl32(pb); // mCoordinates[1] avio_rl32(pb); // mCoordinates[2] size -= 20; - ch_layout->u.map[i].id = mov_get_channel_id(label); + tmp.u.map[i].id = mov_get_channel_id(label); } - ret = av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL); + ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL); if (ret < 0) goto out; + + av_channel_layout_uninit(ch_layout); + *ch_layout = tmp; } else if (layout_tag == MOV_CH_LAYOUT_USE_BITMAP) { if (!ch_layout->nb_channels || av_popcount(bitmap) == ch_layout->nb_channels) { if (bitmap < 0x40000) { @@ -783,11 +792,10 @@ int ff_mov_read_chnl(AVFormatContext *s, AVIOContext *pb, AVStream *st) av_log(s, AV_LOG_TRACE, "'chnl' layout %d\n", layout); if (!layout) { - AVChannelLayout *ch_layout = &st->codecpar->ch_layout; + AVChannelLayout tmp = { 0 }, *ch_layout = &st->codecpar->ch_layout; int nb_channels = ch_layout->nb_channels; - av_channel_layout_uninit(ch_layout); - ret = av_channel_layout_custom_init(ch_layout, nb_channels); + ret = av_channel_layout_custom_init(&tmp, nb_channels); if (ret < 0) return ret; @@ -808,12 +816,15 @@ int ff_mov_read_chnl(AVFormatContext *s, AVIOContext *pb, AVStream *st) channel = AV_CHAN_UNKNOWN; } - ch_layout->u.map[i].id = channel; + tmp.u.map[i].id = channel; } - ret = av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL); + ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL); if (ret < 0) return ret; + + av_channel_layout_uninit(ch_layout); + *ch_layout = tmp; } else { uint64_t omitted_channel_map = avio_rb64(pb); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
