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/1391>
This commit is contained in:
Benjamin Gaignard 2024-02-12 14:00:54 +01:00
parent 7f9dd58718
commit 22796cee0c

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")]
pub fn add<'a>(
buffer: &'a mut BufferRef,