+2005-09-27 Wim Taymans <wim@fluendo.com>
+
+ * gst/elements/gsttee.c: (gst_tee_init), (gst_tee_do_push):
+ * gst/gstutils.c: (intersect_caps_func), (gst_pad_proxy_getcaps),
+ (link_fold_func), (gst_pad_proxy_setcaps):
+ Leak fixes, the fold functions need to unref the passed object and
+ _get_parent_*() returns ref to parent.
+
2005-09-27 Tim-Philipp Müller <tim at centricular dot net>
* check/gst/gstbuffer.c: (test_make_writable):
tee->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
"sink");
- gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
gst_pad_set_setcaps_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
gst_pad_set_getcaps_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
+ gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
tee->last_message = NULL;
}
res = gst_pad_push (pad, gst_buffer_ref (data->buffer));
g_value_set_enum (ret, res);
+ gst_object_unref (pad);
+
return (res == GST_FLOW_OK);
}
gst_caps_unref (existing);
gst_caps_unref (peercaps);
}
+ gst_object_unref (pad);
return TRUE;
}
&ret, pad);
gst_iterator_free (iter);
- if (res != GST_ITERATOR_DONE) {
- g_warning ("Pad list changed during capsnego for element %s",
- GST_ELEMENT_NAME (element));
- return NULL;
- }
+ if (res != GST_ITERATOR_DONE)
+ goto pads_changed;
+
+ gst_object_unref (element);
caps = g_value_get_pointer (&ret);
g_value_unset (&ret);
gst_caps_unref (caps);
return intersected;
+
+ /* ERRORS */
+pads_changed:
+ {
+ g_warning ("Pad list changed during capsnego for element %s",
+ GST_ELEMENT_NAME (element));
+ gst_object_unref (element);
+ return NULL;
+ }
}
typedef struct
success = gst_pad_set_caps (pad, data->caps);
g_value_set_boolean (ret, success);
}
+ gst_object_unref (pad);
return success;
}
GST_DEBUG ("proxying pad link for %s:%s", GST_DEBUG_PAD_NAME (pad));
element = gst_pad_get_parent_element (pad);
+ if (element == NULL)
+ return FALSE;
iter = gst_element_iterate_pads (element);
&ret, &data);
gst_iterator_free (iter);
- if (res != GST_ITERATOR_DONE) {
+ if (res != GST_ITERATOR_DONE)
+ goto pads_changed;
+
+ gst_object_unref (element);
+
+ /* ok not to unset the gvalue */
+ return g_value_get_boolean (&ret);
+
+ /* ERRORS */
+pads_changed:
+ {
g_warning ("Pad list changed during proxy_pad_link for element %s",
GST_ELEMENT_NAME (element));
+ gst_object_unref (element);
return FALSE;
}
-
- /* ok not to unset the gvalue */
- return g_value_get_boolean (&ret);
}
/**
tee->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
"sink");
- gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
gst_pad_set_setcaps_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
gst_pad_set_getcaps_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
+ gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
tee->last_message = NULL;
}
res = gst_pad_push (pad, gst_buffer_ref (data->buffer));
g_value_set_enum (ret, res);
+ gst_object_unref (pad);
+
return (res == GST_FLOW_OK);
}