diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 4b40ea27e..9ef3c9347 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -334,6 +334,7 @@ pub mod prelude { pub use gobject::GObjectExtManualGst; pub use object::GstObjectExtManual; pub use pad::PadExtManual; + pub use param_spec::GstParamSpecExt; pub use tag_setter::TagSetterExtManual; pub use value::GstValueExt; diff --git a/gstreamer/src/param_spec.rs b/gstreamer/src/param_spec.rs index 4c3496950..283d2bf0e 100644 --- a/gstreamer/src/param_spec.rs +++ b/gstreamer/src/param_spec.rs @@ -10,11 +10,30 @@ use ffi; use glib; use glib::translate::*; -pub struct ParamSpec(()); - -impl ParamSpec { +pub trait GstParamSpecExt { #[cfg(any(feature = "v1_14", feature = "dox"))] - pub fn array( + fn array( + name: &str, + nick: &str, + blurb: &str, + element_spec: &glib::ParamSpec, + flags: glib::ParamFlags, + ) -> Self; + + fn fraction( + name: &str, + nick: &str, + blurb: &str, + min: ::Fraction, + max: ::Fraction, + default: ::Fraction, + flags: glib::ParamFlags, + ) -> Self; +} + +impl GstParamSpecExt for glib::ParamSpec { + #[cfg(any(feature = "v1_14", feature = "dox"))] + fn array( name: &str, nick: &str, blurb: &str, @@ -32,7 +51,7 @@ impl ParamSpec { } } - pub fn fraction( + fn fraction( name: &str, nick: &str, blurb: &str, @@ -57,3 +76,24 @@ impl ParamSpec { } } } + +#[cfg(test)] +mod tests { + use glib; + use prelude::*; + + #[test] + fn test_trait() { + ::init().unwrap(); + + let _pspec = glib::ParamSpec::fraction( + "foo", + "Foo", + "Foo Bar", + (0, 1).into(), + (100, 1).into(), + (1, 1).into(), + glib::ParamFlags::READWRITE, + ); + } +}