[FFmpeg-soc] [soc]: r4387 - als/ffmpeg-patches/hack4als.patch

thilo.borgmann subversion at mplayerhq.hu
Fri Jun 5 13:06:54 CEST 2009


Author: thilo.borgmann
Date: Fri Jun  5 13:06:54 2009
New Revision: 4387

Log:
Adds a patch for the FFmpeg trunk to enable ALS demuxing.

This patch has been written by Jai Menon but has not passed review yet.
Refer to thread "[PATCH] als in mp4" for details.

This patch is not meant to be applied as-is in the end but enables
me to continue work on the ALS decoder for the time being. If necessary,
I will continue to work on this patch to pass the review process
if it has not been done as soon as the ALS decoder is to be applied
to the codebase.

Added:
   als/ffmpeg-patches/hack4als.patch

Added: als/ffmpeg-patches/hack4als.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ als/ffmpeg-patches/hack4als.patch	Fri Jun  5 13:06:54 2009	(r4387)
@@ -0,0 +1,65 @@
+Index: libavcodec/mpeg4audio.c
+===================================================================
+--- libavcodec/mpeg4audio.c	(Revision 19089)
++++ libavcodec/mpeg4audio.c	(Arbeitskopie)
+@@ -57,6 +57,8 @@
+     c->object_type = get_object_type(&gb);
+     c->sample_rate = get_sample_rate(&gb, &c->sampling_index);
+     c->chan_config = get_bits(&gb, 4);
++    c->absolute_channels = 0;
++    c->bits_per_sample   = 0;
+     c->sbr = -1;
+     if (c->object_type == 5) {
+         c->ext_object_type = c->object_type;
+@@ -84,6 +86,12 @@
+                 get_bits1(&gb); // skip 1 bit
+         }
+     }
++    if (c->object_type == AOT_ALS) {
++        c->absolute_channels = 1;
++        c->sample_rate       = AV_RB32(buf + 10);
++        c->chan_config       = AV_RB16(buf + 18) + 1;
++        c->bits_per_sample   = (((buf[20] >> 2) & 0x07) + 1) << 3;
++    }
+     return specific_config_bitindex;
+ }
+ 
+Index: libavcodec/mpeg4audio.h
+===================================================================
+--- libavcodec/mpeg4audio.h	(Revision 19089)
++++ libavcodec/mpeg4audio.h	(Arbeitskopie)
+@@ -36,6 +36,8 @@
+     int ext_sampling_index;
+     int ext_sample_rate;
+     int ext_chan_config;
++    int bits_per_sample;
++    int absolute_channels;
+ } MPEG4AudioConfig;
+ 
+ extern const int ff_mpeg4audio_sample_rates[16];
+Index: libavformat/mov.c
+===================================================================
+--- libavformat/mov.c	(Revision 19089)
++++ libavformat/mov.c	(Arbeitskopie)
+@@ -425,13 +425,18 @@
+                 MPEG4AudioConfig cfg;
+                 ff_mpeg4audio_get_config(&cfg, st->codec->extradata,
+                                          st->codec->extradata_size);
+-                if (cfg.chan_config > 7)
+-                    return -1;
+-                st->codec->channels = ff_mpeg4audio_channels[cfg.chan_config];
++                if (!cfg.absolute_channels) {
++                    if (cfg.chan_config > 7)
++                        return -1;
++                    st->codec->channels = ff_mpeg4audio_channels[cfg.chan_config];
++                } else st->codec->channels = cfg.chan_config;
++
+                 if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
+                     st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index];
+                 else
+                     st->codec->sample_rate = cfg.sample_rate; // ext sample rate ?
++                if (cfg.bits_per_sample)
++                    st->codec->bits_per_coded_sample = cfg.bits_per_sample;
+                 dprintf(c->fc, "mp4a config channels %d obj %d ext obj %d "
+                         "sample rate %d ext sample rate %d\n", st->codec->channels,
+                         cfg.object_type, cfg.ext_object_type,


More information about the FFmpeg-soc mailing list