diff options
| author | Miika Pekkarinen <miipekk@ihme.org> | 2006-01-22 10:25:07 +0000 |
|---|---|---|
| committer | Miika Pekkarinen <miipekk@ihme.org> | 2006-01-22 10:25:07 +0000 |
| commit | 6d6ca6b6a5641a0ab3657e60a1770a440cc52493 (patch) | |
| tree | ad769586634236732aff30337e6b6465f1dad0c0 /apps/codecs/mpa.c | |
| parent | 998610ca0bb8d12376936308631a8bed2f5e1281 (diff) | |
| download | rockbox-6d6ca6b6a5641a0ab3657e60a1770a440cc52493.zip rockbox-6d6ca6b6a5641a0ab3657e60a1770a440cc52493.tar.gz rockbox-6d6ca6b6a5641a0ab3657e60a1770a440cc52493.tar.bz2 rockbox-6d6ca6b6a5641a0ab3657e60a1770a440cc52493.tar.xz | |
Muting trick to prevent tiny pops and glitchless mp3 seeking.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8416 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/mpa.c')
| -rw-r--r-- | apps/codecs/mpa.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c index 2c946f3..1be6222 100644 --- a/apps/codecs/mpa.c +++ b/apps/codecs/mpa.c @@ -72,6 +72,22 @@ void recalc_samplecount(void) samplecount -= start_skip + stop_skip; } +void init_mad(void) +{ + ci->memset(&stream, 0, sizeof(struct mad_stream)); + ci->memset(&frame, 0, sizeof(struct mad_frame)); + ci->memset(&synth, 0, sizeof(struct mad_synth)); + + mad_stream_init(&stream); + mad_frame_init(&frame); + mad_synth_init(&synth); + + /* We do this so libmad doesn't try to call codec_calloc() */ + ci->memset(mad_frame_overlap, 0, sizeof(mad_frame_overlap)); + frame.overlap = &mad_frame_overlap; + stream.main_data = &mad_main_data; +} + /* this is the codec entry point */ enum codec_status codec_start(struct codec_api *api) { @@ -107,18 +123,7 @@ enum codec_status codec_start(struct codec_api *api) * 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)); - - mad_stream_init(&stream); - mad_frame_init(&frame); - mad_synth_init(&synth); - - /* We do this so libmad doesn't try to call codec_calloc() */ - ci->memset(mad_frame_overlap, 0, sizeof(mad_frame_overlap)); - frame.overlap = &mad_frame_overlap; - stream.main_data = &mad_main_data; + init_mad(); file_end = 0; while (!*ci->taginfo_ready && !ci->stop_codec) @@ -168,11 +173,7 @@ enum codec_status codec_start(struct codec_api *api) if (!ci->seek_buffer(newpos)) goto next_track; ci->seek_complete(); - if (newpos == 0) - { - ci->id3->elapsed = 0; - goto next_track; - } + init_mad(); } /* Lock buffers */ |