aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-18 03:37:55 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-18 03:37:55 +0000
commit746e7477e047a78296fc60347448720add025bce (patch)
treed54ca55fab5f86b789fbc524643583e4258cd294 /src/player.c
parentaed844a67df54d54f4765413077af0651378bb81 (diff)
downloadmpd-746e7477e047a78296fc60347448720add025bce.tar.gz
mpd-746e7477e047a78296fc60347448720add025bce.tar.xz
mpd-746e7477e047a78296fc60347448720add025bce.zip
yes! rudimentary stream playing for mp3's!
be gentle git-svn-id: https://svn.musicpd.org/mpd/trunk@1051 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/player.c')
-rw-r--r--src/player.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/player.c b/src/player.c
index f8d183baa..a764dd28a 100644
--- a/src/player.c
+++ b/src/player.c
@@ -161,22 +161,22 @@ int playerInit() {
}
int playerGetDecodeType(char * utf8file) {
- if(!isFile(utf8file,NULL));
+ if(!isRemoteUrl(utf8file) && !isFile(utf8file,NULL)) return -1;
#ifdef HAVE_MAD
- else if(hasMp3Suffix(utf8file)) return DECODE_TYPE_MP3;
+ if(hasMp3Suffix(utf8file)) return DECODE_TYPE_MP3;
#endif
#ifdef HAVE_OGG
- else if(hasOggSuffix(utf8file)) return DECODE_TYPE_OGG;
+ if(hasOggSuffix(utf8file)) return DECODE_TYPE_OGG;
#endif
#ifdef HAVE_FLAC
- else if(hasFlacSuffix(utf8file)) return DECODE_TYPE_FLAC;
+ if(hasFlacSuffix(utf8file)) return DECODE_TYPE_FLAC;
#endif
#ifdef HAVE_AUDIOFILE
- else if(hasWaveSuffix(utf8file)) return DECODE_TYPE_AUDIOFILE;
+ if(hasWaveSuffix(utf8file)) return DECODE_TYPE_AUDIOFILE;
#endif
#ifdef HAVE_FAAD
- else if(hasAacSuffix(utf8file)) return DECODE_TYPE_AAC;
- else if(hasMp4Suffix(utf8file)) return DECODE_TYPE_MP4;
+ if(hasAacSuffix(utf8file)) return DECODE_TYPE_AAC;
+ if(hasMp4Suffix(utf8file)) return DECODE_TYPE_MP4;
#endif
return -1;
}
@@ -189,7 +189,7 @@ int playerPlay(FILE * fp, char * utf8file) {
if(playerStop(fp)<0) return -1;
- {
+ /*{
struct stat st;
if(stat(rmp2amp(utf8ToFsCharset(utf8file)),&st)<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
@@ -197,7 +197,7 @@ int playerPlay(FILE * fp, char * utf8file) {
pc->error = PLAYER_ERROR_FILENOTFOUND;
return 0;
}
- }
+ }*/
decodeType = playerGetDecodeType(utf8file);
if(decodeType < 0) {
@@ -208,7 +208,10 @@ int playerPlay(FILE * fp, char * utf8file) {
}
pc->decodeType = decodeType;
- strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
+ if(isRemoteUrl(utf8file)) {
+ strncpy(pc->file,utf8file,MAXPATHLEN);
+ }
+ else strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
pc->play = 1;
@@ -353,7 +356,10 @@ int queueSong(char * utf8file) {
int decodeType;
if(pc->queueState==PLAYER_QUEUE_BLANK) {
- strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
+ if(isRemoteUrl(utf8file)) {
+ strncpy(pc->file,utf8file,MAXPATHLEN);
+ }
+ else strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
decodeType = playerGetDecodeType(utf8file);
@@ -410,7 +416,8 @@ int playerSeek(FILE * fp, char * utf8file, float time) {
return -1;
}
- file = rmp2amp(utf8ToFsCharset(utf8file));
+ if(isRemoteUrl(utf8file)) file = utf8file;
+ else file = rmp2amp(utf8ToFsCharset(utf8file));
if(strcmp(pc->file,file)!=0) {
decodeType = playerGetDecodeType(utf8file);
if(decodeType < 0) {