1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GstControlBinding.html
27  * outPack = gstreamer
28  * outFile = ControlBinding
29  * strct   = GstControlBinding
30  * realStrct=
31  * ctorStrct=
32  * clss    = ControlBinding
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_control_binding_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- gobject.Value
47  * 	- gstreamer.ObjectGst
48  * structWrap:
49  * 	- GValue* -> Value
50  * 	- GstObject* -> ObjectGst
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module gstreamer.ControlBinding;
57 
58 public  import gstreamerc.gstreamertypes;
59 
60 private import gstreamerc.gstreamer;
61 private import glib.ConstructionException;
62 private import gobject.ObjectG;
63 
64 private import gobject.Value;
65 private import gstreamer.ObjectGst;
66 
67 
68 private import gstreamer.ObjectGst;
69 
70 /**
71  * A base class for value mapping objects that attaches control sources to gobject
72  * properties. Such an object is taking one or more GstControlSource instances,
73  * combines them and maps the resulting value to the type and value range of the
74  * bound property.
75  */
76 public class ControlBinding : ObjectGst
77 {
78 	
79 	/** the main Gtk struct */
80 	protected GstControlBinding* gstControlBinding;
81 	
82 	
83 	/** Get the main Gtk struct */
84 	public GstControlBinding* getControlBindingStruct()
85 	{
86 		return gstControlBinding;
87 	}
88 	
89 	
90 	/** the main Gtk struct as a void* */
91 	protected override void* getStruct()
92 	{
93 		return cast(void*)gstControlBinding;
94 	}
95 	
96 	/**
97 	 * Sets our main struct and passes it to the parent class
98 	 */
99 	public this (GstControlBinding* gstControlBinding)
100 	{
101 		super(cast(GstObject*)gstControlBinding);
102 		this.gstControlBinding = gstControlBinding;
103 	}
104 	
105 	protected override void setStruct(GObject* obj)
106 	{
107 		super.setStruct(obj);
108 		gstControlBinding = cast(GstControlBinding*)obj;
109 	}
110 	
111 	/**
112 	 */
113 	
114 	/**
115 	 * Sets the property of the object, according to the GstControlSources that
116 	 * handle them and for the given timestamp.
117 	 * If this function fails, it is most likely the application developers fault.
118 	 * Most probably the control sources are not setup correctly.
119 	 * Params:
120 	 * object = the object that has controlled properties
121 	 * timestamp = the time that should be processed
122 	 * lastSync = the last time this was called
123 	 * Returns: TRUE if the controller value could be applied to the object property, FALSE otherwise
124 	 */
125 	public int syncValues(ObjectGst object, GstClockTime timestamp, GstClockTime lastSync)
126 	{
127 		// gboolean gst_control_binding_sync_values (GstControlBinding *binding,  GstObject *object,  GstClockTime timestamp,  GstClockTime last_sync);
128 		return gst_control_binding_sync_values(gstControlBinding, (object is null) ? null : object.getObjectGstStruct(), timestamp, lastSync);
129 	}
130 	
131 	/**
132 	 * Gets the value for the given controlled property at the requested time.
133 	 * Params:
134 	 * timestamp = the time the control-change should be read from
135 	 * Returns: the GValue of the property at the given time, or NULL if the property isn't controlled.
136 	 */
137 	public Value getValue(GstClockTime timestamp)
138 	{
139 		// GValue * gst_control_binding_get_value (GstControlBinding *binding,  GstClockTime timestamp);
140 		auto p = gst_control_binding_get_value(gstControlBinding, timestamp);
141 		
142 		if(p is null)
143 		{
144 			return null;
145 		}
146 		
147 		return ObjectG.getDObject!(Value)(cast(GValue*) p);
148 	}
149 	
150 	/**
151 	 * Gets a number of values for the given controlled property starting at the
152 	 * requested time. The array values need to hold enough space for n_values of
153 	 * the same type as the objects property's type.
154 	 * This function is useful if one wants to e.g. draw a graph of the control
155 	 * curve or apply a control curve sample by sample.
156 	 * The values are unboxed and ready to be used. The similar function
157 	 * gst_control_binding_get_g_value_array() returns the array as GValues and is
158 	 * more suitable for bindings.
159 	 * Params:
160 	 * timestamp = the time that should be processed
161 	 * interval = the time spacing between subsequent values
162 	 * values = array to put control-values in
163 	 * Returns: TRUE if the given array could be filled, FALSE otherwise
164 	 */
165 	public int getValueArray(GstClockTime timestamp, GstClockTime interval, void[] values)
166 	{
167 		// gboolean gst_control_binding_get_value_array (GstControlBinding *binding,  GstClockTime timestamp,  GstClockTime interval,  guint n_values,  gpointer values);
168 		return gst_control_binding_get_value_array(gstControlBinding, timestamp, interval, cast(int) values.length, values.ptr);
169 	}
170 	
171 	/**
172 	 * Gets a number of GValues for the given controlled property starting at the
173 	 * requested time. The array values need to hold enough space for n_values of
174 	 * GValue.
175 	 * This function is useful if one wants to e.g. draw a graph of the control
176 	 * curve or apply a control curve sample by sample.
177 	 * Params:
178 	 * timestamp = the time that should be processed
179 	 * interval = the time spacing between subsequent values
180 	 * values = array to put control-values in
181 	 * Returns: TRUE if the given array could be filled, FALSE otherwise
182 	 */
183 	public int getGValueArray(GstClockTime timestamp, GstClockTime interval, GValue[] values)
184 	{
185 		// gboolean gst_control_binding_get_g_value_array  (GstControlBinding *binding,  GstClockTime timestamp,  GstClockTime interval,  guint n_values,  GValue *values);
186 		return gst_control_binding_get_g_value_array(gstControlBinding, timestamp, interval, cast(int) values.length, values.ptr);
187 	}
188 	
189 	/**
190 	 * This function is used to disable a control binding for some time, i.e.
191 	 * gst_object_sync_values() will do nothing.
192 	 * Params:
193 	 * disabled = boolean that specifies whether to disable the controller
194 	 * or not.
195 	 */
196 	public void setDisabled(int disabled)
197 	{
198 		// void gst_control_binding_set_disabled (GstControlBinding *binding,  gboolean disabled);
199 		gst_control_binding_set_disabled(gstControlBinding, disabled);
200 	}
201 	
202 	/**
203 	 * Check if the control binding is disabled.
204 	 * Returns: TRUE if the binding is inactive
205 	 */
206 	public int isDisabled()
207 	{
208 		// gboolean gst_control_binding_is_disabled (GstControlBinding *binding);
209 		return gst_control_binding_is_disabled(gstControlBinding);
210 	}
211 }