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 = GstControlSource.html 27 * outPack = gstreamer 28 * outFile = ControlSource 29 * strct = GstControlSource 30 * realStrct= 31 * ctorStrct= 32 * clss = ControlSource 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_control_source_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * structWrap: 47 * module aliases: 48 * local aliases: 49 * overrides: 50 */ 51 52 module gstreamer.ControlSource; 53 54 public import gstreamerc.gstreamertypes; 55 56 private import gstreamerc.gstreamer; 57 private import glib.ConstructionException; 58 private import gobject.ObjectG; 59 60 61 62 63 64 private import gstreamer.ObjectGst; 65 66 /** 67 * The GstControlSource is a base class for control value sources that could 68 * be used by GstController to get timestamp-value pairs. A control source 69 * essentially is a function over time, returning gloat values between 0.0 and 1.0. 70 * 71 * A GstControlSource is used by first getting an instance of a specific 72 * control-source, creating a binding for the control-source to the target property 73 * of the element and then adding the binding to the element. The binding will 74 * convert the data types and value range to fit to the bound property. 75 * 76 * For implementing a new GstControlSource one has to implement 77 * GstControlSourceGetValue and GstControlSourceGetValueArray functions. 78 * These are then used by gst_control_source_get_value() and 79 * gst_control_source_get_value_array() to get values for specific timestamps. 80 */ 81 public class ControlSource : ObjectGst 82 { 83 84 /** the main Gtk struct */ 85 protected GstControlSource* gstControlSource; 86 87 88 public GstControlSource* getControlSourceStruct() 89 { 90 return gstControlSource; 91 } 92 93 94 /** the main Gtk struct as a void* */ 95 protected override void* getStruct() 96 { 97 return cast(void*)gstControlSource; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class 102 */ 103 public this (GstControlSource* gstControlSource) 104 { 105 super(cast(GstObject*)gstControlSource); 106 this.gstControlSource = gstControlSource; 107 } 108 109 protected override void setStruct(GObject* obj) 110 { 111 super.setStruct(obj); 112 gstControlSource = cast(GstControlSource*)obj; 113 } 114 115 /** 116 */ 117 118 /** 119 * Gets the value for this GstControlSource at a given timestamp. 120 * Params: 121 * timestamp = the time for which the value should be returned 122 * value = the value 123 * Returns: FALSE if the value couldn't be returned, TRUE otherwise. 124 */ 125 public int getValue(GstClockTime timestamp, out double value) 126 { 127 // gboolean gst_control_source_get_value (GstControlSource *self, GstClockTime timestamp, gdouble *value); 128 return gst_control_source_get_value(gstControlSource, timestamp, &value); 129 } 130 131 /** 132 * Gets an array of values for for this GstControlSource. Values that are 133 * undefined contain NANs. 134 * Params: 135 * timestamp = the first timestamp 136 * interval = the time steps 137 * values = array to put control-values in 138 * Returns: TRUE if the given array could be filled, FALSE otherwise 139 */ 140 public int getValueArray(GstClockTime timestamp, GstClockTime interval, double[] values) 141 { 142 // gboolean gst_control_source_get_value_array (GstControlSource *self, GstClockTime timestamp, GstClockTime interval, guint n_values, gdouble *values); 143 return gst_control_source_get_value_array(gstControlSource, timestamp, interval, cast(int) values.length, values.ptr); 144 } 145 }