Add GstElementFlags and suppressed_flags API of GstBin

This commit is contained in:
Sebastian Dröge 2017-08-14 22:15:37 +03:00
parent 56847216a0
commit 474749598e
4 changed files with 80 additions and 12 deletions

View file

@ -67,6 +67,7 @@ generate = [
"Gst.TocSetter",
"Gst.ClockType",
"Gst.ClockReturn",
"Gst.ElementFlags",
]
manual = [

View file

@ -3,6 +3,8 @@
use ChildProxy;
use Element;
#[cfg(feature = "v1_10")]
use ElementFlags;
use Iterator;
use Object;
use Pad;
@ -56,8 +58,8 @@ pub trait BinExt {
fn get_by_name_recurse_up(&self, name: &str) -> Option<Element>;
//#[cfg(feature = "v1_10")]
//fn get_suppressed_flags(&self) -> /*Ignored*/ElementFlags;
#[cfg(feature = "v1_10")]
fn get_suppressed_flags(&self) -> ElementFlags;
fn iterate_all_by_interface(&self, iface: glib::types::Type) -> Option<Iterator>;
@ -77,8 +79,8 @@ pub trait BinExt {
//fn remove_many<P: IsA<Element>>(&self, element_1: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
//#[cfg(feature = "v1_10")]
//fn set_suppressed_flags(&self, flags: /*Ignored*/ElementFlags);
#[cfg(feature = "v1_10")]
fn set_suppressed_flags(&self, flags: ElementFlags);
fn sync_children_states(&self) -> Result<(), glib::error::BoolError>;
@ -138,10 +140,12 @@ impl<O: IsA<Bin> + IsA<glib::object::Object>> BinExt for O {
}
}
//#[cfg(feature = "v1_10")]
//fn get_suppressed_flags(&self) -> /*Ignored*/ElementFlags {
// unsafe { TODO: call ffi::gst_bin_get_suppressed_flags() }
//}
#[cfg(feature = "v1_10")]
fn get_suppressed_flags(&self) -> ElementFlags {
unsafe {
from_glib(ffi::gst_bin_get_suppressed_flags(self.to_glib_none().0))
}
}
fn iterate_all_by_interface(&self, iface: glib::types::Type) -> Option<Iterator> {
unsafe {
@ -195,10 +199,12 @@ impl<O: IsA<Bin> + IsA<glib::object::Object>> BinExt for O {
// unsafe { TODO: call ffi::gst_bin_remove_many() }
//}
//#[cfg(feature = "v1_10")]
//fn set_suppressed_flags(&self, flags: /*Ignored*/ElementFlags) {
// unsafe { TODO: call ffi::gst_bin_set_suppressed_flags() }
//}
#[cfg(feature = "v1_10")]
fn set_suppressed_flags(&self, flags: ElementFlags) {
unsafe {
ffi::gst_bin_set_suppressed_flags(self.to_glib_none().0, flags.to_glib());
}
}
fn sync_children_states(&self) -> Result<(), glib::error::BoolError> {
unsafe {

View file

@ -67,6 +67,59 @@ impl SetValue for BufferFlags {
}
}
bitflags! {
pub struct ElementFlags: u32 {
const ELEMENT_FLAG_LOCKED_STATE = 16;
const ELEMENT_FLAG_SINK = 32;
const ELEMENT_FLAG_SOURCE = 64;
const ELEMENT_FLAG_PROVIDE_CLOCK = 128;
const ELEMENT_FLAG_REQUIRE_CLOCK = 256;
const ELEMENT_FLAG_INDEXABLE = 512;
const ELEMENT_FLAG_LAST = 16384;
}
}
#[doc(hidden)]
impl ToGlib for ElementFlags {
type GlibType = ffi::GstElementFlags;
fn to_glib(&self) -> ffi::GstElementFlags {
ffi::GstElementFlags::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstElementFlags> for ElementFlags {
fn from_glib(value: ffi::GstElementFlags) -> ElementFlags {
skip_assert_initialized!();
ElementFlags::from_bits_truncate(value.bits())
}
}
impl StaticType for ElementFlags {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_element_flags_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for ElementFlags {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for ElementFlags {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstElementFlags::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
impl SetValue for ElementFlags {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
bitflags! {
pub struct PadProbeType: u32 {
const PAD_PROBE_TYPE_INVALID = 0;

View file

@ -154,6 +154,14 @@ pub use self::flags::BUFFER_FLAG_DELTA_UNIT;
pub use self::flags::BUFFER_FLAG_TAG_MEMORY;
pub use self::flags::BUFFER_FLAG_SYNC_AFTER;
pub use self::flags::BUFFER_FLAG_LAST;
pub use self::flags::ElementFlags;
pub use self::flags::ELEMENT_FLAG_LOCKED_STATE;
pub use self::flags::ELEMENT_FLAG_SINK;
pub use self::flags::ELEMENT_FLAG_SOURCE;
pub use self::flags::ELEMENT_FLAG_PROVIDE_CLOCK;
pub use self::flags::ELEMENT_FLAG_REQUIRE_CLOCK;
pub use self::flags::ELEMENT_FLAG_INDEXABLE;
pub use self::flags::ELEMENT_FLAG_LAST;
pub use self::flags::PadProbeType;
pub use self::flags::PAD_PROBE_TYPE_INVALID;
pub use self::flags::PAD_PROBE_TYPE_IDLE;