mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +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
|
gst_pad_proxy_getcaps() now takes a GstCaps* parameter to inform
|
||||||
the other side about the possible caps and preferences.
|
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
|
* GstMiniObject
|
||||||
A miniobject is now a simple refcounted structure holding the information
|
A miniobject is now a simple refcounted structure holding the information
|
||||||
common to buffers, events, messages, queries and caps.
|
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.
|
* Gets the template for @pad.
|
||||||
*
|
*
|
||||||
* Returns: (transfer none): the #GstPadTemplate from which this pad was
|
* Returns: (transfer full): the #GstPadTemplate from which this pad was
|
||||||
* instantiated, or %NULL if this pad has no template.
|
* instantiated, or %NULL if this pad has no template. Unref after
|
||||||
*
|
* usage.
|
||||||
* FIXME: currently returns an unrefcounted padtemplate.
|
|
||||||
*/
|
*/
|
||||||
GstPadTemplate *
|
GstPadTemplate *
|
||||||
gst_pad_get_pad_template (GstPad * pad)
|
gst_pad_get_pad_template (GstPad * pad)
|
||||||
{
|
{
|
||||||
|
GstPadTemplate *templ;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
|
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 */
|
/* should be called with the pad LOCK held */
|
||||||
/* refs the caps, so caller is responsible for getting it unreffed */
|
/* refs the caps, so caller is responsible for getting it unreffed */
|
||||||
|
@ -2815,10 +2817,10 @@ no_function:
|
||||||
*
|
*
|
||||||
* Gets the capabilities for @pad's template.
|
* Gets the capabilities for @pad's template.
|
||||||
*
|
*
|
||||||
* Returns: (transfer none): the #GstCaps of this pad template. If you intend
|
* Returns: (transfer full): the #GstCaps of this pad template.
|
||||||
* to keep a reference on the caps, make a copy (see gst_caps_copy ()).
|
* Unref after usage.
|
||||||
*/
|
*/
|
||||||
const GstCaps *
|
GstCaps *
|
||||||
gst_pad_get_pad_template_caps (GstPad * pad)
|
gst_pad_get_pad_template_caps (GstPad * pad)
|
||||||
{
|
{
|
||||||
static GstStaticCaps anycaps = GST_STATIC_CAPS ("ANY");
|
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);
|
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
|
||||||
|
|
||||||
if (GST_PAD_PAD_TEMPLATE (pad))
|
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);
|
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_fixatecaps_function (GstPad *pad, GstPadFixateCapsFunction fixatecaps);
|
||||||
void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps);
|
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 */
|
/* capsnego function for linked/unlinked pads */
|
||||||
GstCaps * gst_pad_get_current_caps (GstPad * pad);
|
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.
|
* Gets the capabilities of the pad template.
|
||||||
*
|
*
|
||||||
* Returns: (transfer none): the #GstCaps of the pad template. If you need to
|
* Returns: (transfer full): the #GstCaps of the pad template.
|
||||||
* keep a reference to the caps, take a ref (see gst_caps_ref ()).
|
* Unref after usage.
|
||||||
*/
|
*/
|
||||||
GstCaps *
|
GstCaps *
|
||||||
gst_pad_template_get_caps (GstPadTemplate * templ)
|
gst_pad_template_get_caps (GstPadTemplate * templ)
|
||||||
{
|
{
|
||||||
|
GstCaps *caps;
|
||||||
g_return_val_if_fail (GST_IS_PAD_TEMPLATE (templ), NULL);
|
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