Mercurial > libavformat.hg
comparison adtsenc.c @ 6205:1327f1008940 libavformat
Allow remuxing of explicitly signalled AAC files into ADTS.
The ADTS output files are not explicitly signaled because the format
does not support explicit signalling.
author | alexc |
---|---|
date | Thu, 01 Jul 2010 14:49:32 +0000 |
parents | 667736f463b3 |
children | 79b5e6fa86c9 |
comparison
equal
deleted
inserted
replaced
6204:fbc809c24e5b | 6205:1327f1008940 |
---|---|
21 */ | 21 */ |
22 | 22 |
23 #include "libavcodec/get_bits.h" | 23 #include "libavcodec/get_bits.h" |
24 #include "libavcodec/put_bits.h" | 24 #include "libavcodec/put_bits.h" |
25 #include "libavcodec/avcodec.h" | 25 #include "libavcodec/avcodec.h" |
26 #include "libavcodec/mpeg4audio.h" | |
26 #include "avformat.h" | 27 #include "avformat.h" |
27 #include "adts.h" | 28 #include "adts.h" |
28 | 29 |
29 int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf, int size) | 30 int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf, int size) |
30 { | 31 { |
31 GetBitContext gb; | 32 GetBitContext gb; |
32 PutBitContext pb; | 33 PutBitContext pb; |
34 MPEG4AudioConfig m4ac; | |
35 int off; | |
33 | 36 |
34 init_get_bits(&gb, buf, size * 8); | 37 init_get_bits(&gb, buf, size * 8); |
35 adts->objecttype = get_bits(&gb, 5) - 1; | 38 off = ff_mpeg4audio_get_config(&m4ac, buf, size); |
36 adts->sample_rate_index = get_bits(&gb, 4); | 39 if (off < 0) |
37 adts->channel_conf = get_bits(&gb, 4); | 40 return off; |
41 skip_bits_long(&gb, off); | |
42 adts->objecttype = m4ac.object_type - 1; | |
43 adts->sample_rate_index = m4ac.sampling_index; | |
44 adts->channel_conf = m4ac.chan_config; | |
38 | 45 |
39 if (adts->objecttype > 3U) { | 46 if (adts->objecttype > 3U) { |
40 av_log(s, AV_LOG_ERROR, "MPEG-4 AOT %d is not allowed in ADTS\n", adts->objecttype+1); | 47 av_log(s, AV_LOG_ERROR, "MPEG-4 AOT %d is not allowed in ADTS\n", adts->objecttype+1); |
41 return -1; | 48 return -1; |
42 } | 49 } |
48 av_log(s, AV_LOG_ERROR, "960/120 MDCT window is not allowed in ADTS\n"); | 55 av_log(s, AV_LOG_ERROR, "960/120 MDCT window is not allowed in ADTS\n"); |
49 return -1; | 56 return -1; |
50 } | 57 } |
51 if (get_bits(&gb, 1)) { | 58 if (get_bits(&gb, 1)) { |
52 av_log(s, AV_LOG_ERROR, "Scalable configurations are not allowed in ADTS\n"); | 59 av_log(s, AV_LOG_ERROR, "Scalable configurations are not allowed in ADTS\n"); |
53 return -1; | |
54 } | |
55 if (get_bits(&gb, 1)) { | |
56 av_log_missing_feature(s, "Signaled SBR or PS", 0); | |
57 return -1; | 60 return -1; |
58 } | 61 } |
59 if (!adts->channel_conf) { | 62 if (!adts->channel_conf) { |
60 init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE); | 63 init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE); |
61 | 64 |