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 private import gstreamer.ObjectGst;
63 
64 /**
65  * The GstControlSource is a base class for control value sources that could
66  * be used by GstController to get timestamp-value pairs. A control source
67  * essentially is a function over time, returning gloat values between 0.0 and 1.0.
68  *
69  * A GstControlSource is used by first getting an instance of a specific
70  * control-source, creating a binding for the control-source to the target property
71  * of the element and then adding the binding to the element. The binding will
72  * convert the data types and value range to fit to the bound property.
73  *
74  * For implementing a new GstControlSource one has to implement
75  * GstControlSourceGetValue and GstControlSourceGetValueArray functions.
76  * These are then used by gst_control_source_get_value() and
77  * gst_control_source_get_value_array() to get values for specific timestamps.
78  */
79 public class ControlSource : ObjectGst
80 {
81 	
82 	/** the main Gtk struct */
83 	protected GstControlSource* gstControlSource;
84 	
85 	
86 	/** Get the main Gtk struct */
87 	public GstControlSource* getControlSourceStruct()
88 	{
89 		return gstControlSource;
90 	}
91 	
92 	
93 	/** the main Gtk struct as a void* */
94 	protected override void* getStruct()
95 	{
96 		return cast(void*)gstControlSource;
97 	}
98 	
99 	/**
100 	 * Sets our main struct and passes it to the parent class
101 	 */
102 	public this (GstControlSource* gstControlSource)
103 	{
104 		super(cast(GstObject*)gstControlSource);
105 		this.gstControlSource = gstControlSource;
106 	}
107 	
108 	protected override void setStruct(GObject* obj)
109 	{
110 		super.setStruct(obj);
111 		gstControlSource = cast(GstControlSource*)obj;
112 	}
113 	
114 	/**
115 	 */
116 	
117 	/**
118 	 * Gets the value for this GstControlSource at a given timestamp.
119 	 * Params:
120 	 * timestamp = the time for which the value should be returned
121 	 * value = the value
122 	 * Returns: FALSE if the value couldn't be returned, TRUE otherwise.
123 	 */
124 	public int getValue(GstClockTime timestamp, out double value)
125 	{
126 		// gboolean gst_control_source_get_value (GstControlSource *self,  GstClockTime timestamp,  gdouble *value);
127 		return gst_control_source_get_value(gstControlSource, timestamp, &value);
128 	}
129 	
130 	/**
131 	 * Gets an array of values for for this GstControlSource. Values that are
132 	 * undefined contain NANs.
133 	 * Params:
134 	 * timestamp = the first timestamp
135 	 * interval = the time steps
136 	 * values = array to put control-values in
137 	 * Returns: TRUE if the given array could be filled, FALSE otherwise
138 	 */
139 	public int getValueArray(GstClockTime timestamp, GstClockTime interval, double[] values)
140 	{
141 		// gboolean gst_control_source_get_value_array (GstControlSource *self,  GstClockTime timestamp,  GstClockTime interval,  guint n_values,  gdouble *values);
142 		return gst_control_source_get_value_array(gstControlSource, timestamp, interval, cast(int) values.length, values.ptr);
143 	}
144 }