aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-05-05 22:40:51 +0200
committerMax Kellermann <max@duempel.org>2009-05-05 22:40:51 +0200
commitebc1d3516c0334a093d8426e52402febb3dd6b00 (patch)
treecf35b07984b5b70788b20c999c24d598fe5c2149 /src
parent7875072d3860865aadcbd245c71e86b6c94203d4 (diff)
downloadmpd-ebc1d3516c0334a093d8426e52402febb3dd6b00.tar.gz
mpd-ebc1d3516c0334a093d8426e52402febb3dd6b00.tar.xz
mpd-ebc1d3516c0334a093d8426e52402febb3dd6b00.zip
vorbis_encoder: start a new stream in tag()
When a new tag is set, end the current stream and begin a new one. Use vorbis_analysis_headerout() to write a full ogg header. This fixes a problem with icecast: after a song change in MPD, icecast stops forwarding ogg packets to its clients.
Diffstat (limited to 'src')
-rw-r--r--src/encoder/vorbis_encoder.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/encoder/vorbis_encoder.c b/src/encoder/vorbis_encoder.c
index 0332f1106..a5f6387f6 100644
--- a/src/encoder/vorbis_encoder.c
+++ b/src/encoder/vorbis_encoder.c
@@ -295,22 +295,25 @@ vorbis_encoder_tag(struct encoder *_encoder, const struct tag *tag,
{
struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder;
vorbis_comment comment;
- ogg_packet packet;
/* write the vorbis_comment object */
vorbis_comment_init(&comment);
copy_tag_to_vorbis_comment(&comment, tag);
- /* convert that vorbis_comment into a ogg_packet */
+ /* reset ogg_stream_state and begin a new stream */
- vorbis_commentheader_out(&comment, &packet);
+ ogg_stream_reset_serialno(&encoder->os, g_random_int());
+
+ /* send that vorbis_comment to the ogg_stream_state */
+
+ vorbis_encoder_headerout(encoder, &comment);
vorbis_comment_clear(&comment);
- /* .. and send it into the ogg_stream_state */
+ /* the next vorbis_encoder_read() call should flush the
+ ogg_stream_state */
- ogg_stream_packetin(&encoder->os, &packet);
- ogg_packet_clear(&packet);
+ encoder->flush = true;
return true;
}