aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-18 13:13:55 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-18 13:13:55 +0000
commitc51ad71efaa975c64f6ad31dce5578307a5cba7b (patch)
tree348881ea4c5b04bd17e04e881905dbacef296869 /src/player.c
parent6c24180516f823985f564ba013607b47f70afa81 (diff)
downloadmpd-c51ad71efaa975c64f6ad31dce5578307a5cba7b.tar.gz
mpd-c51ad71efaa975c64f6ad31dce5578307a5cba7b.tar.xz
mpd-c51ad71efaa975c64f6ad31dce5578307a5cba7b.zip
rework stuff so that we can use mime-type of streams to detect type of file
git-svn-id: https://svn.musicpd.org/mpd/trunk@1062 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/player.c')
-rw-r--r--src/player.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/player.c b/src/player.c
index 7f28670bf..a05b43b14 100644
--- a/src/player.c
+++ b/src/player.c
@@ -161,25 +161,29 @@ int playerInit() {
}
int playerGetDecodeType(char * utf8file) {
- if(isRemoteUrl(utf8file)) return DECODE_TYPE_MP3;
- if(!isFile(utf8file,NULL)) return -1;
+ if(isRemoteUrl(utf8file)) return DECODE_TYPE_URL;
+ if(isFile(utf8file,NULL)) return DECODE_TYPE_FILE;
+ return -1;
+}
+
+int playerGetSuffix(char * utf8file) {
#ifdef HAVE_MAD
- if(hasMp3Suffix(utf8file)) return DECODE_TYPE_MP3;
+ if(hasMp3Suffix(utf8file)) return DECODE_SUFFIX_MP3;
+#endif
+#ifdef HAVE_OGG
+ if(hasOggSuffix(utf8file)) return DECODE_SUFFIX_OGG;
#endif
-#ifdef HAVE_OGG
- if(hasOggSuffix(utf8file)) return DECODE_TYPE_OGG;
+#ifdef HAVE_FAAD
+ if(hasAacSuffix(utf8file)) return DECODE_SUFFIX_AAC;
+ if(hasMp4Suffix(utf8file)) return DECODE_SUFFIX_MP4;
#endif
-#ifdef HAVE_FLAC
- if(hasFlacSuffix(utf8file)) return DECODE_TYPE_FLAC;
+#ifdef HAVE_FLAC
+ if(hasFlacSuffix(utf8file)) return DECODE_SUFFIX_FLAC;
#endif
#ifdef HAVE_AUDIOFILE
- if(hasWaveSuffix(utf8file)) return DECODE_TYPE_AUDIOFILE;
-#endif
-#ifdef HAVE_FAAD
- if(hasAacSuffix(utf8file)) return DECODE_TYPE_AAC;
- if(hasMp4Suffix(utf8file)) return DECODE_TYPE_MP4;
+ if(hasWaveSuffix(utf8file)) return DECODE_SUFFIX_WAVE;
#endif
- return -1;
+ return -1;
}
int playerPlay(FILE * fp, char * utf8file) {
@@ -208,6 +212,7 @@ int playerPlay(FILE * fp, char * utf8file) {
return 0;
}
pc->decodeType = decodeType;
+ pc->fileSuffix = playerGetSuffix(utf8file);
if(isRemoteUrl(utf8file)) {
strncpy(pc->file,utf8file,MAXPATHLEN);
@@ -366,6 +371,7 @@ int queueSong(char * utf8file) {
decodeType = playerGetDecodeType(utf8file);
if(decodeType < 0) return -1;
pc->decodeType = decodeType;
+ pc->fileSuffix = playerGetSuffix(utf8file);
pc->queueState = PLAYER_QUEUE_FULL;
return 0;
@@ -428,6 +434,7 @@ int playerSeek(FILE * fp, char * utf8file, float time) {
return -1;
}
pc->decodeType = decodeType;
+ pc->fileSuffix = playerGetSuffix(utf8file);
strncpy(pc->file,file,MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';