g_return_val_if_fail (pad != NULL, NULL);
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
+ GST_DEBUG ("finding pad in %s compatible with %s:%s",
+ GST_ELEMENT_NAME (element), GST_DEBUG_PAD_NAME (pad));
+
/* let's use the real pad */
pad = (GstPad *) GST_PAD_REALIZE (pad);
g_return_val_if_fail (pad != NULL, NULL);
/* try to create a new one */
/* requesting is a little crazy, we need a template. Let's create one */
+ templcaps = gst_pad_get_caps (pad);
if (filtercaps != NULL) {
- templcaps = gst_caps_intersect (filtercaps, (GstCaps *) GST_RPAD_CAPS (pad));
- /* FIXME */
- if (templcaps == NULL)
- return NULL;
- } else {
- templcaps = gst_caps_copy (gst_pad_get_caps (pad));
+ GstCaps *temp;
+ temp = gst_caps_intersect (filtercaps, templcaps);
+ gst_caps_free (templcaps);
+ templcaps = temp;
}
- templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad), GST_RPAD_DIRECTION (pad),
- GST_PAD_ALWAYS, templcaps);
+ templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad),
+ GST_RPAD_DIRECTION (pad), GST_PAD_ALWAYS, templcaps);
foundpad = gst_element_request_compatible_pad (element, templ);
- gst_object_unref (GST_OBJECT (templ)); /* this will take care of the caps too */
+ gst_object_unref (GST_OBJECT (templ));
+
+ if (foundpad) return foundpad;
- /* FIXME: this is broken, but it's in here so autoplugging elements that don't
- have caps on their source padtemplates (spider) can link... */
- if (!foundpad && !filtercaps) {
- templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad), GST_RPAD_DIRECTION (pad),
- GST_PAD_ALWAYS, gst_caps_new_any());
+ /* FIXME: this is broken, but it's in here so autoplugging elements
+ * that don't have caps on their source padtemplates (spider) can
+ * link... */
+ //g_warning("got here");
+ //if (filtercaps == NULL) {
+ templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad),
+ GST_RPAD_DIRECTION (pad), GST_PAD_ALWAYS, gst_caps_new_any());
foundpad = gst_element_request_compatible_pad (element, templ);
gst_object_unref (GST_OBJECT (templ));
- }
+
+ if (foundpad) return foundpad;
+ //}
- return foundpad;
+ g_critical("could not find a compatible pad");
+
+ return NULL;
}
/**
g_return_if_fail (caps != NULL);
g_return_if_fail (!gst_caps_is_empty(caps));
+ GST_DEBUG_CAPS ("trying to fixate caps", caps);
+
while (!gst_caps_is_fixed (caps)) {
if (link->app_fixate) {
newcaps = (link->app_fixate) (GST_PAD (link->srcpad), caps, NULL);
if (newcaps) {
caps = newcaps;
+ GST_DEBUG_CAPS ("app fixated to", caps);
continue;
}
}
caps, NULL);
if (newcaps) {
caps = newcaps;
+ GST_DEBUG_CAPS ("src pad fixated to", caps);
continue;
}
}
caps, NULL);
if (newcaps) {
caps = newcaps;
+ GST_DEBUG_CAPS ("sink pad fixated to", caps);
continue;
}
}
caps = _gst_pad_default_fixate_func (GST_PAD(link->srcpad), caps, NULL);
+ GST_DEBUG_CAPS ("core fixated to", caps);
}
GST_DEBUG_CAPS ("fixate decided on", caps);
GstRealPad *realsrc, *realsink;
GstPadLink *link;
- /* FIXME This function is gosss. It's almost a direct copy of
+ /* FIXME This function is gross. It's almost a direct copy of
* gst_pad_link_filtered(). Any decent programmer would attempt
* to merge the two functions, which I will do some day. --ds
*/
link->sinkcaps = gst_pad_get_caps (link->sinkpad);
if (filtercaps) link->filtercaps = gst_caps_copy (filtercaps);
- if (!gst_pad_link_ready_for_negotiation (link)) {
- return FALSE;
- }
-
gst_pad_link_intersect (link);
if (gst_caps_is_empty (link->caps))
return FALSE;