if (srctemp->direction == GST_PAD_SRC &&
desttemp->direction == GST_PAD_SINK) {
- if (gst_caps_check_compatibility (gst_pad_template_get_caps (srctemp),
+ if (gst_caps_is_always_compatible (gst_pad_template_get_caps (srctemp),
gst_pad_template_get_caps (desttemp))) {
GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT,
"factory \"%s\" can connect with factory \"%s\"\n", GST_OBJECT_NAME (src),
if (gst_pad_get_direction(sinkpad) == GST_PAD_SINK &&
!GST_PAD_IS_CONNECTED(sinkpad))
{
- if (gst_caps_check_compatibility (gst_pad_get_caps(pad), gst_pad_get_caps(sinkpad))) {
+ if (gst_caps_is_always_compatible (gst_pad_get_caps(pad), gst_pad_get_caps(sinkpad))) {
gst_pad_connect(pad, sinkpad);
GST_DEBUG (0,"gstpipeline: autoconnect pad \"%s\" in element %s <-> ", GST_PAD_NAME (pad),
GST_ELEMENT_NAME(src));
GstPadTemplate *templ = GST_PAD_PAD_TEMPLATE (pad);
pads = g_list_next (pads);
- if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (templ), info->endcap)) {
+ if (gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (templ), info->endcap)) {
gchar *name;
name = g_strdup_printf ("src_%02d", info->i);
gboolean res;
if (IS_CAPS (src) && IS_CAPS (dest)) {
- res = gst_caps_check_compatibility ((GstCaps *)src, (GstCaps *)dest);
+ res = gst_caps_is_always_compatible ((GstCaps *)src, (GstCaps *)dest);
}
else if (IS_CAPS (src)) {
res = gst_element_factory_can_sink_caps ((GstElementFactory *)dest, (GstCaps *)src);
GstPad *pad = GST_PAD (pads->data);
GstPadTemplate *templ = GST_PAD_PAD_TEMPLATE (pad);
- if (gst_caps_check_compatibility (srccaps, GST_PAD_TEMPLATE_CAPS (templ))) {
+ if (gst_caps_is_always_compatible (srccaps, GST_PAD_TEMPLATE_CAPS (templ))) {
gst_element_add_ghost_pad (result, pad, "sink");
break;
}
GstPadTemplate *templ = GST_PAD_PAD_TEMPLATE (pad);
pads = g_list_next (pads);
- if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (templ), endcap)) {
+ if (gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (templ), endcap)) {
gchar *name;
name = g_strdup_printf ("src_%02d", i);
GstPadTemplate *template = (GstPadTemplate *)templates->data;
if (template->direction == direction && direction == GST_PAD_SRC) {
- if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (template), caps))
+ if (gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (template), caps))
return template;
}
else if (template->direction == direction && direction == GST_PAD_SINK) {
- if (gst_caps_check_compatibility (caps, GST_PAD_TEMPLATE_CAPS (template)))
+ if (gst_caps_is_always_compatible (caps, GST_PAD_TEMPLATE_CAPS (template)))
return template;
}
templates = g_list_next (templates);
desttemps = g_list_next (desttemps);
if (desttemp->direction == GST_PAD_SINK && desttemp->presence != GST_PAD_REQUEST) {
- if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (srctemp), GST_PAD_TEMPLATE_CAPS (desttemp))) {
+ if (gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (srctemp), GST_PAD_TEMPLATE_CAPS (desttemp))) {
GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT,
"factory \"%s\" can connect with factory \"%s\"",
GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest));
gboolean res;
if (IS_CAPS (src) && IS_CAPS (dest)) {
- res = gst_caps_check_compatibility ((GstCaps *)src, (GstCaps *)dest);
+ res = gst_caps_is_always_compatible ((GstCaps *)src, (GstCaps *)dest);
/*GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"caps %d to caps %d %d", ((GstCaps *)src)->id, ((GstCaps *)dest)->id, res); */
}
else if (IS_CAPS (src)) {
GstPad *pad = GST_PAD (pads->data);
GstPadTemplate *templ = GST_PAD_PAD_TEMPLATE (pad);
- if (gst_caps_check_compatibility (srccaps, GST_PAD_TEMPLATE_CAPS (templ))) {
+ if (gst_caps_is_always_compatible (srccaps, GST_PAD_TEMPLATE_CAPS (templ))) {
gst_element_add_ghost_pad (result, pad, "sink");
break;
}
}
/**
- * gst_caps_check_compatibility:
- * @fromcaps: a capabilty
- * @tocaps: a capabilty
+ * gst_caps_is_always_compatible:
+ * @fromcaps: a #GstCaps capability to check compatibility of.
+ * @tocaps: the #GstCaps capabilty to check compatibility with.
*
- * Checks whether two capabilities are compatible.
+ * Checks if a connection is always possible from fromcaps to tocaps, for all
+ * possible capabilities.
*
- * Returns: TRUE if compatible, FALSE otherwise
+ * Returns: TRUE if compatible under all circumstances, FALSE otherwise.
*/
gboolean
-gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps)
+gst_caps_is_always_compatible (GstCaps *fromcaps, GstCaps *tocaps)
{
if (fromcaps == NULL) {
if (tocaps == NULL) {
- GST_DEBUG (GST_CAT_CAPS,"no caps");
+ /* if both are NULL, they can always connect. Think filesrc ! filesink */
+ GST_DEBUG (GST_CAT_CAPS, "both caps NULL, compatible");
return TRUE;
}
else {
- GST_DEBUG (GST_CAT_CAPS,"no source but destination caps");
+ /* if source caps are NULL, it could be sending anything, so the
+ * destination can't know if it can accept this. Think filesrc ! mad */
+ GST_DEBUG (GST_CAT_CAPS, "source caps NULL, not guaranteed compatible");
return FALSE;
}
}
else {
if (tocaps == NULL) {
- GST_DEBUG (GST_CAT_CAPS,"source caps and no destination caps");
+ /* if the dest caps are NULL, the element can accept anything, always,
+ * so they're compatible by definition. Think mad ! filesink */
+ GST_DEBUG (GST_CAT_CAPS,"destination caps NULL");
return TRUE;
}
}
GstCaps* gst_caps_append (GstCaps *caps, GstCaps *capstoadd);
GstCaps* gst_caps_prepend (GstCaps *caps, GstCaps *capstoadd);
-gboolean gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps);
+gboolean gst_caps_is_always_compatible (GstCaps *fromcaps, GstCaps *tocaps);
GstCaps* gst_caps_intersect (GstCaps *caps1, GstCaps *caps2);
GstCaps* gst_caps_normalize (GstCaps *caps);
if (padtempl->direction == GST_PAD_SRC &&
compattempl->direction == GST_PAD_SINK) {
GST_DEBUG (GST_CAT_CAPS, "compatible direction: found src pad template");
- comp = gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (padtempl),
+ comp = gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (padtempl),
GST_PAD_TEMPLATE_CAPS (compattempl));
GST_DEBUG(GST_CAT_CAPS, "caps are %scompatible", (comp ? "" : "not "));
} else if (padtempl->direction == GST_PAD_SINK &&
compattempl->direction == GST_PAD_SRC) {
GST_DEBUG (GST_CAT_CAPS, "compatible direction: found sink pad template");
- comp = gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (compattempl),
+ comp = gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (compattempl),
GST_PAD_TEMPLATE_CAPS (padtempl));
GST_DEBUG (GST_CAT_CAPS, "caps are %scompatible", (comp ? "" : "not "));
}
destpads = gst_element_get_pad_list (dest);
if (srcpads || destpads) {
+ GST_DEBUG (GST_CAT_ELEMENT_PADS, "looping through src and dest pads");
/* loop through the existing pads in the source, trying to find a
* compatible destination pad */
while (srcpads) {
srcpad = (GstPad *) GST_PAD_REALIZE (srcpads->data);
+ GST_DEBUG (GST_CAT_ELEMENT_PADS, "trying src pad %s:%s",
+ GST_DEBUG_PAD_NAME (srcpad));
if ((GST_RPAD_DIRECTION (srcpad) == GST_PAD_SRC) &&
(GST_PAD_PEER (srcpad) == NULL)) {
destpad = gst_element_get_compatible_pad_filtered (dest, srcpad,
/* loop through the existing pads in the destination */
while (destpads) {
destpad = (GstPad *) GST_PAD_REALIZE (destpads->data);
+ GST_DEBUG (GST_CAT_ELEMENT_PADS, "trying dest pad %s:%s",
+ GST_DEBUG_PAD_NAME (destpad));
if ((GST_RPAD_DIRECTION (destpad) == GST_PAD_SINK) &&
(GST_PAD_PEER (destpad) == NULL)) {
srcpad = gst_element_get_compatible_pad_filtered (src, destpad,
desttempl = (GstPadTemplate*) desttempls->data;
if (desttempl->presence == GST_PAD_REQUEST &&
desttempl->direction != srctempl->direction) {
- if (gst_caps_check_compatibility (gst_pad_template_get_caps (srctempl),
+ if (gst_caps_is_always_compatible (gst_pad_template_get_caps (srctempl),
gst_pad_template_get_caps (desttempl))) {
srcpad = gst_element_get_request_pad (src,
srctempl->name_template);
GstPadTemplate *template = (GstPadTemplate *)templates->data;
if (template->direction == GST_PAD_SRC) {
- if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (template), caps))
+ if (gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (template), caps))
return TRUE;
}
templates = g_list_next (templates);
GstPadTemplate *template = (GstPadTemplate *)templates->data;
if (template->direction == GST_PAD_SINK) {
- if (gst_caps_check_compatibility (caps, GST_PAD_TEMPLATE_CAPS (template)))
+ if (gst_caps_is_always_compatible (caps, GST_PAD_TEMPLATE_CAPS (template)))
return TRUE;
}
templates = g_list_next (templates);
/* first take the intersection of the pad caps */
intersection = gst_caps_intersect (srccaps, sinkcaps);
+ gst_caps_debug (intersection, "caps of intersection");
/* if we have no intersection but one of the caps was not NULL.. */
if (!intersection && (srccaps || sinkcaps)) {
g_return_val_if_fail (GST_IS_PAD (sinkpad), FALSE);
if (GST_PAD_CAPS (srcpad) && GST_PAD_CAPS (sinkpad)) {
- if (!gst_caps_check_compatibility (GST_PAD_CAPS (srcpad),
- GST_PAD_CAPS (sinkpad))) {
+ if (!gst_caps_is_always_compatible (GST_PAD_CAPS (srcpad),
+ GST_PAD_CAPS (sinkpad))) {
return FALSE;
}
else {