gstpromise: Added gst_clear_promise()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5756>
This commit is contained in:
Jordan Yelloz 2023-11-29 08:46:49 -07:00 committed by GStreamer Marge Bot
parent 14c7d3f4e9
commit ac6952e936
3 changed files with 46 additions and 0 deletions

View file

@ -49840,6 +49840,24 @@ pointer casts.</doc>
</parameter>
</parameters>
</function>
<function name="clear_promise" c:identifier="gst_clear_promise" version="1.24" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstpromise.c">Clears a reference to a #GstPromise.
@promise_ptr must not be `NULL`.
If the reference is `NULL` then this function does nothing. Otherwise, the
reference count of the promise is decreased and the pointer is set to `NULL`.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstpromise.h"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<parameter name="promise_ptr" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstpromise.c">a pointer to a #GstPromise reference</doc>
<type name="Promise" c:type="GstPromise**"/>
</parameter>
</parameters>
</function>
<function name="clear_query" c:identifier="gst_clear_query" version="1.16" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.c">Clears a reference to a #GstQuery.

View file

@ -440,3 +440,22 @@ gst_promise_unref (GstPromise * promise)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (promise));
}
/**
* gst_clear_promise: (skip)
* @promise_ptr: a pointer to a #GstPromise reference
*
* Clears a reference to a #GstPromise.
*
* @promise_ptr must not be `NULL`.
*
* If the reference is `NULL` then this function does nothing. Otherwise, the
* reference count of the promise is decreased and the pointer is set to `NULL`.
*
* Since: 1.24
*/
void
gst_clear_promise (GstPromise ** promise_ptr)
{
gst_clear_mini_object ((GstMiniObject **) promise_ptr);
}

View file

@ -106,12 +106,21 @@ gst_promise_unref (GstPromise * promise)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (promise));
}
static inline void
gst_clear_promise (GstPromise ** promise_ptr)
{
gst_clear_mini_object ((GstMiniObject **) promise_ptr);
}
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
GST_API
GstPromise * gst_promise_ref (GstPromise * promise);
GST_API
void gst_promise_unref (GstPromise * promise);
GST_API
void gst_clear_promise (GstPromise ** promise_ptr);
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPromise, gst_promise_unref)