Mercurial > audlegacy-plugins
changeset 262:f653f1219db2 trunk
[svn] So input.c wants to have the old-style function available...
author | chainsaw |
---|---|
date | Sat, 18 Nov 2006 16:29:50 -0800 |
parents | 9ce03bf021ae |
children | 7e1d5cc9ef1b |
files | ChangeLog src/aac/src/libmp4.c |
diffstat | 2 files changed, 42 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Nov 18 16:26:08 2006 -0800 +++ b/ChangeLog Sat Nov 18 16:29:50 2006 -0800 @@ -1,3 +1,10 @@ +2006-11-19 00:26:08 +0000 Tony Vroon <chainsaw@gentoo.org> + revision [546] + So input.c wants to have the old-style function available... + trunk/src/alac/plugin.c | 34 +++++++++++++++++++++++++++++++++- + 1 file changed, 33 insertions(+), 1 deletion(-) + + 2006-11-19 00:21:15 +0000 Tony Vroon <chainsaw@gentoo.org> revision [544] So input.c wants to have the old-style function available...
--- a/src/aac/src/libmp4.c Sat Nov 18 16:26:08 2006 -0800 +++ b/src/aac/src/libmp4.c Sat Nov 18 16:29:50 2006 -0800 @@ -36,6 +36,7 @@ static int mp4_getTime(void); static void mp4_cleanup(void); static int mp4_IsOurFD(char *, VFSFile *); +static int mp4_IsOurFile(char *); static void mp4_getSongTitle(char *filename, char **, int *); static void* mp4Decode(void *); static TitleInput *mp4_get_song_tuple(char *); @@ -51,7 +52,7 @@ mp4_init, mp4_about, 0, // configuration - 0, + mp4_IsOurFile, 0, //scandir mp4_play, mp4_stop, @@ -152,6 +153,39 @@ } } +static int mp4_IsOurFile(char *filename) +{ + VFSFile *file; + gchar* extension; + gchar magic[8]; + + extension = strrchr(filename, '.'); + if ((file = vfs_fopen(filename, "rb"))) { + vfs_fread(magic, 1, 8, file); + if (!memcmp(magic, AAC_MAGIC, 4)) { + vfs_fclose(file); + return 1; + } + if (!memcmp(magic, "ID3", 3)) { // ID3 tag bolted to the front, obfuscated magic bytes + vfs_fclose(file); + 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; + } + if (!memcmp(&magic[4], "ftyp", 4)) { + vfs_fclose(file); + return 1; + } + vfs_fclose(file); + } + return 0; +} + static int mp4_IsOurFD(char *filename, VFSFile* file) { gchar* extension;