aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-15 18:36:26 +0100
committerMax Kellermann <max@duempel.org>2009-03-15 18:36:26 +0100
commit4bb84c05d7b701a55143af9431afd6b61eee31e2 (patch)
tree776687e2e7f341aefbc8ec989d19807fd9055917
parent3333502edbd9e4a54c14f003606ce9ad5fe0cfe7 (diff)
downloadmpd-4bb84c05d7b701a55143af9431afd6b61eee31e2.tar.gz
mpd-4bb84c05d7b701a55143af9431afd6b61eee31e2.tar.xz
mpd-4bb84c05d7b701a55143af9431afd6b61eee31e2.zip
vorbis_encoder: removed vorbis_encoder.vc
Allocate the vorbis_comment object when it's used. It is not used anymore in vorbis_encoder_tag().
-rw-r--r--src/encoder/vorbis_encoder.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/encoder/vorbis_encoder.c b/src/encoder/vorbis_encoder.c
index a1ff89388..cbf227c22 100644
--- a/src/encoder/vorbis_encoder.c
+++ b/src/encoder/vorbis_encoder.c
@@ -47,7 +47,6 @@ struct vorbis_encoder {
vorbis_dsp_state vd;
vorbis_block vb;
vorbis_info vi;
- vorbis_comment vc;
bool flush;
};
@@ -177,7 +176,6 @@ vorbis_encoder_reinit(struct vorbis_encoder *encoder, GError **error)
vorbis_analysis_init(&encoder->vd, &encoder->vi);
vorbis_block_init(&encoder->vd, &encoder->vb);
ogg_stream_init(&encoder->os, g_random_int());
- vorbis_comment_init(&encoder->vc);
return true;
}
@@ -185,14 +183,19 @@ vorbis_encoder_reinit(struct vorbis_encoder *encoder, GError **error)
static void
vorbis_encoder_send_header(struct vorbis_encoder *encoder)
{
+ vorbis_comment vc;
ogg_packet packet, comments, codebooks;
- vorbis_analysis_headerout(&encoder->vd, &encoder->vc,
+ vorbis_comment_init(&vc);
+
+ vorbis_analysis_headerout(&encoder->vd, &vc,
&packet, &comments, &codebooks);
ogg_stream_packetin(&encoder->os, &packet);
ogg_stream_packetin(&encoder->os, &comments);
ogg_stream_packetin(&encoder->os, &codebooks);
+
+ vorbis_comment_clear(&vc);
}
static bool
@@ -223,7 +226,6 @@ vorbis_encoder_open(struct encoder *_encoder,
static void
vorbis_encoder_clear(struct vorbis_encoder *encoder)
{
- vorbis_comment_clear(&encoder->vc);
ogg_stream_clear(&encoder->os);
vorbis_block_clear(&encoder->vb);
vorbis_dsp_clear(&encoder->vd);