mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 17:41:05 +00:00
gstreamer: Add bindings for ClockEntryType and ClockFlags
This commit is contained in:
parent
1c8b2c671b
commit
1faf41986b
4 changed files with 115 additions and 0 deletions
|
@ -71,6 +71,8 @@ generate = [
|
|||
"Gst.PluginDependencyFlags",
|
||||
"Gst.BufferPoolAcquireFlags",
|
||||
"Gst.PromiseResult",
|
||||
"Gst.ClockEntryType",
|
||||
"Gst.ClockFlags",
|
||||
]
|
||||
|
||||
manual = [
|
||||
|
|
|
@ -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<gst_sys::GstClockEntryType> 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<Self> {
|
||||
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 {
|
||||
|
|
|
@ -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<gst_sys::GstClockFlags> 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<Self> {
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue