diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 842d19f68..d64f7ed49 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -104,7 +104,8 @@ pub mod meta; #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))] pub use crate::meta::MetaSeqnum; pub use crate::meta::{ - Meta, MetaAPI, MetaRef, MetaRefMut, ParentBufferMeta, ProtectionMeta, ReferenceTimestampMeta, + Meta, MetaAPI, MetaAPIExt, MetaRef, MetaRefMut, ParentBufferMeta, ProtectionMeta, + ReferenceTimestampMeta, }; pub mod buffer; pub use crate::buffer::{ @@ -322,7 +323,7 @@ pub mod prelude { gobject::GObjectExtManualGst, memory::MemoryType, message::MessageErrorDomain, - meta::MetaAPI, + meta::{MetaAPI, MetaAPIExt}, miniobject::IsMiniObject, object::GstObjectExtManual, pad::PadExtManual, diff --git a/gstreamer/src/meta.rs b/gstreamer/src/meta.rs index f1631b5c4..460b88bf4 100644 --- a/gstreamer/src/meta.rs +++ b/gstreamer/src/meta.rs @@ -14,7 +14,23 @@ pub unsafe trait MetaAPI: Sync + Send + Sized { #[doc(alias = "get_meta_api")] fn meta_api() -> glib::Type; +} +pub trait MetaAPIExt: MetaAPI { + #[doc(alias = "gst_meta_api_type_has_tag")] + fn has_tag(&self, tag: glib::Quark) -> bool; + + #[doc(alias = "gst_meta_api_type_get_tags")] + fn tags(&self) -> &[glib::GStringPtr]; + + unsafe fn from_ptr(buffer: &BufferRef, ptr: *const Self::GstType) -> MetaRef; + unsafe fn from_mut_ptr( + buffer: &mut BufferRef, + ptr: *mut Self::GstType, + ) -> MetaRefMut; +} + +impl MetaAPIExt for A { fn has_tag(&self, tag: glib::Quark) -> bool { unsafe { from_glib(ffi::gst_meta_api_type_has_tag(