From bfaf6cbd9d3c39d466179be9fad0654cc75a4765 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Wed, 9 Jun 2004 16:58:33 +0000 Subject: fix some streaming metadata issues git-svn-id: https://svn.musicpd.org/mpd/trunk@1416 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/decode.c | 4 +++- src/inputPlugins/ogg_plugin.c | 3 +++ src/outputBuffer.c | 11 ++++++++++- src/player.c | 10 +++------- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/decode.c b/src/decode.c index 88208670d..17dad4659 100644 --- a/src/decode.c +++ b/src/decode.c @@ -393,7 +393,9 @@ void handleMetadata(OutputBuffer * cb, PlayerControl * pc, int * previous, if(cb->begin!=cb->end) { int meta = cb->metaChunk[cb->begin]; if( meta != *previous ) { + DEBUG("player: metadata change\n"); if( meta >= 0 && cb->metaChunkSet[meta]) { + DEBUG("player: new metadata from decoder!\n"); memcpy(currentChunk, cb->metadataChunks+meta, sizeof(MetadataChunk)); @@ -625,6 +627,7 @@ void decode() { cb = &(getPlayerData()->buffer); + clearAllMetaChunkSets(cb); cb->begin = 0; cb->end = 0; pc = &(getPlayerData()->playerControl); @@ -634,7 +637,6 @@ void decode() { dc->seek = 0; dc->stop = 0; dc->start = 1; - clearAllMetaChunkSets(cb); if(decode_pid==NULL || *decode_pid<=0) { if(decoderInit(pc,cb,dc)<0) return; diff --git a/src/inputPlugins/ogg_plugin.c b/src/inputPlugins/ogg_plugin.c index e47471177..c5197f132 100644 --- a/src/inputPlugins/ogg_plugin.c +++ b/src/inputPlugins/ogg_plugin.c @@ -206,6 +206,9 @@ void putOggCommentsIntoOutputBuffer(OutputBuffer * cb, char * streamName, MpdTag * tag; tag = oggCommentsParse(comments); + if(!tag && streamName) { + tag = newMpdTag(); + } if(!tag) return; /*if(tag->artist) printf("Artist: %s\n", tag->artist); diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 39d9b66af..bde118ff8 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -21,6 +21,7 @@ #include "pcm_utils.h" #include "playerData.h" #include "utils.h" +#include "log.h" #include @@ -154,10 +155,12 @@ int copyMpdTagToOutputBuffer(OutputBuffer * cb, MpdTag * tag) { sendMetaChunk = 0; if(last) free(last); last = NULL; + DEBUG("copyMpdTagToOB: !acceptMetadata || !tag\n"); return 0; } if(last && mpdTagsAreEqual(last, tag)) { + DEBUG("copyMpdTagToOB: same as last\n"); return 0; } @@ -167,7 +170,11 @@ int copyMpdTagToOutputBuffer(OutputBuffer * cb, MpdTag * tag) { nextChunk = currentMetaChunk+1; if(nextChunk >= BUFFERED_METACHUNKS) nextChunk = 0; - if(cb->metaChunkSet[nextChunk]) return -1; + if(cb->metaChunkSet[nextChunk]) { + sendMetaChunk = 0; + DEBUG("copyMpdTagToOB: metachunk in use!\n"); + return -1; + } sendMetaChunk = 1; currentMetaChunk = nextChunk; @@ -178,5 +185,7 @@ int copyMpdTagToOutputBuffer(OutputBuffer * cb, MpdTag * tag) { cb->metaChunkSet[nextChunk] = 1; + DEBUG("copyMpdTagToOB: copiedTag\n"); + return 0; } diff --git a/src/player.c b/src/player.c index 0682a537a..4188243e6 100644 --- a/src/player.c +++ b/src/player.c @@ -473,11 +473,8 @@ Song * playerCurrentDecodeSong() { Song * ret = NULL; PlayerControl * pc = &(getPlayerData()->playerControl); - if(pc->metadataState == PLAYER_METADATA_STATE_READ && - ((!song || strcmp(song->utf8url, pc->currentUrl)) - || (!prev || memcmp(prev, &(pc->metadataChunk), - sizeof(MetadataChunk))))) - { + if(pc->metadataState == PLAYER_METADATA_STATE_READ) { + DEBUG("playerCurrentDecodeSong: caught new metadata!\n"); if(prev) free(prev); prev = malloc(sizeof(MetadataChunk)); memcpy(prev, &(pc->metadataChunk), sizeof(MetadataChunk)); @@ -488,9 +485,8 @@ Song * playerCurrentDecodeSong() { song->tag = metadataChunkToMpdTagDup(prev); validateUtf8Tag(song->tag); ret = song; + resetPlayerMetadata(); } - resetPlayerMetadata(); - return ret; } -- cgit v1.2.3