diff --git a/Cargo.toml b/Cargo.toml index 32e6689a5..af3c9abf6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "gstreamer-app", "gstreamer-audio", "gstreamer-base", + "gstreamer-controller", "gstreamer-net", "gstreamer-player", "gstreamer-rtsp", diff --git a/Gir_Gst.toml b/Gir_Gst.toml index 69e4df1d5..c3d5f60f4 100644 --- a/Gir_Gst.toml +++ b/Gir_Gst.toml @@ -64,6 +64,7 @@ manual = [ "Gst.Segment", "Gst.StaticCaps", "Gst.StaticPadTemplate", + "GObject.Value", ] [[object]] @@ -201,6 +202,12 @@ status = "generate" name = "Gst.ChildProxy" status = "generate" manual_traits = ["ChildProxyExtManual"] + [[object.function]] + name = "get_property" + ignore = true + [[object.function]] + name = "set_property" + ignore = true [[object]] name = "Gst.ClockTime" @@ -267,6 +274,9 @@ status = "generate" name = "Gst.TagSetter" status = "generate" manual_traits = ["TagSetterExtManual"] + [[object.function]] + name = "add_tag_value" + ignore = true [[object]] name = "Gst.TocScope" @@ -816,6 +826,15 @@ trait_name = "GstObjectExt" [object.function.return] bool_return_is_error = "Failed to sync values" + [[object.function]] + name = "get_g_value_array" + ignore = true + [[object.function]] + name = "add_control_binding" + [object.function.return] + bool_return_is_error = "Failed to add control binding" + + [[object]] name = "Gst.ObjectFlags" status = "generate" @@ -1778,3 +1797,25 @@ status = "generate" name = "to_iso8601_string" [object.function.return] nullable_return_is_error = "Failed to create ISO-8601 string from DateTime" + +[[object]] +name = "Gst.ControlSource" +status = "generate" +manual_traits = ["ControlSourceExtManual"] +generate_builder = true + [[object.function]] + name = "control_source_get_value" + rename = "get_value" + [[object.function]] + name = "control_source_get_value_array" + ignore = true + + +[[object]] +name = "Gst.ControlBinding" +status = "generate" +manual_traits = ["ControlBindingExtManual"] +generate_builder = true + [[object.function]] + name = "get_g_value_array" + ignore = true diff --git a/Gir_GstController.toml b/Gir_GstController.toml new file mode 100644 index 000000000..bcd6d5fd3 --- /dev/null +++ b/Gir_GstController.toml @@ -0,0 +1,45 @@ +[options] +girs_dir = "gir-files" +library = "GstController" +version = "1.0" +min_cfg_version = "1.8" +target_path = "gstreamer-controller" +work_mode = "normal" +concurrency = "send+sync" +generate_safety_asserts = true +single_version_file = true +doc_target_path = "docs/gstreamer-controller/docs.md" +generate_display_trait = false + +external_libraries = [ + "GLib", + "GObject", + "Gst", +] + +generate = [ + "GstController.ARGBControlBinding", + "GstController.DirectControlBinding", + "GstController.InterpolationControlSource", + "GstController.LFOControlSource", + "GstController.ProxyControlBinding", + "GstController.TimedValueControlSource", + "GstController.TriggerControlSource", + "GstController.DirectControlBindingConvertValue", + "GstController.DirectControlBindingConvertGValue", + "GstController.LFOWaveform", + "GstController.InterpolationMode", +] + +manual = [ + "Gst.Object", + "Gst.ControlBinding", + "Gst.ControlSource", + "GstController.ControlPoint", +] + +[[object]] +name = "Gst.ClockTime" +status = "manual" +conversion_type = "scalar" + diff --git a/gir-files/GstController-1.0.gir b/gir-files/GstController-1.0.gir new file mode 100644 index 000000000..4f18ae406 --- /dev/null +++ b/gir-files/GstController-1.0.gir @@ -0,0 +1,1072 @@ + + + + + + + + + + + + A value mapping object that attaches multiple control sources to a guint +gobject properties representing a color. A control value of 0.0 will turn the +color component off and a value of 1.0 will be the color level. + + + Create a new control-binding that attaches the given #GstControlSource to the +#GObject property. + + + the new #GstARGBControlBinding + + + + + the object of the property + + + + the property-name to attach the control source + + + + the control source for the alpha channel + + + + the control source for the red channel + + + + the control source for the green channel + + + + the control source for the blue channel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The class structure of #GstARGBControlBinding. + + + Parent class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An internal structure for value+time and various temporary +values used for interpolation. This "inherits" from +GstTimedValue. + + + timestamp of the value change + + + + the new value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Frees all data allocated by a #GstControlPoint instance. + + + + + + + the object to free + + + + + + + + + + + + + + + + + + + + + + + + + + + + A value mapping object that attaches control sources to gobject properties. It +will map the control values directly to the target property range. If a +non-absolute direct control binding is used, the value range [0.0 ... 1.0] +is mapped to full target property range, and all values outside the range +will be clipped. An absolute control binding will not do any value +transformations. + + + Create a new control-binding that attaches the #GstControlSource to the +#GObject property. It will map the control source range [0.0 ... 1.0] to +the full target property range, and clip all values outside this range. + + + the new #GstDirectControlBinding + + + + + the object of the property + + + + the property-name to attach the control source + + + + the control source + + + + + + Create a new control-binding that attaches the #GstControlSource to the +#GObject property. It will directly map the control source values to the +target property range without any transformations. + + + the new #GstDirectControlBinding + + + + + the object of the property + + + + the property-name to attach the control source + + + + the control source + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The class structure of #GstDirectControlBinding. + + + Parent class + + + + + + + + + + Function to map a control-value to the target GValue. + + + + + + + the #GstDirectControlBinding instance + + + + the value returned by the cotnrol source + + + + the target GValue + + + + + + Function to map a control-value to the target plain data type. + + + + + + + the #GstDirectControlBinding instance + + + + the value returned by the cotnrol source + + + + the target location + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #GstInterpolationControlSource is a #GstControlSource, that interpolates values between user-given +control points. It supports several interpolation modes and property types. + +To use #GstInterpolationControlSource get a new instance by calling +gst_interpolation_control_source_new(), bind it to a #GParamSpec and set some +control points by calling gst_timed_value_control_source_set(). + +All functions are MT-safe. + + + This returns a new, unbound #GstInterpolationControlSource. + + + a new, unbound #GstInterpolationControlSource. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The various interpolation modes available. + + steps-like interpolation, default + + + linear interpolation + + + cubic interpolation (natural), may overshoot + the min or max values set by the control point, but is more 'curvy' + + + monotonic cubic interpolation, will not + produce any values outside of the min-max range set by the control points + (Since: 1.8) + + + + #GstLFOControlSource is a #GstControlSource, that provides several periodic +waveforms as control values. + +To use #GstLFOControlSource get a new instance by calling +gst_lfo_control_source_new(), bind it to a #GParamSpec and set the relevant +properties. + +All functions are MT-safe. + + + This returns a new, unbound #GstLFOControlSource. + + + a new, unbound #GstLFOControlSource. + + + + + Specifies the amplitude for the waveform of this #GstLFOControlSource. + + + + Specifies the frequency that should be used for the waveform +of this #GstLFOControlSource. It should be large enough +so that the period is longer than one nanosecond. + + + + Specifies the value offset for the waveform of this #GstLFOControlSource. + + + + Specifies the timeshift to the right that should be used for the waveform +of this #GstLFOControlSource in nanoseconds. + +To get a n nanosecond shift to the left use +"(GST_SECOND / frequency) - n". + + + + Specifies the waveform that should be used for this #GstLFOControlSource. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The various waveform modes available. + + sine waveform + + + square waveform + + + saw waveform + + + reverse saw waveform + + + triangle waveform + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A #GstControlBinding that forwards requests to another #GstControlBinding + + + #GstProxyControlBinding forwards all access to data or sync_values() +requests from @property_name on @object to the control binding at +@ref_property_name on @ref_object. + + + a new #GstControlBinding that proxies the control interface between +properties on different #GstObject's + + + + + a #GstObject + + + + the property name in @object to control + + + + a #GstObject to forward all + #GstControlBinding requests to + + + + the property_name in @ref_object to control + + + + + + + + + + + + + + + + + + + + + Opaque #GstProxyControlBindingClass struct + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Base class for #GstControlSource that use time-stamped values. + +When overriding bind, chain up first to give this bind implementation a +chance to setup things. + +All functions are MT-safe. + + + Find last value before given timestamp in control point list. +If all values in the control point list come after the given +timestamp or no values exist, %NULL is returned. + +For use in control source implementations. + + + the found #GSequenceIter or %NULL + + + + + the control source to search in + + + + the search key + + + + + + Returns a read-only copy of the list of #GstTimedValue for the given property. +Free the list after done with it. + + + a copy +of the list, or %NULL if the property isn't handled by the controller + + + + + + + the #GstTimedValueControlSource to get the list from + + + + + + Get the number of control points that are set. + + + the number of control points that are set. + + + + + the #GstTimedValueControlSource to get the number of values from + + + + + + Set the value of given controller-handled property at a certain time. + + + FALSE if the values couldn't be set, TRUE otherwise. + + + + + the #GstTimedValueControlSource object + + + + the time the control-change is scheduled for + + + + the control-value + + + + + + Sets multiple timed values at once. + + + FALSE if the values couldn't be set, TRUE otherwise. + + + + + the #GstTimedValueControlSource object + + + + a list +with #GstTimedValue items + + + + + + + + Used to remove the value of given controller-handled property at a certain +time. + + + FALSE if the value couldn't be unset (i.e. not found, TRUE otherwise. + + + + + the #GstTimedValueControlSource object + + + + the time the control-change should be removed from + + + + + + Used to remove all time-stamped values of given controller-handled property + + + + + + + the #GstTimedValueControlSource object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Emitted right after the new value has been added to @self + + + + + + The newly added #GstTimedValue + + + + + + Emitted right after the new value has been set on @timed_signals + + + + + + The #GstTimedValue where the value changed + + + + + + Emitted when @timed_value is removed from @self + + + + + + The removed #GstTimedValue + + + + + + + + + + + + + + + + + + + + + #GstTriggerControlSource is a #GstControlSource, that returns values from user-given +control points. It allows for a tolerance on the time-stamps. + +To use #GstTriggerControlSource get a new instance by calling +gst_trigger_control_source_new(), bind it to a #GParamSpec and set some +control points by calling gst_timed_value_control_source_set(). + +All functions are MT-safe. + + + This returns a new, unbound #GstTriggerControlSource. + + + a new, unbound #GstTriggerControlSource. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Reset the controlled value cache. + + + + + + + the #GstTimedValueControlSource + + + + + + diff --git a/gstreamer-controller/Cargo.toml b/gstreamer-controller/Cargo.toml new file mode 100644 index 000000000..5e6acf802 --- /dev/null +++ b/gstreamer-controller/Cargo.toml @@ -0,0 +1,41 @@ +[package] +name = "gstreamer-controller" +version = "0.17.0" +authors = ["Alexey Galakhov ", "Sebastian Dröge "] +categories = ["api-bindings", "multimedia"] +description = "Rust bindings for GStreamer Controller library" +repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" +license = "MIT/Apache-2.0" +readme = "README.md" +homepage = "https://gstreamer.freedesktop.org" +documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/gstreamer_controller/" +keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"] +build = "build.rs" + +[dependencies] +bitflags = "1.0" +once_cell = "1.0" +glib-sys = { git = "https://github.com/gtk-rs/sys" } +gobject-sys = { git = "https://github.com/gtk-rs/sys" } +gstreamer-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"] } +gstreamer-controller-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"] } +glib = { git = "https://github.com/gtk-rs/glib" } +gstreamer = { path = "../gstreamer" } + +[build-dependencies.rustdoc-stripper] +version = "0.1" +optional = true + +[features] +default = [] +v1_10 = ["gstreamer/v1_10", "gstreamer-controller-sys/v1_10"] +v1_12 = ["gstreamer/v1_12", "gstreamer-controller-sys/v1_12", "v1_10"] +v1_14 = ["gstreamer/v1_14", "gstreamer-controller-sys/v1_14", "v1_12"] +v1_16 = ["gstreamer/v1_16", "gstreamer-controller-sys/v1_16", "v1_14"] +v1_18 = ["gstreamer/v1_18", "gstreamer-controller-sys/v1_18", "v1_16"] +embed-lgpl-docs = ["rustdoc-stripper"] +purge-lgpl-docs = ["rustdoc-stripper"] +dox = ["v1_18", "gstreamer-controller-sys/dox", "glib/dox", "gstreamer/dox"] + +[package.metadata.docs.rs] +dox = ["v1_18", "gstreamer-controller-sys/dox", "glib/dox", "gstreamer/dox"] diff --git a/gstreamer-controller/build.rs b/gstreamer-controller/build.rs new file mode 100644 index 000000000..6dd369ba5 --- /dev/null +++ b/gstreamer-controller/build.rs @@ -0,0 +1,23 @@ +fn main() { + manage_docs(); +} + +#[cfg(all( + any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"), + not(all(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs")) +))] +fn manage_docs() { + extern crate lgpl_docs; + const PATH: &str = "src"; + const IGNORES: &[&str] = &[]; + lgpl_docs::purge(PATH, IGNORES); + if cfg!(feature = "embed-lgpl-docs") { + lgpl_docs::embed(lgpl_docs::Library::GstController, PATH, IGNORES); + } +} + +#[cfg(any( + all(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"), + not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs")) +))] +fn manage_docs() {} diff --git a/gstreamer-controller/src/auto/argb_control_binding.rs b/gstreamer-controller/src/auto/argb_control_binding.rs new file mode 100644 index 000000000..fd741ce5a --- /dev/null +++ b/gstreamer-controller/src/auto/argb_control_binding.rs @@ -0,0 +1,341 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::value::SetValueOptional; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use gst; +use gst_controller_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; + +glib_wrapper! { + pub struct ARGBControlBinding(Object) @extends gst::ControlBinding, gst::Object; + + match fn { + get_type => || gst_controller_sys::gst_argb_control_binding_get_type(), + } +} + +impl ARGBControlBinding { + pub fn new< + P: IsA, + Q: IsA, + R: IsA, + S: IsA, + T: IsA, + >( + object: &P, + property_name: &str, + cs_a: &Q, + cs_r: &R, + cs_g: &S, + cs_b: &T, + ) -> ARGBControlBinding { + assert_initialized_main_thread!(); + unsafe { + gst::ControlBinding::from_glib_none(gst_controller_sys::gst_argb_control_binding_new( + object.as_ref().to_glib_none().0, + property_name.to_glib_none().0, + cs_a.as_ref().to_glib_none().0, + cs_r.as_ref().to_glib_none().0, + cs_g.as_ref().to_glib_none().0, + cs_b.as_ref().to_glib_none().0, + )) + .unsafe_cast() + } + } +} + +unsafe impl Send for ARGBControlBinding {} +unsafe impl Sync for ARGBControlBinding {} + +pub const NONE_ARGB_CONTROL_BINDING: Option<&ARGBControlBinding> = None; + +pub trait ARGBControlBindingExt: 'static { + fn get_property_control_source_a(&self) -> Option; + + fn set_property_control_source_a + SetValueOptional>( + &self, + control_source_a: Option<&P>, + ); + + fn get_property_control_source_b(&self) -> Option; + + fn set_property_control_source_b + SetValueOptional>( + &self, + control_source_b: Option<&P>, + ); + + fn get_property_control_source_g(&self) -> Option; + + fn set_property_control_source_g + SetValueOptional>( + &self, + control_source_g: Option<&P>, + ); + + fn get_property_control_source_r(&self) -> Option; + + fn set_property_control_source_r + SetValueOptional>( + &self, + control_source_r: Option<&P>, + ); + + fn connect_property_control_source_a_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_control_source_b_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_control_source_g_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_control_source_r_notify( + &self, + f: F, + ) -> SignalHandlerId; +} + +impl> ARGBControlBindingExt for O { + fn get_property_control_source_a(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"control-source-a\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `control-source-a` getter") + } + } + + fn set_property_control_source_a + SetValueOptional>( + &self, + control_source_a: Option<&P>, + ) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"control-source-a\0".as_ptr() as *const _, + Value::from(control_source_a).to_glib_none().0, + ); + } + } + + fn get_property_control_source_b(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"control-source-b\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `control-source-b` getter") + } + } + + fn set_property_control_source_b + SetValueOptional>( + &self, + control_source_b: Option<&P>, + ) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"control-source-b\0".as_ptr() as *const _, + Value::from(control_source_b).to_glib_none().0, + ); + } + } + + fn get_property_control_source_g(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"control-source-g\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `control-source-g` getter") + } + } + + fn set_property_control_source_g + SetValueOptional>( + &self, + control_source_g: Option<&P>, + ) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"control-source-g\0".as_ptr() as *const _, + Value::from(control_source_g).to_glib_none().0, + ); + } + } + + fn get_property_control_source_r(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"control-source-r\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `control-source-r` getter") + } + } + + fn set_property_control_source_r + SetValueOptional>( + &self, + control_source_r: Option<&P>, + ) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"control-source-r\0".as_ptr() as *const _, + Value::from(control_source_r).to_glib_none().0, + ); + } + } + + fn connect_property_control_source_a_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_control_source_a_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_controller_sys::GstARGBControlBinding, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::control-source-a\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_control_source_a_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_control_source_b_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_control_source_b_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_controller_sys::GstARGBControlBinding, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::control-source-b\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_control_source_b_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_control_source_g_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_control_source_g_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_controller_sys::GstARGBControlBinding, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::control-source-g\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_control_source_g_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_control_source_r_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_control_source_r_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_controller_sys::GstARGBControlBinding, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&ARGBControlBinding::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::control-source-r\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_control_source_r_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-controller/src/auto/direct_control_binding.rs b/gstreamer-controller/src/auto/direct_control_binding.rs new file mode 100644 index 000000000..53398d19f --- /dev/null +++ b/gstreamer-controller/src/auto/direct_control_binding.rs @@ -0,0 +1,157 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::value::SetValueOptional; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use gst; +use gst_controller_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; + +glib_wrapper! { + pub struct DirectControlBinding(Object) @extends gst::ControlBinding, gst::Object; + + match fn { + get_type => || gst_controller_sys::gst_direct_control_binding_get_type(), + } +} + +impl DirectControlBinding { + pub fn new, Q: IsA>( + object: &P, + property_name: &str, + cs: &Q, + ) -> DirectControlBinding { + assert_initialized_main_thread!(); + unsafe { + gst::ControlBinding::from_glib_none(gst_controller_sys::gst_direct_control_binding_new( + object.as_ref().to_glib_none().0, + property_name.to_glib_none().0, + cs.as_ref().to_glib_none().0, + )) + .unsafe_cast() + } + } + + pub fn new_absolute, Q: IsA>( + object: &P, + property_name: &str, + cs: &Q, + ) -> DirectControlBinding { + assert_initialized_main_thread!(); + unsafe { + gst::ControlBinding::from_glib_none( + gst_controller_sys::gst_direct_control_binding_new_absolute( + object.as_ref().to_glib_none().0, + property_name.to_glib_none().0, + cs.as_ref().to_glib_none().0, + ), + ) + .unsafe_cast() + } + } +} + +unsafe impl Send for DirectControlBinding {} +unsafe impl Sync for DirectControlBinding {} + +pub const NONE_DIRECT_CONTROL_BINDING: Option<&DirectControlBinding> = None; + +pub trait DirectControlBindingExt: 'static { + fn get_property_absolute(&self) -> bool; + + fn get_property_control_source(&self) -> Option; + + fn set_property_control_source + SetValueOptional>( + &self, + control_source: Option<&P>, + ); + + fn connect_property_control_source_notify( + &self, + f: F, + ) -> SignalHandlerId; +} + +impl> DirectControlBindingExt for O { + fn get_property_absolute(&self) -> bool { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"absolute\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `absolute` getter") + .unwrap() + } + } + + fn get_property_control_source(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"control-source\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `control-source` getter") + } + } + + fn set_property_control_source + SetValueOptional>( + &self, + control_source: Option<&P>, + ) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"control-source\0".as_ptr() as *const _, + Value::from(control_source).to_glib_none().0, + ); + } + } + + fn connect_property_control_source_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_control_source_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_controller_sys::GstDirectControlBinding, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&DirectControlBinding::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::control-source\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_control_source_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-controller/src/auto/enums.rs b/gstreamer-controller/src/auto/enums.rs new file mode 100644 index 000000000..377cd19c5 --- /dev/null +++ b/gstreamer-controller/src/auto/enums.rs @@ -0,0 +1,146 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::translate::*; +use glib::value::FromValue; +use glib::value::FromValueOptional; +use glib::value::SetValue; +use glib::value::Value; +use glib::StaticType; +use glib::Type; +use gobject_sys; +use gst_controller_sys; + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +pub enum InterpolationMode { + None, + Linear, + Cubic, + CubicMonotonic, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for InterpolationMode { + type GlibType = gst_controller_sys::GstInterpolationMode; + + fn to_glib(&self) -> gst_controller_sys::GstInterpolationMode { + match *self { + InterpolationMode::None => gst_controller_sys::GST_INTERPOLATION_MODE_NONE, + InterpolationMode::Linear => gst_controller_sys::GST_INTERPOLATION_MODE_LINEAR, + InterpolationMode::Cubic => gst_controller_sys::GST_INTERPOLATION_MODE_CUBIC, + InterpolationMode::CubicMonotonic => { + gst_controller_sys::GST_INTERPOLATION_MODE_CUBIC_MONOTONIC + } + InterpolationMode::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for InterpolationMode { + fn from_glib(value: gst_controller_sys::GstInterpolationMode) -> Self { + skip_assert_initialized!(); + match value { + 0 => InterpolationMode::None, + 1 => InterpolationMode::Linear, + 2 => InterpolationMode::Cubic, + 3 => InterpolationMode::CubicMonotonic, + value => InterpolationMode::__Unknown(value), + } + } +} + +impl StaticType for InterpolationMode { + fn static_type() -> Type { + unsafe { from_glib(gst_controller_sys::gst_interpolation_mode_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for InterpolationMode { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for InterpolationMode { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for InterpolationMode { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +pub enum LFOWaveform { + Sine, + Square, + Saw, + ReverseSaw, + Triangle, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for LFOWaveform { + type GlibType = gst_controller_sys::GstLFOWaveform; + + fn to_glib(&self) -> gst_controller_sys::GstLFOWaveform { + match *self { + LFOWaveform::Sine => gst_controller_sys::GST_LFO_WAVEFORM_SINE, + LFOWaveform::Square => gst_controller_sys::GST_LFO_WAVEFORM_SQUARE, + LFOWaveform::Saw => gst_controller_sys::GST_LFO_WAVEFORM_SAW, + LFOWaveform::ReverseSaw => gst_controller_sys::GST_LFO_WAVEFORM_REVERSE_SAW, + LFOWaveform::Triangle => gst_controller_sys::GST_LFO_WAVEFORM_TRIANGLE, + LFOWaveform::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for LFOWaveform { + fn from_glib(value: gst_controller_sys::GstLFOWaveform) -> Self { + skip_assert_initialized!(); + match value { + 0 => LFOWaveform::Sine, + 1 => LFOWaveform::Square, + 2 => LFOWaveform::Saw, + 3 => LFOWaveform::ReverseSaw, + 4 => LFOWaveform::Triangle, + value => LFOWaveform::__Unknown(value), + } + } +} + +impl StaticType for LFOWaveform { + fn static_type() -> Type { + unsafe { from_glib(gst_controller_sys::gst_lfo_waveform_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for LFOWaveform { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for LFOWaveform { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for LFOWaveform { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} diff --git a/gstreamer-controller/src/auto/interpolation_control_source.rs b/gstreamer-controller/src/auto/interpolation_control_source.rs new file mode 100644 index 000000000..ba8ce3f1d --- /dev/null +++ b/gstreamer-controller/src/auto/interpolation_control_source.rs @@ -0,0 +1,115 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use gst; +use gst_controller_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; +use InterpolationMode; +use TimedValueControlSource; + +glib_wrapper! { + pub struct InterpolationControlSource(Object) @extends TimedValueControlSource, gst::ControlSource, gst::Object; + + match fn { + get_type => || gst_controller_sys::gst_interpolation_control_source_get_type(), + } +} + +impl InterpolationControlSource { + pub fn new() -> InterpolationControlSource { + assert_initialized_main_thread!(); + unsafe { + gst::ControlSource::from_glib_full( + gst_controller_sys::gst_interpolation_control_source_new(), + ) + .unsafe_cast() + } + } +} + +impl Default for InterpolationControlSource { + fn default() -> Self { + Self::new() + } +} + +unsafe impl Send for InterpolationControlSource {} +unsafe impl Sync for InterpolationControlSource {} + +pub const NONE_INTERPOLATION_CONTROL_SOURCE: Option<&InterpolationControlSource> = None; + +pub trait InterpolationControlSourceExt: 'static { + fn get_property_mode(&self) -> InterpolationMode; + + fn set_property_mode(&self, mode: InterpolationMode); + + fn connect_property_mode_notify( + &self, + f: F, + ) -> SignalHandlerId; +} + +impl> InterpolationControlSourceExt for O { + fn get_property_mode(&self) -> InterpolationMode { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"mode\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `mode` getter") + .unwrap() + } + } + + fn set_property_mode(&self, mode: InterpolationMode) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"mode\0".as_ptr() as *const _, + Value::from(&mode).to_glib_none().0, + ); + } + } + + fn connect_property_mode_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_mode_trampoline( + this: *mut gst_controller_sys::GstInterpolationControlSource, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&InterpolationControlSource::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::mode\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_mode_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-controller/src/auto/lfo_control_source.rs b/gstreamer-controller/src/auto/lfo_control_source.rs new file mode 100644 index 000000000..422ea20ec --- /dev/null +++ b/gstreamer-controller/src/auto/lfo_control_source.rs @@ -0,0 +1,356 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use gst; +use gst_controller_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; +use LFOWaveform; + +glib_wrapper! { + pub struct LFOControlSource(Object) @extends gst::ControlSource, gst::Object; + + match fn { + get_type => || gst_controller_sys::gst_lfo_control_source_get_type(), + } +} + +impl LFOControlSource { + pub fn new() -> LFOControlSource { + assert_initialized_main_thread!(); + unsafe { + gst::ControlSource::from_glib_full(gst_controller_sys::gst_lfo_control_source_new()) + .unsafe_cast() + } + } +} + +impl Default for LFOControlSource { + fn default() -> Self { + Self::new() + } +} + +unsafe impl Send for LFOControlSource {} +unsafe impl Sync for LFOControlSource {} + +pub const NONE_LFO_CONTROL_SOURCE: Option<&LFOControlSource> = None; + +pub trait LFOControlSourceExt: 'static { + fn get_property_amplitude(&self) -> f64; + + fn set_property_amplitude(&self, amplitude: f64); + + fn get_property_frequency(&self) -> f64; + + fn set_property_frequency(&self, frequency: f64); + + fn get_property_offset(&self) -> f64; + + fn set_property_offset(&self, offset: f64); + + fn get_property_timeshift(&self) -> u64; + + fn set_property_timeshift(&self, timeshift: u64); + + fn get_property_waveform(&self) -> LFOWaveform; + + fn set_property_waveform(&self, waveform: LFOWaveform); + + fn connect_property_amplitude_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_frequency_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_offset_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_timeshift_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_waveform_notify( + &self, + f: F, + ) -> SignalHandlerId; +} + +impl> LFOControlSourceExt for O { + fn get_property_amplitude(&self) -> f64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"amplitude\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `amplitude` getter") + .unwrap() + } + } + + fn set_property_amplitude(&self, amplitude: f64) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"amplitude\0".as_ptr() as *const _, + Value::from(&litude).to_glib_none().0, + ); + } + } + + fn get_property_frequency(&self) -> f64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"frequency\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `frequency` getter") + .unwrap() + } + } + + fn set_property_frequency(&self, frequency: f64) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"frequency\0".as_ptr() as *const _, + Value::from(&frequency).to_glib_none().0, + ); + } + } + + fn get_property_offset(&self) -> f64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"offset\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `offset` getter") + .unwrap() + } + } + + fn set_property_offset(&self, offset: f64) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"offset\0".as_ptr() as *const _, + Value::from(&offset).to_glib_none().0, + ); + } + } + + fn get_property_timeshift(&self) -> u64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"timeshift\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `timeshift` getter") + .unwrap() + } + } + + fn set_property_timeshift(&self, timeshift: u64) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"timeshift\0".as_ptr() as *const _, + Value::from(×hift).to_glib_none().0, + ); + } + } + + fn get_property_waveform(&self) -> LFOWaveform { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"waveform\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `waveform` getter") + .unwrap() + } + } + + fn set_property_waveform(&self, waveform: LFOWaveform) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"waveform\0".as_ptr() as *const _, + Value::from(&waveform).to_glib_none().0, + ); + } + } + + fn connect_property_amplitude_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_amplitude_trampoline( + this: *mut gst_controller_sys::GstLFOControlSource, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&LFOControlSource::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::amplitude\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_amplitude_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_frequency_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_frequency_trampoline( + this: *mut gst_controller_sys::GstLFOControlSource, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&LFOControlSource::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::frequency\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_frequency_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_offset_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_offset_trampoline( + this: *mut gst_controller_sys::GstLFOControlSource, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&LFOControlSource::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::offset\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_offset_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_timeshift_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_timeshift_trampoline( + this: *mut gst_controller_sys::GstLFOControlSource, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&LFOControlSource::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::timeshift\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_timeshift_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_waveform_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_waveform_trampoline( + this: *mut gst_controller_sys::GstLFOControlSource, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&LFOControlSource::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::waveform\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_waveform_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-controller/src/auto/mod.rs b/gstreamer-controller/src/auto/mod.rs new file mode 100644 index 000000000..c5797b8fd --- /dev/null +++ b/gstreamer-controller/src/auto/mod.rs @@ -0,0 +1,60 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +mod argb_control_binding; +pub use self::argb_control_binding::ARGBControlBindingExt; +pub use self::argb_control_binding::{ + ARGBControlBinding, ARGBControlBindingClass, NONE_ARGB_CONTROL_BINDING, +}; + +mod direct_control_binding; +pub use self::direct_control_binding::DirectControlBindingExt; +pub use self::direct_control_binding::{ + DirectControlBinding, DirectControlBindingClass, NONE_DIRECT_CONTROL_BINDING, +}; + +mod interpolation_control_source; +pub use self::interpolation_control_source::InterpolationControlSourceExt; +pub use self::interpolation_control_source::{ + InterpolationControlSource, InterpolationControlSourceClass, NONE_INTERPOLATION_CONTROL_SOURCE, +}; + +mod lfo_control_source; +pub use self::lfo_control_source::LFOControlSourceExt; +pub use self::lfo_control_source::{ + LFOControlSource, LFOControlSourceClass, NONE_LFO_CONTROL_SOURCE, +}; + +#[cfg(any(feature = "v1_12", feature = "dox"))] +mod proxy_control_binding; +#[cfg(any(feature = "v1_12", feature = "dox"))] +pub use self::proxy_control_binding::{ + ProxyControlBinding, ProxyControlBindingClass, NONE_PROXY_CONTROL_BINDING, +}; + +mod timed_value_control_source; +pub use self::timed_value_control_source::TimedValueControlSourceExt; +pub use self::timed_value_control_source::{ + TimedValueControlSource, TimedValueControlSourceClass, NONE_TIMED_VALUE_CONTROL_SOURCE, +}; + +mod trigger_control_source; +pub use self::trigger_control_source::TriggerControlSourceExt; +pub use self::trigger_control_source::{ + TriggerControlSource, TriggerControlSourceClass, NONE_TRIGGER_CONTROL_SOURCE, +}; + +mod enums; +pub use self::enums::InterpolationMode; +pub use self::enums::LFOWaveform; + +#[doc(hidden)] +pub mod traits { + pub use super::ARGBControlBindingExt; + pub use super::DirectControlBindingExt; + pub use super::InterpolationControlSourceExt; + pub use super::LFOControlSourceExt; + pub use super::TimedValueControlSourceExt; + pub use super::TriggerControlSourceExt; +} diff --git a/gstreamer-controller/src/auto/proxy_control_binding.rs b/gstreamer-controller/src/auto/proxy_control_binding.rs new file mode 100644 index 000000000..49034d6ca --- /dev/null +++ b/gstreamer-controller/src/auto/proxy_control_binding.rs @@ -0,0 +1,45 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +#[cfg(any(feature = "v1_12", feature = "dox"))] +use glib::object::Cast; +#[cfg(any(feature = "v1_12", feature = "dox"))] +use glib::object::IsA; +use glib::translate::*; +use gst; +use gst_controller_sys; + +glib_wrapper! { + pub struct ProxyControlBinding(Object) @extends gst::ControlBinding, gst::Object; + + match fn { + get_type => || gst_controller_sys::gst_proxy_control_binding_get_type(), + } +} + +impl ProxyControlBinding { + #[cfg(any(feature = "v1_12", feature = "dox"))] + pub fn new, Q: IsA>( + object: &P, + property_name: &str, + ref_object: &Q, + ref_property_name: &str, + ) -> ProxyControlBinding { + assert_initialized_main_thread!(); + unsafe { + gst::ControlBinding::from_glib_none(gst_controller_sys::gst_proxy_control_binding_new( + object.as_ref().to_glib_none().0, + property_name.to_glib_none().0, + ref_object.as_ref().to_glib_none().0, + ref_property_name.to_glib_none().0, + )) + .unsafe_cast() + } + } +} + +unsafe impl Send for ProxyControlBinding {} +unsafe impl Sync for ProxyControlBinding {} + +pub const NONE_PROXY_CONTROL_BINDING: Option<&ProxyControlBinding> = None; diff --git a/gstreamer-controller/src/auto/timed_value_control_source.rs b/gstreamer-controller/src/auto/timed_value_control_source.rs new file mode 100644 index 000000000..a950d515b --- /dev/null +++ b/gstreamer-controller/src/auto/timed_value_control_source.rs @@ -0,0 +1,207 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib_sys; +use gst; +use gst_controller_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; +use ControlPoint; + +glib_wrapper! { + pub struct TimedValueControlSource(Object) @extends gst::ControlSource, gst::Object; + + match fn { + get_type => || gst_controller_sys::gst_timed_value_control_source_get_type(), + } +} + +unsafe impl Send for TimedValueControlSource {} +unsafe impl Sync for TimedValueControlSource {} + +pub const NONE_TIMED_VALUE_CONTROL_SOURCE: Option<&TimedValueControlSource> = None; + +pub trait TimedValueControlSourceExt: 'static { + //fn find_control_point_iter(&self, timestamp: gst::ClockTime) -> /*Ignored*/Option; + + //fn get_all(&self) -> /*Ignored*/Vec; + + fn get_count(&self) -> i32; + + fn set(&self, timestamp: gst::ClockTime, value: f64) -> bool; + + //fn set_from_list(&self, timedvalues: /*Ignored*/&[&gst::TimedValue]) -> bool; + + fn unset(&self, timestamp: gst::ClockTime) -> bool; + + fn unset_all(&self); + + fn connect_value_added( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_value_changed( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_value_removed( + &self, + f: F, + ) -> SignalHandlerId; +} + +impl> TimedValueControlSourceExt for O { + //fn find_control_point_iter(&self, timestamp: gst::ClockTime) -> /*Ignored*/Option { + // unsafe { TODO: call gst_controller_sys:gst_timed_value_control_source_find_control_point_iter() } + //} + + //fn get_all(&self) -> /*Ignored*/Vec { + // unsafe { TODO: call gst_controller_sys:gst_timed_value_control_source_get_all() } + //} + + fn get_count(&self) -> i32 { + unsafe { + gst_controller_sys::gst_timed_value_control_source_get_count( + self.as_ref().to_glib_none().0, + ) + } + } + + fn set(&self, timestamp: gst::ClockTime, value: f64) -> bool { + unsafe { + from_glib(gst_controller_sys::gst_timed_value_control_source_set( + self.as_ref().to_glib_none().0, + timestamp.to_glib(), + value, + )) + } + } + + //fn set_from_list(&self, timedvalues: /*Ignored*/&[&gst::TimedValue]) -> bool { + // unsafe { TODO: call gst_controller_sys:gst_timed_value_control_source_set_from_list() } + //} + + fn unset(&self, timestamp: gst::ClockTime) -> bool { + unsafe { + from_glib(gst_controller_sys::gst_timed_value_control_source_unset( + self.as_ref().to_glib_none().0, + timestamp.to_glib(), + )) + } + } + + fn unset_all(&self) { + unsafe { + gst_controller_sys::gst_timed_value_control_source_unset_all( + self.as_ref().to_glib_none().0, + ); + } + } + + fn connect_value_added( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn value_added_trampoline< + P, + F: Fn(&P, &ControlPoint) + Send + Sync + 'static, + >( + this: *mut gst_controller_sys::GstTimedValueControlSource, + timed_value: *mut gst_controller_sys::GstControlPoint, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f( + &TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(timed_value), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"value-added\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + value_added_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_value_changed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn value_changed_trampoline< + P, + F: Fn(&P, &ControlPoint) + Send + Sync + 'static, + >( + this: *mut gst_controller_sys::GstTimedValueControlSource, + timed_value: *mut gst_controller_sys::GstControlPoint, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f( + &TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(timed_value), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"value-changed\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + value_changed_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_value_removed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn value_removed_trampoline< + P, + F: Fn(&P, &ControlPoint) + Send + Sync + 'static, + >( + this: *mut gst_controller_sys::GstTimedValueControlSource, + timed_value: *mut gst_controller_sys::GstControlPoint, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f( + &TimedValueControlSource::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(timed_value), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"value-removed\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + value_removed_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-controller/src/auto/trigger_control_source.rs b/gstreamer-controller/src/auto/trigger_control_source.rs new file mode 100644 index 000000000..c09f362a3 --- /dev/null +++ b/gstreamer-controller/src/auto/trigger_control_source.rs @@ -0,0 +1,112 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use gst; +use gst_controller_sys; +use std::boxed::Box as Box_; +use std::mem::transmute; +use TimedValueControlSource; + +glib_wrapper! { + pub struct TriggerControlSource(Object) @extends TimedValueControlSource, gst::ControlSource, gst::Object; + + match fn { + get_type => || gst_controller_sys::gst_trigger_control_source_get_type(), + } +} + +impl TriggerControlSource { + pub fn new() -> TriggerControlSource { + assert_initialized_main_thread!(); + unsafe { + gst::ControlSource::from_glib_full(gst_controller_sys::gst_trigger_control_source_new()) + .unsafe_cast() + } + } +} + +impl Default for TriggerControlSource { + fn default() -> Self { + Self::new() + } +} + +unsafe impl Send for TriggerControlSource {} +unsafe impl Sync for TriggerControlSource {} + +pub const NONE_TRIGGER_CONTROL_SOURCE: Option<&TriggerControlSource> = None; + +pub trait TriggerControlSourceExt: 'static { + fn get_property_tolerance(&self) -> i64; + + fn set_property_tolerance(&self, tolerance: i64); + + fn connect_property_tolerance_notify( + &self, + f: F, + ) -> SignalHandlerId; +} + +impl> TriggerControlSourceExt for O { + fn get_property_tolerance(&self) -> i64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"tolerance\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `tolerance` getter") + .unwrap() + } + } + + fn set_property_tolerance(&self, tolerance: i64) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"tolerance\0".as_ptr() as *const _, + Value::from(&tolerance).to_glib_none().0, + ); + } + } + + fn connect_property_tolerance_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_tolerance_trampoline( + this: *mut gst_controller_sys::GstTriggerControlSource, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&TriggerControlSource::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tolerance\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tolerance_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-controller/src/auto/versions.txt b/gstreamer-controller/src/auto/versions.txt new file mode 100644 index 000000000..58b27f3ac --- /dev/null +++ b/gstreamer-controller/src/auto/versions.txt @@ -0,0 +1,2 @@ +Generated by gir (https://github.com/gtk-rs/gir @ a6737c7) +from gir-files (https://github.com/gtk-rs/gir-files @ f9bc6779) diff --git a/gstreamer-controller/src/control_point.rs b/gstreamer-controller/src/control_point.rs new file mode 100644 index 000000000..772f9b2b8 --- /dev/null +++ b/gstreamer-controller/src/control_point.rs @@ -0,0 +1,32 @@ +use glib::translate::*; +use gst_controller_sys; + +glib_wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct ControlPoint(Boxed); + + match fn { + copy => |ptr| gst_controller_sys::gst_control_point_copy(mut_override(ptr)), + free => |ptr| gst_controller_sys::gst_control_point_free(ptr), + get_type => || gst_controller_sys::gst_control_point_get_type(), + } +} + +impl ControlPoint { + pub fn timestamp(&self) -> gst::ClockTime { + unsafe { + let ptr = self.to_glib_none().0; + from_glib((*ptr).timestamp) + } + } + + pub fn value(&self) -> f64 { + unsafe { + let ptr = self.to_glib_none().0; + (*ptr).value + } + } +} + +unsafe impl Send for ControlPoint {} +unsafe impl Sync for ControlPoint {} diff --git a/gstreamer-controller/src/lib.rs b/gstreamer-controller/src/lib.rs new file mode 100644 index 000000000..3a4f85ce0 --- /dev/null +++ b/gstreamer-controller/src/lib.rs @@ -0,0 +1,32 @@ +#[macro_use] +extern crate glib; +extern crate glib_sys; +extern crate gobject_sys; +extern crate gstreamer as gst; +extern crate gstreamer_sys as gst_sys; + +extern crate gstreamer_controller_sys as gst_controller_sys; + +macro_rules! assert_initialized_main_thread { + () => { + if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { + panic!("GStreamer has not been initialized. Call `gst::init` first."); + } + }; +} + +macro_rules! skip_assert_initialized { + () => {}; +} + +#[allow(clippy::unreadable_literal)] +#[allow(clippy::too_many_arguments)] +#[allow(clippy::match_same_arms)] +mod auto; +mod control_point; +pub use auto::*; +use control_point::*; + +pub mod prelude { + pub use auto::traits::*; +} diff --git a/gstreamer/src/auto/child_proxy.rs b/gstreamer/src/auto/child_proxy.rs index aa8ec552a..a4f0f52c6 100644 --- a/gstreamer/src/auto/child_proxy.rs +++ b/gstreamer/src/auto/child_proxy.rs @@ -42,16 +42,12 @@ pub trait ChildProxyExt: 'static { fn get_children_count(&self) -> u32; - //fn get_property(&self, name: &str, value: /*Ignored*/glib::Value); - //fn get_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported); //fn lookup(&self, name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option; //fn set(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); - //fn set_property(&self, name: &str, value: /*Ignored*/&glib::Value); - //fn set_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported); fn connect_child_added( @@ -112,10 +108,6 @@ impl> ChildProxyExt for O { unsafe { gst_sys::gst_child_proxy_get_children_count(self.as_ref().to_glib_none().0) } } - //fn get_property(&self, name: &str, value: /*Ignored*/glib::Value) { - // unsafe { TODO: call gst_sys:gst_child_proxy_get_property() } - //} - //fn get_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) { // unsafe { TODO: call gst_sys:gst_child_proxy_get_valist() } //} @@ -128,10 +120,6 @@ impl> ChildProxyExt for O { // unsafe { TODO: call gst_sys:gst_child_proxy_set() } //} - //fn set_property(&self, name: &str, value: /*Ignored*/&glib::Value) { - // unsafe { TODO: call gst_sys:gst_child_proxy_set_property() } - //} - //fn set_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) { // unsafe { TODO: call gst_sys:gst_child_proxy_set_valist() } //} diff --git a/gstreamer/src/auto/control_binding.rs b/gstreamer/src/auto/control_binding.rs new file mode 100644 index 000000000..68a7f02ca --- /dev/null +++ b/gstreamer/src/auto/control_binding.rs @@ -0,0 +1,107 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib; +use glib::object::IsA; +use glib::translate::*; +use glib::StaticType; +use glib::Value; +use gobject_sys; +use gst_sys; +use ClockTime; +use Object; + +glib_wrapper! { + pub struct ControlBinding(Object) @extends Object; + + match fn { + get_type => || gst_sys::gst_control_binding_get_type(), + } +} + +unsafe impl Send for ControlBinding {} +unsafe impl Sync for ControlBinding {} + +pub const NONE_CONTROL_BINDING: Option<&ControlBinding> = None; + +pub trait ControlBindingExt: 'static { + fn get_value(&self, timestamp: ClockTime) -> Option; + + //fn get_value_array(&self, timestamp: ClockTime, interval: ClockTime, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool; + + fn is_disabled(&self) -> bool; + + fn set_disabled(&self, disabled: bool); + + fn sync_values>( + &self, + object: &P, + timestamp: ClockTime, + last_sync: ClockTime, + ) -> bool; + + fn get_property_object(&self) -> Option; +} + +impl> ControlBindingExt for O { + fn get_value(&self, timestamp: ClockTime) -> Option { + unsafe { + from_glib_full(gst_sys::gst_control_binding_get_value( + self.as_ref().to_glib_none().0, + timestamp.to_glib(), + )) + } + } + + //fn get_value_array(&self, timestamp: ClockTime, interval: ClockTime, values: /*Unimplemented*/&[&Fundamental: Pointer]) -> bool { + // unsafe { TODO: call gst_sys:gst_control_binding_get_value_array() } + //} + + fn is_disabled(&self) -> bool { + unsafe { + from_glib(gst_sys::gst_control_binding_is_disabled( + self.as_ref().to_glib_none().0, + )) + } + } + + fn set_disabled(&self, disabled: bool) { + unsafe { + gst_sys::gst_control_binding_set_disabled( + self.as_ref().to_glib_none().0, + disabled.to_glib(), + ); + } + } + + fn sync_values>( + &self, + object: &P, + timestamp: ClockTime, + last_sync: ClockTime, + ) -> bool { + unsafe { + from_glib(gst_sys::gst_control_binding_sync_values( + self.as_ref().to_glib_none().0, + object.as_ref().to_glib_none().0, + timestamp.to_glib(), + last_sync.to_glib(), + )) + } + } + + fn get_property_object(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"object\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `object` getter") + } + } +} diff --git a/gstreamer/src/auto/control_source.rs b/gstreamer/src/auto/control_source.rs new file mode 100644 index 000000000..baf4fe67a --- /dev/null +++ b/gstreamer/src/auto/control_source.rs @@ -0,0 +1,46 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::object::IsA; +use glib::translate::*; +use gst_sys; +use std::mem; +use ClockTime; +use Object; + +glib_wrapper! { + pub struct ControlSource(Object) @extends Object; + + match fn { + get_type => || gst_sys::gst_control_source_get_type(), + } +} + +unsafe impl Send for ControlSource {} +unsafe impl Sync for ControlSource {} + +pub const NONE_CONTROL_SOURCE: Option<&ControlSource> = None; + +pub trait ControlSourceExt: 'static { + fn get_value(&self, timestamp: ClockTime) -> Option; +} + +impl> ControlSourceExt for O { + fn get_value(&self, timestamp: ClockTime) -> Option { + unsafe { + let mut value = mem::MaybeUninit::uninit(); + let ret = from_glib(gst_sys::gst_control_source_get_value( + self.as_ref().to_glib_none().0, + timestamp.to_glib(), + value.as_mut_ptr(), + )); + let value = value.assume_init(); + if ret { + Some(value) + } else { + None + } + } + } +} diff --git a/gstreamer/src/auto/mod.rs b/gstreamer/src/auto/mod.rs index a5ef0e8e8..989e0c4d3 100644 --- a/gstreamer/src/auto/mod.rs +++ b/gstreamer/src/auto/mod.rs @@ -25,6 +25,14 @@ mod clock; pub use self::clock::ClockExt; pub use self::clock::{Clock, ClockClass, NONE_CLOCK}; +mod control_binding; +pub use self::control_binding::ControlBindingExt; +pub use self::control_binding::{ControlBinding, ControlBindingClass, NONE_CONTROL_BINDING}; + +mod control_source; +pub use self::control_source::ControlSourceExt; +pub use self::control_source::{ControlSource, ControlSourceClass, NONE_CONTROL_SOURCE}; + mod device; pub use self::device::DeviceExt; pub use self::device::{Device, DeviceClass, NONE_DEVICE}; @@ -201,6 +209,8 @@ pub mod traits { pub use super::BufferPoolExt; pub use super::ChildProxyExt; pub use super::ClockExt; + pub use super::ControlBindingExt; + pub use super::ControlSourceExt; pub use super::DeviceExt; pub use super::DeviceMonitorExt; pub use super::DeviceProviderExt; diff --git a/gstreamer/src/auto/object.rs b/gstreamer/src/auto/object.rs index 2d15c5b30..c8e737fe8 100644 --- a/gstreamer/src/auto/object.rs +++ b/gstreamer/src/auto/object.rs @@ -14,6 +14,7 @@ use gst_sys; use std::boxed::Box as Box_; use std::mem::transmute; use ClockTime; +use ControlBinding; glib_wrapper! { pub struct Object(Object); @@ -53,23 +54,24 @@ unsafe impl Sync for Object {} pub const NONE_OBJECT: Option<&Object> = None; pub trait GstObjectExt: 'static { - //fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool; + fn add_control_binding>( + &self, + binding: &P, + ) -> Result<(), glib::error::BoolError>; fn default_error(&self, error: &glib::Error, debug: Option<&str>); - //fn get_control_binding(&self, property_name: &str) -> /*Ignored*/Option; + fn get_control_binding(&self, property_name: &str) -> Option; fn get_control_rate(&self) -> ClockTime; - //fn get_g_value_array(&self, property_name: &str, timestamp: ClockTime, interval: ClockTime, values: /*Ignored*/&[&glib::Value]) -> bool; - fn get_name(&self) -> GString; fn get_parent(&self) -> Option; fn get_path_string(&self) -> GString; - //fn get_value(&self, property_name: &str, timestamp: ClockTime) -> /*Ignored*/Option; + fn get_value(&self, property_name: &str, timestamp: ClockTime) -> Option; //fn get_value_array(&self, property_name: &str, timestamp: ClockTime, interval: ClockTime, n_values: u32, values: /*Unimplemented*/Option) -> bool; @@ -81,7 +83,7 @@ pub trait GstObjectExt: 'static { fn has_as_parent>(&self, parent: &P) -> bool; - //fn remove_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool; + fn remove_control_binding>(&self, binding: &P) -> bool; fn set_control_binding_disabled(&self, property_name: &str, disabled: bool); @@ -106,9 +108,20 @@ pub trait GstObjectExt: 'static { } impl> GstObjectExt for O { - //fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool { - // unsafe { TODO: call gst_sys:gst_object_add_control_binding() } - //} + fn add_control_binding>( + &self, + binding: &P, + ) -> Result<(), glib::error::BoolError> { + unsafe { + glib_result_from_gboolean!( + gst_sys::gst_object_add_control_binding( + self.as_ref().to_glib_none().0, + binding.as_ref().to_glib_none().0 + ), + "Failed to add control binding" + ) + } + } fn default_error(&self, error: &glib::Error, debug: Option<&str>) { unsafe { @@ -120,9 +133,14 @@ impl> GstObjectExt for O { } } - //fn get_control_binding(&self, property_name: &str) -> /*Ignored*/Option { - // unsafe { TODO: call gst_sys:gst_object_get_control_binding() } - //} + fn get_control_binding(&self, property_name: &str) -> Option { + unsafe { + from_glib_full(gst_sys::gst_object_get_control_binding( + self.as_ref().to_glib_none().0, + property_name.to_glib_none().0, + )) + } + } fn get_control_rate(&self) -> ClockTime { unsafe { @@ -132,10 +150,6 @@ impl> GstObjectExt for O { } } - //fn get_g_value_array(&self, property_name: &str, timestamp: ClockTime, interval: ClockTime, values: /*Ignored*/&[&glib::Value]) -> bool { - // unsafe { TODO: call gst_sys:gst_object_get_g_value_array() } - //} - fn get_name(&self) -> GString { unsafe { from_glib_full(gst_sys::gst_object_get_name(self.as_ref().to_glib_none().0)) } } @@ -156,9 +170,15 @@ impl> GstObjectExt for O { } } - //fn get_value(&self, property_name: &str, timestamp: ClockTime) -> /*Ignored*/Option { - // unsafe { TODO: call gst_sys:gst_object_get_value() } - //} + fn get_value(&self, property_name: &str, timestamp: ClockTime) -> Option { + unsafe { + from_glib_full(gst_sys::gst_object_get_value( + self.as_ref().to_glib_none().0, + property_name.to_glib_none().0, + timestamp.to_glib(), + )) + } + } //fn get_value_array(&self, property_name: &str, timestamp: ClockTime, interval: ClockTime, n_values: u32, values: /*Unimplemented*/Option) -> bool { // unsafe { TODO: call gst_sys:gst_object_get_value_array() } @@ -199,9 +219,14 @@ impl> GstObjectExt for O { } } - //fn remove_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool { - // unsafe { TODO: call gst_sys:gst_object_remove_control_binding() } - //} + fn remove_control_binding>(&self, binding: &P) -> bool { + unsafe { + from_glib(gst_sys::gst_object_remove_control_binding( + self.as_ref().to_glib_none().0, + binding.as_ref().to_glib_none().0, + )) + } + } fn set_control_binding_disabled(&self, property_name: &str, disabled: bool) { unsafe { diff --git a/gstreamer/src/auto/tag_setter.rs b/gstreamer/src/auto/tag_setter.rs index 0948d17aa..104089d94 100644 --- a/gstreamer/src/auto/tag_setter.rs +++ b/gstreamer/src/auto/tag_setter.rs @@ -28,8 +28,6 @@ pub trait TagSetterExt: 'static { //fn add_tag_valist_values(&self, mode: TagMergeMode, tag: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported); - //fn add_tag_value(&self, mode: TagMergeMode, tag: &str, value: /*Ignored*/&glib::Value); - //fn add_tag_values(&self, mode: TagMergeMode, tag: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); //fn add_tags(&self, mode: TagMergeMode, tag: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); @@ -54,10 +52,6 @@ impl> TagSetterExt for O { // unsafe { TODO: call gst_sys:gst_tag_setter_add_tag_valist_values() } //} - //fn add_tag_value(&self, mode: TagMergeMode, tag: &str, value: /*Ignored*/&glib::Value) { - // unsafe { TODO: call gst_sys:gst_tag_setter_add_tag_value() } - //} - //fn add_tag_values(&self, mode: TagMergeMode, tag: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { // unsafe { TODO: call gst_sys:gst_tag_setter_add_tag_values() } //} diff --git a/gstreamer/src/auto/versions.txt b/gstreamer/src/auto/versions.txt index 5061db15e..16f6c334b 100644 --- a/gstreamer/src/auto/versions.txt +++ b/gstreamer/src/auto/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ 60cbef0) -from gir-files (https://github.com/gtk-rs/gir-files @ 0877e6fc) +from gir-files (https://github.com/gtk-rs/gir-files @ 233d39ae) diff --git a/gstreamer/src/control_binding.rs b/gstreamer/src/control_binding.rs new file mode 100644 index 000000000..6820a8d99 --- /dev/null +++ b/gstreamer/src/control_binding.rs @@ -0,0 +1,45 @@ +// Copyright (C) 2017 Sebastian Dröge +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use glib::object::IsA; +use glib::translate::*; +use gst_sys; +use ClockTime; +use ControlBinding; + +pub trait ControlBindingExtManual: 'static { + fn get_g_value_array( + &self, + timestamp: ClockTime, + interval: ClockTime, + values: &mut [glib::Value], + ) -> Result<(), glib::error::BoolError>; +} + +impl> ControlBindingExtManual for O { + fn get_g_value_array( + &self, + timestamp: ClockTime, + interval: ClockTime, + values: &mut [glib::Value], + ) -> Result<(), glib::error::BoolError> { + let n_values = values.len() as u32; + unsafe { + glib_result_from_gboolean!( + gst_sys::gst_control_binding_get_g_value_array( + self.as_ref().to_glib_none().0, + timestamp.to_glib(), + interval.to_glib(), + n_values, + values.as_mut_ptr() as *mut gobject_sys::GValue, + ), + "Failed to get value array" + ) + } + } +} diff --git a/gstreamer/src/control_source.rs b/gstreamer/src/control_source.rs new file mode 100644 index 000000000..09d571302 --- /dev/null +++ b/gstreamer/src/control_source.rs @@ -0,0 +1,45 @@ +// Copyright (C) 2017 Sebastian Dröge +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use glib::object::IsA; +use glib::translate::*; +use gst_sys; +use ClockTime; +use ControlSource; + +pub trait ControlSourceExtManual: 'static { + fn get_value_array( + &self, + timestamp: ClockTime, + interval: ClockTime, + values: &mut [f64], + ) -> Result<(), glib::error::BoolError>; +} + +impl> ControlSourceExtManual for O { + fn get_value_array( + &self, + timestamp: ClockTime, + interval: ClockTime, + values: &mut [f64], + ) -> Result<(), glib::error::BoolError> { + let n_values = values.len() as u32; + unsafe { + glib_result_from_gboolean!( + gst_sys::gst_control_source_get_value_array( + self.as_ref().to_glib_none().0, + timestamp.to_glib(), + interval.to_glib(), + n_values, + values.to_glib_none().0, + ), + "Failed to get value array" + ) + } + } +} diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 0aca5b86a..d83f1eeca 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -204,6 +204,8 @@ mod iterator; mod object; mod pad; pub use pad::PadBuilder; +mod control_binding; +mod control_source; mod parse_context; mod proxy_pad; mod tag_setter; diff --git a/gstreamer/src/object.rs b/gstreamer/src/object.rs index f9a7bc74d..3c2e5f7ca 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -14,6 +14,7 @@ use glib::IsA; use gobject_sys; +use ClockTime; use ObjectFlags; pub trait GstObjectExtManual: 'static { @@ -28,6 +29,14 @@ pub trait GstObjectExtManual: 'static { fn unset_object_flags(&self, flags: ObjectFlags); fn get_object_flags(&self) -> ObjectFlags; + + fn get_g_value_array( + &self, + property_name: &str, + timestamp: ClockTime, + interval: ClockTime, + values: &mut [glib::Value], + ) -> Result<(), glib::error::BoolError>; } impl> GstObjectExtManual for O { @@ -98,6 +107,29 @@ impl> GstObjectExtManual for O { from_glib((*ptr).flags) } } + + fn get_g_value_array( + &self, + property_name: &str, + timestamp: ClockTime, + interval: ClockTime, + values: &mut [glib::Value], + ) -> Result<(), glib::error::BoolError> { + let n_values = values.len() as u32; + unsafe { + glib_result_from_gboolean!( + gst_sys::gst_object_get_g_value_array( + self.as_ref().to_glib_none().0, + property_name.to_glib_none().0, + timestamp.to_glib(), + interval.to_glib(), + n_values, + values.as_mut_ptr() as *mut gobject_sys::GValue, + ), + "Failed to get value array" + ) + } + } } #[cfg(test)]