diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-06-07 14:16:10 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-06-07 14:16:10 +0000 |
commit | 333c0a6fdd6039e936f0de1cd9f7534a9339deda (patch) | |
tree | f1deee5d78f123d6f19e9f05d9b4346e5dd86f44 | |
parent | ae44b7dae5878a1484243b89d14317d2dab5fdde (diff) | |
download | mpd-333c0a6fdd6039e936f0de1cd9f7534a9339deda.tar.gz mpd-333c0a6fdd6039e936f0de1cd9f7534a9339deda.tar.xz mpd-333c0a6fdd6039e936f0de1cd9f7534a9339deda.zip |
some fixes to metadata stuff
git-svn-id: https://svn.musicpd.org/mpd/trunk@1370 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/decode.c | 11 | ||||
-rw-r--r-- | src/outputBuffer.c | 11 | ||||
-rw-r--r-- | src/player.c | 9 |
3 files changed, 16 insertions, 15 deletions
diff --git a/src/decode.c b/src/decode.c index 51c951c51..1ed2c00ee 100644 --- a/src/decode.c +++ b/src/decode.c @@ -388,17 +388,6 @@ int decoderInit(PlayerControl * pc, OutputBuffer * cb, DecoderControl * dc) { return 0; } -#define copyMetadata() { \ - memcpy(pc->metadata, metadata, DECODE_METADATA_LENGTH); \ - pc->name = name; \ - pc->title = title; \ - pc->artist = artist; \ - pc->album = album; \ - gotMetadata = 0; \ - pc->metadataState = PLAYER_METADATA_STATE_READ; \ - kill(getppid(), SIGUSR1); \ -} - void handleMetadata(OutputBuffer * cb, PlayerControl * pc, int * previous, int * currentChunkSent, MetadataChunk * currentChunk) { diff --git a/src/outputBuffer.c b/src/outputBuffer.c index fd8d5b83f..44621d9d4 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -147,11 +147,19 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, int copyMpdTagToOutputBuffer(OutputBuffer * cb, MpdTag * tag) { int nextChunk; + static MpdTag * last = NULL; printf("copyMpdTagToOB called\n"); if(!cb->acceptMetadata || !tag) { sendMetaChunk = 0; + if(last) free(last); + last = NULL; + return 0; + } + + if(last && mpdTagsAreEqual(last, tag)) { + printf("same as last\n"); return 0; } @@ -165,6 +173,9 @@ int copyMpdTagToOutputBuffer(OutputBuffer * cb, MpdTag * tag) { printMpdTag(stdout, tag); + if(last) freeMpdTag(last); + last = mpdTagDup(tag); + copyMpdTagToMetadataChunk(tag, &(cb->metadataChunks[currentMetaChunk])); cb->metaChunkSet[nextChunk] = 1; diff --git a/src/player.c b/src/player.c index 3ddd21062..0682a537a 100644 --- a/src/player.c +++ b/src/player.c @@ -470,6 +470,7 @@ void playerCycleLogFiles() { Song * playerCurrentDecodeSong() { static Song * song = NULL; static MetadataChunk * prev = NULL; + Song * ret = NULL; PlayerControl * pc = &(getPlayerData()->playerControl); if(pc->metadataState == PLAYER_METADATA_STATE_READ && @@ -477,19 +478,19 @@ Song * playerCurrentDecodeSong() { || (!prev || memcmp(prev, &(pc->metadataChunk), sizeof(MetadataChunk))))) { - printf("metadata in the PLAYER!\n"); if(prev) free(prev); prev = malloc(sizeof(MetadataChunk)); memcpy(prev, &(pc->metadataChunk), sizeof(MetadataChunk)); - resetPlayerMetadata(); if(song) freeJustSong(song); song = newNullSong(); if(song->utf8url) free(song->utf8url); song->utf8url = strdup(pc->currentUrl); song->tag = metadataChunkToMpdTagDup(prev); validateUtf8Tag(song->tag); - return song; + ret = song; } - return NULL; + resetPlayerMetadata(); + + return ret; } |