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/outputBuffer.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 'src/outputBuffer.c')
-rw-r--r-- | src/outputBuffer.c | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 194e3af8a..d0a98b692 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -26,6 +26,9 @@ static mpd_sint16 currentChunk = -1; +static mpd_sint8 currentMetaChunk = -1; +static mpd_sint8 sendMetaChunk = 0; + void clearOutputBuffer(OutputBuffer * cb) { currentChunk = -1; cb->end = cb->begin; @@ -95,6 +98,13 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, currentChunk = cb->end; cb->chunkSize[currentChunk] = 0; + + if(sendMetaChunk) { + cb->metaChunk[currentChunk] = currentMetaChunk; + } + else cb->metaChunk[currentChunk] = -1; + cb->bitRate[currentChunk] = bitRate; + cb->times[currentChunk] = time; } chunkLeft = CHUNK_SIZE-cb->chunkSize[currentChunk]; @@ -104,9 +114,6 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, cb->chunkSize[currentChunk], data, dataToSend); cb->chunkSize[currentChunk]+= dataToSend; - cb->bitRate[currentChunk] = bitRate; - cb->times[currentChunk] = time; - datalen-= dataToSend; data+= dataToSend; @@ -118,32 +125,19 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, return 0; } -/* this is stuff for inputPlugins to use! */ -#define copyStringToMetadata(string, element) { \ - if(string && (slen = strlen(string)) && \ - pos < DECODE_METADATA_LENGTH-1) \ - { \ - strncpy(cb->metadata+pos, string, \ - DECODE_METADATA_LENGTH-1-pos); \ - element = pos; \ - pos += slen+1; \ - } \ -} - void copyMpdTagToOutputBuffer(OutputBuffer * cb, MpdTag * tag) { - int pos = 0; - int slen; + printf("copyMpdTagToOB called\n"); + + if(!cb->acceptMetadata || !tag) { + sendMetaChunk = 0; + return; + } - if(!cb->acceptMetadata) return; - if(!tag) return; + sendMetaChunk = 1; + currentMetaChunk++; + if(currentMetaChunk >= BUFFERED_METACHUNKS) currentMetaChunk = 0; - memset(cb->metadata, 0, DECODE_METADATA_LENGTH); - - copyStringToMetadata(tag->name, cb->name); - copyStringToMetadata(tag->artist, cb->artist); - copyStringToMetadata(tag->title, cb->title); - copyStringToMetadata(tag->album, cb->album); + printMpdTag(stdout, tag); - cb->metaChunk = cb->end; - cb->metadataSet = 1; + copyMpdTagToMetadataChunk(tag, &(cb->metadataChunks[currentMetaChunk])); } |