From 1a5b04e4e83640cd0a58d4e49fe755598af73262 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Mon, 31 May 2004 23:29:35 +0000 Subject: some stream metadata fixes git-svn-id: https://svn.musicpd.org/mpd/trunk@1266 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/decode.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/decode.c') diff --git a/src/decode.c b/src/decode.c index 6c4beeeed..b361b62f3 100644 --- a/src/decode.c +++ b/src/decode.c @@ -71,6 +71,7 @@ void stopDecode(DecoderControl * dc) { void quitDecode(PlayerControl * pc, DecoderControl * dc) { stopDecode(dc); + pc->metadataState = PLAYER_METADATA_STATE_READ; pc->state = PLAYER_STATE_STOP; dc->seek = 0; pc->play = 0; @@ -110,6 +111,15 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) { quitDecode(pc,dc); \ return; \ } \ + if(pc->metadataState == PLAYER_METADATA_STATE_WRITE && \ + dc->metadataSet) \ + { \ + memcpy(pc->metadata, dc->metadata, \ + DECODE_METADATA_LENGTH); \ + pc->metadata[DECODE_METADATA_LENGTH-1] = '\0'; \ + pc->title = dc->title; \ + } \ + pc->metadataState = PLAYER_METADATA_STATE_READ; \ pc->totalTime = dc->totalTime; \ pc->sampleRate = dc->audioFormat.sampleRate; \ pc->bits = dc->audioFormat.bits; \ @@ -131,6 +141,9 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) { int waitOnDecode(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb, int * decodeWaitedOn) { + strncpy(pc->currentUrl, pc->utf8url, MAXPATHLEN); + pc->currentUrl[MAXPATHLEN] = '\0'; + while(decode_pid && *decode_pid>0 && dc->start) my_usleep(10000); if(dc->start || dc->error!=DECODE_ERROR_NOERROR) { @@ -570,7 +583,7 @@ void decode() { dc->seek = 0; dc->stop = 0; dc->start = 1; - + if(decode_pid==NULL || *decode_pid<=0) { if(decoderInit(pc,cb,dc)<0) return; } -- cgit v1.2.3