summaryrefslogtreecommitdiff
path: root/apps/codecs/smaf.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-02-20 15:27:10 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-02-20 15:27:10 +0000
commit85e40257dc65e3542b785898ddf60482e2d1ab0c (patch)
treef7bf9b33decce4296fbea0f437252f40aba6d5de /apps/codecs/smaf.c
parent460d54977ae2f9c2c5997c6c4cd5541ab436d718 (diff)
downloadrockbox-85e40257dc65e3542b785898ddf60482e2d1ab0c.tar.gz
rockbox-85e40257dc65e3542b785898ddf60482e2d1ab0c.zip
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
Diffstat (limited to 'apps/codecs/smaf.c')
-rw-r--r--apps/codecs/smaf.c9
1 files changed, 5 insertions, 4 deletions
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)
334 334
335enum codec_status codec_main(void) 335enum codec_status codec_main(void)
336{ 336{
337 int status = CODEC_OK; 337 int status;
338 uint32_t decodedsamples; 338 uint32_t decodedsamples;
339 size_t n; 339 size_t n;
340 int bufcount; 340 int bufcount;
@@ -347,13 +347,15 @@ enum codec_status codec_main(void)
347 ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1); 347 ci->configure(DSP_SET_SAMPLE_DEPTH, PCM_OUTPUT_DEPTH-1);
348 348
349next_track: 349next_track:
350 status = CODEC_OK;
351
350 if (codec_init()) { 352 if (codec_init()) {
351 status = CODEC_ERROR; 353 status = CODEC_ERROR;
352 goto exit; 354 goto exit;
353 } 355 }
354 356
355 while (!*ci->taginfo_ready && !ci->stop_codec) 357 if (codec_wait_taginfo() != 0)
356 ci->sleep(1); 358 goto done;
357 359
358 codec_set_replaygain(ci->id3); 360 codec_set_replaygain(ci->id3);
359 361
@@ -479,7 +481,6 @@ next_track:
479 481
480 ci->set_elapsed(decodedsamples*1000LL/ci->id3->frequency); 482 ci->set_elapsed(decodedsamples*1000LL/ci->id3->frequency);
481 } 483 }
482 status = CODEC_OK;
483 484
484done: 485done:
485 if (ci->request_next_track()) 486 if (ci->request_next_track())