summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-07-05 19:55:40 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-07-05 19:55:40 +0000
commit5c2c991d148de6aafae4836f4e40edb453734d94 (patch)
tree8bc792d3422894aad42643ddf13a025dc2084104 /apps
parent1e5119b77bda5f67ad032a9587ead2d311b0767a (diff)
downloadrockbox-5c2c991d148de6aafae4836f4e40edb453734d94.zip
rockbox-5c2c991d148de6aafae4836f4e40edb453734d94.tar.gz
rockbox-5c2c991d148de6aafae4836f4e40edb453734d94.tar.bz2
rockbox-5c2c991d148de6aafae4836f4e40edb453734d94.tar.xz
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
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs.c1
-rw-r--r--apps/codecs.h1
-rw-r--r--apps/codecs/mpa.c17
-rw-r--r--apps/metadata.c5
-rw-r--r--apps/playback.c3
-rw-r--r--apps/playback.h3
6 files changed, 8 insertions, 22 deletions
diff --git a/apps/codecs.c b/apps/codecs.c
index 8b4f9b5..d3a9d9e 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -74,7 +74,6 @@ struct codec_api ci = {
0, /* filesize */
0, /* curpos */
NULL, /* id3 */
- NULL, /* mp3data */
NULL, /* taginfo_ready */
false, /* stop_codec */
false, /* reload_codec */
diff --git a/apps/codecs.h b/apps/codecs.h
index 5878ca9..ea59729 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -121,7 +121,6 @@ struct codec_api {
/* For gapless mp3 */
struct mp3entry *id3; /* TAG metadata pointer */
- struct mp3info *mp3data; /* MP3 metadata pointer */
bool *taginfo_ready; /* Is metadata read */
/* Codec should periodically check if stop_codec is set to true.
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index df78b07..5cf4eb8 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;
diff --git a/apps/metadata.c b/apps/metadata.c
index 6ba2331..0e770dd 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -23,7 +23,6 @@
#include "metadata.h"
#include "mp3_playback.h"
-#include "mp3data.h"
#include "logf.h"
#include "atoi.h"
@@ -113,10 +112,6 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname,
mp3info(&track->id3, trackname, v1first);
lseek(fd, 0, SEEK_SET);
- /* This is too slow to execute on some files. */
- get_mp3file_info(fd, &track->mp3data);
- lseek(fd, 0, SEEK_SET);
-
/*
logf("T:%s", track->id3.title);
logf("L:%d", track->id3.length);
diff --git a/apps/playback.c b/apps/playback.c
index 8186cf3..11ef7d7 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -39,7 +39,6 @@
#include "audio.h"
#include "logf.h"
#include "mp3_playback.h"
-#include "mp3data.h"
#include "usb.h"
#include "status.h"
#include "main_menu.h"
@@ -738,7 +737,6 @@ bool loadcodec(const char *trackname, bool start_play)
cur_ti = &tracks[track_widx];
ci.filesize = cur_ti->filesize;
ci.id3 = (struct mp3entry *)&cur_ti->id3;
- ci.mp3data = (struct mp3info *)&cur_ti->mp3data;
ci.taginfo_ready = (bool *)&cur_ti->taginfo_ready;
ci.curpos = 0;
playing = true;
@@ -1179,7 +1177,6 @@ void audio_update_trackinfo(void)
cur_ti->id3.elapsed = 0;
cur_ti->id3.offset = 0;
ci.id3 = (struct mp3entry *)&cur_ti->id3;
- ci.mp3data = (struct mp3info *)&cur_ti->mp3data;
ci.curpos = 0;
cur_ti->start_pos = 0;
ci.taginfo_ready = (bool *)&cur_ti->taginfo_ready;
diff --git a/apps/playback.h b/apps/playback.h
index 48d533f..cb006f9 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -44,10 +44,9 @@ enum {
/* Not yet implemented. */
#define CODEC_SET_AUDIOBUF_WATERMARK 4
-#define MAX_TRACK 10
+#define MAX_TRACK 32
struct track_info {
struct mp3entry id3; /* TAG metadata */
- struct mp3info mp3data; /* MP3 metadata */
char *codecbuf; /* Pointer to codec buffer */
long codecsize; /* Codec length in bytes */