aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-15 18:36:25 +0100
committerMax Kellermann <max@duempel.org>2009-03-15 18:36:25 +0100
commit3333502edbd9e4a54c14f003606ce9ad5fe0cfe7 (patch)
treed703cef1974578f6090340dc109951b7a3e4bf18 /src
parent2b74311b0a9c90e1c8a7e289fbc46ed36b204e6e (diff)
downloadmpd-3333502edbd9e4a54c14f003606ce9ad5fe0cfe7.tar.gz
mpd-3333502edbd9e4a54c14f003606ce9ad5fe0cfe7.tar.xz
mpd-3333502edbd9e4a54c14f003606ce9ad5fe0cfe7.zip
vorbis_encoder: use vorbis_commentheader_out() in the tag() method
Don't reinitialize the encoder with every tag.
Diffstat (limited to '')
-rw-r--r--src/encoder/vorbis_encoder.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/encoder/vorbis_encoder.c b/src/encoder/vorbis_encoder.c
index af325cbaa..a1ff89388 100644
--- a/src/encoder/vorbis_encoder.c
+++ b/src/encoder/vorbis_encoder.c
@@ -302,17 +302,26 @@ copy_tag_to_vorbis_comment(vorbis_comment *vc, const struct tag *tag)
static bool
vorbis_encoder_tag(struct encoder *_encoder, const struct tag *tag,
- GError **error)
+ G_GNUC_UNUSED GError **error)
{
struct vorbis_encoder *encoder = (struct vorbis_encoder *)_encoder;
+ vorbis_comment comment;
+ ogg_packet packet;
- vorbis_encoder_clear(encoder);
- if (!vorbis_encoder_reinit(encoder, error))
- return false;
+ /* write the vorbis_comment object */
- copy_tag_to_vorbis_comment(&encoder->vc, tag);
+ vorbis_comment_init(&comment);
+ copy_tag_to_vorbis_comment(&comment, tag);
- vorbis_encoder_send_header(encoder);
+ /* convert that vorbis_comment into a ogg_packet */
+
+ vorbis_commentheader_out(&comment, &packet);
+ vorbis_comment_clear(&comment);
+
+ /* .. and send it into the ogg_stream_state */
+
+ ogg_stream_packetin(&encoder->os, &packet);
+ ogg_packet_clear(&packet);
return true;
}