summaryrefslogtreecommitdiffstats
path: root/apps/metadata
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-02-15 20:10:50 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-02-15 20:10:50 +0000
commite3abdb1a52a2e9ae7469a6ce1b0e5900ac58d89b (patch)
tree24659c17ed31eac362056253392c960898540899 /apps/metadata
parent237ca504e12c06a5cfa7cd0fb9d9c672dc588f1c (diff)
downloadrockbox-e3abdb1a52a2e9ae7469a6ce1b0e5900ac58d89b.tar.gz
rockbox-e3abdb1a52a2e9ae7469a6ce1b0e5900ac58d89b.tar.bz2
rockbox-e3abdb1a52a2e9ae7469a6ce1b0e5900ac58d89b.zip
Undo unwanted commit r29310.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29311 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata')
-rw-r--r--apps/metadata/id3tags.c12
-rw-r--r--apps/metadata/metadata_common.c5
-rw-r--r--apps/metadata/mp4.c31
3 files changed, 22 insertions, 26 deletions
diff --git a/apps/metadata/id3tags.c b/apps/metadata/id3tags.c
index 9143f8ad25..9ee183a1b3 100644
--- a/apps/metadata/id3tags.c
+++ b/apps/metadata/id3tags.c
@@ -358,7 +358,8 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
if ((tag - entry->id3v2buf + desc_len + 2) < bufferpos) {
/* At least part of the value was read, so we can safely try to
- * parse it */
+ * parse it
+ */
value = tag + desc_len + 1;
value_len = bufferpos - (tag - entry->id3v2buf);
@@ -367,7 +368,8 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
entry->albumartist = tag;
#if CONFIG_CODEC == SWCODEC
} else {
- value_len = parse_replaygain(tag, value, entry, tag, value_len);
+ value_len = parse_replaygain(tag, value, entry, tag,
+ value_len);
#endif
}
}
@@ -1038,12 +1040,6 @@ void setid3v2title(int fd, struct mp3entry *entry)
#endif
if( tr->ppFunc )
bufferpos = tr->ppFunc(entry, tag, bufferpos);
-
- /* Trim. Take into account that multiple string contents will
- * only be displayed up to their first null termination. All
- * content after this null termination is obsolete and can be
- * overwritten. */
- bufferpos -= (bytesread - strlen(tag));
/* Seek to the next frame */
if(framelen < totframelen)
diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c
index 4f001775f3..e1ef9a0d62 100644
--- a/apps/metadata/metadata_common.c
+++ b/apps/metadata/metadata_common.c
@@ -337,10 +337,7 @@ long parse_tag(const char* name, char* value, struct mp3entry* id3,
p = NULL;
}
- /* Do not overwrite already available metadata. Especially when reading
- * tags with e.g. multiple genres / artists. This way only the first
- * of multiple entries is used, all following are dropped. */
- if (p!=NULL && *p==NULL)
+ if (p)
{
len = strlen(value);
len = MIN(len, buf_remaining - 1);
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c
index 26ab7cc30a..1ef3701e30 100644
--- a/apps/metadata/mp4.c
+++ b/apps/metadata/mp4.c
@@ -73,6 +73,9 @@
#define MP4_udta FOURCC('u', 'd', 't', 'a')
#define MP4_extra FOURCC('-', '-', '-', '-')
+/* Used to correct id3->samples, if SBR upsampling was detected in esds atom. */
+static bool SBR_upsampling_used = false;
+
/* Read the tag data from an MP4 file, storing up to buffer_size bytes in
* buffer.
*/
@@ -117,17 +120,11 @@ static unsigned int read_mp4_tag_string(int fd, int size_left, char** buffer,
if (bytes_read)
{
- /* Do not overwrite already available metadata. Especially when reading
- * tags with e.g. multiple genres / artists. This way only the first
- * of multiple entries is used, all following are dropped. */
- if (*dest == NULL)
- {
- (*buffer)[bytes_read] = 0;
- *dest = *buffer;
- length = strlen(*buffer) + 1;
- *buffer_left -= length;
- *buffer += length;
- }
+ (*buffer)[bytes_read] = 0;
+ *dest = *buffer;
+ length = strlen(*buffer) + 1;
+ *buffer_left -= length;
+ *buffer += length;
}
else
{
@@ -346,6 +343,11 @@ static bool read_mp4_esds(int fd, struct mp3entry* id3, uint32_t* size)
* decoding (parts of) the file.
*/
id3->frequency *= 2;
+
+ /* Set this to true to be able to calculate the correct runtime
+ * and bitrate. */
+ SBR_upsampling_used = true;
+
sbr = true;
}
}
@@ -638,7 +640,7 @@ static bool read_mp4_container(int fd, struct mp3entry* id3,
unsigned int i;
/* Reset to false. */
- id3->needs_upsampling_correction = false;
+ id3->needs_upsampling_correction = true;
lseek(fd, 4, SEEK_CUR);
read_uint32be(fd, &entries);
@@ -652,12 +654,12 @@ static bool read_mp4_container(int fd, struct mp3entry* id3,
read_uint32be(fd, &n);
read_uint32be(fd, &l);
- /* Some AAC file use HE profile. In this case the number
+ /* Some SBR files use upsampling. In this case the number
* of output samples is doubled to a maximum of 2048
* samples per frame. This means that files which already
* report a frame size of 2048 in their header will not
* need any further special handling. */
- if (id3->codectype==AFMT_MP4_AAC_HE && l<=1024)
+ if (SBR_upsampling_used && l<=1024)
{
id3->samples += n * l * 2;
id3->needs_upsampling_correction = true;
@@ -772,6 +774,7 @@ static bool read_mp4_container(int fd, struct mp3entry* id3,
bool get_mp4_metadata(int fd, struct mp3entry* id3)
{
+ SBR_upsampling_used = false;
id3->codectype = AFMT_UNKNOWN;
id3->filesize = 0;
errno = 0;