[SCM] libav/experimental: Add a channels field to MPEG4AudioConfig.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:54:25 UTC 2013


The following commit has been merged in the experimental branch:
commit 5aea268d14b2973188589c89b275d8b248150446
Author: Alex Converse <alex.converse at gmail.com>
Date:   Wed Nov 11 20:24:23 2009 +0000

    Add a channels field to MPEG4AudioConfig.
    
    Originally committed as revision 20512 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5d470b0..6e56257 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -30,8 +30,8 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 38
-#define LIBAVCODEC_VERSION_MICRO  1
+#define LIBAVCODEC_VERSION_MINOR 39
+#define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index 6c0bc7d..8c96572 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -57,6 +57,8 @@ int ff_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_si
     c->object_type = get_object_type(&gb);
     c->sample_rate = get_sample_rate(&gb, &c->sampling_index);
     c->chan_config = get_bits(&gb, 4);
+    if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels))
+        c->channels = ff_mpeg4audio_channels[c->chan_config];
     c->sbr = -1;
     if (c->object_type == AOT_SBR) {
         c->ext_object_type = c->object_type;
diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
index 5e3a1d3..c9eac18 100644
--- a/libavcodec/mpeg4audio.h
+++ b/libavcodec/mpeg4audio.h
@@ -36,6 +36,7 @@ typedef struct {
     int ext_sampling_index;
     int ext_sample_rate;
     int ext_chan_config;
+    int channels;
 } MPEG4AudioConfig;
 
 extern const int ff_mpeg4audio_sample_rates[16];
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index b3b3cc1..27062dc 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -410,9 +410,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
                 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];
+                st->codec->channels = cfg.channels;
                 st->codec->sample_rate = cfg.sample_rate;
                 dprintf(s, "mp4a config channels %d sample rate %d\n",
                         st->codec->channels, st->codec->sample_rate);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3d67630..196f41d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -434,9 +434,7 @@ int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom)
                 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];
+                st->codec->channels = cfg.channels;
                 if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
                     st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index];
                 else

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list