Mercurial > audlegacy-plugins
changeset 258:1987fda01d2a trunk
[svn] So input.c wants to have the old-style function available...
author | chainsaw |
---|---|
date | Sat, 18 Nov 2006 16:09:09 -0800 |
parents | e0dc4cc45d26 |
children | 56750b17f279 |
files | ChangeLog src/timidity/src/xmms-timidity.c src/timidity/src/xmms-timidity.h |
diffstat | 3 files changed, 61 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Nov 18 11:46:50 2006 -0800 +++ b/ChangeLog Sat Nov 18 16:09:09 2006 -0800 @@ -1,3 +1,11 @@ +2006-11-18 19:46:50 +0000 William Pitcock <nenolod@nenolod.net> + revision [538] + - NewVFS probe support + + trunk/src/mpg123/mpg123.c | 48 ++++++++++++++++++++++++++++++---------------- + 1 file changed, 32 insertions(+), 16 deletions(-) + + 2006-11-18 19:46:19 +0000 Tony Vroon <chainsaw@gentoo.org> revision [536] Port to NewVFS probe function.
--- a/src/timidity/src/xmms-timidity.c Sat Nov 18 11:46:50 2006 -0800 +++ b/src/timidity/src/xmms-timidity.c Sat Nov 18 16:09:09 2006 -0800 @@ -60,7 +60,11 @@ NULL, xmmstimid_get_song_info, NULL, - NULL + NULL, + NULL, + NULL, + NULL, + xmmstimid_is_our_fd, }; static struct { @@ -240,36 +244,57 @@ static gint xmmstimid_is_our_file( gchar * filename ) { - VFSFile * fp; - gchar magic_bytes[4]; + VFSFile * fp; + gchar magic_bytes[4]; - fp = vfs_fopen( filename , "rb" ); + fp = vfs_fopen( filename , "rb" ); + + if (fp == NULL) + return FALSE; - if (fp == NULL) - return FALSE; + vfs_fread( magic_bytes , 1 , 4 , fp ); - vfs_fread( magic_bytes , 1 , 4 , fp ); + if ( !memcmp( magic_bytes , "MThd" , 4 ) ) + { + vfs_fclose( fp ); + return TRUE; + } - if ( !strncmp( magic_bytes , "MThd" , 4 ) ) - { - vfs_fclose( fp ); - return TRUE; - } + if ( !memcmp( magic_bytes , "RIFF" , 4 ) ) + { + /* skip the four bytes after RIFF, + then read the next four */ + vfs_fseek( fp , 4 , SEEK_CUR ); + vfs_fread( magic_bytes , 1 , 4 , fp ); + if ( !memcmp( magic_bytes , "RMID" , 4 ) ) + { + vfs_fclose( fp ); + return TRUE; + } + } + vfs_fclose( fp ); + return FALSE; +} - if ( !strncmp( magic_bytes , "RIFF" , 4 ) ) - { - /* skip the four bytes after RIFF, - then read the next four */ - vfs_fseek( fp , 4 , SEEK_CUR ); - vfs_fread( magic_bytes , 1 , 4 , fp ); - if ( !strncmp( magic_bytes , "RMID" , 4 ) ) - { - vfs_fclose( fp ); - return TRUE; - } - } - vfs_fclose( fp ); - return FALSE; +static gint xmmstimid_is_our_fd( gchar * filename, VFSFile * fp ) +{ + gchar magic_bytes[4]; + + vfs_fread( magic_bytes , 1 , 4 , fp ); + + if ( !memcmp( magic_bytes , "MThd" , 4 ) ) + return TRUE; + + if ( !memcmp( magic_bytes , "RIFF" , 4 ) ) + { + /* skip the four bytes after RIFF, + then read the next four */ + vfs_fseek( fp , 4 , SEEK_CUR ); + vfs_fread( magic_bytes , 1 , 4 , fp ); + if ( !memcmp( magic_bytes , "RMID" , 4 ) ) + return TRUE; + } + return FALSE; } static void *xmmstimid_play_loop(void *arg) {
--- a/src/timidity/src/xmms-timidity.h Sat Nov 18 11:46:50 2006 -0800 +++ b/src/timidity/src/xmms-timidity.h Sat Nov 18 16:09:09 2006 -0800 @@ -21,12 +21,14 @@ #define XMMS_TIMIDITY_H #include <audacious/plugin.h> +#include <audacious/vfs.h> extern InputPlugin xmmstimid_ip; static void xmmstimid_init(void); static void xmmstimid_about(void); static void xmmstimid_configure(void); +static int xmmstimid_is_our_fd(char *filename, VFSFile *fp); static int xmmstimid_is_our_file(char *filename); static void xmmstimid_play_file(char *filename); static void xmmstimid_stop(void);