summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-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 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