meta: Add is_registered function for CustomMeta

Test if a Meta type is already registered.
It is useful to know if a custom metadata type has already
been registed to avoid registererd twice and get asserts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1402>
This commit is contained in:
Benjamin Gaignard 2024-02-12 14:00:54 +01:00 committed by Sebastian Dröge
parent 02c6b9128c
commit d07f72f34e

View file

@ -951,6 +951,11 @@ impl CustomMeta {
} }
} }
pub fn is_registered(name: &str) -> bool {
assert_initialized_main_thread!();
unsafe { name.run_with_gstr(|name| !ffi::gst_meta_get_info(name.as_ptr()).is_null()) }
}
#[doc(alias = "gst_buffer_add_custom_meta")] #[doc(alias = "gst_buffer_add_custom_meta")]
pub fn add<'a>( pub fn add<'a>(
buffer: &'a mut BufferRef, buffer: &'a mut BufferRef,