gstreamer/auto/control_binding.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, ClockTime, Object};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 /// A base class for value mapping objects that attaches control sources to [`glib::Object`][crate::glib::Object]
11 /// properties. Such an object is taking one or more [`ControlSource`][crate::ControlSource] instances,
12 /// combines them and maps the resulting value to the type and value range of the
13 /// bound property.
14 ///
15 /// This is an Abstract Base Class, you cannot instantiate it.
16 ///
17 /// ## Properties
18 ///
19 ///
20 /// #### `name`
21 /// Readable | Writeable | Construct Only
22 ///
23 ///
24 /// #### `object`
25 /// Readable | Writeable | Construct Only
26 /// <details><summary><h4>Object</h4></summary>
27 ///
28 ///
29 /// #### `name`
30 /// Readable | Writeable | Construct
31 ///
32 ///
33 /// #### `parent`
34 /// The parent of the object. Please note, that when changing the 'parent'
35 /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::Object#deep-notify]
36 /// signals due to locking issues. In some cases one can use
37 /// [`element-added`][struct@crate::Bin#element-added] or [`element-removed`][struct@crate::Bin#element-removed] signals on the parent to
38 /// achieve a similar effect.
39 ///
40 /// Readable | Writeable
41 /// </details>
42 ///
43 /// # Implements
44 ///
45 /// [`ControlBindingExt`][trait@crate::prelude::ControlBindingExt], [`GstObjectExt`][trait@crate::prelude::GstObjectExt], [`trait@glib::ObjectExt`], [`ControlBindingExtManual`][trait@crate::prelude::ControlBindingExtManual]
46 #[doc(alias = "GstControlBinding")]
47 pub struct ControlBinding(Object<ffi::GstControlBinding, ffi::GstControlBindingClass>) @extends Object;
48
49 match fn {
50 type_ => || ffi::gst_control_binding_get_type(),
51 }
52}
53
54impl ControlBinding {
55 pub const NONE: Option<&'static ControlBinding> = None;
56}
57
58unsafe impl Send for ControlBinding {}
59unsafe impl Sync for ControlBinding {}
60
61/// Trait containing all [`struct@ControlBinding`] methods.
62///
63/// # Implementors
64///
65/// [`ControlBinding`][struct@crate::ControlBinding]
66pub trait ControlBindingExt: IsA<ControlBinding> + 'static {
67 /// Gets the value for the given controlled property at the requested time.
68 /// ## `timestamp`
69 /// the time the control-change should be read from
70 ///
71 /// # Returns
72 ///
73 /// the GValue of the property at the given time,
74 /// or [`None`] if the property isn't controlled.
75 #[doc(alias = "gst_control_binding_get_value")]
76 #[doc(alias = "get_value")]
77 fn value(&self, timestamp: ClockTime) -> Option<glib::Value> {
78 unsafe {
79 from_glib_full(ffi::gst_control_binding_get_value(
80 self.as_ref().to_glib_none().0,
81 timestamp.into_glib(),
82 ))
83 }
84 }
85
86 //#[doc(alias = "gst_control_binding_get_value_array")]
87 //#[doc(alias = "get_value_array")]
88 //fn is_value_array(&self, timestamp: impl Into<Option<ClockTime>>, interval: impl Into<Option<ClockTime>>, values: /*Unimplemented*/&[&Basic: Pointer]) -> bool {
89 // unsafe { TODO: call ffi:gst_control_binding_get_value_array() }
90 //}
91
92 /// Checks if the control binding is disabled.
93 ///
94 /// # Returns
95 ///
96 /// [`true`] if the binding is inactive
97 #[doc(alias = "gst_control_binding_is_disabled")]
98 fn is_disabled(&self) -> bool {
99 unsafe {
100 from_glib(ffi::gst_control_binding_is_disabled(
101 self.as_ref().to_glib_none().0,
102 ))
103 }
104 }
105
106 /// This function is used to disable a control binding for some time, i.e.
107 /// [`GstObjectExt::sync_values()`][crate::prelude::GstObjectExt::sync_values()] will do nothing.
108 /// ## `disabled`
109 /// boolean that specifies whether to disable the controller
110 /// or not.
111 #[doc(alias = "gst_control_binding_set_disabled")]
112 fn set_disabled(&self, disabled: bool) {
113 unsafe {
114 ffi::gst_control_binding_set_disabled(
115 self.as_ref().to_glib_none().0,
116 disabled.into_glib(),
117 );
118 }
119 }
120
121 /// Sets the property of the `object`, according to the `GstControlSources` that
122 /// handles it and for the given timestamp.
123 ///
124 /// If this function fails, it is most likely the application developers fault.
125 /// Most probably the control sources are not setup correctly.
126 /// ## `object`
127 /// the object that has controlled properties
128 /// ## `timestamp`
129 /// the time that should be processed
130 /// ## `last_sync`
131 /// the last time this was called
132 ///
133 /// # Returns
134 ///
135 /// [`true`] if the controller value could be applied to the object
136 /// property, [`false`] otherwise
137 #[doc(alias = "gst_control_binding_sync_values")]
138 fn sync_values(
139 &self,
140 object: &impl IsA<Object>,
141 timestamp: ClockTime,
142 last_sync: impl Into<Option<ClockTime>>,
143 ) -> bool {
144 unsafe {
145 from_glib(ffi::gst_control_binding_sync_values(
146 self.as_ref().to_glib_none().0,
147 object.as_ref().to_glib_none().0,
148 timestamp.into_glib(),
149 last_sync.into().into_glib(),
150 ))
151 }
152 }
153
154 fn object(&self) -> Option<Object> {
155 ObjectExt::property(self.as_ref(), "object")
156 }
157}
158
159impl<O: IsA<ControlBinding>> ControlBindingExt for O {}