From 6488c428901e8c1598d6e9708e6c25e96b381180 Mon Sep 17 00:00:00 2001 From: Vivia Nikolaidou Date: Tue, 3 Sep 2019 17:14:47 +0300 Subject: [PATCH] element: Added num_pads, num_src_pads, num_sink_pads Exposing the corresponding struct element in GstElement --- gstreamer/src/element.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 6cd742987..575a94213 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -191,6 +191,10 @@ pub trait ElementExtManual: 'static { fn get_sink_pads(&self) -> Vec; fn get_src_pads(&self) -> Vec; + fn num_pads(&self) -> u16; + fn num_sink_pads(&self) -> u16; + fn num_src_pads(&self) -> u16; + #[cfg(any(feature = "v1_10", feature = "dox"))] fn add_property_deep_notify_watch( &self, @@ -504,6 +508,30 @@ impl> ElementExtManual for O { } } + fn num_pads(&self) -> u16 { + unsafe { + let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _); + ::utils::MutexGuard::lock(&elt.object.lock); + elt.numpads + } + } + + fn num_sink_pads(&self) -> u16 { + unsafe { + let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _); + ::utils::MutexGuard::lock(&elt.object.lock); + elt.numsinkpads + } + } + + fn num_src_pads(&self) -> u16 { + unsafe { + let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _); + ::utils::MutexGuard::lock(&elt.object.lock); + elt.numsrcpads + } + } + #[cfg(any(feature = "v1_10", feature = "dox"))] fn add_property_deep_notify_watch( &self,