Mercurial > libavformat.hg
comparison mov.c @ 3262:07299732f3b8 libavformat
set channels and sample rate from mpeg4audio config
author | bcoudurier |
---|---|
date | Fri, 25 Apr 2008 14:09:42 +0000 |
parents | bf5f112efcff |
children | d9a40edc615a |
comparison
equal
deleted
inserted
replaced
3261:bf5f112efcff | 3262:07299732f3b8 |
---|---|
26 #include "avformat.h" | 26 #include "avformat.h" |
27 #include "riff.h" | 27 #include "riff.h" |
28 #include "isom.h" | 28 #include "isom.h" |
29 #include "dv.h" | 29 #include "dv.h" |
30 #include "mpeg4audio.h" | 30 #include "mpeg4audio.h" |
31 #include "mpegaudiodata.h" | |
31 | 32 |
32 #ifdef CONFIG_ZLIB | 33 #ifdef CONFIG_ZLIB |
33 #include <zlib.h> | 34 #include <zlib.h> |
34 #endif | 35 #endif |
35 | 36 |
405 st->codec->extradata_size = len; | 406 st->codec->extradata_size = len; |
406 if (st->codec->codec_id == CODEC_ID_AAC) { | 407 if (st->codec->codec_id == CODEC_ID_AAC) { |
407 MPEG4AudioConfig cfg; | 408 MPEG4AudioConfig cfg; |
408 ff_mpeg4audio_get_config(&cfg, st->codec->extradata, | 409 ff_mpeg4audio_get_config(&cfg, st->codec->extradata, |
409 st->codec->extradata_size); | 410 st->codec->extradata_size); |
411 if (!cfg.chan_config || cfg.chan_config > 7) | |
412 return -1; | |
413 st->codec->channels = ff_mpeg4audio_channels[cfg.chan_config]; | |
414 if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4 | |
415 st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index]; | |
416 else | |
417 st->codec->sample_rate = cfg.sample_rate; // ext sample rate ? | |
418 dprintf(c->fc, "mp4a config channels %d obj %d ext obj %d " | |
419 "sample rate %d ext sample rate %d\n", st->codec->channels, | |
420 cfg.object_type, cfg.ext_object_type, | |
421 cfg.sample_rate, cfg.ext_sample_rate); | |
410 if (!(st->codec->codec_id = codec_get_id(mp4_audio_types, | 422 if (!(st->codec->codec_id = codec_get_id(mp4_audio_types, |
411 cfg.object_type))) | 423 cfg.object_type))) |
412 st->codec->codec_id = CODEC_ID_AAC; | 424 st->codec->codec_id = CODEC_ID_AAC; |
413 } | 425 } |
414 } | 426 } |
1294 case CODEC_ID_MPEG4: | 1306 case CODEC_ID_MPEG4: |
1295 #endif | 1307 #endif |
1296 st->codec->width= 0; /* let decoder init width/height */ | 1308 st->codec->width= 0; /* let decoder init width/height */ |
1297 st->codec->height= 0; | 1309 st->codec->height= 0; |
1298 break; | 1310 break; |
1299 #ifdef CONFIG_LIBFAAD | |
1300 case CODEC_ID_AAC: | |
1301 #endif | |
1302 #ifdef CONFIG_VORBIS_DECODER | 1311 #ifdef CONFIG_VORBIS_DECODER |
1303 case CODEC_ID_VORBIS: | 1312 case CODEC_ID_VORBIS: |
1304 #endif | 1313 #endif |
1305 case CODEC_ID_MP3ON4: | |
1306 st->codec->sample_rate= 0; /* let decoder init parameters properly */ | 1314 st->codec->sample_rate= 0; /* let decoder init parameters properly */ |
1307 break; | 1315 break; |
1308 } | 1316 } |
1309 | 1317 |
1310 /* Do not need those anymore. */ | 1318 /* Do not need those anymore. */ |