summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}