From 9cb6d62a0302d8e49b2225b97602379db7566b5e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 26 Aug 2008 04:22:58 -0700 Subject: Reimplement dynamic metadata handling This has been tested for both playback of streams and outputting to streams, and seems to work fine with minimal locking. This reuses the sequence number infrastructure in OutputBuffer for synchronizing metadata payloads; so (IMNSHO) should be much more understandable than various flags being set here and there.. It could still use some cleanup and much testing, but synchronization issues should be minimal. --- src/inputPlugins/oggvorbis_plugin.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/inputPlugins/oggvorbis_plugin.c') 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()) -- cgit v1.2.3