aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2025-06-05 16:36:26 -0300
committerJames Almer <jamrial@gmail.com>2025-06-08 18:39:17 -0300
commit117343c0ba0ea995eb04263cbf24848b0875ec40 (patch)
tree09640131e50ae0ce5d4ed3efee0b811347870171 /libavformat/movenc.c
parentefbcd312060a9598e7e63f0e8ca8515d8ce109ef (diff)
downloadffmpeg-117343c0ba0ea995eb04263cbf24848b0875ec40.tar.gz
avcodec/ac3_parser: handle more header bits in ff_ac3_parse_header()
Based on a patch by nyanmisaka. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 0db0cb198b..fa41771f52 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -532,8 +532,6 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track)
int parent = hdr->substreamid;
while (cumul_size != pkt->size) {
- GetBitContext gbc;
- int i;
ret = avpriv_ac3_parse_header(&hdr, pkt->data + cumul_size, pkt->size - cumul_size);
if (ret < 0)
goto end;
@@ -544,20 +542,9 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track)
info->substream[parent].num_dep_sub++;
ret /= 8;
- /* header is parsed up to lfeon, but custom channel map may be needed */
- init_get_bits8(&gbc, pkt->data + cumul_size + ret, pkt->size - cumul_size - ret);
- /* skip bsid */
- skip_bits(&gbc, 5);
- /* skip volume control params */
- for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {
- skip_bits(&gbc, 5); // skip dialog normalization
- if (get_bits1(&gbc)) {
- skip_bits(&gbc, 8); // skip compression gain word
- }
- }
/* get the dependent stream channel map, if exists */
- if (get_bits1(&gbc))
- info->substream[parent].chan_loc |= (get_bits(&gbc, 16) >> 5) & 0x1f;
+ if (hdr->channel_map_present)
+ info->substream[parent].chan_loc |= (hdr->channel_map >> 5) & 0x1f;
else
info->substream[parent].chan_loc |= hdr->channel_mode;
cumul_size += hdr->frame_size;