From fd6aa253594e18877ca2380961c0425a7de21b2e Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Mon, 31 May 2004 01:21:17 +0000 Subject: mp3 and ogg plugin stuff git-svn-id: https://svn.musicpd.org/mpd/trunk@1245 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/song.c | 74 +++++++++----------------------------------------------------- 1 file changed, 10 insertions(+), 64 deletions(-) (limited to 'src/song.c') diff --git a/src/song.c b/src/song.c index 5991a2612..9d2a09e54 100644 --- a/src/song.c +++ b/src/song.c @@ -23,13 +23,10 @@ #include "utils.h" #include "tag.h" #include "log.h" -#include "mp3_decode.h" -#include "audiofile_decode.h" -#include "ogg_decode.h" -#include "flac_decode.h" #include "path.h" #include "playlist.h" #include "tables.h" +#include "inputPlugin.h" #define SONG_KEY "key: " #define SONG_FILE "file: " @@ -60,36 +57,10 @@ Song * newSong(char * utf8url, SONG_TYPE type) { song->type = type; if(song->type == SONG_TYPE_FILE) { - if(!isFile(utf8url,&(song->mtime))); -#ifdef HAVE_OGG - else if(hasOggSuffix(utf8url)) { - song->tag = oggTagDup(utf8url); - } -#endif -#ifdef HAVE_FLAC - else if((hasFlacSuffix(utf8url))) { - song->tag = flacTagDup(utf8url); - } -#endif -#ifdef HAVE_MAD - else if(hasMp3Suffix(utf8url)) { - song->tag = mp3TagDup(utf8url); - } -#endif -#ifdef HAVE_AUDIOFILE - else if(hasWaveSuffix(utf8url)) { - song->tag = audiofileTagDup(utf8url); - } -#endif -#ifdef HAVE_FAAD - else if(hasAacSuffix(utf8url)) { - song->tag = aacTagDup(utf8url); - } - else if(hasMp4Suffix(utf8url)) { - song->tag = mp4TagDup(utf8url); - } -#endif - + InputPlugin * plugin; + if((plugin = isMusic(utf8url,&(song->mtime)))) { + song->tag = plugin->tagDupFunc(utf8url); + } if(!song->tag || song->tag->time<0) { freeSong(song); song = NULL; @@ -288,41 +259,16 @@ int updateSongInfo(Song * song) { char * utf8url = song->utf8url; if(song->type == SONG_TYPE_FILE) { + InputPlugin * plugin; + removeASongFromTables(song); if(song->tag) freeMpdTag(song->tag); song->tag = NULL; - if(!isFile(utf8url,&(song->mtime))); -#ifdef HAVE_OGG - else if(hasOggSuffix(utf8url)) { - song->tag = oggTagDup(utf8url); - } -#endif -#ifdef HAVE_FLAC - else if((hasFlacSuffix(utf8url))) { - song->tag = flacTagDup(utf8url); - } -#endif -#ifdef HAVE_MAD - else if(hasMp3Suffix(utf8url)) { - song->tag = mp3TagDup(utf8url); - } -#endif -#ifdef HAVE_AUDIOFILE - else if(hasWaveSuffix(utf8url)) { - song->tag = audiofileTagDup(utf8url); - } -#endif -#ifdef HAVE_FAAD - else if(hasAacSuffix(utf8url)) { - song->tag = aacTagDup(utf8url); - } - else if(hasMp4Suffix(utf8url)) { - song->tag = mp4TagDup(utf8url); - } -#endif - + if((plugin = isMusic(utf8url,&(song->mtime)))) { + song->tag = plugin->tagDupFunc(utf8url); + } if(!song->tag || song->tag->time<0) return -1; else addSongToTables(song); } -- cgit v1.2.3