From 1faf41986bc9cc249b510eec0f37deac3dcf647f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 25 Sep 2019 16:44:20 +0300 Subject: [PATCH] gstreamer: Add bindings for ClockEntryType and ClockFlags --- Gir_Gst.toml | 2 ++ gstreamer/src/auto/enums.rs | 57 +++++++++++++++++++++++++++++++++++++ gstreamer/src/auto/flags.rs | 54 +++++++++++++++++++++++++++++++++++ gstreamer/src/auto/mod.rs | 2 ++ 4 files changed, 115 insertions(+) diff --git a/Gir_Gst.toml b/Gir_Gst.toml index 7c800ff4b..d7872bace 100644 --- a/Gir_Gst.toml +++ b/Gir_Gst.toml @@ -71,6 +71,8 @@ generate = [ "Gst.PluginDependencyFlags", "Gst.BufferPoolAcquireFlags", "Gst.PromiseResult", + "Gst.ClockEntryType", + "Gst.ClockFlags", ] manual = [ diff --git a/gstreamer/src/auto/enums.rs b/gstreamer/src/auto/enums.rs index 1c99a9529..5028f28c4 100644 --- a/gstreamer/src/auto/enums.rs +++ b/gstreamer/src/auto/enums.rs @@ -194,6 +194,63 @@ impl SetValue for CapsIntersectMode { } } +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +pub enum ClockEntryType { + Single, + Periodic, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for ClockEntryType { + type GlibType = gst_sys::GstClockEntryType; + + fn to_glib(&self) -> gst_sys::GstClockEntryType { + match *self { + ClockEntryType::Single => gst_sys::GST_CLOCK_ENTRY_SINGLE, + ClockEntryType::Periodic => gst_sys::GST_CLOCK_ENTRY_PERIODIC, + ClockEntryType::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for ClockEntryType { + fn from_glib(value: gst_sys::GstClockEntryType) -> Self { + skip_assert_initialized!(); + match value { + 0 => ClockEntryType::Single, + 1 => ClockEntryType::Periodic, + value => ClockEntryType::__Unknown(value), + } + } +} + +impl StaticType for ClockEntryType { + fn static_type() -> Type { + unsafe { from_glib(gst_sys::gst_clock_entry_type_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for ClockEntryType { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for ClockEntryType { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for ClockEntryType { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} + #[must_use] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] pub enum ClockReturn { diff --git a/gstreamer/src/auto/flags.rs b/gstreamer/src/auto/flags.rs index 97dd5d7a3..936e741e9 100644 --- a/gstreamer/src/auto/flags.rs +++ b/gstreamer/src/auto/flags.rs @@ -226,6 +226,60 @@ impl SetValue for BufferPoolAcquireFlags { } } +bitflags! { + pub struct ClockFlags: u32 { + const CAN_DO_SINGLE_SYNC = 16; + const CAN_DO_SINGLE_ASYNC = 32; + const CAN_DO_PERIODIC_SYNC = 64; + const CAN_DO_PERIODIC_ASYNC = 128; + const CAN_SET_RESOLUTION = 256; + const CAN_SET_MASTER = 512; + const NEEDS_STARTUP_SYNC = 1024; + const LAST = 4096; + } +} + +#[doc(hidden)] +impl ToGlib for ClockFlags { + type GlibType = gst_sys::GstClockFlags; + + fn to_glib(&self) -> gst_sys::GstClockFlags { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for ClockFlags { + fn from_glib(value: gst_sys::GstClockFlags) -> ClockFlags { + skip_assert_initialized!(); + ClockFlags::from_bits_truncate(value) + } +} + +impl StaticType for ClockFlags { + fn static_type() -> Type { + unsafe { from_glib(gst_sys::gst_clock_flags_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for ClockFlags { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for ClockFlags { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl SetValue for ClockFlags { + 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 DebugColorFlags: u32 { const FG_BLACK = 0; diff --git a/gstreamer/src/auto/mod.rs b/gstreamer/src/auto/mod.rs index 9fc90bbe2..7ce9ceb4b 100644 --- a/gstreamer/src/auto/mod.rs +++ b/gstreamer/src/auto/mod.rs @@ -120,6 +120,7 @@ mod enums; pub use self::enums::BufferingMode; pub use self::enums::BusSyncReply; pub use self::enums::CapsIntersectMode; +pub use self::enums::ClockEntryType; pub use self::enums::ClockReturn; pub use self::enums::ClockType; pub use self::enums::CoreError; @@ -164,6 +165,7 @@ pub use self::flags::BinFlags; pub use self::flags::BufferCopyFlags; pub use self::flags::BufferFlags; pub use self::flags::BufferPoolAcquireFlags; +pub use self::flags::ClockFlags; pub use self::flags::DebugColorFlags; pub use self::flags::DebugGraphDetails; pub use self::flags::ElementFlags;