Add GstPadLinkCheck

This commit is contained in:
Sebastian Dröge 2017-08-14 22:19:47 +03:00
parent 97bca10484
commit de98b8039e
5 changed files with 86 additions and 14 deletions

View file

@ -69,6 +69,7 @@ generate = [
"Gst.ClockReturn", "Gst.ClockReturn",
"Gst.ElementFlags", "Gst.ElementFlags",
"Gst.Rank", "Gst.Rank",
"Gst.PadLinkCheck",
] ]
manual = [ manual = [

View file

@ -13,6 +13,7 @@ use Iterator;
use Message; use Message;
use Object; use Object;
use Pad; use Pad;
use PadLinkCheck;
use PadTemplate; use PadTemplate;
use Plugin; use Plugin;
use SeekFlags; use SeekFlags;
@ -145,7 +146,7 @@ pub trait ElementExt {
fn link_pads_filtered<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>, S: Into<Option<&'c Caps>>>(&self, srcpadname: P, dest: &Q, destpadname: R, filter: S) -> Result<(), glib::error::BoolError>; fn link_pads_filtered<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>, S: Into<Option<&'c Caps>>>(&self, srcpadname: P, dest: &Q, destpadname: R, filter: S) -> Result<(), glib::error::BoolError>;
//fn link_pads_full<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: /*Ignored*/PadLinkCheck) -> bool; fn link_pads_full<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: PadLinkCheck) -> bool;
fn lost_state(&self); fn lost_state(&self);
@ -403,9 +404,15 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
} }
} }
//fn link_pads_full<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: /*Ignored*/PadLinkCheck) -> bool { fn link_pads_full<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: PadLinkCheck) -> bool {
// unsafe { TODO: call ffi::gst_element_link_pads_full() } let srcpadname = srcpadname.into();
//} let srcpadname = srcpadname.to_glib_none();
let destpadname = destpadname.into();
let destpadname = destpadname.to_glib_none();
unsafe {
from_glib(ffi::gst_element_link_pads_full(self.to_glib_none().0, srcpadname.0, dest.to_glib_none().0, destpadname.0, flags.to_glib()))
}
}
fn lost_state(&self) { fn lost_state(&self) {
unsafe { unsafe {

View file

@ -120,6 +120,58 @@ impl SetValue for ElementFlags {
} }
} }
bitflags! {
pub struct PadLinkCheck: u32 {
const PAD_LINK_CHECK_NOTHING = 0;
const PAD_LINK_CHECK_HIERARCHY = 1;
const PAD_LINK_CHECK_TEMPLATE_CAPS = 2;
const PAD_LINK_CHECK_CAPS = 4;
const PAD_LINK_CHECK_NO_RECONFIGURE = 8;
const PAD_LINK_CHECK_DEFAULT = 5;
}
}
#[doc(hidden)]
impl ToGlib for PadLinkCheck {
type GlibType = ffi::GstPadLinkCheck;
fn to_glib(&self) -> ffi::GstPadLinkCheck {
ffi::GstPadLinkCheck::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstPadLinkCheck> for PadLinkCheck {
fn from_glib(value: ffi::GstPadLinkCheck) -> PadLinkCheck {
skip_assert_initialized!();
PadLinkCheck::from_bits_truncate(value.bits())
}
}
impl StaticType for PadLinkCheck {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_pad_link_check_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for PadLinkCheck {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for PadLinkCheck {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstPadLinkCheck::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
impl SetValue for PadLinkCheck {
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! { bitflags! {
pub struct PadProbeType: u32 { pub struct PadProbeType: u32 {
const PAD_PROBE_TYPE_INVALID = 0; const PAD_PROBE_TYPE_INVALID = 0;

View file

@ -163,6 +163,13 @@ pub use self::flags::ELEMENT_FLAG_PROVIDE_CLOCK;
pub use self::flags::ELEMENT_FLAG_REQUIRE_CLOCK; pub use self::flags::ELEMENT_FLAG_REQUIRE_CLOCK;
pub use self::flags::ELEMENT_FLAG_INDEXABLE; pub use self::flags::ELEMENT_FLAG_INDEXABLE;
pub use self::flags::ELEMENT_FLAG_LAST; pub use self::flags::ELEMENT_FLAG_LAST;
pub use self::flags::PadLinkCheck;
pub use self::flags::PAD_LINK_CHECK_NOTHING;
pub use self::flags::PAD_LINK_CHECK_HIERARCHY;
pub use self::flags::PAD_LINK_CHECK_TEMPLATE_CAPS;
pub use self::flags::PAD_LINK_CHECK_CAPS;
pub use self::flags::PAD_LINK_CHECK_NO_RECONFIGURE;
pub use self::flags::PAD_LINK_CHECK_DEFAULT;
pub use self::flags::PadProbeType; pub use self::flags::PadProbeType;
pub use self::flags::PAD_PROBE_TYPE_INVALID; pub use self::flags::PAD_PROBE_TYPE_INVALID;
pub use self::flags::PAD_PROBE_TYPE_IDLE; pub use self::flags::PAD_PROBE_TYPE_IDLE;

View file

@ -10,6 +10,7 @@ use Format;
use Iterator; use Iterator;
use Object; use Object;
use PadDirection; use PadDirection;
use PadLinkCheck;
use PadLinkReturn; use PadLinkReturn;
use PadMode; use PadMode;
use PadTemplate; use PadTemplate;
@ -135,13 +136,13 @@ pub trait PadExt {
fn link<P: IsA<Pad>>(&self, sinkpad: &P) -> PadLinkReturn; fn link<P: IsA<Pad>>(&self, sinkpad: &P) -> PadLinkReturn;
//fn link_full<P: IsA<Pad>>(&self, sinkpad: &P, flags: /*Ignored*/PadLinkCheck) -> PadLinkReturn; fn link_full<P: IsA<Pad>>(&self, sinkpad: &P, flags: PadLinkCheck) -> PadLinkReturn;
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> Result<(), glib::error::BoolError>; fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> Result<(), glib::error::BoolError>;
//#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
//fn link_maybe_ghosting_full<P: IsA<Pad>>(&self, sink: &P, flags: /*Ignored*/PadLinkCheck) -> bool; fn link_maybe_ghosting_full<P: IsA<Pad>>(&self, sink: &P, flags: PadLinkCheck) -> bool;
fn mark_reconfigure(&self); fn mark_reconfigure(&self);
@ -395,9 +396,11 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
} }
} }
//fn link_full<P: IsA<Pad>>(&self, sinkpad: &P, flags: /*Ignored*/PadLinkCheck) -> PadLinkReturn { fn link_full<P: IsA<Pad>>(&self, sinkpad: &P, flags: PadLinkCheck) -> PadLinkReturn {
// unsafe { TODO: call ffi::gst_pad_link_full() } unsafe {
//} from_glib(ffi::gst_pad_link_full(self.to_glib_none().0, sinkpad.to_glib_none().0, flags.to_glib()))
}
}
#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> Result<(), glib::error::BoolError> { fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> Result<(), glib::error::BoolError> {
@ -406,10 +409,12 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
} }
} }
//#[cfg(feature = "v1_10")] #[cfg(feature = "v1_10")]
//fn link_maybe_ghosting_full<P: IsA<Pad>>(&self, sink: &P, flags: /*Ignored*/PadLinkCheck) -> bool { fn link_maybe_ghosting_full<P: IsA<Pad>>(&self, sink: &P, flags: PadLinkCheck) -> bool {
// unsafe { TODO: call ffi::gst_pad_link_maybe_ghosting_full() } unsafe {
//} from_glib(ffi::gst_pad_link_maybe_ghosting_full(self.to_glib_none().0, sink.to_glib_none().0, flags.to_glib()))
}
}
fn mark_reconfigure(&self) { fn mark_reconfigure(&self) {
unsafe { unsafe {