diff options
| author | Miika Pekkarinen <miipekk@ihme.org> | 2006-01-20 22:02:44 +0000 |
|---|---|---|
| committer | Miika Pekkarinen <miipekk@ihme.org> | 2006-01-20 22:02:44 +0000 |
| commit | 0e159f13cf4562cf17d0a2edd16bfd3b665c8473 (patch) | |
| tree | dbb75cedac68b5124ab353e654b7f8f95f209348 /apps/codecs/mpa.c | |
| parent | 57b1ccba2bd2b49a1fe6248878f5afec6676fe70 (diff) | |
| download | rockbox-0e159f13cf4562cf17d0a2edd16bfd3b665c8473.zip rockbox-0e159f13cf4562cf17d0a2edd16bfd3b665c8473.tar.gz rockbox-0e159f13cf4562cf17d0a2edd16bfd3b665c8473.tar.bz2 rockbox-0e159f13cf4562cf17d0a2edd16bfd3b665c8473.tar.xz | |
Fixed a few iriver playback quirks and issues with previous fixes.
Also fixed "TST.." bug when seeking and possible an enhancement to mp3
gapless playback also.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8402 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/mpa.c')
| -rw-r--r-- | apps/codecs/mpa.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c index 3ee2b35..2c946f3 100644 --- a/apps/codecs/mpa.c +++ b/apps/codecs/mpa.c @@ -101,6 +101,12 @@ enum codec_status codec_start(struct codec_api *api) ci->configure(DSP_SET_CLIP_MAX, (int *)(MAD_F_ONE - 1)); ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*16)); + /** This label might need to be moved above all the init code, but I don't + * think reiniting the codec is necessary for MPEG. It might even be unwanted + * for gapless playback. + * Reinitializing seems to be necessary to avoid playback quircks when seeking. */ + next_track: + ci->memset(&stream, 0, sizeof(struct mad_stream)); ci->memset(&frame, 0, sizeof(struct mad_frame)); ci->memset(&synth, 0, sizeof(struct mad_synth)); @@ -114,10 +120,6 @@ enum codec_status codec_start(struct codec_api *api) frame.overlap = &mad_frame_overlap; stream.main_data = &mad_main_data; - /* This label might need to be moved above all the init code, but I don't - think reiniting the codec is necessary for MPEG. It might even be unwanted - for gapless playback */ -next_track: file_end = 0; while (!*ci->taginfo_ready && !ci->stop_codec) ci->sleep(1); @@ -156,14 +158,21 @@ next_track: samplesdone = ((int64_t) (ci->seek_time - 1)) * current_frequency / 1000; - newpos = ci->mp3_get_filepos(ci->seek_time-1) + - ci->id3->first_frame_offset; + + if (ci->seek_time-1 == 0) + newpos = 0; + else + newpos = ci->mp3_get_filepos(ci->seek_time-1) + + ci->id3->first_frame_offset; if (!ci->seek_buffer(newpos)) goto next_track; - if (newpos == 0) - samples_to_skip = start_skip; ci->seek_complete(); + if (newpos == 0) + { + ci->id3->elapsed = 0; + goto next_track; + } } /* Lock buffers */ |