summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Boot <rotator@gmail.com>2007-04-06 21:48:17 +0000
committerAdam Boot <rotator@gmail.com>2007-04-06 21:48:17 +0000
commita5d7309d96cca974e1524dc746482ab2a26d7395 (patch)
tree8d835f98b75c7abd46f1c0b430b390b4c269f10f
parent8527ce82b651b20f2f3406a9b95c4948e8c7dddf (diff)
downloadrockbox-a5d7309d96cca974e1524dc746482ab2a26d7395.tar.gz
rockbox-a5d7309d96cca974e1524dc746482ab2a26d7395.tar.bz2
rockbox-a5d7309d96cca974e1524dc746482ab2a26d7395.zip
Support resume for Musepack
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13049 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/mpc.c17
-rw-r--r--apps/playback.c1
2 files changed, 17 insertions, 1 deletions
diff --git a/apps/codecs/mpc.c b/apps/codecs/mpc.c
index fe22c8cccb..122cb22025 100644
--- a/apps/codecs/mpc.c
+++ b/apps/codecs/mpc.c
@@ -100,6 +100,8 @@ next_track:
goto exit;
}
+ samplesdone = ci->id3->offset;
+
/* read file's streaminfo data */
mpc_streaminfo_init(&info);
if (mpc_streaminfo_read(&info, &reader) != ERROR_CODE_OK) {
@@ -128,9 +130,21 @@ next_track:
retval = CODEC_ERROR;
goto done;
}
+
+ /* Resume to saved sample offset. */
+ if(samplesdone > 0) {
+ /* hack to improve seek time if filebuf goes empty */
+ ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*512);
+ if (mpc_decoder_seek_sample(&decoder, samplesdone)) {
+ ci->set_elapsed(samplesdone/frequency);
+ } else {
+ samplesdone = 0;
+ }
+ /* reset chunksize */
+ ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*16);
+ }
/* This is the decoding loop. */
- samplesdone = 0;
do {
#if 1
/* Complete seek handler. */
@@ -173,6 +187,7 @@ next_track:
status);
samplesdone += status;
ci->set_elapsed(samplesdone/frequency);
+ ci->set_offset(samplesdone);
}
} while (status != 0);
retval = CODEC_OK;
diff --git a/apps/playback.c b/apps/playback.c
index cf8d94f303..6fea60c7ea 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -2855,6 +2855,7 @@ static bool audio_load_track(int offset, bool start_play, bool rebuffer)
case AFMT_PCM_WAV:
case AFMT_A52:
case AFMT_AAC:
+ case AFMT_MPC:
tracks[track_widx].id3.offset = offset;
break;
}