diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-02-15 20:26:04 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-02-15 20:26:04 +0000 |
commit | 526bee6266cc9c74c591e3d517084aa83ea39873 (patch) | |
tree | 7cffbfd232c0838a13abbf64ccbdcc6203be5e0e | |
parent | e3abdb1a52a2e9ae7469a6ce1b0e5900ac58d89b (diff) | |
download | rockbox-526bee6266cc9c74c591e3d517084aa83ea39873.tar.gz rockbox-526bee6266cc9c74c591e3d517084aa83ea39873.zip |
2nd try: All AAC-HE files will double the frame sample count, not only AAC-HE files with SBR upsampling. This change fixes issues with some m4a files reported in the forums.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29312 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/metadata/mp4.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c index 1ef3701e30..981d639bbf 100644 --- a/apps/metadata/mp4.c +++ b/apps/metadata/mp4.c | |||
@@ -73,9 +73,6 @@ | |||
73 | #define MP4_udta FOURCC('u', 'd', 't', 'a') | 73 | #define MP4_udta FOURCC('u', 'd', 't', 'a') |
74 | #define MP4_extra FOURCC('-', '-', '-', '-') | 74 | #define MP4_extra FOURCC('-', '-', '-', '-') |
75 | 75 | ||
76 | /* Used to correct id3->samples, if SBR upsampling was detected in esds atom. */ | ||
77 | static bool SBR_upsampling_used = false; | ||
78 | |||
79 | /* Read the tag data from an MP4 file, storing up to buffer_size bytes in | 76 | /* Read the tag data from an MP4 file, storing up to buffer_size bytes in |
80 | * buffer. | 77 | * buffer. |
81 | */ | 78 | */ |
@@ -343,11 +340,6 @@ static bool read_mp4_esds(int fd, struct mp3entry* id3, uint32_t* size) | |||
343 | * decoding (parts of) the file. | 340 | * decoding (parts of) the file. |
344 | */ | 341 | */ |
345 | id3->frequency *= 2; | 342 | id3->frequency *= 2; |
346 | |||
347 | /* Set this to true to be able to calculate the correct runtime | ||
348 | * and bitrate. */ | ||
349 | SBR_upsampling_used = true; | ||
350 | |||
351 | sbr = true; | 343 | sbr = true; |
352 | } | 344 | } |
353 | } | 345 | } |
@@ -640,7 +632,7 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, | |||
640 | unsigned int i; | 632 | unsigned int i; |
641 | 633 | ||
642 | /* Reset to false. */ | 634 | /* Reset to false. */ |
643 | id3->needs_upsampling_correction = true; | 635 | id3->needs_upsampling_correction = false; |
644 | 636 | ||
645 | lseek(fd, 4, SEEK_CUR); | 637 | lseek(fd, 4, SEEK_CUR); |
646 | read_uint32be(fd, &entries); | 638 | read_uint32be(fd, &entries); |
@@ -654,12 +646,12 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, | |||
654 | read_uint32be(fd, &n); | 646 | read_uint32be(fd, &n); |
655 | read_uint32be(fd, &l); | 647 | read_uint32be(fd, &l); |
656 | 648 | ||
657 | /* Some SBR files use upsampling. In this case the number | 649 | /* Some AAC file use HE profile. In this case the number |
658 | * of output samples is doubled to a maximum of 2048 | 650 | * of output samples is doubled to a maximum of 2048 |
659 | * samples per frame. This means that files which already | 651 | * samples per frame. This means that files which already |
660 | * report a frame size of 2048 in their header will not | 652 | * report a frame size of 2048 in their header will not |
661 | * need any further special handling. */ | 653 | * need any further special handling. */ |
662 | if (SBR_upsampling_used && l<=1024) | 654 | if (id3->codectype==AFMT_MP4_AAC_HE && l<=1024) |
663 | { | 655 | { |
664 | id3->samples += n * l * 2; | 656 | id3->samples += n * l * 2; |
665 | id3->needs_upsampling_correction = true; | 657 | id3->needs_upsampling_correction = true; |
@@ -774,7 +766,6 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, | |||
774 | 766 | ||
775 | bool get_mp4_metadata(int fd, struct mp3entry* id3) | 767 | bool get_mp4_metadata(int fd, struct mp3entry* id3) |
776 | { | 768 | { |
777 | SBR_upsampling_used = false; | ||
778 | id3->codectype = AFMT_UNKNOWN; | 769 | id3->codectype = AFMT_UNKNOWN; |
779 | id3->filesize = 0; | 770 | id3->filesize = 0; |
780 | errno = 0; | 771 | errno = 0; |