From 1060e447f83128a78dfaa8d59ba0baa642d15a4d Mon Sep 17 00:00:00 2001 From: Brandon Low Date: Wed, 18 Jan 2006 20:22:03 +0000 Subject: Part of the profiling patch to use a consistent return path in all codecs to facilitate 'on exit' functionality git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8374 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/flac.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'apps/codecs/flac.c') 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) int consumed; int res; int frame; + int retval; /* Generic codec initialisation */ rb = api; @@ -243,17 +244,19 @@ enum codec_status codec_start(struct codec_api* api) ci->configure(DSP_DITHER, (bool *)false); ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_NONINTERLEAVED); ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(FLAC_OUTPUT_DEPTH-1)); - + next_track: if (codec_init(api)) { LOGF("FLAC: Error initialising codec\n"); - return CODEC_ERROR; + retval = CODEC_ERROR; + goto exit; } if (!flac_init(&fc,ci->id3->first_frame_offset)) { LOGF("FLAC: Error initialising codec\n"); - return CODEC_ERROR; + retval = CODEC_ERROR; + goto exit; } while (!*ci->taginfo_ready) @@ -284,7 +287,8 @@ enum codec_status codec_start(struct codec_api* api) if((res=flac_decode_frame(&fc,decoded0,decoded1,buf, bytesleft,ci->yield)) < 0) { LOGF("FLAC: Frame %d, error %d\n",frame,res); - return CODEC_ERROR; + retval = CODEC_ERROR; + goto exit; } consumed=fc.gb.index/8; frame++; @@ -309,5 +313,7 @@ enum codec_status codec_start(struct codec_api* api) if (ci->request_next_track()) goto next_track; - return CODEC_OK; + retval = CODEC_OK; +exit: + return retval; } -- cgit v1.2.3