Add a channels field to MPEG4AudioConfig.

Originally committed as revision 20512 to svn://svn.ffmpeg.org/ffmpeg/trunk
release/0.6
Alex Converse 15 years ago
parent f2b7ce8ae6
commit 5aea268d14
  1. 4
      libavcodec/avcodec.h
  2. 2
      libavcodec/mpeg4audio.c
  3. 1
      libavcodec/mpeg4audio.h
  4. 4
      libavformat/flvdec.c
  5. 4
      libavformat/mov.c

@ -30,8 +30,8 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 52 #define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 38 #define LIBAVCODEC_VERSION_MINOR 39
#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \

@ -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->object_type = get_object_type(&gb);
c->sample_rate = get_sample_rate(&gb, &c->sampling_index); c->sample_rate = get_sample_rate(&gb, &c->sampling_index);
c->chan_config = get_bits(&gb, 4); 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; c->sbr = -1;
if (c->object_type == AOT_SBR) { if (c->object_type == AOT_SBR) {
c->ext_object_type = c->object_type; c->ext_object_type = c->object_type;

@ -36,6 +36,7 @@ typedef struct {
int ext_sampling_index; int ext_sampling_index;
int ext_sample_rate; int ext_sample_rate;
int ext_chan_config; int ext_chan_config;
int channels;
} MPEG4AudioConfig; } MPEG4AudioConfig;
extern const int ff_mpeg4audio_sample_rates[16]; extern const int ff_mpeg4audio_sample_rates[16];

@ -410,9 +410,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
MPEG4AudioConfig cfg; MPEG4AudioConfig cfg;
ff_mpeg4audio_get_config(&cfg, st->codec->extradata, ff_mpeg4audio_get_config(&cfg, st->codec->extradata,
st->codec->extradata_size); st->codec->extradata_size);
if (cfg.chan_config > 7) st->codec->channels = cfg.channels;
return -1;
st->codec->channels = ff_mpeg4audio_channels[cfg.chan_config];
st->codec->sample_rate = cfg.sample_rate; st->codec->sample_rate = cfg.sample_rate;
dprintf(s, "mp4a config channels %d sample rate %d\n", dprintf(s, "mp4a config channels %d sample rate %d\n",
st->codec->channels, st->codec->sample_rate); st->codec->channels, st->codec->sample_rate);

@ -434,9 +434,7 @@ int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom)
MPEG4AudioConfig cfg; MPEG4AudioConfig cfg;
ff_mpeg4audio_get_config(&cfg, st->codec->extradata, ff_mpeg4audio_get_config(&cfg, st->codec->extradata,
st->codec->extradata_size); st->codec->extradata_size);
if (cfg.chan_config > 7) st->codec->channels = cfg.channels;
return -1;
st->codec->channels = ff_mpeg4audio_channels[cfg.chan_config];
if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4 if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index]; st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index];
else else

Loading…
Cancel
Save