diff --git a/gstreamer-validate/src/action_type.rs b/gstreamer-validate/src/action_type.rs index ba71bc893..28cb92554 100644 --- a/gstreamer-validate/src/action_type.rs +++ b/gstreamer-validate/src/action_type.rs @@ -365,6 +365,25 @@ impl<'a> ActionTypeBuilder<'a> { } } +pub trait ActionTypeExtManual: 'static { + fn find(name: &str) -> Option; +} + +impl ActionTypeExtManual for crate::ActionType { + fn find(name: &str) -> Option { + assert_initialized_main_thread!(); + unsafe { + let action_type = ffi::gst_validate_get_action_type(name.to_glib_none().0); + + if action_type.is_null() { + None + } else { + Some(from_glib_full(action_type)) + } + } + } +} + #[cfg(test)] mod tests { use std::{ @@ -375,6 +394,7 @@ mod tests { #[test] fn test_action_types() { gst::init().unwrap(); + use crate::prelude::*; crate::init(); let failling_action_type = crate::ActionTypeBuilder::new("fails", |_, action| { @@ -441,5 +461,7 @@ mod tests { .default_value("true") .add_possible_variable("position") .build(); + + crate::ActionType::find("succeeds").expect("Failed to find action type"); } } diff --git a/gstreamer-validate/src/lib.rs b/gstreamer-validate/src/lib.rs index 2542f8fbe..53b35a3e5 100644 --- a/gstreamer-validate/src/lib.rs +++ b/gstreamer-validate/src/lib.rs @@ -60,5 +60,6 @@ pub mod prelude { #[doc(hidden)] pub use gst::prelude::*; + pub use crate::action_type::ActionTypeExtManual; pub use crate::auto::traits::*; }