aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/oggvorbis_plugin.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-08-26 04:22:58 -0700
committerEric Wong <normalperson@yhbt.net>2008-08-26 04:26:48 -0700
commit9cb6d62a0302d8e49b2225b97602379db7566b5e (patch)
tree0ae4fc4a8376c4f6e78dfebae0724c78e346f9a9 /src/inputPlugins/oggvorbis_plugin.c
parent4be65a911b6024dc924d1e7d016cab8c42179f71 (diff)
downloadmpd-9cb6d62a0302d8e49b2225b97602379db7566b5e.tar.gz
mpd-9cb6d62a0302d8e49b2225b97602379db7566b5e.tar.xz
mpd-9cb6d62a0302d8e49b2225b97602379db7566b5e.zip
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.
Diffstat (limited to 'src/inputPlugins/oggvorbis_plugin.c')
-rw-r--r--src/inputPlugins/oggvorbis_plugin.c16
1 files changed, 11 insertions, 5 deletions
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())