diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-06-06 19:41:03 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-06-06 19:41:03 +0000 |
commit | b29f73c819ff8445b71963d883364e315b7a12d8 (patch) | |
tree | 772690e7472972ea3e78bb7b354ff4b903a8e4f3 /src/player.c | |
parent | 4e53282469de4fea4b8daaec67298bd3394f34bd (diff) | |
download | mpd-b29f73c819ff8445b71963d883364e315b7a12d8.tar.gz mpd-b29f73c819ff8445b71963d883364e315b7a12d8.tar.xz mpd-b29f73c819ff8445b71963d883364e315b7a12d8.zip |
mechanism for updating metadata while decoding
vorbis comments are updated on the fly for streams
need to decode icy metadata
buffering of metadata needs to be hardened, to ensure that player has already read a particular metachunk or passed over it
git-svn-id: https://svn.musicpd.org/mpd/trunk@1358 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/player.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/player.c b/src/player.c index 587a5501d..e6da9aeb9 100644 --- a/src/player.c +++ b/src/player.c @@ -55,9 +55,6 @@ static void resetPlayerMetadata() { if(pc->metadataState == PLAYER_METADATA_STATE_READ) { pc->metadataState = PLAYER_METADATA_STATE_WRITE; - pc->title = -1; - pc->artist = -1; - pc->album = -1; } } @@ -75,8 +72,6 @@ void resetPlayer() { 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); getPlayerData()->playerControl.decode_pid = 0; @@ -474,31 +469,24 @@ void playerCycleLogFiles() { /* this actually creates a dupe of the current metadata */ Song * playerCurrentDecodeSong() { static Song * song = NULL; - static char * prev = NULL; + static MetadataChunk * prev = NULL; PlayerControl * pc = &(getPlayerData()->playerControl); if(pc->metadataState == PLAYER_METADATA_STATE_READ && ((!song || strcmp(song->utf8url, pc->currentUrl)) - || (!prev || strcmp(prev,pc->metadata)))) + || (!prev || memcmp(prev, &(pc->metadataChunk), + sizeof(MetadataChunk))))) { + printf("metadata in the PLAYER!\n"); if(song) freeJustSong(song); song = newNullSong(); - song->tag = newMpdTag(); if(song->utf8url) free(song->utf8url); song->utf8url = strdup(pc->currentUrl); - if(pc->title >= 0) { - song->tag->title = strdup(pc->title + pc->metadata); - /*printf("player title: %s\n", song->tag->title);*/ - } - if(pc->artist >= 0) { - song->tag->artist = strdup(pc->artist + pc->metadata); - } - if(pc->album >= 0) { - song->tag->album = strdup(pc->album + pc->metadata); - } + song->tag = metadataChunkToMpdTagDup(&(pc->metadataChunk)); validateUtf8Tag(song->tag); if(prev) free(prev); - prev = strdup(pc->metadata); + prev = malloc(sizeof(MetadataChunk)); + memcpy(prev, &(pc->metadataChunk), sizeof(MetadataChunk)); resetPlayerMetadata(); return song; } |