From 044d931d0170330a2036b24df5ac3953b2047248 Mon Sep 17 00:00:00 2001 From: Vivia Nikolaidou Date: Sat, 11 May 2019 16:33:45 +0300 Subject: [PATCH] flags: Expose GstMemoryFlags --- Gir_Gst.toml | 1 + gstreamer/src/auto/flags.rs | 53 +++++++++++++++++++++++++++++++++++++ gstreamer/src/auto/mod.rs | 1 + 3 files changed, 55 insertions(+) diff --git a/Gir_Gst.toml b/Gir_Gst.toml index 61815dc5b..704568b55 100644 --- a/Gir_Gst.toml +++ b/Gir_Gst.toml @@ -59,6 +59,7 @@ generate = [ "Gst.BinFlags", "Gst.PipelineFlags", "Gst.PluginFlags", + "Gst.MemoryFlags", "Gst.PadLinkCheck", "Gst.DebugLevel", "Gst.DebugColorFlags", diff --git a/gstreamer/src/auto/flags.rs b/gstreamer/src/auto/flags.rs index f30648030..a7d705e2c 100644 --- a/gstreamer/src/auto/flags.rs +++ b/gstreamer/src/auto/flags.rs @@ -396,6 +396,59 @@ impl SetValue for ElementFlags { } } +bitflags! { + pub struct MemoryFlags: u32 { + const READONLY = 2; + const NO_SHARE = 16; + const ZERO_PREFIXED = 32; + const ZERO_PADDED = 64; + const PHYSICALLY_CONTIGUOUS = 128; + const NOT_MAPPABLE = 256; + const LAST = 1048576; + } +} + +#[doc(hidden)] +impl ToGlib for MemoryFlags { + type GlibType = gst_sys::GstMemoryFlags; + + fn to_glib(&self) -> gst_sys::GstMemoryFlags { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for MemoryFlags { + fn from_glib(value: gst_sys::GstMemoryFlags) -> MemoryFlags { + skip_assert_initialized!(); + MemoryFlags::from_bits_truncate(value) + } +} + +impl StaticType for MemoryFlags { + fn static_type() -> Type { + unsafe { from_glib(gst_sys::gst_memory_flags_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for MemoryFlags { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for MemoryFlags { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl SetValue for MemoryFlags { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) + } +} + bitflags! { pub struct ObjectFlags: u32 { const MAY_BE_LEAKED = 1; diff --git a/gstreamer/src/auto/mod.rs b/gstreamer/src/auto/mod.rs index 2c8f4f7a4..ad312de65 100644 --- a/gstreamer/src/auto/mod.rs +++ b/gstreamer/src/auto/mod.rs @@ -163,6 +163,7 @@ pub use self::flags::BufferPoolAcquireFlags; pub use self::flags::DebugColorFlags; pub use self::flags::DebugGraphDetails; pub use self::flags::ElementFlags; +pub use self::flags::MemoryFlags; pub use self::flags::ObjectFlags; pub use self::flags::PadFlags; pub use self::flags::PadLinkCheck;