From 4ec5de878461158e4eeebe0fd3e4a0c101eb2254 Mon Sep 17 00:00:00 2001 From: Jordan Yelloz Date: Wed, 29 Nov 2023 10:53:15 -0700 Subject: [PATCH] gstcontext: Added gst_clear_context() Part-of: --- girs/Gst-1.0.gir | 18 ++++++++++++++++++ subprojects/gstreamer/gst/gstcontext.c | 19 +++++++++++++++++++ subprojects/gstreamer/gst/gstcontext.h | 9 +++++++++ 3 files changed, 46 insertions(+) diff --git a/girs/Gst-1.0.gir b/girs/Gst-1.0.gir index e44d7aab70..ef131c7df0 100644 --- a/girs/Gst-1.0.gir +++ b/girs/Gst-1.0.gir @@ -49760,6 +49760,24 @@ reference count of the caps is decreased and the pointer is set to %NULL. + + 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`. + + + + + + + a pointer to a #GstContext reference + + + + Clears a reference to a #GstEvent. diff --git a/subprojects/gstreamer/gst/gstcontext.c b/subprojects/gstreamer/gst/gstcontext.c index 39e199a699..a1b90be2cd 100644 --- a/subprojects/gstreamer/gst/gstcontext.c +++ b/subprojects/gstreamer/gst/gstcontext.c @@ -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 diff --git a/subprojects/gstreamer/gst/gstcontext.h b/subprojects/gstreamer/gst/gstcontext.h index 92d8502b83..42a7d47798 100644 --- a/subprojects/gstreamer/gst/gstcontext.h +++ b/subprojects/gstreamer/gst/gstcontext.h @@ -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 */