summaryrefslogtreecommitdiff
path: root/apps/codecs/flac.c
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@rockbox.org>2006-01-18 20:22:03 +0000
committerBrandon Low <lostlogic@rockbox.org>2006-01-18 20:22:03 +0000
commit1060e447f83128a78dfaa8d59ba0baa642d15a4d (patch)
tree9af0876f9c5d0ad5cb8bfc2adc7b1653c43013ff /apps/codecs/flac.c
parent3ded3cea756d8290372b808884837931a7e8cf1a (diff)
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
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)
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;
}