3 * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
5 * gstcontrolsource.h: Interface declaration for control sources
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #ifndef __GST_CONTROL_SOURCE_H__
24 #define __GST_CONTROL_SOURCE_H__
26 #include <gst/gstconfig.h>
28 #include <glib-object.h>
30 #include <gst/gstclock.h>
34 #define GST_TYPE_CONTROL_SOURCE \
35 (gst_control_source_get_type())
36 #define GST_CONTROL_SOURCE(obj) \
37 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CONTROL_SOURCE,GstControlSource))
38 #define GST_CONTROL_SOURCE_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CONTROL_SOURCE,GstControlSourceClass))
40 #define GST_IS_CONTROL_SOURCE(obj) \
41 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CONTROL_SOURCE))
42 #define GST_IS_CONTROL_SOURCE_CLASS(klass) \
43 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CONTROL_SOURCE))
44 #define GST_CONTROL_SOURCE_GET_CLASS(obj) \
45 (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstControlSourceClass))
47 typedef struct _GstControlSource GstControlSource;
48 typedef struct _GstControlSourceClass GstControlSourceClass;
49 typedef struct _GstTimedValue GstTimedValue;
50 typedef struct _GstValueArray GstValueArray;
54 * @timestamp: timestamp of the value change
55 * @value: the corresponding value
57 * Structure for saving a timestamp and a value.
61 GstClockTime timestamp;
67 * @property_name: the name of the property this array belongs to
68 * @nbsamples: number of samples requested
69 * @sample_interval: interval between each sample
70 * @values: pointer to the array
72 * Structure to receive multiple values at once.
76 const gchar *property_name;
78 GstClockTime sample_interval;
83 * GstControlSourceGetValue
84 * @self: the #GstControlSource instance
85 * @timestamp: timestamp for which a value should be calculated
86 * @value: a #GValue which will be set to the result. It must be initialized to the correct type.
88 * Function for returning a value for a given timestamp.
90 * Returns: %TRUE if the value was successfully calculated.
93 typedef gboolean (* GstControlSourceGetValue) (GstControlSource *self, GstClockTime timestamp, GValue *value);
96 * GstControlSourceGetValueArray
97 * @self: the #GstControlSource instance
98 * @timestamp: timestamp for which a value should be calculated
99 * @value_array: array to put control-values in
101 * Function for returning a #GstValueArray for a given timestamp.
103 * Returns: %TRUE if the values were successfully calculated.
106 typedef gboolean (* GstControlSourceGetValueArray) (GstControlSource *self, GstClockTime timestamp, GstValueArray *value_array);
109 * GstControlSourceBind
110 * @self: the #GstControlSource instance
111 * @pspec: #GParamSpec that should be bound to
113 * Function for binding a #GstControlSource to a #GParamSpec.
115 * Returns: %TRUE if the property could be bound to the #GstControlSource, %FALSE otherwise.
117 typedef gboolean (* GstControlSourceBind) (GstControlSource *self, GParamSpec *pspec);
121 * @get_value: Function for returning a value for a given timestamp
122 * @get_value_array: Function for returning a #GstValueArray for a given timestamp
124 * The instance structure of #GstControlSource.
126 struct _GstControlSource {
130 GstControlSourceGetValue get_value; /* Returns the value for a property at a given timestamp */
131 GstControlSourceGetValueArray get_value_array; /* Returns values for a property in a given timespan */
135 gpointer _gst_reserved[GST_PADDING];
139 * GstControlSourceClass:
140 * @parent_class: Parent class
141 * @bind: Class method for binding the #GstControlSource to a specific GParamSpec
143 * The class structure of #GstControlSource.
146 struct _GstControlSourceClass
148 GObjectClass parent_class;
150 GstControlSourceBind bind; /* Binds the GstControlSource to a specific GParamSpec */
153 gpointer _gst_reserved[GST_PADDING];
156 GType gst_control_source_get_type (void);
160 gboolean gst_control_source_get_value (GstControlSource *self, GstClockTime timestamp, GValue *value);
161 gboolean gst_control_source_get_value_array (GstControlSource *self, GstClockTime timestamp, GstValueArray *value_array);
162 gboolean gst_control_source_bind (GstControlSource *self, GParamSpec *pspec);
166 #endif /* __GST_CONTROL_SOURCE_H__ */