From de98b8039e1f3f37e1fd8dbbc47d8e5303c60c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 14 Aug 2017 22:19:47 +0300 Subject: [PATCH] Add GstPadLinkCheck --- Gir_Gst.toml | 1 + gstreamer/src/auto/element.rs | 15 +++++++--- gstreamer/src/auto/flags.rs | 52 +++++++++++++++++++++++++++++++++++ gstreamer/src/auto/mod.rs | 7 +++++ gstreamer/src/auto/pad.rs | 25 ++++++++++------- 5 files changed, 86 insertions(+), 14 deletions(-) diff --git a/Gir_Gst.toml b/Gir_Gst.toml index 6f1c355ce..7eb7e44ec 100644 --- a/Gir_Gst.toml +++ b/Gir_Gst.toml @@ -69,6 +69,7 @@ generate = [ "Gst.ClockReturn", "Gst.ElementFlags", "Gst.Rank", + "Gst.PadLinkCheck", ] manual = [ diff --git a/gstreamer/src/auto/element.rs b/gstreamer/src/auto/element.rs index 46958f5a0..faf22114d 100644 --- a/gstreamer/src/auto/element.rs +++ b/gstreamer/src/auto/element.rs @@ -13,6 +13,7 @@ use Iterator; use Message; use Object; use Pad; +use PadLinkCheck; use PadTemplate; use Plugin; use SeekFlags; @@ -145,7 +146,7 @@ pub trait ElementExt { fn link_pads_filtered<'a, 'b, 'c, P: Into>, Q: IsA, R: Into>, S: Into>>(&self, srcpadname: P, dest: &Q, destpadname: R, filter: S) -> Result<(), glib::error::BoolError>; - //fn link_pads_full<'a, 'b, P: Into>, Q: IsA, R: Into>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: /*Ignored*/PadLinkCheck) -> bool; + fn link_pads_full<'a, 'b, P: Into>, Q: IsA, R: Into>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: PadLinkCheck) -> bool; fn lost_state(&self); @@ -403,9 +404,15 @@ impl + IsA> ElementExt for O { } } - //fn link_pads_full<'a, 'b, P: Into>, Q: IsA, R: Into>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: /*Ignored*/PadLinkCheck) -> bool { - // unsafe { TODO: call ffi::gst_element_link_pads_full() } - //} + fn link_pads_full<'a, 'b, P: Into>, Q: IsA, R: Into>>(&self, srcpadname: P, dest: &Q, destpadname: R, flags: PadLinkCheck) -> bool { + 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) { unsafe { diff --git a/gstreamer/src/auto/flags.rs b/gstreamer/src/auto/flags.rs index fd511f571..774b1e40e 100644 --- a/gstreamer/src/auto/flags.rs +++ b/gstreamer/src/auto/flags.rs @@ -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 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 { + 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! { pub struct PadProbeType: u32 { const PAD_PROBE_TYPE_INVALID = 0; diff --git a/gstreamer/src/auto/mod.rs b/gstreamer/src/auto/mod.rs index 22f7ebf0b..c6e3b785c 100644 --- a/gstreamer/src/auto/mod.rs +++ b/gstreamer/src/auto/mod.rs @@ -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_INDEXABLE; 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::PAD_PROBE_TYPE_INVALID; pub use self::flags::PAD_PROBE_TYPE_IDLE; diff --git a/gstreamer/src/auto/pad.rs b/gstreamer/src/auto/pad.rs index 717aacd39..36ad135b7 100644 --- a/gstreamer/src/auto/pad.rs +++ b/gstreamer/src/auto/pad.rs @@ -10,6 +10,7 @@ use Format; use Iterator; use Object; use PadDirection; +use PadLinkCheck; use PadLinkReturn; use PadMode; use PadTemplate; @@ -135,13 +136,13 @@ pub trait PadExt { fn link>(&self, sinkpad: &P) -> PadLinkReturn; - //fn link_full>(&self, sinkpad: &P, flags: /*Ignored*/PadLinkCheck) -> PadLinkReturn; + fn link_full>(&self, sinkpad: &P, flags: PadLinkCheck) -> PadLinkReturn; #[cfg(feature = "v1_10")] fn link_maybe_ghosting>(&self, sink: &P) -> Result<(), glib::error::BoolError>; - //#[cfg(feature = "v1_10")] - //fn link_maybe_ghosting_full>(&self, sink: &P, flags: /*Ignored*/PadLinkCheck) -> bool; + #[cfg(feature = "v1_10")] + fn link_maybe_ghosting_full>(&self, sink: &P, flags: PadLinkCheck) -> bool; fn mark_reconfigure(&self); @@ -395,9 +396,11 @@ impl + IsA> PadExt for O { } } - //fn link_full>(&self, sinkpad: &P, flags: /*Ignored*/PadLinkCheck) -> PadLinkReturn { - // unsafe { TODO: call ffi::gst_pad_link_full() } - //} + fn link_full>(&self, sinkpad: &P, flags: PadLinkCheck) -> PadLinkReturn { + 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")] fn link_maybe_ghosting>(&self, sink: &P) -> Result<(), glib::error::BoolError> { @@ -406,10 +409,12 @@ impl + IsA> PadExt for O { } } - //#[cfg(feature = "v1_10")] - //fn link_maybe_ghosting_full>(&self, sink: &P, flags: /*Ignored*/PadLinkCheck) -> bool { - // unsafe { TODO: call ffi::gst_pad_link_maybe_ghosting_full() } - //} + #[cfg(feature = "v1_10")] + fn link_maybe_ghosting_full>(&self, sink: &P, flags: PadLinkCheck) -> bool { + 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) { unsafe {