diff --git a/gstreamer/Gir.toml b/gstreamer/Gir.toml index dde28441a..f894b158a 100644 --- a/gstreamer/Gir.toml +++ b/gstreamer/Gir.toml @@ -2268,3 +2268,13 @@ status = "generate" [[object.derive]] name = "Debug, PartialEq, Eq, PartialOrd, Ord, Hash" + +[[object]] +name = "Gst.MetaFlags" +status = "generate" + [[object.member]] + name = "none" + ignore = true + [[object.member]] + name = "last" + ignore = true diff --git a/gstreamer/src/auto/flags.rs b/gstreamer/src/auto/flags.rs index 53dd94de2..46271f306 100644 --- a/gstreamer/src/auto/flags.rs +++ b/gstreamer/src/auto/flags.rs @@ -799,6 +799,68 @@ impl ToValue for MemoryFlags { } } +bitflags! { + #[doc(alias = "GstMetaFlags")] + pub struct MetaFlags: u32 { + #[doc(alias = "GST_META_FLAG_READONLY")] + const READONLY = ffi::GST_META_FLAG_READONLY as u32; + #[doc(alias = "GST_META_FLAG_POOLED")] + const POOLED = ffi::GST_META_FLAG_POOLED as u32; + #[doc(alias = "GST_META_FLAG_LOCKED")] + const LOCKED = ffi::GST_META_FLAG_LOCKED as u32; + } +} + +#[doc(hidden)] +impl IntoGlib for MetaFlags { + type GlibType = ffi::GstMetaFlags; + + fn into_glib(self) -> ffi::GstMetaFlags { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for MetaFlags { + unsafe fn from_glib(value: ffi::GstMetaFlags) -> Self { + skip_assert_initialized!(); + Self::from_bits_truncate(value) + } +} + +impl StaticType for MetaFlags { + fn static_type() -> Type { + unsafe { from_glib(ffi::gst_meta_flags_get_type()) } + } +} + +impl glib::value::ValueType for MetaFlags { + type Type = Self; +} + +unsafe impl<'a> FromValue<'a> for MetaFlags { + type Checker = glib::value::GenericValueTypeChecker; + + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl ToValue for MetaFlags { + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + bitflags! { #[doc(alias = "GstObjectFlags")] pub struct ObjectFlags: u32 { diff --git a/gstreamer/src/auto/mod.rs b/gstreamer/src/auto/mod.rs index f157d227f..b089431c5 100644 --- a/gstreamer/src/auto/mod.rs +++ b/gstreamer/src/auto/mod.rs @@ -172,6 +172,7 @@ pub use self::flags::EventTypeFlags; #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))] pub use self::flags::GapFlags; pub use self::flags::MemoryFlags; +pub use self::flags::MetaFlags; pub use self::flags::ObjectFlags; pub use self::flags::PadFlags; pub use self::flags::PadLinkCheck; diff --git a/gstreamer/src/meta.rs b/gstreamer/src/meta.rs index b08403404..db63c2efe 100644 --- a/gstreamer/src/meta.rs +++ b/gstreamer/src/meta.rs @@ -145,6 +145,13 @@ impl<'a, T> MetaRef<'a, T> { } } + pub fn flags(&self) -> crate::MetaFlags { + unsafe { + let meta = self.meta as *const _ as *const ffi::GstMeta; + from_glib((*meta).flags) + } + } + pub fn type_(&self) -> glib::Type { unsafe { let meta = self.meta as *const _ as *const ffi::GstMeta; @@ -207,6 +214,13 @@ impl<'a, T, U> MetaRefMut<'a, T, U> { } } + pub fn flags(&self) -> crate::MetaFlags { + unsafe { + let meta = self.meta as *const _ as *const ffi::GstMeta; + from_glib((*meta).flags) + } + } + pub fn type_(&self) -> glib::Type { unsafe { let meta = self.meta as *const _ as *const ffi::GstMeta; @@ -316,6 +330,10 @@ impl Meta { fn api(&self) -> glib::Type { unsafe { glib::Type::from_glib((*self.0.info).api) } } + + pub fn flags(&self) -> crate::MetaFlags { + unsafe { from_glib(self.0.flags) } + } } unsafe impl MetaAPI for Meta {