From 5c2c991d148de6aafae4836f4e40edb453734d94 Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Tue, 5 Jul 2005 19:55:40 +0000 Subject: Applied patch "[ 1232957 ] MP3 metadata fixes for software codec". Thanks to Magnus Holmgren. Now metadata reading is better with improved performance for mp3 files. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7030 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/mpa.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'apps/codecs/mpa.c') diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c index df78b07247..5cf4eb8730 100644 --- a/apps/codecs/mpa.c +++ b/apps/codecs/mpa.c @@ -23,7 +23,6 @@ #include "playback.h" #include "dsp.h" -#include "mp3data.h" #include "lib/codeclib.h" struct mad_stream Stream IDATA_ATTR; @@ -61,7 +60,6 @@ extern char iramend[]; enum codec_status codec_start(struct codec_api* api) { struct codec_api *ci = api; - struct mp3info *info; int Status = 0; size_t size; int file_end; @@ -115,7 +113,6 @@ enum codec_status codec_start(struct codec_api* api) for gapless playback */ next_track: - info = ci->mp3data; first_frame = false; file_end = 0; OutputPtr = OutputBuffer; @@ -128,24 +125,24 @@ enum codec_status codec_start(struct codec_api* api) ci->request_buffer(&size, ci->id3->first_frame_offset); ci->advance_buffer(size); - - if (info->enc_delay >= 0 && info->enc_padding >= 0) { - stop_skip = info->enc_padding - mpeg_latency[info->layer]; + + if (ci->id3->lead_trim >= 0 && ci->id3->tail_trim >= 0) { + stop_skip = ci->id3->tail_trim - mpeg_latency[ci->id3->layer]; if (stop_skip < 0) stop_skip = 0; - start_skip = info->enc_delay + mpeg_latency[info->layer]; + start_skip = ci->id3->lead_trim + mpeg_latency[ci->id3->layer]; } else { stop_skip = 0; /* We want to skip this amount anyway */ - start_skip = mpeg_latency[info->layer]; + start_skip = mpeg_latency[ci->id3->layer]; } /* NOTE: currently this doesn't work, the below calculated samples_count seems to be right, but sometimes libmad just can't supply us with all the data we need... */ - if (info->frame_count) { + if (ci->id3->frame_count) { /* TODO: 1152 is the frame size in samples for MPEG1 layer 2 and layer 3, it's probably not correct at all for MPEG2 and layer 1 */ - samplecount = info->frame_count*1152 - (start_skip + stop_skip); + samplecount = ci->id3->frame_count*1152 - (start_skip + stop_skip); samplesdone = ci->id3->elapsed * frequency_divider / 10; } else { samplecount = ci->id3->length * frequency_divider / 10; -- cgit v1.2.3