pad: add 2 new caps methods

Add method to get the currently configured caps on the pad.
Add a method to check if caps are configured on a pad.
This commit is contained in:
Wim Taymans 2011-05-06 19:03:33 +02:00
parent b35a700d3e
commit 62b1a5a7be
2 changed files with 52 additions and 1 deletions

View file

@ -2253,6 +2253,54 @@ done:
return result;
}
/**
* gst_pad_has_current_caps:
* @pad: a #GstPad to check
*
* Check if @pad has caps set on it with gst_pad_set_caps().
*
* Returns: TRUE when @pad has caps associated with it.
*/
gboolean
gst_pad_has_current_caps (GstPad * pad)
{
gboolean result;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
GST_OBJECT_LOCK (pad);
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "check current pad caps");
result = (get_pad_caps (pad) != NULL);
GST_OBJECT_UNLOCK (pad);
return result;
}
/**
* gst_pad_get_current_caps:
* @pad: a #GstPad to get the current capabilities of.
*
* Gets the capabilities currently configured on @pad with the last call to
* gst_pad_set_caps().
*
* Returns: the current caps of the pad with incremented ref-count.
*/
GstCaps *
gst_pad_get_current_caps (GstPad * pad)
{
GstCaps *result;
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
GST_OBJECT_LOCK (pad);
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "get current pad caps");
if ((result = get_pad_caps (pad)))
gst_caps_ref (result);
GST_OBJECT_UNLOCK (pad);
return result;
}
/**
* gst_pad_get_caps:
* @pad: a #GstPad to get the capabilities of.
@ -2287,6 +2335,7 @@ gst_pad_get_caps (GstPad * pad)
return result;
}
/**
* gst_pad_peer_get_caps:
* @pad: a #GstPad to get the capabilities of.

View file

@ -850,6 +850,8 @@ void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps
G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
/* capsnego function for linked/unlinked pads */
GstCaps * gst_pad_get_current_caps (GstPad * pad);
gboolean gst_pad_has_current_caps (GstPad * pad);
GstCaps * gst_pad_get_caps (GstPad * pad);
void gst_pad_fixate_caps (GstPad * pad, GstCaps *caps);
gboolean gst_pad_accept_caps (GstPad * pad, GstCaps *caps);
@ -860,7 +862,7 @@ gboolean gst_pad_peer_accept_caps (GstPad * pad, GstCaps *caps);
/* capsnego for linked pads */
GstCaps * gst_pad_get_allowed_caps (GstPad * pad);
GstCaps * gst_pad_get_negotiated_caps (GstPad * pad);
GstCaps * gst_pad_get_negotiated_caps (GstPad * pad);
/* data passing functions to peer */
GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);