summaryrefslogtreecommitdiffstats
path: root/apps/metadata
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-02-24 19:10:59 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-02-24 19:10:59 +0000
commit71ceac0b740398050af4f21b56acd5b31e2520f0 (patch)
treeda550f14a3c81f62aceae698c8b459287d201a01 /apps/metadata
parent65109732230849eeb9eec2f56f9e046ad6b476c3 (diff)
downloadrockbox-71ceac0b740398050af4f21b56acd5b31e2520f0.tar.gz
rockbox-71ceac0b740398050af4f21b56acd5b31e2520f0.tar.bz2
rockbox-71ceac0b740398050af4f21b56acd5b31e2520f0.zip
FS#11964. Rework replaygain handling to save metadata buffer and binsize. Remove string representation of replaygain and use a dedicated ftoa implementation for WPS/screen info.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29388 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata')
-rw-r--r--apps/metadata/asf.c12
-rw-r--r--apps/metadata/id3tags.c18
-rw-r--r--apps/metadata/metadata_common.c2
-rw-r--r--apps/metadata/mp4.c8
-rw-r--r--apps/metadata/mpc.c6
5 files changed, 10 insertions, 36 deletions
diff --git a/apps/metadata/asf.c b/apps/metadata/asf.c
index c445e485a2..56d5c87f9d 100644
--- a/apps/metadata/asf.c
+++ b/apps/metadata/asf.c
@@ -456,18 +456,8 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
lseek(fd, length, SEEK_CUR);
}
} else if (!strncmp("replaygain_", utf8buf, 11)) {
- char* value = id3buf;
- int buf_len = id3buf_remaining;
- int len;
asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining);
- len = parse_replaygain(utf8buf, value, id3,
- value, buf_len);
-
- if (len == 0) {
- /* Don't need to keep the value */
- id3buf = value;
- id3buf_remaining = buf_len;
- }
+ parse_replaygain(utf8buf, id3buf, id3);
} else if (!strcmp("MusicBrainz/Track Id", utf8buf)) {
id3->mb_track_id = id3buf;
asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining);
diff --git a/apps/metadata/id3tags.c b/apps/metadata/id3tags.c
index 3cbebc12e3..c1d9cb2020 100644
--- a/apps/metadata/id3tags.c
+++ b/apps/metadata/id3tags.c
@@ -370,14 +370,8 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
entry->albumartist = tag;
#if CONFIG_CODEC == SWCODEC
} else {
- /* Calculate residual buffer size in bytes which can be used by
- * parse_replaygain() to save the string representation of
- * replaygain data.*/
- length = sizeof(entry->id3v2buf) - (tag - entry->id3v2buf);
-
- /* Call parse_replaygain(), returns length in bytes used by the
- * string representation of replaygain data. */
- length = parse_replaygain(tag, value, entry, tag, length);
+ /* Call parse_replaygain(). */
+ parse_replaygain(tag, value, entry);
#endif
}
}
@@ -387,12 +381,11 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
#if CONFIG_CODEC == SWCODEC
/* parse RVA2 binary data and convert to replaygain information. */
-static int parserva2( struct mp3entry* entry, char* tag, int bufferpos )
+static int parserva2( struct mp3entry* entry, char* tag, int bufferpos)
{
int desc_len = strlen(tag);
int start_pos = tag - entry->id3v2buf;
int end_pos = start_pos + desc_len + 5;
- int value_len = 0;
unsigned char* value = tag + desc_len + 1;
/* Only parse RVA2 replaygain tags if tag version == 2.4 and channel
@@ -447,11 +440,10 @@ static int parserva2( struct mp3entry* entry, char* tag, int bufferpos )
}
}
- value_len = parse_replaygain_int(album, gain, peak * 2, entry,
- tag, sizeof(entry->id3v2buf) - start_pos);
+ parse_replaygain_int(album, gain, peak * 2, entry);
}
- return start_pos + value_len;
+ return start_pos;
}
#endif
diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c
index 341d279b5d..ae6b245616 100644
--- a/apps/metadata/metadata_common.c
+++ b/apps/metadata/metadata_common.c
@@ -333,7 +333,7 @@ long parse_tag(const char* name, char* value, struct mp3entry* id3,
}
else
{
- len = parse_replaygain(name, value, id3, buf, buf_remaining);
+ parse_replaygain(name, value, id3);
p = NULL;
}
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c
index 6130135bae..a431231e12 100644
--- a/apps/metadata/mp4.c
+++ b/apps/metadata/mp4.c
@@ -528,13 +528,7 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3,
buffer -= length;
buffer_left += length;
- if (parse_replaygain(tag_name, buffer, id3,
- buffer, buffer_left) > 0)
- {
- /* Data used, keep it. */
- buffer += length;
- buffer_left -= length;
- }
+ parse_replaygain(tag_name, buffer, id3);
}
}
}
diff --git a/apps/metadata/mpc.c b/apps/metadata/mpc.c
index 0387dc9f77..0b75ed04dd 100644
--- a/apps/metadata/mpc.c
+++ b/apps/metadata/mpc.c
@@ -46,8 +46,7 @@ static int set_replaygain_sv7(struct mp3entry* id3,
/* We use a peak value of 0 to indicate a given gain type isn't used. */
if (peak != 0) {
/* Save the ReplayGain data to id3-structure for further processing. */
- used += parse_replaygain_int(album, gain * 512 / 100, peak << 9,
- id3, id3->toc + used, sizeof(id3->toc) - used);
+ parse_replaygain_int(album, gain * 512 / 100, peak << 9, id3);
}
return used;
@@ -73,8 +72,7 @@ static int set_replaygain_sv8(struct mp3entry* id3,
/* We use a peak value of 0 to indicate a given gain type isn't used. */
if (peak != 0) {
/* Save the ReplayGain data to id3-structure for further processing. */
- used += parse_replaygain_int(album, gain * 512 / 100, peak,
- id3, id3->toc + used, sizeof(id3->toc) - used);
+ parse_replaygain_int(album, gain * 512 / 100, peak, id3);
}
return used;