Mercurial > audlegacy
comparison Plugins/Input/aac/src/libmp4.c @ 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 | 3c4bcd9b8719 |
children | d2db0feae0ca |
comparison
equal
deleted
inserted
replaced
830:4d60baab67a0 | 831:f51680f2dab0 |
---|---|
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 static int mp4_isFile(char *filename) | 184 static int mp4_isFile(char *filename) |
185 { | 185 { |
186 if(filename){ | 186 MP4FileHandle mp4file2; |
187 gchar* extention; | 187 gint mp4track; |
188 | 188 |
189 extention = strrchr(filename, '.'); | 189 if(!filename) |
190 if (extention &&( | 190 return 0; |
191 !strcasecmp(extention, ".mp4") || // official extention | 191 |
192 !strcasecmp(extention, ".m4a") || // Apple mp4 extention | 192 if((mp4file2 = MP4Read(filename, 0))){ |
193 !strcasecmp(extention, ".aac") // old MPEG2/4-AAC extention | 193 if((mp4track = getAACTrack(mp4file2)) >= 0){ |
194 )){ | 194 MP4Close(mp4file2); // This is a valid MP4 file, good to go |
195 return (1); | 195 return 1; |
196 } | 196 } else { |
197 MP4Close(mp4file2); // Corrupted MP4 file, will not try to play | |
198 return 0; | |
199 } | |
200 } else { // Not MP4, could be AAC, check extension | |
201 gchar* extension; | |
202 extension = strrchr(filename, '.'); | |
203 if (extension &&( | |
204 !strcasecmp(extension, ".mp4") || // official extension | |
205 !strcasecmp(extension, ".m4a") || // Apple mp4 extension | |
206 !strcasecmp(extension, ".aac") // old MPEG2/4-AAC extension | |
207 )) | |
208 return 1; | |
209 else | |
210 return 0; | |
197 } | 211 } |
198 return(0); | |
199 } | 212 } |
200 | 213 |
201 static void mp4_about(void) | 214 static void mp4_about(void) |
202 { | 215 { |
203 static GtkWidget *aboutbox; | 216 static GtkWidget *aboutbox; |