mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
This changes an important part of the plugin API, gst_pad_try_set_caps() no longer returns a boolean, it now returns ...
Original commit message from CVS: This changes an important part of the plugin API, gst_pad_try_set_caps() no longer returns a boolean, it now returns a GstPadConnectReturn, which makes much more sense than a boolean. All plugins have also been changed, so don't worry ;)
This commit is contained in:
parent
1cbfc22ca4
commit
5b5274daf2
9 changed files with 28 additions and 30 deletions
|
@ -163,10 +163,7 @@ gst_identity_connect (GstPad *pad, GstCaps *caps)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
|
|||
{
|
||||
GstTee *tee;
|
||||
GList *pads;
|
||||
GstPadConnectReturn set_retval;
|
||||
|
||||
tee = GST_TEE (gst_pad_get_parent (pad));
|
||||
|
||||
|
@ -140,8 +141,8 @@ gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
|
|||
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;
|
||||
|
|
30
gst/gstpad.c
30
gst/gstpad.c
|
@ -1337,12 +1337,14 @@ gst_pad_try_set_caps_func (GstRealPad *pad, GstCaps *caps, gboolean notify)
|
|||
*
|
||||
* 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);
|
||||
|
@ -1360,30 +1362,30 @@ gst_pad_try_set_caps (GstPad *pad, GstCaps *caps)
|
|||
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:
|
||||
|
|
|
@ -430,7 +430,7 @@ GstPad* gst_pad_get_peer (GstPad *pad);
|
|||
/* 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);
|
||||
|
|
|
@ -188,7 +188,7 @@ gst_type_find_chain (GstPad *pad, GstBuffer *buf)
|
|||
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");
|
||||
}
|
||||
|
||||
|
|
|
@ -163,10 +163,7 @@ gst_identity_connect (GstPad *pad, GstCaps *caps)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
|
|||
{
|
||||
GstTee *tee;
|
||||
GList *pads;
|
||||
GstPadConnectReturn set_retval;
|
||||
|
||||
tee = GST_TEE (gst_pad_get_parent (pad));
|
||||
|
||||
|
@ -140,8 +141,8 @@ gst_tee_sinkconnect (GstPad *pad, GstCaps *caps)
|
|||
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;
|
||||
|
|
|
@ -109,7 +109,7 @@ main (int argc, char *argv[])
|
|||
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");
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ main (int argc, char *argv[])
|
|||
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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue