From 85e40257dc65e3542b785898ddf60482e2d1ab0c Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sun, 20 Feb 2011 15:27:10 +0000 Subject: Enforce that codecs wait for their metadata in a proper-ish and consistent manner. Sort of a halfway patch; best would be to give them an internal copy of the current track information which lasts unaltered by playback until a track switch or unload. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29348 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/smaf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'apps/codecs/smaf.c') diff --git a/apps/codecs/smaf.c b/apps/codecs/smaf.c index 6763e95001..3e8a41387d 100644 --- a/apps/codecs/smaf.c +++ b/apps/codecs/smaf.c @@ -334,7 +334,7 @@ static uint8_t *read_buffer(size_t *realsize) enum codec_status codec_main(void) { - int status = CODEC_OK; + int status; uint32_t decodedsamples; size_t n; int bufcount; @@ -347,13 +347,15 @@ enum codec_status codec_main(void) ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1); next_track: + status = CODEC_OK; + if (codec_init()) { status = CODEC_ERROR; goto exit; } - while (!*ci->taginfo_ready && !ci->stop_codec) - ci->sleep(1); + if (codec_wait_taginfo() != 0) + goto done; codec_set_replaygain(ci->id3); @@ -479,7 +481,6 @@ next_track: ci->set_elapsed(decodedsamples*1000LL/ci->id3->frequency); } - status = CODEC_OK; done: if (ci->request_next_track()) -- cgit v1.2.3