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