Mercurial > libavcodec.hg
comparison liba52.c @ 6352:a14abb3d08aa libavcodec
Cosmetics: indentation
Patch by Thorsten Jordan (tjordan atay macrosystem otday de)
[FFmpeg-devel] Behaviour of liba52 decoder
author | superdump |
---|---|
date | Wed, 13 Feb 2008 14:24:34 +0000 |
parents | b568fe642948 |
children | 48759bfbd073 |
comparison
equal
deleted
inserted
replaced
6351:b568fe642948 | 6352:a14abb3d08aa |
---|---|
158 if (buf_size < HEADER_SIZE) { | 158 if (buf_size < HEADER_SIZE) { |
159 av_log(avctx, AV_LOG_ERROR, "Error decoding frame, not enough bytes for header\n"); | 159 av_log(avctx, AV_LOG_ERROR, "Error decoding frame, not enough bytes for header\n"); |
160 return -1; | 160 return -1; |
161 } | 161 } |
162 len = s->a52_syncinfo(buf, &s->flags, &sample_rate, &bit_rate); | 162 len = s->a52_syncinfo(buf, &s->flags, &sample_rate, &bit_rate); |
163 if (len == 0) { | 163 if (len == 0) { |
164 av_log(avctx, AV_LOG_ERROR, "Error decoding frame, no sync byte at begin\n"); | 164 av_log(avctx, AV_LOG_ERROR, "Error decoding frame, no sync byte at begin\n"); |
165 return -1; | 165 return -1; |
166 } | 166 } |
167 if (buf_size < len) { | 167 if (buf_size < len) { |
168 av_log(avctx, AV_LOG_ERROR, "Error decoding frame, not enough bytes\n"); | 168 av_log(avctx, AV_LOG_ERROR, "Error decoding frame, not enough bytes\n"); |
169 return -1; | 169 return -1; |
170 } | 170 } |
171 /* update codec info */ | 171 /* update codec info */ |
172 avctx->sample_rate = sample_rate; | 172 avctx->sample_rate = sample_rate; |
173 s->channels = ac3_channels[s->flags & 7]; | 173 s->channels = ac3_channels[s->flags & 7]; |
174 if (s->flags & A52_LFE) | 174 if (s->flags & A52_LFE) |
175 s->channels++; | 175 s->channels++; |
176 if (avctx->request_channels > 0 && | 176 if (avctx->request_channels > 0 && |
177 avctx->request_channels <= 2 && | 177 avctx->request_channels <= 2 && |
178 avctx->request_channels < s->channels) { | 178 avctx->request_channels < s->channels) { |
179 avctx->channels = avctx->request_channels; | 179 avctx->channels = avctx->request_channels; |
180 } else { | 180 } else { |
181 avctx->channels = s->channels; | 181 avctx->channels = s->channels; |
182 } | 182 } |
183 avctx->bit_rate = bit_rate; | 183 avctx->bit_rate = bit_rate; |
184 flags = s->flags; | 184 flags = s->flags; |
185 if (avctx->channels == 1) | 185 if (avctx->channels == 1) |
186 flags = A52_MONO; | 186 flags = A52_MONO; |
187 else if (avctx->channels == 2) | 187 else if (avctx->channels == 2) |
188 flags = A52_STEREO; | 188 flags = A52_STEREO; |
189 else | 189 else |
190 flags |= A52_ADJUST_LEVEL; | 190 flags |= A52_ADJUST_LEVEL; |
191 level = 1; | 191 level = 1; |
192 if (s->a52_frame(s->state, buf, &flags, &level, 384)) { | 192 if (s->a52_frame(s->state, buf, &flags, &level, 384)) { |
193 fail: | 193 fail: |
194 av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n"); | 194 av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n"); |
195 return -1; | 195 return -1; |
196 } | 196 } |
197 for (i = 0; i < 6; i++) { | 197 for (i = 0; i < 6; i++) { |
198 if (s->a52_block(s->state)) | 198 if (s->a52_block(s->state)) |
199 goto fail; | 199 goto fail; |
200 float_to_int(s->samples, out_samples + i * 256 * avctx->channels, avctx->channels); | 200 float_to_int(s->samples, out_samples + i * 256 * avctx->channels, avctx->channels); |
201 } | 201 } |
202 *data_size = 6 * avctx->channels * 256 * sizeof(int16_t); | 202 *data_size = 6 * avctx->channels * 256 * sizeof(int16_t); |
203 return len; | 203 return len; |
204 } | 204 } |
205 | 205 |
206 static int a52_decode_end(AVCodecContext *avctx) | 206 static int a52_decode_end(AVCodecContext *avctx) |
207 { | 207 { |