Mercurial > audlegacy
changeset 831:f51680f2dab0 trunk
[svn] Be smarter about spotting MP4 files, only fall back on extension for AAC.
author | chainsaw |
---|---|
date | Mon, 13 Mar 2006 13:58:32 -0800 |
parents | 4d60baab67a0 |
children | d2db0feae0ca |
files | Plugins/Input/aac/src/libmp4.c |
diffstat | 1 files changed, 23 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Input/aac/src/libmp4.c Mon Mar 13 11:07:18 2006 -0800 +++ b/Plugins/Input/aac/src/libmp4.c Mon Mar 13 13:58:32 2006 -0800 @@ -183,19 +183,32 @@ static int mp4_isFile(char *filename) { - if(filename){ - gchar* extention; + MP4FileHandle mp4file2; + gint mp4track; + + if(!filename) + return 0; - extention = strrchr(filename, '.'); - if (extention &&( - !strcasecmp(extention, ".mp4") || // official extention - !strcasecmp(extention, ".m4a") || // Apple mp4 extention - !strcasecmp(extention, ".aac") // old MPEG2/4-AAC extention - )){ - return (1); + if((mp4file2 = MP4Read(filename, 0))){ + if((mp4track = getAACTrack(mp4file2)) >= 0){ + MP4Close(mp4file2); // This is a valid MP4 file, good to go + return 1; + } else { + MP4Close(mp4file2); // Corrupted MP4 file, will not try to play + return 0; } + } else { // Not MP4, could be AAC, check extension + gchar* extension; + extension = strrchr(filename, '.'); + if (extension &&( + !strcasecmp(extension, ".mp4") || // official extension + !strcasecmp(extension, ".m4a") || // Apple mp4 extension + !strcasecmp(extension, ".aac") // old MPEG2/4-AAC extension + )) + return 1; + else + return 0; } - return(0); } static void mp4_about(void)