gstcontext: Added gst_clear_context()

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

View file

@ -49760,6 +49760,24 @@ reference count of the caps is decreased and the pointer is set to %NULL.</doc>
</parameter>
</parameters>
</function>
<function name="clear_context" c:identifier="gst_clear_context" version="1.24" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.c">Clears a reference to a #GstContext.
@context_ptr must not be `NULL`.
If the reference is `NULL` then this function does nothing. Otherwise, the
reference count of the context is decreased and the pointer is set to `NULL`.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstcontext.h"/>
<return-value transfer-ownership="none">
<type name="none" c:type="void"/>
</return-value>
<parameters>
<parameter name="context_ptr" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.c">a pointer to a #GstContext reference</doc>
<type name="Context" c:type="GstContext**"/>
</parameter>
</parameters>
</function>
<function name="clear_event" c:identifier="gst_clear_event" version="1.16" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.c">Clears a reference to a #GstEvent.

View file

@ -316,6 +316,25 @@ gst_context_unref (GstContext * context)
gst_mini_object_unref (GST_MINI_OBJECT_CAST (context));
}
/**
* gst_clear_context: (skip)
* @context_ptr: a pointer to a #GstContext reference
*
* Clears a reference to a #GstContext.
*
* @context_ptr must not be `NULL`.
*
* If the reference is `NULL` then this function does nothing. Otherwise, the
* reference count of the context is decreased and the pointer is set to `NULL`.
*
* Since: 1.24
*/
void
gst_clear_context (GstContext ** context_ptr)
{
gst_clear_mini_object ((GstMiniObject **) context_ptr);
}
/**
* gst_context_copy:
* @context: the context to copy

View file

@ -59,6 +59,12 @@ gst_context_unref (GstContext * context)
gst_mini_object_unref (GST_MINI_OBJECT_CAST (context));
}
static inline void
gst_clear_context (GstContext ** context_ptr)
{
gst_clear_mini_object ((GstMiniObject **) context_ptr);
}
/* copy context */
static inline GstContext *
gst_context_copy (const GstContext * context)
@ -72,6 +78,9 @@ GstContext * gst_context_ref (GstContext * context);
GST_API
void gst_context_unref (GstContext * context);
GST_API
void gst_clear_context (GstContext ** context_ptr);
GST_API
GstContext * gst_context_copy (const GstContext * context);
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */