Mercurial > libavcodec.hg
comparison ac3_parser.c @ 6118:76801e61ddc4 libavcodec
cosmetics: indentation after last commit
author | jbr |
---|---|
date | Sat, 05 Jan 2008 18:40:49 +0000 |
parents | 01b1342e717b |
children | 48759bfbd073 |
comparison
equal
deleted
inserted
replaced
6117:01b1342e717b | 6118:76801e61ddc4 |
---|---|
52 hdr->bitstream_id = show_bits_long(&gbc, 29) & 0x1F; | 52 hdr->bitstream_id = show_bits_long(&gbc, 29) & 0x1F; |
53 if(hdr->bitstream_id > 16) | 53 if(hdr->bitstream_id > 16) |
54 return AC3_PARSE_ERROR_BSID; | 54 return AC3_PARSE_ERROR_BSID; |
55 | 55 |
56 if(hdr->bitstream_id <= 10) { | 56 if(hdr->bitstream_id <= 10) { |
57 /* Normal AC-3 */ | 57 /* Normal AC-3 */ |
58 hdr->crc1 = get_bits(&gbc, 16); | 58 hdr->crc1 = get_bits(&gbc, 16); |
59 hdr->sr_code = get_bits(&gbc, 2); | 59 hdr->sr_code = get_bits(&gbc, 2); |
60 if(hdr->sr_code == 3) | 60 if(hdr->sr_code == 3) |
61 return AC3_PARSE_ERROR_SAMPLE_RATE; | 61 return AC3_PARSE_ERROR_SAMPLE_RATE; |
62 | 62 |
63 frame_size_code = get_bits(&gbc, 6); | 63 frame_size_code = get_bits(&gbc, 6); |
64 if(frame_size_code > 37) | 64 if(frame_size_code > 37) |
65 return AC3_PARSE_ERROR_FRAME_SIZE; | 65 return AC3_PARSE_ERROR_FRAME_SIZE; |
66 | 66 |
67 skip_bits(&gbc, 5); // skip bsid, already got it | 67 skip_bits(&gbc, 5); // skip bsid, already got it |
68 | 68 |
69 skip_bits(&gbc, 3); // skip bitstream mode | 69 skip_bits(&gbc, 3); // skip bitstream mode |
70 hdr->channel_mode = get_bits(&gbc, 3); | 70 hdr->channel_mode = get_bits(&gbc, 3); |
71 if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO) { | 71 if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO) { |
72 skip_bits(&gbc, 2); // skip center mix level | 72 skip_bits(&gbc, 2); // skip center mix level |
73 } | 73 } |
74 if(hdr->channel_mode & 4) { | 74 if(hdr->channel_mode & 4) { |
75 skip_bits(&gbc, 2); // skip surround mix level | 75 skip_bits(&gbc, 2); // skip surround mix level |
76 } | 76 } |
77 if(hdr->channel_mode == AC3_CHMODE_STEREO) { | 77 if(hdr->channel_mode == AC3_CHMODE_STEREO) { |
78 skip_bits(&gbc, 2); // skip dolby surround mode | 78 skip_bits(&gbc, 2); // skip dolby surround mode |
79 } | 79 } |
80 hdr->lfe_on = get_bits1(&gbc); | 80 hdr->lfe_on = get_bits1(&gbc); |
81 | 81 |
82 hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8; | 82 hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8; |
83 hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift; | 83 hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift; |
84 hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift; | 84 hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift; |
85 hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; | 85 hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; |
86 hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2; | 86 hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2; |
87 } else { | 87 } else { |
88 /* Enhanced AC-3 */ | 88 /* Enhanced AC-3 */ |
89 hdr->crc1 = 0; | 89 hdr->crc1 = 0; |
90 skip_bits(&gbc, 2); // skip stream type | 90 skip_bits(&gbc, 2); // skip stream type |
91 skip_bits(&gbc, 3); // skip substream id | 91 skip_bits(&gbc, 3); // skip substream id |
128 err = ff_ac3_parse_header(buf, &hdr); | 128 err = ff_ac3_parse_header(buf, &hdr); |
129 | 129 |
130 if(err < 0) | 130 if(err < 0) |
131 return 0; | 131 return 0; |
132 | 132 |
133 *sample_rate = hdr.sample_rate; | 133 *sample_rate = hdr.sample_rate; |
134 *bit_rate = hdr.bit_rate; | 134 *bit_rate = hdr.bit_rate; |
135 *channels = hdr.channels; | 135 *channels = hdr.channels; |
136 *samples = AC3_FRAME_SIZE; | 136 *samples = AC3_FRAME_SIZE; |
137 return hdr.frame_size; | 137 return hdr.frame_size; |
138 } | 138 } |
139 | 139 |
140 static int ac3_parse_init(AVCodecParserContext *s1) | 140 static int ac3_parse_init(AVCodecParserContext *s1) |
141 { | 141 { |
142 AACAC3ParseContext *s = s1->priv_data; | 142 AACAC3ParseContext *s = s1->priv_data; |