# HG changeset patch # User chainsaw # Date 1142287112 28800 # Node ID f51680f2dab01be542c23dadc6886d8e120b5ab5 # Parent 4d60baab67a0970ae1433ca7d0166813adbf79ec [svn] Be smarter about spotting MP4 files, only fall back on extension for AAC. diff -r 4d60baab67a0 -r f51680f2dab0 Plugins/Input/aac/src/libmp4.c --- 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)