From df37b444372a225f934fe2f3ea4dc40d7ffecdbc Mon Sep 17 00:00:00 2001 From: Buschel Date: Tue, 15 Feb 2011 20:26:04 +0000 Subject: [PATCH] 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 --- apps/metadata/mp4.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c index 1ef3701e3..981d639bb 100644 --- a/apps/metadata/mp4.c +++ b/apps/metadata/mp4.c @@ -73,9 +73,6 @@ #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. */ @@ -343,11 +340,6 @@ 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; } } @@ -640,7 +632,7 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, unsigned int i; /* Reset to false. */ - id3->needs_upsampling_correction = true; + id3->needs_upsampling_correction = false; lseek(fd, 4, SEEK_CUR); read_uint32be(fd, &entries); @@ -654,12 +646,12 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, read_uint32be(fd, &n); read_uint32be(fd, &l); - /* Some SBR files use upsampling. In this case the number + /* Some AAC file use HE profile. 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 (SBR_upsampling_used && l<=1024) + if (id3->codectype==AFMT_MP4_AAC_HE && l<=1024) { id3->samples += n * l * 2; id3->needs_upsampling_correction = true; @@ -774,7 +766,6 @@ 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; -- 2.11.4.GIT