comparison aac_parser.c @ 6565:013def14c931 libavcodec

change of aac_ac3_parser, so it is able to send complete portion of data to decoder
author bwolowiec
date Sat, 05 Apr 2008 20:09:36 +0000
parents 23430438e4e8
children 9b8a881e871c
comparison
equal deleted inserted replaced
6564:cb31fe7bd914 6565:013def14c931
25 #include "bitstream.h" 25 #include "bitstream.h"
26 #include "mpeg4audio.h" 26 #include "mpeg4audio.h"
27 27
28 #define AAC_HEADER_SIZE 7 28 #define AAC_HEADER_SIZE 7
29 29
30 static int aac_sync(AACAC3ParseContext *hdr_info, AACAC3FrameFlag *flag) 30 static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
31 int *need_next_header, int *new_frame_start)
31 { 32 {
32 GetBitContext bits; 33 GetBitContext bits;
33 int size, rdb, ch, sr; 34 int size, rdb, ch, sr;
35 uint64_t tmp = be2me_64(state);
34 36
35 init_get_bits(&bits, hdr_info->inbuf, AAC_HEADER_SIZE * 8); 37 init_get_bits(&bits, (uint8_t *)&tmp, AAC_HEADER_SIZE * 8);
36 38
37 if(get_bits(&bits, 12) != 0xfff) 39 if(get_bits(&bits, 12) != 0xfff)
38 return 0; 40 return 0;
39 41
40 skip_bits1(&bits); /* id */ 42 skip_bits1(&bits); /* id */
63 65
64 hdr_info->channels = ff_mpeg4audio_channels[ch]; 66 hdr_info->channels = ff_mpeg4audio_channels[ch];
65 hdr_info->sample_rate = ff_mpeg4audio_sample_rates[sr]; 67 hdr_info->sample_rate = ff_mpeg4audio_sample_rates[sr];
66 hdr_info->samples = (rdb + 1) * 1024; 68 hdr_info->samples = (rdb + 1) * 1024;
67 hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples; 69 hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples;
68 *flag = FRAME_COMPLETE;
69 70
71 *need_next_header=0;
72 *new_frame_start=1;
70 return size; 73 return size;
71 } 74 }
72 75
73 static av_cold int aac_parse_init(AVCodecParserContext *s1) 76 static av_cold int aac_parse_init(AVCodecParserContext *s1)
74 { 77 {
75 AACAC3ParseContext *s = s1->priv_data; 78 AACAC3ParseContext *s = s1->priv_data;
76 s->inbuf_ptr = s->inbuf;
77 s->header_size = AAC_HEADER_SIZE; 79 s->header_size = AAC_HEADER_SIZE;
78 s->sync = aac_sync; 80 s->sync = aac_sync;
79 return 0; 81 return 0;
80 } 82 }
81 83