diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-05-19 00:34:26 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-05-19 00:34:26 +0000 |
commit | bf9e2afbf9f8c9ec44dbad033290c8fe66d170f6 (patch) | |
tree | 40f0d94ab2d528578eba3b21431ced08f291c905 /src/player.c | |
parent | 3cb9923714c4dfa18bf6338c30b0554524b25836 (diff) | |
download | mpd-bf9e2afbf9f8c9ec44dbad033290c8fe66d170f6.tar.gz mpd-bf9e2afbf9f8c9ec44dbad033290c8fe66d170f6.tar.xz mpd-bf9e2afbf9f8c9ec44dbad033290c8fe66d170f6.zip |
just a we bit of changes
git-svn-id: https://svn.musicpd.org/mpd/trunk@1075 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/player.c | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/src/player.c b/src/player.c index aa3f34362..82f3101cd 100644 --- a/src/player.c +++ b/src/player.c @@ -186,7 +186,7 @@ int playerGetSuffix(char * utf8file) { return -1; } -int playerPlay(FILE * fp, char * utf8file) { +int playerPlay(FILE * fp, Song * song) { PlayerControl * pc = &(getPlayerData()->playerControl); int decodeType; @@ -204,7 +204,7 @@ int playerPlay(FILE * fp, char * utf8file) { } }*/ - decodeType = playerGetDecodeType(utf8file); + decodeType = playerGetDecodeType(song->utf8url); if(decodeType < 0) { strncpy(pc->erroredFile,pc->file,MAXPATHLEN); pc->erroredFile[MAXPATHLEN] = '\0'; @@ -212,12 +212,15 @@ int playerPlay(FILE * fp, char * utf8file) { return 0; } pc->decodeType = decodeType; - pc->fileSuffix = playerGetSuffix(utf8file); + pc->fileSuffix = playerGetSuffix(song->utf8url); + if(song->tag) pc->fileTime = song->tag->time; + else pc->fileTime = 0; - if(isRemoteUrl(utf8file)) { - strncpy(pc->file,utf8file,MAXPATHLEN); + if(isRemoteUrl(song->utf8url)) { + strncpy(pc->file, song->utf8url, MAXPATHLEN); } - else strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN); + else strncpy(pc->file, rmp2amp(utf8ToFsCharset(song->utf8url)), + MAXPATHLEN); pc->file[MAXPATHLEN] = '\0'; pc->play = 1; @@ -247,9 +250,9 @@ int playerStop(FILE * fp) { void playerKill() { int pid; - PlayerControl * pc = &(getPlayerData()->playerControl); + /*PlayerControl * pc = &(getPlayerData()->playerControl); - /*playerStop(stderr); + playerStop(stderr); playerCloseAudio(stderr); if(player_pid>0 && pc->closeAudio) sleep(1);*/ @@ -357,21 +360,24 @@ void playerCloseAudio() { } } -int queueSong(char * utf8file) { +int queueSong(Song * song) { PlayerControl * pc = &(getPlayerData()->playerControl); int decodeType; if(pc->queueState==PLAYER_QUEUE_BLANK) { - if(isRemoteUrl(utf8file)) { - strncpy(pc->file,utf8file,MAXPATHLEN); + if(isRemoteUrl(song->utf8url)) { + strncpy(pc->file, song->utf8url, MAXPATHLEN); } - else strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN); + else strncpy(pc->file, rmp2amp(utf8ToFsCharset(song->utf8url)), + MAXPATHLEN); pc->file[MAXPATHLEN] = '\0'; - decodeType = playerGetDecodeType(utf8file); + decodeType = playerGetDecodeType(song->utf8url); if(decodeType < 0) return -1; pc->decodeType = decodeType; - pc->fileSuffix = playerGetSuffix(utf8file); + pc->fileSuffix = playerGetSuffix(song->utf8url); + if(song->tag) pc->fileTime = song->tag->time; + else pc->fileTime = 0; pc->queueState = PLAYER_QUEUE_FULL; return 0; @@ -412,7 +418,7 @@ void playerQueueUnlock() { } } -int playerSeek(FILE * fp, char * utf8file, float time) { +int playerSeek(FILE * fp, Song * song, float time) { PlayerControl * pc = &(getPlayerData()->playerControl); char * file; int decodeType; @@ -423,18 +429,21 @@ int playerSeek(FILE * fp, char * utf8file, float time) { return -1; } - if(isRemoteUrl(utf8file)) file = utf8file; - else file = rmp2amp(utf8ToFsCharset(utf8file)); + if(isRemoteUrl(song->utf8url)) file = song->utf8url; + else file = rmp2amp(utf8ToFsCharset(song->utf8url)); if(strcmp(pc->file,file)!=0) { - decodeType = playerGetDecodeType(utf8file); + decodeType = playerGetDecodeType(song->utf8url); if(decodeType < 0) { myfprintf(fp,"%s unknown file type: %s\n", - COMMAND_RESPOND_ERROR, utf8file); - ERROR("playerSeek: unknown file type: %s\n", utf8file); + COMMAND_RESPOND_ERROR, song->utf8url); + ERROR("playerSeek: unknown file type: %s\n", + song->utf8url); return -1; } pc->decodeType = decodeType; - pc->fileSuffix = playerGetSuffix(utf8file); + pc->fileSuffix = playerGetSuffix(song->utf8url); + if(song->tag) pc->fileTime = song->tag->time; + else pc->fileTime = 0; strncpy(pc->file,file,MAXPATHLEN); pc->file[MAXPATHLEN] = '\0'; |