diff options
Diffstat (limited to 'src/inputPlugins')
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 7 | ||||
-rw-r--r-- | src/inputPlugins/oggvorbis_plugin.c | 16 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 5bbd7601f..c36cab6f0 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -921,7 +921,7 @@ static int mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo) data->inStream->metaTitle); free(data->inStream->metaTitle); data->inStream->metaTitle = NULL; - freeMpdTag(tag); + metadata_pipe_send(tag, data->elapsedTime); } samplesLeft = (data->synth).pcm.length; @@ -1050,20 +1050,19 @@ static int mp3_decode(InputStream * inStream) if (inStream->metaName) { addItemToMpdTag(tag, TAG_ITEM_NAME, inStream->metaName); } - freeMpdTag(tag); } else if (tag) { if (inStream->metaName) { clearItemsFromMpdTag(tag, TAG_ITEM_NAME); addItemToMpdTag(tag, TAG_ITEM_NAME, inStream->metaName); } - freeMpdTag(tag); } else if (inStream->metaName) { tag = newMpdTag(); if (inStream->metaName) { addItemToMpdTag(tag, TAG_ITEM_NAME, inStream->metaName); } - freeMpdTag(tag); } + if (tag) + metadata_pipe_send(tag, 0); while (mp3Read(&data, &replayGainInfo) != DECODE_BREAK) ; /* send last little bit if not dc_intr() */ diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index fcedda54a..cb6eed28e 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -196,7 +196,8 @@ static MpdTag *oggCommentsParse(char **comments) } static void putOggCommentsIntoOutputBuffer(char *streamName, - char **comments) + char **comments, + float time) { MpdTag *tag; @@ -212,7 +213,12 @@ static void putOggCommentsIntoOutputBuffer(char *streamName, addItemToMpdTag(tag, TAG_ITEM_NAME, streamName); } - freeMpdTag(tag); + metadata_pipe_send(tag, time); +} + +static float current_time(OggVorbis_File *vf) +{ + return (ov_pcm_tell(vf) / dc.audio_format.sampleRate); } /* public */ @@ -291,7 +297,8 @@ static int oggvorbis_decode(InputStream * inStream) dc.audio_format.sampleRate = vi->rate; comments = ov_comment(&vf, -1)->user_comments; putOggCommentsIntoOutputBuffer(inStream->metaName, - comments); + comments, + current_time(&vf)); ogg_getReplayGainInfo(comments, &replayGainInfo); } @@ -310,8 +317,7 @@ static int oggvorbis_decode(InputStream * inStream) if ((test = ov_bitrate_instant(&vf)) > 0) { bitRate = test / 1000; } - ob_send(chunk, chunkpos, - ov_pcm_tell(&vf) / dc.audio_format.sampleRate, + ob_send(chunk, chunkpos, current_time(&vf), bitRate, replayGainInfo); chunkpos = 0; if (dc_intr()) |