aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-31 01:21:17 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-31 01:21:17 +0000
commitfd6aa253594e18877ca2380961c0425a7de21b2e (patch)
treeb86fc645573adef9c0de9bd5f22eadffe3d16814 /src/song.c
parentd7893a3e76d261b33b83fd9333d85892b3308594 (diff)
downloadmpd-fd6aa253594e18877ca2380961c0425a7de21b2e.tar.gz
mpd-fd6aa253594e18877ca2380961c0425a7de21b2e.tar.xz
mpd-fd6aa253594e18877ca2380961c0425a7de21b2e.zip
mp3 and ogg plugin stuff
git-svn-id: https://svn.musicpd.org/mpd/trunk@1245 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/song.c')
-rw-r--r--src/song.c74
1 files changed, 10 insertions, 64 deletions
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);
}