summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-02-03 09:23:04 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-02-03 09:23:04 +0000
commit4e74494d57b2b9f74bfcca79edcabb534b7a8384 (patch)
treeae70eca49cd80d6b932e8c59fc14adb3188366d9
parent6b476e7bece2ba181264da7bb15d3a9b481db64d (diff)
downloadrockbox-4e74494d57b2b9f74bfcca79edcabb534b7a8384.zip
rockbox-4e74494d57b2b9f74bfcca79edcabb534b7a8384.tar.gz
rockbox-4e74494d57b2b9f74bfcca79edcabb534b7a8384.tar.bz2
rockbox-4e74494d57b2b9f74bfcca79edcabb534b7a8384.tar.xz
Changes in m4a parser: The metadata (e.g. sampling rate) for alac and aac must read from their dedicated metadata atom. Otherwise there might be wrong settings used. This patch also adds (commented) code which enables parsing for an alac metadata atom if neccessary. I have several sample files which require such parsing to find the metadata atom. Fixes FS#11719.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29201 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/metadata/mp4.c72
1 files changed, 39 insertions, 33 deletions
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c
index 9ae174a..1ef3701 100644
--- a/apps/metadata/mp4.c
+++ b/apps/metadata/mp4.c
@@ -675,48 +675,54 @@ static bool read_mp4_container(int fd, struct mp3entry* id3,
break;
case MP4_mp4a:
+ {
+ uint32_t subsize;
+ uint32_t subtype;
+
+ /* Move to the next expected mp4 atom. */
+ lseek(fd, 28, SEEK_CUR);
+ read_mp4_atom(fd, &subsize, &subtype, size);
+ size -= 36;
+
+ if (subtype == MP4_esds)
+ {
+ /* Read esds metadata and return if AAC-HE/SBR is used. */
+ if (read_mp4_esds(fd, id3, &size))
+ id3->codectype = AFMT_MP4_AAC_HE;
+ else
+ id3->codectype = AFMT_MP4_AAC;
+ }
+ }
+ break;
+
case MP4_alac:
{
uint32_t frequency;
-
- lseek(fd, 22, SEEK_CUR);
- read_uint32be(fd, &frequency);
- size -= 26;
- id3->frequency = frequency;
-
- if (type == MP4_mp4a)
+ uint32_t subsize;
+ uint32_t subtype;
+
+ /* Move to the next expected mp4 atom. */
+ lseek(fd, 28, SEEK_CUR);
+ read_mp4_atom(fd, &subsize, &subtype, size);
+ size -= 36;
+#if 0
+ /* We might need to parse for the alac metadata atom. */
+ while (!((subsize==28) && (subtype==MP4_alac)) && (size>0))
{
- uint32_t subsize;
- uint32_t subtype;
- bool sbr_used;
-
- /* Get frequency from the decoder info tag, if possible. */
- lseek(fd, 2, SEEK_CUR);
- /* The esds atom is a part of the mp4a atom, so ignore
- * the returned size (it's already accounted for).
- */
+ lseek(fd, -7, SEEK_CUR);
read_mp4_atom(fd, &subsize, &subtype, size);
- size -= 10;
-
- id3->codectype = AFMT_MP4_AAC;
- if (subtype == MP4_esds)
- {
- sbr_used = read_mp4_esds(fd, id3, &size);
- if (sbr_used)
- {
- id3->codectype = AFMT_MP4_AAC_HE;
- if (SBR_upsampling_used)
- DEBUGF("MP4: AAC-HE, SBR upsampling\n");
- else
- DEBUGF("MP4: AAC-HE, SBR\n");
- }
- }
+ size -= 1;
+ errno = 0; /* will most likely be set while parsing */
}
- else
+#endif
+ if (subtype == MP4_alac)
{
+ lseek(fd, 24, SEEK_CUR);
+ read_uint32be(fd, &frequency);
+ size -= 28;
+ id3->frequency = frequency;
id3->codectype = AFMT_MP4_ALAC;
}
-
}
break;