[FFmpeg-soc] [soc]: r5100 - als/ffmpeg-patches/addALSreadconfig.patch

thilo.borgmann subversion at mplayerhq.hu
Fri Aug 14 04:11:40 CEST 2009


Author: thilo.borgmann
Date: Fri Aug 14 04:11:40 2009
New Revision: 5100

Log:
Added channel configuration and sample rate override due to buggy conformance
files.

Modified:
   als/ffmpeg-patches/addALSreadconfig.patch

Modified: als/ffmpeg-patches/addALSreadconfig.patch
==============================================================================
--- als/ffmpeg-patches/addALSreadconfig.patch	Fri Aug 14 03:48:26 2009	(r5099)
+++ als/ffmpeg-patches/addALSreadconfig.patch	Fri Aug 14 04:11:40 2009	(r5100)
@@ -2,7 +2,7 @@ Index: libavcodec/mpeg4audio.c
 ===================================================================
 --- libavcodec/mpeg4audio.c	(revision 19634)
 +++ libavcodec/mpeg4audio.c	(working copy)
-@@ -24,6 +24,30 @@
+@@ -24,6 +24,34 @@
  #include "put_bits.h"
  #include "mpeg4audio.h"
 
@@ -10,21 +10,25 @@ Index: libavcodec/mpeg4audio.c
 + * Parse MPEG-4 audio configuration for ALS object type.
 + * @param[in] gb       Bit reader context.
 + * @param[in] c        MPEG4AudioConfig structure to fill.
-+ * @param[in] buf_size Size of the bit reader context buffer.
 + * @return On error -1 is returned, on success 0 is returned.
 + */
-+static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, int buf_size)
++static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c)
 +{
-+    buf_size -= get_bits_count(gb) >> 3;
-+
-+    if (buf_size < 14)
++    if (gb->size_in_bits - get_bits_count(gb) < 112)
 +        return -1;
 +
-+    if (show_bits_long(gb, 24) != 0x414C53)
++    if (get_bits_long(gb, 32) != 0x414C5300)
 +        return -1;
 +
-+    // skip als_id, sample_rate, number of samples
-+    skip_bits_long(gb, 96);
++    // override AudioSpecificConfig channel configuration and sample rate
++    // which are buggy in old ALS conformance files
++    c->sample_rate = get_bits_long(gb, 32);
++
++    // skip number of samples
++    skip_bits_long(gb, 32);
++
++    // read number of channels
++    c->chan_config = 0;
 +    c->channels = get_bits(gb, 16) + 1;
 +
 +    return 0;
@@ -33,7 +37,7 @@ Index: libavcodec/mpeg4audio.c
  const int ff_mpeg4audio_sample_rates[16] = {
      96000, 88200, 64000, 48000, 44100, 32000,
      24000, 22050, 16000, 12000, 11025, 8000, 7350
-@@ -71,8 +95,18 @@
+@@ -71,8 +99,19 @@
      }
      specific_config_bitindex = get_bits_count(&gb);
 
@@ -43,7 +47,8 @@ Index: libavcodec/mpeg4audio.c
 +            skip_bits_long(&gb, 24);
 +        }
 +        specific_config_bitindex = get_bits_count(&gb);
-+        if (!c->chan_config && parse_config_ALS(&gb, c, buf_size))
++
++        if (parse_config_ALS(&gb, c))
 +            return -1;
 +    }
 +


More information about the FFmpeg-soc mailing list