mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
pad: Let template related functions return new references
gst_pad_template_get_caps(), gst_pad_get_pad_template_caps() and gst_pad_get_pad_template() return a new reference of the caps or template now and the return value needs to be unreffed after usage.
This commit is contained in:
parent
50f91c0825
commit
b5bc5b459a
4 changed files with 27 additions and 14 deletions
|
@ -88,6 +88,14 @@ The 0.11 porting guide
|
|||
gst_pad_proxy_getcaps() now takes a GstCaps* parameter to inform
|
||||
the other side about the possible caps and preferences.
|
||||
|
||||
gst_pad_get_pad_template_caps() and gst_pad_get_pad_template()
|
||||
return a new reference of the caps or template now and the return
|
||||
value needs to be unreffed after usage.
|
||||
|
||||
* GstPadTemplate
|
||||
gst_pad_template_get_caps() returns a new reference of the caps
|
||||
and the return value needs to be unreffed after usage.
|
||||
|
||||
* GstMiniObject
|
||||
A miniobject is now a simple refcounted structure holding the information
|
||||
common to buffers, events, messages, queries and caps.
|
||||
|
|
22
gst/gstpad.c
22
gst/gstpad.c
|
@ -2171,19 +2171,21 @@ gst_pad_set_pad_template (GstPad * pad, GstPadTemplate * templ)
|
|||
*
|
||||
* Gets the template for @pad.
|
||||
*
|
||||
* Returns: (transfer none): the #GstPadTemplate from which this pad was
|
||||
* instantiated, or %NULL if this pad has no template.
|
||||
*
|
||||
* FIXME: currently returns an unrefcounted padtemplate.
|
||||
* Returns: (transfer full): the #GstPadTemplate from which this pad was
|
||||
* instantiated, or %NULL if this pad has no template. Unref after
|
||||
* usage.
|
||||
*/
|
||||
GstPadTemplate *
|
||||
gst_pad_get_pad_template (GstPad * pad)
|
||||
{
|
||||
GstPadTemplate *templ;
|
||||
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
|
||||
|
||||
return GST_PAD_PAD_TEMPLATE (pad);
|
||||
}
|
||||
templ = GST_PAD_PAD_TEMPLATE (pad);
|
||||
|
||||
return (templ ? gst_object_ref (templ) : NULL);
|
||||
}
|
||||
|
||||
/* should be called with the pad LOCK held */
|
||||
/* refs the caps, so caller is responsible for getting it unreffed */
|
||||
|
@ -2815,10 +2817,10 @@ no_function:
|
|||
*
|
||||
* Gets the capabilities for @pad's template.
|
||||
*
|
||||
* Returns: (transfer none): the #GstCaps of this pad template. If you intend
|
||||
* to keep a reference on the caps, make a copy (see gst_caps_copy ()).
|
||||
* Returns: (transfer full): the #GstCaps of this pad template.
|
||||
* Unref after usage.
|
||||
*/
|
||||
const GstCaps *
|
||||
GstCaps *
|
||||
gst_pad_get_pad_template_caps (GstPad * pad)
|
||||
{
|
||||
static GstStaticCaps anycaps = GST_STATIC_CAPS ("ANY");
|
||||
|
@ -2826,7 +2828,7 @@ gst_pad_get_pad_template_caps (GstPad * pad)
|
|||
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
|
||||
|
||||
if (GST_PAD_PAD_TEMPLATE (pad))
|
||||
return GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (pad));
|
||||
return gst_pad_template_get_caps (GST_PAD_PAD_TEMPLATE (pad));
|
||||
|
||||
return gst_static_caps_get (&anycaps);
|
||||
}
|
||||
|
|
|
@ -846,7 +846,7 @@ void gst_pad_set_acceptcaps_function (GstPad *pad, GstPadAcceptCapsFunction a
|
|||
void gst_pad_set_fixatecaps_function (GstPad *pad, GstPadFixateCapsFunction fixatecaps);
|
||||
void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps);
|
||||
|
||||
G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
|
||||
GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
|
||||
|
||||
/* capsnego function for linked/unlinked pads */
|
||||
GstCaps * gst_pad_get_current_caps (GstPad * pad);
|
||||
|
|
|
@ -397,15 +397,18 @@ gst_static_pad_template_get_caps (GstStaticPadTemplate * templ)
|
|||
*
|
||||
* Gets the capabilities of the pad template.
|
||||
*
|
||||
* Returns: (transfer none): the #GstCaps of the pad template. If you need to
|
||||
* keep a reference to the caps, take a ref (see gst_caps_ref ()).
|
||||
* Returns: (transfer full): the #GstCaps of the pad template.
|
||||
* Unref after usage.
|
||||
*/
|
||||
GstCaps *
|
||||
gst_pad_template_get_caps (GstPadTemplate * templ)
|
||||
{
|
||||
GstCaps *caps;
|
||||
g_return_val_if_fail (GST_IS_PAD_TEMPLATE (templ), NULL);
|
||||
|
||||
return GST_PAD_TEMPLATE_CAPS (templ);
|
||||
caps = GST_PAD_TEMPLATE_CAPS (templ);
|
||||
|
||||
return (caps ? gst_caps_ref (caps) : NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue