[FFmpeg-devel] [PATCH] code to parse mpeg4audio extradata

Andreas Öman andreas
Wed Mar 19 17:08:28 CET 2008


Baptiste Coudurier wrote:
> Hi,
> 
> Here is a patch that adds parsing of mpeg4audio extradata, and retrieve
> needed infos for decoders (only mp3on4 atm, but will be needed for aac),
> and will be used by mov demuxer ideally to correctly compute sample rate
> and channels.
> Also extract common mpeg4audio code from aac_parser.c.

Sorry for the inadequate quoting, my thunderbird cannot inline the
patch correctly... :/


+            c->ext_sample_rate = get_bits(&gb, 24);
+        else
+            c->ext_sample_rate = 
ff_mpeg4audio_sample_rates[c->sampling_index];
+        if ((c->object_type = get_bits(&gb, 5)) == 31)
+            c->object_type = 32 + get_bits(&gb, 6);
+    }

GASpecificConfig() resides here, so either we need to add a callback,
or the function must be split (at least for aac.c to use this)

But without specific parser for all used audioObjectTypes i don't see
how the code below here is supposed to work at all (since it will
read the wrong bits)

+    if (c->ext_object_type != 5 &&
+        buf_size*8 - get_bits_count(&gb) >= 16) {
+        if (get_bits(&gb, 11) == 0x2b7) { // sync extension
+            if ((c->ext_object_type = get_bits(&gb, 5)) == 31)
+                c->ext_object_type = 32 + get_bits(&gb, 6);




More information about the ffmpeg-devel mailing list