summaryrefslogtreecommitdiff
path: root/apps/codecs/shorten.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/shorten.c
parent3ded3cea756d8290372b808884837931a7e8cf1a (diff)
downloadrockbox-1060e447f83128a78dfaa8d59ba0baa642d15a4d.zip
rockbox-1060e447f83128a78dfaa8d59ba0baa642d15a4d.tar.gz
rockbox-1060e447f83128a78dfaa8d59ba0baa642d15a4d.tar.bz2
rockbox-1060e447f83128a78dfaa8d59ba0baa642d15a4d.tar.xz
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/shorten.c')
-rw-r--r--apps/codecs/shorten.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/codecs/shorten.c b/apps/codecs/shorten.c
index ffbd42a..290686e 100644
--- a/apps/codecs/shorten.c
+++ b/apps/codecs/shorten.c
@@ -50,6 +50,7 @@ enum codec_status codec_start(struct codec_api* api)
int8_t *buf;
int cur_chan, consumed, res;
long bytesleft;
+ int retval;
/* Generic codec initialisation */
rb = api;
@@ -72,7 +73,8 @@ next_track:
/* Codec initialization */
if (codec_init(api)) {
LOGF("Shorten: Error initialising codec\n");
- return CODEC_ERROR;
+ retval = CODEC_ERROR;
+ goto exit;
}
while (!*ci->taginfo_ready)
@@ -92,7 +94,8 @@ next_track:
res = shorten_init(&sc, (unsigned char *)buf, bytesleft);
if (res < 0) {
LOGF("shorten_init error: %d\n", res);
- return CODEC_ERROR;
+ retval = CODEC_ERROR;
+ goto exit;
}
ci->id3->frequency = sc.sample_rate;
@@ -169,7 +172,8 @@ seek_start:
break;
} else if (res < 0) {
LOGF("shorten_decode_frame error: \n", res);
- return CODEC_ERROR;
+ retval = CODEC_ERROR;
+ goto exit;
}
consumed = sc.gb.index/8;
@@ -183,5 +187,7 @@ seek_start:
if (ci->request_next_track())
goto next_track;
- return CODEC_OK;
+ retval = CODEC_OK;
+exit:
+ return retval;
}