# HG changeset patch # User chainsaw # Date 1163877657 28800 # Node ID 902605dec467b97a1dea73b88c42172adc1a9117 # Parent cdf9756d1528f2e54190c7bcd9eb3e571823cb47 [svn] Port to NewVFS probe function. diff -r cdf9756d1528 -r 902605dec467 ChangeLog --- a/ChangeLog Sat Nov 18 11:00:22 2006 -0800 +++ b/ChangeLog Sat Nov 18 11:20:57 2006 -0800 @@ -1,3 +1,11 @@ +2006-11-18 19:00:22 +0000 Tony Vroon + revision [532] + Port to NewVFS file probe. + trunk/src/musepack/libmpc.cxx | 25 +++++++++++-------------- + trunk/src/musepack/libmpc.h | 2 +- + 2 files changed, 12 insertions(+), 15 deletions(-) + + 2006-11-18 18:02:24 +0000 Tony Vroon revision [524] Port to NewVFS file probe & add explicit cast to silence warning, thanks to spb. diff -r cdf9756d1528 -r 902605dec467 src/aac/src/libmp4.c --- a/src/aac/src/libmp4.c Sat Nov 18 11:00:22 2006 -0800 +++ b/src/aac/src/libmp4.c Sat Nov 18 11:20:57 2006 -0800 @@ -35,7 +35,7 @@ static void mp4_seek(int); static int mp4_getTime(void); static void mp4_cleanup(void); -static int mp4_IsOurFile(char *); +static int mp4_IsOurFD(char *, VFSFile *); static void mp4_getSongTitle(char *filename, char **, int *); static void* mp4Decode(void *); static TitleInput *mp4_get_song_tuple(char *); @@ -51,7 +51,7 @@ mp4_init, mp4_about, 0, // configuration - mp4_IsOurFile, + 0, 0, //scandir mp4_play, mp4_stop, @@ -70,6 +70,9 @@ 0, // info box 0, // to output plugin mp4_get_song_tuple, + 0, + 0, + mp4_IsOurFD, }; typedef struct _mp4cfg{ @@ -149,35 +152,26 @@ } } -static int mp4_IsOurFile(char *filename) +static int mp4_IsOurFD(char *filename, VFSFile* file) { - 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); + vfs_fread(magic, 1, 8, file); + if (!memcmp(magic, AAC_MAGIC, 4)) + return 1; + if (!memcmp(&magic[4], "ftyp", 4)) + return 1; + if (!memcmp(magic, "ID3", 3)) { // ID3 tag bolted to the front, obfuscated magic bytes + 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; }