1/* GStreamer
2 *
3 * Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
4 *
5 * gstcontrolbinding.h: Attachment for control sources
6 *
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.
11 *
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.
16 *
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., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef __GST_CONTROL_BINDING_H__
24#define __GST_CONTROL_BINDING_H__
25
26#include <gst/gstconfig.h>
27
28#include <glib-object.h>
29
30G_BEGIN_DECLS
31
32#define GST_TYPE_CONTROL_BINDING \
33 (gst_control_binding_get_type())
34#define GST_CONTROL_BINDING(obj) \
35 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CONTROL_BINDING,GstControlBinding))
36#define GST_CONTROL_BINDING_CLASS(klass) \
37 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CONTROL_BINDING,GstControlBindingClass))
38#define GST_IS_CONTROL_BINDING(obj) \
39 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CONTROL_BINDING))
40#define GST_IS_CONTROL_BINDING_CLASS(klass) \
41 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CONTROL_BINDING))
42#define GST_CONTROL_BINDING_GET_CLASS(obj) \
43 (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstControlBindingClass))
44
45typedef struct _GstControlBinding GstControlBinding;
46typedef struct _GstControlBindingClass GstControlBindingClass;
47typedef struct _GstControlBindingPrivate GstControlBindingPrivate;
48
49#include <gst/gstcontrolsource.h>
50
51/**
52 * GstControlBindingConvert: (attributes doc.skip=true)
53 * FIXME(2.0): remove, this is unused
54 */
55typedef void (* GstControlBindingConvert) (GstControlBinding *binding, gdouble src_value, GValue *dest_value);
56
57/**
58 * GstControlBinding:
59 * @parent: the parent structure
60 * @name: name of the property of this binding
61 * @pspec: #GParamSpec for this property
62 *
63 * The instance structure of #GstControlBinding.
64 */
65struct _GstControlBinding {
66 GstObject parent;
67
68 /*< public >*/
69 gchar *name;
70 GParamSpec *pspec;
71
72 /*< private >*/
73#ifndef GST_DISABLE_DEPRECATED
74 GstObject *object; /* GstObject owning the property
75 * (== parent when bound) */
76#else
77 gpointer __object;
78#endif
79 gboolean disabled;
80
81 union {
82 struct {
83 /*< private >*/
84 GstControlBindingPrivate *priv;
85 } abi;
86 /*< private >*/
87 gpointer _gst_reserved[GST_PADDING];
88 } ABI;
89};
90
91/**
92 * GstControlBindingClass:
93 * @parent_class: Parent class
94 *
95 * The class structure of #GstControlBinding.
96 */
97
98struct _GstControlBindingClass
99{
100 GstObjectClass parent_class;
101
102 /*< public >*/
103
104 /**
105 * GstControlBindingClass::sync_values:
106 * @binding: the control binding
107 * @object: the object that has controlled properties
108 * @timestamp: the time that should be processed
109 * @last_sync: the last time this was called
110 *
111 * Update the target values
112 *
113 * Returns: %TRUE if the controller value could be applied to the object
114 * property, %FALSE otherwise
115 */
116 gboolean (* sync_values) (GstControlBinding *binding, GstObject *object, GstClockTime timestamp, GstClockTime last_sync);
117
118 /**
119 * GstControlBindingClass::get_value:
120 * @binding: the control binding
121 * @timestamp: the time the control-change should be read from
122 *
123 * Fetch a single control-value
124 *
125 * Returns: (nullable): the GValue of the property at the given time,
126 * or %NULL if the property isn't controlled.
127 */
128 GValue * (* get_value) (GstControlBinding *binding, GstClockTime timestamp);
129
130 /**
131 * GstControlBindingClass::get_value_array:
132 * @binding: the control binding
133 * @timestamp: the time that should be processed
134 * @interval: the time spacing between subsequent values
135 * @n_values: the number of values
136 * @values: (array length=n_values): array to put control-values in
137 *
138 * Fetch a series of control-values
139 *
140 * Returns: %TRUE if the given array could be filled, %FALSE otherwise
141 */
142 gboolean (* get_value_array) (GstControlBinding *binding, GstClockTime timestamp,GstClockTime interval, guint n_values, gpointer values);
143
144 /**
145 * GstControlBindingClass::get_g_value_array:
146 * @binding: the control binding
147 * @timestamp: the time that should be processed
148 * @interval: the time spacing between subsequent values
149 * @n_values: the number of values
150 * @values: (array length=n_values): array to put control-values in
151 *
152 * Fetch a series of control-values as g_values
153 *
154 * Returns: %TRUE if the given array could be filled, %FALSE otherwise
155 */
156 gboolean (* get_g_value_array) (GstControlBinding *binding, GstClockTime timestamp,GstClockTime interval, guint n_values, GValue *values);
157
158 /*< private >*/
159 gpointer _gst_reserved[GST_PADDING];
160};
161
162#define GST_CONTROL_BINDING_PSPEC(cb) (((GstControlBinding *) cb)->pspec)
163
164GST_API
165GType gst_control_binding_get_type (void);
166
167/* Functions */
168
169GST_API
170gboolean gst_control_binding_sync_values (GstControlBinding * binding, GstObject *object,
171 GstClockTime timestamp, GstClockTime last_sync);
172GST_API
173GValue * gst_control_binding_get_value (GstControlBinding *binding,
174 GstClockTime timestamp);
175GST_API
176gboolean gst_control_binding_get_value_array (GstControlBinding *binding, GstClockTime timestamp,
177 GstClockTime interval, guint n_values, gpointer values);
178GST_API
179gboolean gst_control_binding_get_g_value_array (GstControlBinding *binding, GstClockTime timestamp,
180 GstClockTime interval, guint n_values, GValue *values);
181GST_API
182void gst_control_binding_set_disabled (GstControlBinding * binding, gboolean disabled);
183
184GST_API
185gboolean gst_control_binding_is_disabled (GstControlBinding * binding);
186
187G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstControlBinding, gst_object_unref)
188
189G_END_DECLS
190
191#endif /* __GST_CONTROL_BINDING_H__ */
192

source code of include/gstreamer-1.0/gst/gstcontrolbinding.h