diff --git a/girs/Gst-1.0.gir b/girs/Gst-1.0.gir index 6b50e782d5..e44d7aab70 100644 --- a/girs/Gst-1.0.gir +++ b/girs/Gst-1.0.gir @@ -49840,6 +49840,24 @@ pointer casts. + + 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`. + + + + + + + a pointer to a #GstPromise reference + + + + Clears a reference to a #GstQuery. diff --git a/subprojects/gstreamer/gst/gstpromise.c b/subprojects/gstreamer/gst/gstpromise.c index 322d603ff6..d9170b6e0c 100644 --- a/subprojects/gstreamer/gst/gstpromise.c +++ b/subprojects/gstreamer/gst/gstpromise.c @@ -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); +} diff --git a/subprojects/gstreamer/gst/gstpromise.h b/subprojects/gstreamer/gst/gstpromise.h index 192ffe094a..b205adc2db 100644 --- a/subprojects/gstreamer/gst/gstpromise.h +++ b/subprojects/gstreamer/gst/gstpromise.h @@ -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)