+2006-02-06 Jan Schmidt <thaytan@mad.scientist.com>
+
+ * ext/theora/theoraenc.c: (gst_theora_enc_class_init),
+ (theora_enc_finalize), (theora_enc_sink_setcaps):
+ Add a finalize method to ensure we clean up state even if
+ someone omitted the state change back to NULL.
+
+ * ext/vorbis/vorbisenc.c: (gst_vorbisenc_metadata_set1),
+ (gst_vorbisenc_chain):
+ Free some more leaked bits.
+
+ * tests/check/pipelines/theoraenc.c: (start_pipeline),
+ (stop_pipeline):
+ Wait for state changes to happen if they're ASYNC.
+
+ This ought to teach those fancy pants buildbots a lesson.
+
2006-02-05 Jan Schmidt <thaytan@mad.scientist.com>
* gst-libs/gst/tag/gstid3tag.c:
GValue * value, GParamSpec * pspec);
static void theora_enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
+static void theora_enc_finalize (GObject * object);
static void
gst_theora_enc_base_init (gpointer g_class)
gobject_class->set_property = theora_enc_set_property;
gobject_class->get_property = theora_enc_get_property;
+ gobject_class->finalize = theora_enc_finalize;
g_object_class_install_property (gobject_class, ARG_CENTER,
g_param_spec_boolean ("center", "Center",
enc->info.keyframe_frequency_force, enc->granule_shift);
}
+static void
+theora_enc_finalize (GObject * object)
+{
+ GstTheoraEnc *enc = GST_THEORA_ENC (object);
+
+ theora_clear (&enc->state);
+ theora_comment_clear (&enc->comment);
+ theora_info_clear (&enc->info);
+}
+
static gboolean
theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
{
theora_encode_init (&enc->state, &enc->info);
+ gst_object_unref (enc);
+
return TRUE;
}
vorbis_comment_add_tag (&enc->vc, tmptag, vorbisvalue);
g_free (tmptag);
+ g_free (vorbisvalue);
}
}
}
gst_vorbisenc_set_metadata (vorbisenc);
vorbis_analysis_headerout (&vorbisenc->vd, &vorbisenc->vc, &header,
&header_comm, &header_code);
+ vorbis_comment_clear (&vorbisenc->vc);
/* create header buffers */
buf1 = gst_vorbisenc_buffer_from_header_packet (vorbisenc, &header);
static void
start_pipeline (GstElement * bin, GstPad * pad)
{
+ GstStateChangeReturn ret;
+
id = gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe), NULL);
cond = g_cond_new ();
lock = g_mutex_new ();
- gst_element_set_state (bin, GST_STATE_PLAYING);
-
+ ret = gst_element_set_state (bin, GST_STATE_PLAYING);
+ fail_if (ret == GST_STATE_CHANGE_FAILURE, "Could not start test pipeline");
+ if (ret == GST_STATE_CHANGE_ASYNC) {
+ ret = gst_element_get_state (bin, NULL, NULL, GST_CLOCK_TIME_NONE);
+ fail_if (ret != GST_STATE_CHANGE_SUCCESS, "Could not start test pipeline");
+ }
}
/* waits until the probe receives a buffer. will catch every buffer */
static void
stop_pipeline (GstElement * bin, GstPad * pad)
{
+ GstStateChangeReturn ret;
+
g_mutex_lock (lock);
if (buf)
gst_buffer_unref (buf);
g_cond_signal (cond);
g_mutex_unlock (lock);
- gst_element_set_state (bin, GST_STATE_NULL);
+ ret = gst_element_set_state (bin, GST_STATE_NULL);
+ fail_if (ret == GST_STATE_CHANGE_FAILURE, "Could not stop test pipeline");
+ if (ret == GST_STATE_CHANGE_ASYNC) {
+ ret = gst_element_get_state (bin, NULL, NULL, GST_CLOCK_TIME_NONE);
+ fail_if (ret != GST_STATE_CHANGE_SUCCESS, "Could not stop test pipeline");
+ }
g_mutex_lock (lock);
if (buf)