fix some streaming metadata issues
git-svn-id: https://svn.musicpd.org/mpd/trunk@1416 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
d5f7a7745a
commit
bfaf6cbd9d
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "pcm_utils.h"
|
||||
#include "playerData.h"
|
||||
#include "utils.h"
|
||||
#include "log.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
10
src/player.c
10
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();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue