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 
65 private import gobject.Value;
66 private import gstreamer.ObjectGst;
67 
68 
69 
70 private import gstreamer.ObjectGst;
71 
72 /**
73  * A base class for value mapping objects that attaches control sources to gobject
74  * properties. Such an object is taking one or more GstControlSource instances,
75  * combines them and maps the resulting value to the type and value range of the
76  * bound property.
77  */
78 public class ControlBinding : ObjectGst
79 {
80 	
81 	/** the main Gtk struct */
82 	protected GstControlBinding* gstControlBinding;
83 	
84 	
85 	public GstControlBinding* getControlBindingStruct()
86 	{
87 		return gstControlBinding;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected override void* getStruct()
93 	{
94 		return cast(void*)gstControlBinding;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (GstControlBinding* gstControlBinding)
101 	{
102 		super(cast(GstObject*)gstControlBinding);
103 		this.gstControlBinding = gstControlBinding;
104 	}
105 	
106 	protected override void setStruct(GObject* obj)
107 	{
108 		super.setStruct(obj);
109 		gstControlBinding = cast(GstControlBinding*)obj;
110 	}
111 	
112 	/**
113 	 */
114 	
115 	/**
116 	 * Sets the property of the object, according to the GstControlSources that
117 	 * handle them and for the given timestamp.
118 	 * If this function fails, it is most likely the application developers fault.
119 	 * Most probably the control sources are not setup correctly.
120 	 * Params:
121 	 * object = the object that has controlled properties
122 	 * timestamp = the time that should be processed
123 	 * lastSync = the last time this was called
124 	 * Returns: TRUE if the controller value could be applied to the object property, FALSE otherwise
125 	 */
126 	public int syncValues(ObjectGst object, GstClockTime timestamp, GstClockTime lastSync)
127 	{
128 		// gboolean gst_control_binding_sync_values (GstControlBinding *binding,  GstObject *object,  GstClockTime timestamp,  GstClockTime last_sync);
129 		return gst_control_binding_sync_values(gstControlBinding, (object is null) ? null : object.getObjectGstStruct(), timestamp, lastSync);
130 	}
131 	
132 	/**
133 	 * Gets the value for the given controlled property at the requested time.
134 	 * Params:
135 	 * timestamp = the time the control-change should be read from
136 	 * Returns: the GValue of the property at the given time, or NULL if the property isn't controlled.
137 	 */
138 	public Value getValue(GstClockTime timestamp)
139 	{
140 		// GValue * gst_control_binding_get_value (GstControlBinding *binding,  GstClockTime timestamp);
141 		auto p = gst_control_binding_get_value(gstControlBinding, timestamp);
142 		
143 		if(p is null)
144 		{
145 			return null;
146 		}
147 		
148 		return ObjectG.getDObject!(Value)(cast(GValue*) p);
149 	}
150 	
151 	/**
152 	 * Gets a number of values for the given controlled property starting at the
153 	 * requested time. The array values need to hold enough space for n_values of
154 	 * the same type as the objects property's type.
155 	 * This function is useful if one wants to e.g. draw a graph of the control
156 	 * curve or apply a control curve sample by sample.
157 	 * The values are unboxed and ready to be used. The similar function
158 	 * gst_control_binding_get_g_value_array() returns the array as GValues and is
159 	 * more suitable for bindings.
160 	 * Params:
161 	 * timestamp = the time that should be processed
162 	 * interval = the time spacing between subsequent values
163 	 * values = array to put control-values in
164 	 * Returns: TRUE if the given array could be filled, FALSE otherwise
165 	 */
166 	public int getValueArray(GstClockTime timestamp, GstClockTime interval, void[] values)
167 	{
168 		// gboolean gst_control_binding_get_value_array (GstControlBinding *binding,  GstClockTime timestamp,  GstClockTime interval,  guint n_values,  gpointer values);
169 		return gst_control_binding_get_value_array(gstControlBinding, timestamp, interval, cast(int) values.length, values.ptr);
170 	}
171 	
172 	/**
173 	 * Gets a number of GValues for the given controlled property starting at the
174 	 * requested time. The array values need to hold enough space for n_values of
175 	 * GValue.
176 	 * This function is useful if one wants to e.g. draw a graph of the control
177 	 * curve or apply a control curve sample by sample.
178 	 * Params:
179 	 * timestamp = the time that should be processed
180 	 * interval = the time spacing between subsequent values
181 	 * values = array to put control-values in
182 	 * Returns: TRUE if the given array could be filled, FALSE otherwise
183 	 */
184 	public int getGValueArray(GstClockTime timestamp, GstClockTime interval, GValue[] values)
185 	{
186 		// gboolean gst_control_binding_get_g_value_array  (GstControlBinding *binding,  GstClockTime timestamp,  GstClockTime interval,  guint n_values,  GValue *values);
187 		return gst_control_binding_get_g_value_array(gstControlBinding, timestamp, interval, cast(int) values.length, values.ptr);
188 	}
189 	
190 	/**
191 	 * This function is used to disable a control binding for some time, i.e.
192 	 * gst_object_sync_values() will do nothing.
193 	 * Params:
194 	 * disabled = boolean that specifies whether to disable the controller
195 	 * or not.
196 	 */
197 	public void setDisabled(int disabled)
198 	{
199 		// void gst_control_binding_set_disabled (GstControlBinding *binding,  gboolean disabled);
200 		gst_control_binding_set_disabled(gstControlBinding, disabled);
201 	}
202 	
203 	/**
204 	 * Check if the control binding is disabled.
205 	 * Returns: TRUE if the binding is inactive
206 	 */
207 	public int isDisabled()
208 	{
209 		// gboolean gst_control_binding_is_disabled (GstControlBinding *binding);
210 		return gst_control_binding_is_disabled(gstControlBinding);
211 	}
212 }