+2005-11-15 Johan Dahlin <johan@gnome.org>
+
+ * gst/base/gstbasesrc.c: (gst_base_src_init):
+ * gst/elements/gsttypefindelement.c: (gst_type_find_element_init):
+ * gst/gstqueue.c: (gst_queue_init):
+ Free pad templates, fixes a couple of leaks.
+
2005-11-15 Daniel Fischer <dan at f3c dot com>
Reviewed by: Tim-Philipp Müller <tim at centricular dot net>
GST_DEBUG_OBJECT (basesrc, "creating src pad");
pad = gst_pad_new_from_template (pad_template, "src");
+ g_object_unref (pad_template);
GST_DEBUG_OBJECT (basesrc, "setting functions on src pad");
gst_pad_set_activatepush_function (pad,
gst_type_find_element_init (GstTypeFindElement * typefind,
GstTypeFindElementClass * g_class)
{
+ GstPadTemplate *sink_template, *src_template;
+
/* sinkpad */
- typefind->sink =
- gst_pad_new_from_template (gst_static_pad_template_get
- (&type_find_element_sink_template), "sink");
+ src_template = gst_static_pad_template_get (&type_find_element_sink_template);
+ typefind->sink = gst_pad_new_from_template (src_template, "sink");
+ g_object_unref (src_template);
+
gst_pad_set_activate_function (typefind->sink,
GST_DEBUG_FUNCPTR (gst_type_find_element_activate));
gst_pad_set_chain_function (typefind->sink,
gst_pad_set_event_function (typefind->sink,
GST_DEBUG_FUNCPTR (gst_type_find_element_handle_event));
gst_element_add_pad (GST_ELEMENT (typefind), typefind->sink);
+
/* srcpad */
- typefind->src =
- gst_pad_new_from_template (gst_static_pad_template_get
- (&type_find_element_src_template), "src");
+ sink_template = gst_static_pad_template_get (&type_find_element_src_template);
+ typefind->src = gst_pad_new_from_template (sink_template, "src");
+ g_object_unref (sink_template);
+
gst_pad_set_activatepull_function (typefind->src,
GST_DEBUG_FUNCPTR (gst_type_find_element_activate_src_pull));
gst_pad_set_checkgetrange_function (typefind->src,
static void
gst_queue_init (GstQueue * queue)
{
- queue->sinkpad =
- gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
- "sink");
+ GstPadTemplate *sink_template, *src_template;
+
+ sink_template = gst_static_pad_template_get (&sinktemplate);
+ queue->sinkpad = gst_pad_new_from_template (sink_template, "sink");
+ g_object_unref (sink_template);
+
gst_pad_set_chain_function (queue->sinkpad,
GST_DEBUG_FUNCPTR (gst_queue_chain));
gst_pad_set_activatepush_function (queue->sinkpad,
GST_DEBUG_FUNCPTR (gst_queue_bufferalloc));
gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
- queue->srcpad =
- gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate),
- "src");
+ src_template = gst_static_pad_template_get (&srctemplate);
+ queue->srcpad = gst_pad_new_from_template (src_template, "src");
+ g_object_unref (src_template);
+
gst_pad_set_activatepush_function (queue->srcpad,
GST_DEBUG_FUNCPTR (gst_queue_src_activate_push));
gst_pad_set_link_function (queue->srcpad,
GST_DEBUG_OBJECT (basesrc, "creating src pad");
pad = gst_pad_new_from_template (pad_template, "src");
+ g_object_unref (pad_template);
GST_DEBUG_OBJECT (basesrc, "setting functions on src pad");
gst_pad_set_activatepush_function (pad,
static void
gst_queue_init (GstQueue * queue)
{
- queue->sinkpad =
- gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
- "sink");
+ GstPadTemplate *sink_template, *src_template;
+
+ sink_template = gst_static_pad_template_get (&sinktemplate);
+ queue->sinkpad = gst_pad_new_from_template (sink_template, "sink");
+ g_object_unref (sink_template);
+
gst_pad_set_chain_function (queue->sinkpad,
GST_DEBUG_FUNCPTR (gst_queue_chain));
gst_pad_set_activatepush_function (queue->sinkpad,
GST_DEBUG_FUNCPTR (gst_queue_bufferalloc));
gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
- queue->srcpad =
- gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate),
- "src");
+ src_template = gst_static_pad_template_get (&srctemplate);
+ queue->srcpad = gst_pad_new_from_template (src_template, "src");
+ g_object_unref (src_template);
+
gst_pad_set_activatepush_function (queue->srcpad,
GST_DEBUG_FUNCPTR (gst_queue_src_activate_push));
gst_pad_set_link_function (queue->srcpad,
gst_type_find_element_init (GstTypeFindElement * typefind,
GstTypeFindElementClass * g_class)
{
+ GstPadTemplate *sink_template, *src_template;
+
/* sinkpad */
- typefind->sink =
- gst_pad_new_from_template (gst_static_pad_template_get
- (&type_find_element_sink_template), "sink");
+ src_template = gst_static_pad_template_get (&type_find_element_sink_template);
+ typefind->sink = gst_pad_new_from_template (src_template, "sink");
+ g_object_unref (src_template);
+
gst_pad_set_activate_function (typefind->sink,
GST_DEBUG_FUNCPTR (gst_type_find_element_activate));
gst_pad_set_chain_function (typefind->sink,
gst_pad_set_event_function (typefind->sink,
GST_DEBUG_FUNCPTR (gst_type_find_element_handle_event));
gst_element_add_pad (GST_ELEMENT (typefind), typefind->sink);
+
/* srcpad */
- typefind->src =
- gst_pad_new_from_template (gst_static_pad_template_get
- (&type_find_element_src_template), "src");
+ sink_template = gst_static_pad_template_get (&type_find_element_src_template);
+ typefind->src = gst_pad_new_from_template (sink_template, "src");
+ g_object_unref (sink_template);
+
gst_pad_set_activatepull_function (typefind->src,
GST_DEBUG_FUNCPTR (gst_type_find_element_activate_src_pull));
gst_pad_set_checkgetrange_function (typefind->src,