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.
This commit is contained in:
parent
7875072d38
commit
ebc1d3516c
@ -295,22 +295,25 @@ vorbis_encoder_tag(struct encoder *_encoder, const struct tag *tag,
|
|||||||
{
|
{
|
||||||
struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder;
|
struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder;
|
||||||
vorbis_comment comment;
|
vorbis_comment comment;
|
||||||
ogg_packet packet;
|
|
||||||
|
|
||||||
/* write the vorbis_comment object */
|
/* write the vorbis_comment object */
|
||||||
|
|
||||||
vorbis_comment_init(&comment);
|
vorbis_comment_init(&comment);
|
||||||
copy_tag_to_vorbis_comment(&comment, tag);
|
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);
|
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);
|
encoder->flush = true;
|
||||||
ogg_packet_clear(&packet);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user