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/alac.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'apps/codecs/alac.c') diff --git a/apps/codecs/alac.c b/apps/codecs/alac.c index 7ca70ce..a1c4f41 100644 --- a/apps/codecs/alac.c +++ b/apps/codecs/alac.c @@ -50,6 +50,7 @@ enum codec_status codec_start(struct codec_api* api) unsigned int i; unsigned char* buffer; alac_file alac; + int retval; /* Generic codec initialisation */ rb = api; @@ -72,7 +73,8 @@ enum codec_status codec_start(struct codec_api* api) if (codec_init(api)) { LOGF("ALAC: Error initialising codec\n"); - return CODEC_ERROR; + retval = CODEC_ERROR; + goto exit; } while (!rb->taginfo_ready) @@ -86,7 +88,8 @@ enum codec_status codec_start(struct codec_api* api) * the movie data, which can be used directly by the decoder */ if (!qtmovie_read(&input_stream, &demux_res)) { LOGF("ALAC: Error initialising file\n"); - return CODEC_ERROR; + retval = CODEC_ERROR; + goto exit; } /* initialise the sound converter */ @@ -117,14 +120,16 @@ enum codec_status codec_start(struct codec_api* api) if (!get_sample_info(&demux_res, i, &sample_duration, &sample_byte_size)) { LOGF("ALAC: Error in get_sample_info\n"); - return CODEC_ERROR; + retval = CODEC_ERROR; + goto exit; } /* Request the required number of bytes from the input buffer */ buffer=ci->request_buffer((long*)&n,sample_byte_size); if (n!=sample_byte_size) { - return CODEC_ERROR; + retval = CODEC_ERROR; + goto exit; } /* Decode one block - returned samples will be host-endian */ @@ -157,5 +162,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.1