diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2007-04-26 17:59:24 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2007-04-26 17:59:24 +0000 |
commit | 832bbf72a8c9822e00e74d29eee293ef2eff67c1 (patch) | |
tree | 9a533eadd5fc7900883fd4c89fd148c583e2aebb /apps/metadata.c | |
parent | 386d838b8798766f2171b3d3d555033749a71afa (diff) | |
download | rockbox-832bbf72a8c9822e00e74d29eee293ef2eff67c1.tar.gz rockbox-832bbf72a8c9822e00e74d29eee293ef2eff67c1.zip |
AAC: More adjustments to how the frequency is read. Still not perfect, but this is probably as good as it can get.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13274 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata.c')
-rw-r--r-- | apps/metadata.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/metadata.c b/apps/metadata.c index b544a0c410..70e7c0542e 100644 --- a/apps/metadata.c +++ b/apps/metadata.c | |||
@@ -1306,10 +1306,10 @@ static bool read_mp4_esds(int fd, struct mp3entry* id3, | |||
1306 | id3->frequency *= 2; | 1306 | id3->frequency *= 2; |
1307 | } | 1307 | } |
1308 | } | 1308 | } |
1309 | /* TODO: Should check that there is at least 16 bits left */ | ||
1310 | /* Skip 13 bits from above, plus 3 bits, then read 11 bits */ | 1309 | /* Skip 13 bits from above, plus 3 bits, then read 11 bits */ |
1311 | else if (((bits >> 5) & 0x7ff) == 0x2b7) /* extensionAudioObjectType */ | 1310 | else if ((length >= 4) && (((bits >> 5) & 0x7ff) == 0x2b7)) |
1312 | { | 1311 | { |
1312 | /* extensionAudioObjectType */ | ||
1313 | DEBUGF("MP4: extensionAudioType\n"); | 1313 | DEBUGF("MP4: extensionAudioType\n"); |
1314 | type = bits & 0x1f; /* Object type - 5 bits*/ | 1314 | type = bits & 0x1f; /* Object type - 5 bits*/ |
1315 | bits = get_long_be(&buf[4]); | 1315 | bits = get_long_be(&buf[4]); |
@@ -1343,6 +1343,17 @@ static bool read_mp4_esds(int fd, struct mp3entry* id3, | |||
1343 | } | 1343 | } |
1344 | } | 1344 | } |
1345 | } | 1345 | } |
1346 | |||
1347 | if (!sbr && (id3->frequency <= 24000) && (length <= 2)) | ||
1348 | { | ||
1349 | /* Double the frequency for low-frequency files without a "long" | ||
1350 | * DecSpecificConfig header. The file may or may not contain SBR, | ||
1351 | * but here we guess it does if the header is short. This can | ||
1352 | * fail on some files, but it's the best we can do, short of | ||
1353 | * decoding (parts of) the file. | ||
1354 | */ | ||
1355 | id3->frequency *= 2; | ||
1356 | } | ||
1346 | } | 1357 | } |
1347 | 1358 | ||
1348 | return sbr; | 1359 | return sbr; |