diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-02-03 09:23:04 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-02-03 09:23:04 +0000 |
commit | 4e74494d57b2b9f74bfcca79edcabb534b7a8384 (patch) | |
tree | ae70eca49cd80d6b932e8c59fc14adb3188366d9 /apps | |
parent | 6b476e7bece2ba181264da7bb15d3a9b481db64d (diff) | |
download | rockbox-4e74494d57b2b9f74bfcca79edcabb534b7a8384.tar.gz rockbox-4e74494d57b2b9f74bfcca79edcabb534b7a8384.zip |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/metadata/mp4.c | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c index 9ae174af7e..1ef3701e30 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, | |||
675 | break; | 675 | break; |
676 | 676 | ||
677 | case MP4_mp4a: | 677 | case MP4_mp4a: |
678 | { | ||
679 | uint32_t subsize; | ||
680 | uint32_t subtype; | ||
681 | |||
682 | /* Move to the next expected mp4 atom. */ | ||
683 | lseek(fd, 28, SEEK_CUR); | ||
684 | read_mp4_atom(fd, &subsize, &subtype, size); | ||
685 | size -= 36; | ||
686 | |||
687 | if (subtype == MP4_esds) | ||
688 | { | ||
689 | /* Read esds metadata and return if AAC-HE/SBR is used. */ | ||
690 | if (read_mp4_esds(fd, id3, &size)) | ||
691 | id3->codectype = AFMT_MP4_AAC_HE; | ||
692 | else | ||
693 | id3->codectype = AFMT_MP4_AAC; | ||
694 | } | ||
695 | } | ||
696 | break; | ||
697 | |||
678 | case MP4_alac: | 698 | case MP4_alac: |
679 | { | 699 | { |
680 | uint32_t frequency; | 700 | uint32_t frequency; |
681 | 701 | uint32_t subsize; | |
682 | lseek(fd, 22, SEEK_CUR); | 702 | uint32_t subtype; |
683 | read_uint32be(fd, &frequency); | 703 | |
684 | size -= 26; | 704 | /* Move to the next expected mp4 atom. */ |
685 | id3->frequency = frequency; | 705 | lseek(fd, 28, SEEK_CUR); |
686 | 706 | read_mp4_atom(fd, &subsize, &subtype, size); | |
687 | if (type == MP4_mp4a) | 707 | size -= 36; |
708 | #if 0 | ||
709 | /* We might need to parse for the alac metadata atom. */ | ||
710 | while (!((subsize==28) && (subtype==MP4_alac)) && (size>0)) | ||
688 | { | 711 | { |
689 | uint32_t subsize; | 712 | lseek(fd, -7, SEEK_CUR); |
690 | uint32_t subtype; | ||
691 | bool sbr_used; | ||
692 | |||
693 | /* Get frequency from the decoder info tag, if possible. */ | ||
694 | lseek(fd, 2, SEEK_CUR); | ||
695 | /* The esds atom is a part of the mp4a atom, so ignore | ||
696 | * the returned size (it's already accounted for). | ||
697 | */ | ||
698 | read_mp4_atom(fd, &subsize, &subtype, size); | 713 | read_mp4_atom(fd, &subsize, &subtype, size); |
699 | size -= 10; | 714 | size -= 1; |
700 | 715 | errno = 0; /* will most likely be set while parsing */ | |
701 | id3->codectype = AFMT_MP4_AAC; | ||
702 | if (subtype == MP4_esds) | ||
703 | { | ||
704 | sbr_used = read_mp4_esds(fd, id3, &size); | ||
705 | if (sbr_used) | ||
706 | { | ||
707 | id3->codectype = AFMT_MP4_AAC_HE; | ||
708 | if (SBR_upsampling_used) | ||
709 | DEBUGF("MP4: AAC-HE, SBR upsampling\n"); | ||
710 | else | ||
711 | DEBUGF("MP4: AAC-HE, SBR\n"); | ||
712 | } | ||
713 | } | ||
714 | } | 716 | } |
715 | else | 717 | #endif |
718 | if (subtype == MP4_alac) | ||
716 | { | 719 | { |
720 | lseek(fd, 24, SEEK_CUR); | ||
721 | read_uint32be(fd, &frequency); | ||
722 | size -= 28; | ||
723 | id3->frequency = frequency; | ||
717 | id3->codectype = AFMT_MP4_ALAC; | 724 | id3->codectype = AFMT_MP4_ALAC; |
718 | } | 725 | } |
719 | |||
720 | } | 726 | } |
721 | break; | 727 | break; |
722 | 728 | ||