Mercurial > libavcodec.hg
comparison aac_parser.c @ 9633:9592af8b6ce0 libavcodec
Move the ADTS header size to the parser's header file.
author | alexc |
---|---|
date | Wed, 13 May 2009 14:11:11 +0000 |
parents | 0dce4fe6e6f3 |
children | 61c62ab2218f |
comparison
equal
deleted
inserted
replaced
9632:31a033fae70e | 9633:9592af8b6ce0 |
---|---|
23 #include "parser.h" | 23 #include "parser.h" |
24 #include "aac_ac3_parser.h" | 24 #include "aac_ac3_parser.h" |
25 #include "aac_parser.h" | 25 #include "aac_parser.h" |
26 #include "get_bits.h" | 26 #include "get_bits.h" |
27 #include "mpeg4audio.h" | 27 #include "mpeg4audio.h" |
28 | |
29 #define AAC_HEADER_SIZE 7 | |
30 | 28 |
31 int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) | 29 int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) |
32 { | 30 { |
33 int size, rdb, ch, sr; | 31 int size, rdb, ch, sr; |
34 int aot, crc_abs; | 32 int aot, crc_abs; |
54 | 52 |
55 /* adts_variable_header */ | 53 /* adts_variable_header */ |
56 skip_bits1(gbc); /* copyright_identification_bit */ | 54 skip_bits1(gbc); /* copyright_identification_bit */ |
57 skip_bits1(gbc); /* copyright_identification_start */ | 55 skip_bits1(gbc); /* copyright_identification_start */ |
58 size = get_bits(gbc, 13); /* aac_frame_length */ | 56 size = get_bits(gbc, 13); /* aac_frame_length */ |
59 if(size < AAC_HEADER_SIZE) | 57 if(size < AAC_ADTS_HEADER_SIZE) |
60 return AAC_AC3_PARSE_ERROR_FRAME_SIZE; | 58 return AAC_AC3_PARSE_ERROR_FRAME_SIZE; |
61 | 59 |
62 skip_bits(gbc, 11); /* adts_buffer_fullness */ | 60 skip_bits(gbc, 11); /* adts_buffer_fullness */ |
63 rdb = get_bits(gbc, 2); /* number_of_raw_data_blocks_in_frame */ | 61 rdb = get_bits(gbc, 2); /* number_of_raw_data_blocks_in_frame */ |
64 | 62 |
84 uint64_t u64; | 82 uint64_t u64; |
85 uint8_t u8[8]; | 83 uint8_t u8[8]; |
86 } tmp; | 84 } tmp; |
87 | 85 |
88 tmp.u64 = be2me_64(state); | 86 tmp.u64 = be2me_64(state); |
89 init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8); | 87 init_get_bits(&bits, tmp.u8+8-AAC_ADTS_HEADER_SIZE, AAC_ADTS_HEADER_SIZE * 8); |
90 | 88 |
91 if ((size = ff_aac_parse_header(&bits, &hdr)) < 0) | 89 if ((size = ff_aac_parse_header(&bits, &hdr)) < 0) |
92 return 0; | 90 return 0; |
93 *need_next_header = 0; | 91 *need_next_header = 0; |
94 *new_frame_start = 1; | 92 *new_frame_start = 1; |
100 } | 98 } |
101 | 99 |
102 static av_cold int aac_parse_init(AVCodecParserContext *s1) | 100 static av_cold int aac_parse_init(AVCodecParserContext *s1) |
103 { | 101 { |
104 AACAC3ParseContext *s = s1->priv_data; | 102 AACAC3ParseContext *s = s1->priv_data; |
105 s->header_size = AAC_HEADER_SIZE; | 103 s->header_size = AAC_ADTS_HEADER_SIZE; |
106 s->sync = aac_sync; | 104 s->sync = aac_sync; |
107 return 0; | 105 return 0; |
108 } | 106 } |
109 | 107 |
110 | 108 |