3 * Copyright (C) <2005> Stefan Kost <ensonic at users dot sf dot net>
5 * gst-controller.h: dynamic parameter control subsystem
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_CONTROLLER_H__
24 #define __GST_CONTROLLER_H__
29 #include <glib-object.h>
30 #include <glib/gprintf.h>
36 * GST_PARAM_CONTROLLABLE:
38 * Use this flag on GstElement properties you wish to be (eventually) handled
40 * TODO: needs to go to gstelemnt.h (to avoid clashes on G_PARAM_USER_SHIFT)
42 #define GST_PARAM_CONTROLLABLE (1 << (G_PARAM_USER_SHIFT + 1))
48 * a structure for value+time
50 typedef struct _GstTimedValue
52 GstClockTime timestamp; /* timestamp of the value change */
53 GValue value; /* the new value */
59 * @property_name: the name of the property this array belongs to
60 * @nbsamples: number of samples requested
61 * @sample_interval: interval between each sample
62 * @values: pointer to the array
64 * Structure to receive multiple values at once.
66 typedef struct _GstValueArray
70 GstClockTime sample_interval;
77 * @GST_INTERPOLATE_NONE: steps-like interpolation, default
78 * @GST_INTERPOLATE_TRIGGER: returns the default value of the property,
79 * except for times with specific values
80 * @GST_INTERPOLATE_LINEAR: linear interpolation
81 * @GST_INTERPOLATE_QUADRATIC: square interpolation (not yet available)
82 * @GST_INTERPOLATE_CUBIC: cubic interpolation (not yet available)
83 * @GST_INTERPOLATE_USER: user-provided interpolation (not yet available)
85 * The various interpolation modes available.
90 GST_INTERPOLATE_TRIGGER,
91 GST_INTERPOLATE_LINEAR,
92 GST_INTERPOLATE_QUADRATIC,
93 GST_INTERPOLATE_CUBIC,
99 #define GST_TYPE_CONTROLLER (gst_controller_get_type ())
100 #define GST_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CONTROLLER, GstController))
101 #define GST_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CONTROLLER, GstControllerClass))
102 #define GST_IS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CONTROLLER))
103 #define GST_IS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CONTROLLERE))
104 #define GST_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTROLLER, GstControllerClass))
106 typedef struct _GstController GstController;
107 typedef struct _GstControllerClass GstControllerClass;
108 typedef struct _GstControllerPrivate GstControllerPrivate;
114 * The instance structure of GstController
117 struct _GstController
121 GList *properties; /* List of GstControlledProperty */
122 GMutex *lock; /* Secure property access, elements will access from threads */
123 GObject *object; /* the object we control */
126 GstControllerPrivate *priv;
127 gpointer _gst_reserved[GST_PADDING - 1];
130 struct _GstControllerClass
132 GObjectClass parent_class;
135 gpointer _gst_reserved[GST_PADDING];
138 GType gst_controller_get_type (void);
140 /* GstController functions */
142 GstController *gst_controller_new_valist (GObject * object, va_list var_args);
143 GstController *gst_controller_new_list (GObject * object, GList *list);
144 GstController *gst_controller_new (GObject * object, ...) G_GNUC_NULL_TERMINATED;
146 gboolean gst_controller_remove_properties_valist (GstController * self,
148 gboolean gst_controller_remove_properties_list (GstController * self,
150 gboolean gst_controller_remove_properties (GstController * self, ...) G_GNUC_NULL_TERMINATED;
152 gboolean gst_controller_set (GstController * self, gchar * property_name,
153 GstClockTime timestamp, GValue * value);
154 gboolean gst_controller_set_from_list (GstController * self,
155 gchar * property_name, GSList * timedvalues);
157 gboolean gst_controller_unset (GstController * self, gchar * property_name,
158 GstClockTime timestamp);
159 gboolean gst_controller_unset_all (GstController * self, gchar * property_name);
161 GValue *gst_controller_get (GstController * self, gchar * property_name,
162 GstClockTime timestamp);
163 const GList *gst_controller_get_all (GstController * self,
164 gchar * property_name);
166 GstClockTime gst_controller_suggest_next_sync (GstController *self);
167 gboolean gst_controller_sync_values (GstController * self,
168 GstClockTime timestamp);
170 gboolean gst_controller_get_value_arrays (GstController * self,
171 GstClockTime timestamp, GSList * value_arrays);
172 gboolean gst_controller_get_value_array (GstController * self,
173 GstClockTime timestamp, GstValueArray * value_array);
175 gboolean gst_controller_set_interpolation_mode (GstController * self,
176 gchar * property_name, GstInterpolateMode mode);
179 /* GObject convenience functions */
181 GstController *gst_object_control_properties (GObject * object, ...) G_GNUC_NULL_TERMINATED;
182 gboolean gst_object_uncontrol_properties (GObject * object, ...) G_GNUC_NULL_TERMINATED;
184 GstController *gst_object_get_controller (GObject * object);
185 gboolean gst_object_set_controller (GObject * object, GstController * controller);
187 GstClockTime gst_object_suggest_next_sync (GObject * object);
188 gboolean gst_object_sync_values (GObject * object, GstClockTime timestamp);
190 gboolean gst_object_get_value_arrays (GObject * object,
191 GstClockTime timestamp, GSList * value_arrays);
192 gboolean gst_object_get_value_array (GObject * object,
193 GstClockTime timestamp, GstValueArray * value_array);
195 GstClockTime gst_object_get_control_rate (GObject * object);
196 void gst_object_set_control_rate (GObject * object, GstClockTime control_rate);
200 gboolean gst_controller_init (int * argc, char ***argv);
203 #endif /* __GST_CONTROLLER_H__ */