diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-05-31 23:29:35 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-05-31 23:29:35 +0000 |
commit | 1a5b04e4e83640cd0a58d4e49fe755598af73262 (patch) | |
tree | 3eef1d5d024b408346edbd8ce2b6f4d695138f22 /src/player.c | |
parent | 5f2c19bfc9e3afc53017e9a76cde0258a5c56388 (diff) | |
download | mpd-1a5b04e4e83640cd0a58d4e49fe755598af73262.tar.gz mpd-1a5b04e4e83640cd0a58d4e49fe755598af73262.tar.xz mpd-1a5b04e4e83640cd0a58d4e49fe755598af73262.zip |
some stream metadata fixes
git-svn-id: https://svn.musicpd.org/mpd/trunk@1266 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/player.c')
-rw-r--r-- | src/player.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/player.c b/src/player.c index e0d8ee93f..f1df0b0b7 100644 --- a/src/player.c +++ b/src/player.c @@ -50,6 +50,15 @@ void clearPlayerPid() { player_pid = 0; } +static void resetPlayerMetadata() { + PlayerControl * pc = &(getPlayerData()->playerControl); + + if(pc->metadataState == PLAYER_METADATA_STATE_READ) { + pc->metadataState = PLAYER_METADATA_STATE_WRITE; + pc->title = -1; + } +} + void resetPlayer() { int pid; @@ -62,6 +71,9 @@ void resetPlayer() { getPlayerData()->playerControl.state = PLAYER_STATE_STOP; getPlayerData()->playerControl.queueState = PLAYER_QUEUE_UNLOCKED; getPlayerData()->playerControl.seek = 0; + getPlayerData()->playerControl.metadataState = + PLAYER_METADATA_STATE_WRITE; + getPlayerData()->playerControl.title = -1; /* kill decode process if it got left running */ pid = getPlayerData()->playerControl.decode_pid; if(pid>0) kill(pid,SIGTERM); @@ -187,6 +199,7 @@ int playerPlay(FILE * fp, Song * song) { return -1; } + resetPlayerMetadata(); while(player_pid>0 && pc->play) my_usleep(1000); return 0; @@ -385,6 +398,7 @@ int playerSeek(FILE * fp, Song * song, float time) { } if(pc->error==PLAYER_ERROR_NOERROR) { + resetPlayerMetadata(); pc->seekWhere = time; pc->seek = 1; while(player_pid>0 && pc->seek) my_usleep(1000); @@ -461,20 +475,21 @@ void playerCycleLogFiles() { /* this actually creates a dupe of the current metadata */ Song * playerCurrentDecodeSong() { - static Song * song; - DecoderControl * dc = &(getPlayerData()->decoderControl); + static Song * song = NULL; + PlayerControl * pc = &(getPlayerData()->playerControl); - if(dc->metadataSet && (!song || strcmp(song->utf8url, dc->utf8url))) { + if(pc->metadataState == PLAYER_METADATA_STATE_READ && + (!song || strcmp(song->utf8url, pc->currentUrl))) + { if(song) freeJustSong(song); song = newNullSong(); song->tag = newMpdTag(); if(song->utf8url) free(song->utf8url); - song->utf8url = strdup(dc->utf8url); - if(dc->title >= 0) { - song->tag->title = dc->title + dc->metadata; + song->utf8url = strdup(pc->currentUrl); + if(pc->title >= 0) { + song->tag->title = strdup(pc->title + pc->metadata); } - else song->tag->title = NULL; - + resetPlayerMetadata(); return song; } |