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