+2005-05-11 Wim Taymans <wim@fluendo.com>
+
+ * gst/gstelement.c: (gst_element_add_pad), (gst_element_query):
+ * gst/gstutils.c: (gst_element_get_compatible_pad_template),
+ (gst_element_link_pads), (gst_element_query_position),
+ (gst_element_query_convert), (intersect_caps_func),
+ (gst_pad_query_position), (gst_pad_query_convert):
+ Fix refcounting in utils function.
+ No point in trying to activate a pad when it's added, it could
+ be added from the state change function and then we deadlock, the
+ element has to decide what to do.
+
2005-05-10 Andy Wingo <wingo@pobox.com>
* gst/elements/gstfakesink.c (gst_fakesink_render): Er, emit with
* Adds a pad (link point) to @element. @pad's parent will be set to @element;
* see gst_object_set_parent() for refcounting information.
*
- * Pads are automatically activated when the element is in state PLAYING.
+ * Pads are not automatically activated so elements should perform the needed
+ * steps to activate the pad.
*
* The pad and the element should be unlocked when calling this function.
*
element->pads_cookie++;
GST_UNLOCK (element);
- GST_STATE_LOCK (element);
- /* activate pad when we are playing */
- if (GST_STATE (element) == GST_STATE_PLAYING)
- /* FIXME, figure out mode */
- gst_pad_set_active (pad, GST_ACTIVATE_PUSH);
- GST_STATE_UNLOCK (element);
-
/* emit the NEW_PAD signal */
g_signal_emit (G_OBJECT (element), gst_element_signals[NEW_PAD], 0, pad);
GST_DEBUG_PAD_NAME (srcpad));
if ((GST_PAD_DIRECTION (srcpad) == GST_PAD_SRC) &&
(GST_PAD_PEER (srcpad) == NULL)) {
- GstPad *temp = destpadname ? destpad :
- gst_element_get_compatible_pad (dest, srcpad, NULL);
+ GstPad *temp;
+
+ if (destpadname) {
+ temp = destpad;
+ gst_object_ref (GST_OBJECT (temp));
+ } else {
+ temp = gst_element_get_compatible_pad (dest, srcpad, NULL);
+ gst_object_ref (GST_OBJECT (temp));
+ }
if (temp && gst_pad_link (srcpad, temp) == GST_PAD_LINK_OK) {
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s",
gst_object_unref (GST_OBJECT (destpad));
return FALSE;
} else {
- gst_object_unref (GST_OBJECT (srcpad));
+ if (srcpad)
+ gst_object_unref (GST_OBJECT (srcpad));
srcpad = NULL;
}
if (destpad) {