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