otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
if (GST_CAPS_IS_FIXED (caps))
- if (gst_pad_try_set_caps (otherpad, caps))
- return GST_PAD_CONNECT_OK;
- else
- return GST_PAD_CONNECT_REFUSED;
+ return gst_pad_try_set_caps (otherpad, caps);
else
return GST_PAD_CONNECT_DELAYED;
}
{
GstTee *tee;
GList *pads;
+ GstPadConnectReturn set_retval;
tee = GST_TEE (gst_pad_get_parent (pad));
if (GST_PAD_DIRECTION (outpad) != GST_PAD_SRC || !GST_PAD_IS_USABLE (outpad))
continue;
- if (!(gst_pad_try_set_caps (outpad, caps))) {
- return GST_PAD_CONNECT_REFUSED;
+ if ((set_retval = gst_pad_try_set_caps (outpad, caps)) <= 0) {
+ return set_retval;
}
}
return GST_PAD_CONNECT_OK;
*
* Tries to set the caps on the given pad.
*
- * Returns: TRUE if the caps could be set, FALSE otherwise.
+ * Returns: A GstPadConnectReturn value indicating whether the caps
+ * could be set.
*/
-gboolean
+GstPadConnectReturn
gst_pad_try_set_caps (GstPad *pad, GstCaps *caps)
{
GstRealPad *peer, *realpad;
+ GstPadConnectReturn set_retval;
realpad = GST_PAD_REALIZE (pad);
peer = GST_RPAD_PEER (realpad);
g_warning ("trying to set non fixed caps on pad %s:%s, not allowed",
GST_DEBUG_PAD_NAME (realpad));
gst_caps_debug (caps, "unfixed caps");
- return FALSE;
+ return GST_PAD_CONNECT_DELAYED;
}
/* if we have a peer try to set the caps, notifying the peerpad
* if it has a connect function */
- if (peer && (gst_pad_try_set_caps_func (peer, caps, TRUE) != GST_PAD_CONNECT_OK))
+ if (peer && ((set_retval = gst_pad_try_set_caps_func (peer, caps, TRUE)) <= 0))
{
- GST_INFO (GST_CAT_CAPS, "tried to set caps on peerpad %s:%s but couldn't",
- GST_DEBUG_PAD_NAME (peer));
- return FALSE;
+ GST_INFO (GST_CAT_CAPS, "tried to set caps on peerpad %s:%s but couldn't, return value %d",
+ GST_DEBUG_PAD_NAME (peer), set_retval);
+ return set_retval;
}
/* then try to set our own caps, we don't need to be notified */
- if (gst_pad_try_set_caps_func (realpad, caps, FALSE) != GST_PAD_CONNECT_OK)
+ if ((set_retval = gst_pad_try_set_caps_func (realpad, caps, FALSE)) <= 0)
{
- GST_INFO (GST_CAT_CAPS, "tried to set own caps on pad %s:%s but couldn't",
- GST_DEBUG_PAD_NAME (realpad));
- return FALSE;
+ GST_INFO (GST_CAT_CAPS, "tried to set own caps on pad %s:%s but couldn't, return value %d",
+ GST_DEBUG_PAD_NAME (realpad), set_retval);
+ return set_retval;
}
- GST_INFO (GST_CAT_CAPS, "succeeded setting caps %p on pad %s:%s",
- caps, GST_DEBUG_PAD_NAME (realpad));
+ GST_INFO (GST_CAT_CAPS, "succeeded setting caps %p on pad %s:%s, return value %d",
+ caps, GST_DEBUG_PAD_NAME (realpad), set_retval);
g_assert (GST_PAD_CAPS (pad));
- return TRUE;
+ return set_retval;
}
/* this is a caps negotiation convenience routine, it:
/* capsnego functions */
GstCaps* gst_pad_get_caps (GstPad *pad);
GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
-gboolean gst_pad_try_set_caps (GstPad *pad, GstCaps *caps);
+GstPadConnectReturn gst_pad_try_set_caps (GstPad *pad, GstCaps *caps);
gboolean gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad);
void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps);
gst_caps_get_name (caps));
typefind->caps = caps;
- if (!gst_pad_try_set_caps (pad, caps)) {
+ if (gst_pad_try_set_caps (pad, caps) <= 0) {
g_warning ("typefind: found type but peer didn't accept it");
}
otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
if (GST_CAPS_IS_FIXED (caps))
- if (gst_pad_try_set_caps (otherpad, caps))
- return GST_PAD_CONNECT_OK;
- else
- return GST_PAD_CONNECT_REFUSED;
+ return gst_pad_try_set_caps (otherpad, caps);
else
return GST_PAD_CONNECT_DELAYED;
}
{
GstTee *tee;
GList *pads;
+ GstPadConnectReturn set_retval;
tee = GST_TEE (gst_pad_get_parent (pad));
if (GST_PAD_DIRECTION (outpad) != GST_PAD_SRC || !GST_PAD_IS_USABLE (outpad))
continue;
- if (!(gst_pad_try_set_caps (outpad, caps))) {
- return GST_PAD_CONNECT_REFUSED;
+ if ((set_retval = gst_pad_try_set_caps (outpad, caps)) <= 0) {
+ return set_retval;
}
}
return GST_PAD_CONNECT_OK;
g_assert (src_caps != NULL);
g_print ("Setting caps on fakesrc's src pad\n");
pad = gst_element_get_pad (src, "src");
- if (! (gst_pad_try_set_caps (pad, src_caps)))
+ if ((gst_pad_try_set_caps (pad, src_caps)) <= 0)
{
g_print ("Could not set caps !\n");
}
g_assert (src_caps != NULL);
g_print ("Setting caps on fakesrc's src pad\n");
pad = gst_element_get_pad (src, "src");
- if (! (gst_pad_try_set_caps (pad, src_caps)))
+ if ((gst_pad_try_set_caps (pad, src_caps)) <= 0)
{
g_print ("Could not set caps !\n");
}