Mercurial > libavcodec.hg
comparison aac_parser.c @ 6539:04763b6fd4f0 libavcodec
removal of stream_type in AACAC3ParseContext and adding AACAC3FrameFlag
author | bwolowiec |
---|---|
date | Fri, 28 Mar 2008 19:59:58 +0000 |
parents | 7781f4e99d37 |
children | 23430438e4e8 |
comparison
equal
deleted
inserted
replaced
6538:b8f886bce6f5 | 6539:04763b6fd4f0 |
---|---|
21 */ | 21 */ |
22 | 22 |
23 #include "parser.h" | 23 #include "parser.h" |
24 #include "aac_ac3_parser.h" | 24 #include "aac_ac3_parser.h" |
25 #include "bitstream.h" | 25 #include "bitstream.h" |
26 #include "ac3.h" | |
27 | 26 |
28 | 27 |
29 #define AAC_HEADER_SIZE 7 | 28 #define AAC_HEADER_SIZE 7 |
30 | 29 |
31 | 30 |
37 static const int aac_channels[8] = { | 36 static const int aac_channels[8] = { |
38 0, 1, 2, 3, 4, 5, 6, 8 | 37 0, 1, 2, 3, 4, 5, 6, 8 |
39 }; | 38 }; |
40 | 39 |
41 | 40 |
42 static int aac_sync(AACAC3ParseContext *hdr_info) | 41 static int aac_sync(AACAC3ParseContext *hdr_info, AACAC3FrameFlag *flag) |
43 { | 42 { |
44 GetBitContext bits; | 43 GetBitContext bits; |
45 int size, rdb, ch, sr; | 44 int size, rdb, ch, sr; |
46 | 45 |
47 init_get_bits(&bits, hdr_info->inbuf, AAC_HEADER_SIZE * 8); | 46 init_get_bits(&bits, hdr_info->inbuf, AAC_HEADER_SIZE * 8); |
75 | 74 |
76 hdr_info->channels = aac_channels[ch]; | 75 hdr_info->channels = aac_channels[ch]; |
77 hdr_info->sample_rate = aac_sample_rates[sr]; | 76 hdr_info->sample_rate = aac_sample_rates[sr]; |
78 hdr_info->samples = (rdb + 1) * 1024; | 77 hdr_info->samples = (rdb + 1) * 1024; |
79 hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples; | 78 hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples; |
79 *flag = FRAME_COMPLETE; | |
80 | 80 |
81 return size; | 81 return size; |
82 } | 82 } |
83 | 83 |
84 static av_cold int aac_parse_init(AVCodecParserContext *s1) | 84 static av_cold int aac_parse_init(AVCodecParserContext *s1) |
85 { | 85 { |
86 AACAC3ParseContext *s = s1->priv_data; | 86 AACAC3ParseContext *s = s1->priv_data; |
87 s->stream_type = EAC3_STREAM_TYPE_INDEPENDENT; | |
88 s->inbuf_ptr = s->inbuf; | 87 s->inbuf_ptr = s->inbuf; |
89 s->header_size = AAC_HEADER_SIZE; | 88 s->header_size = AAC_HEADER_SIZE; |
90 s->sync = aac_sync; | 89 s->sync = aac_sync; |
91 return 0; | 90 return 0; |
92 } | 91 } |