summaryrefslogtreecommitdiff
path: root/apps/codecs/flac.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/flac.c')
-rw-r--r--apps/codecs/flac.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/codecs/flac.c b/apps/codecs/flac.c
index a96963dd80..4782c95d55 100644
--- a/apps/codecs/flac.c
+++ b/apps/codecs/flac.c
@@ -226,6 +226,7 @@ enum codec_status codec_start(struct codec_api* api)
226 int consumed; 226 int consumed;
227 int res; 227 int res;
228 int frame; 228 int frame;
229 int retval;
229 230
230 /* Generic codec initialisation */ 231 /* Generic codec initialisation */
231 rb = api; 232 rb = api;
@@ -243,17 +244,19 @@ enum codec_status codec_start(struct codec_api* api)
243 ci->configure(DSP_DITHER, (bool *)false); 244 ci->configure(DSP_DITHER, (bool *)false);
244 ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_NONINTERLEAVED); 245 ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_NONINTERLEAVED);
245 ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(FLAC_OUTPUT_DEPTH-1)); 246 ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(FLAC_OUTPUT_DEPTH-1));
246 247
247 next_track: 248 next_track:
248 249
249 if (codec_init(api)) { 250 if (codec_init(api)) {
250 LOGF("FLAC: Error initialising codec\n"); 251 LOGF("FLAC: Error initialising codec\n");
251 return CODEC_ERROR; 252 retval = CODEC_ERROR;
253 goto exit;
252 } 254 }
253 255
254 if (!flac_init(&fc,ci->id3->first_frame_offset)) { 256 if (!flac_init(&fc,ci->id3->first_frame_offset)) {
255 LOGF("FLAC: Error initialising codec\n"); 257 LOGF("FLAC: Error initialising codec\n");
256 return CODEC_ERROR; 258 retval = CODEC_ERROR;
259 goto exit;
257 } 260 }
258 261
259 while (!*ci->taginfo_ready) 262 while (!*ci->taginfo_ready)
@@ -284,7 +287,8 @@ enum codec_status codec_start(struct codec_api* api)
284 if((res=flac_decode_frame(&fc,decoded0,decoded1,buf, 287 if((res=flac_decode_frame(&fc,decoded0,decoded1,buf,
285 bytesleft,ci->yield)) < 0) { 288 bytesleft,ci->yield)) < 0) {
286 LOGF("FLAC: Frame %d, error %d\n",frame,res); 289 LOGF("FLAC: Frame %d, error %d\n",frame,res);
287 return CODEC_ERROR; 290 retval = CODEC_ERROR;
291 goto exit;
288 } 292 }
289 consumed=fc.gb.index/8; 293 consumed=fc.gb.index/8;
290 frame++; 294 frame++;
@@ -309,5 +313,7 @@ enum codec_status codec_start(struct codec_api* api)
309 if (ci->request_next_track()) 313 if (ci->request_next_track())
310 goto next_track; 314 goto next_track;
311 315
312 return CODEC_OK; 316 retval = CODEC_OK;
317exit:
318 return retval;
313} 319}