3 * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
4 * 2011 Stefan Sauer <ensonic@users.sf.net>
6 * gsttimedvaluecontrolsource.h: Base class for timeed value based control
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
25 #ifndef __GST_TIMED_VALUE_CONTROL_SOURCE_H__
26 #define __GST_TIMED_VALUE_CONTROL_SOURCE_H__
28 #include <glib-object.h>
31 #include <gst/gstcontrolsource.h>
35 #define GST_TYPE_TIMED_VALUE_CONTROL_SOURCE \
36 (gst_timed_value_control_source_get_type ())
37 #define GST_TIMED_VALUE_CONTROL_SOURCE(obj) \
38 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSource))
39 #define GST_TIMED_VALUE_CONTROL_SOURCE_CLASS(vtable) \
40 (G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSourceClass))
41 #define GST_IS_TIMED_VALUE_CONTROL_SOURCE(obj) \
42 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE))
43 #define GST_IS_TIMED_VALUE_CONTROL_SOURCE_CLASS(vtable) \
44 (G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE))
45 #define GST_TIMED_VALUE_CONTROL_SOURCE_GET_CLASS(inst) \
46 (G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSourceClass))
48 typedef struct _GstTimedValueControlSource GstTimedValueControlSource;
49 typedef struct _GstTimedValueControlSourceClass GstTimedValueControlSourceClass;
50 typedef struct _GstTimedValueControlSourcePrivate GstTimedValueControlSourcePrivate;
51 typedef struct _GstControlPoint GstControlPoint;
55 * @timestamp: timestamp of the value change
56 * @value: the new value
58 * An internal structure for value+time and various temporary
59 * values used for interpolation. This "inherits" from
62 struct _GstControlPoint
64 /* fields from GstTimedValue. DO NOT CHANGE! */
65 GstClockTime timestamp;
70 /* Caches for the interpolators */
71 /* FIXME: we should not have this here already ... */
73 struct { /* 16 bytes */
77 struct { /* 24 bytes */
78 gdouble c1s, c2s, c3s;
80 guint8 _gst_reserved[64];
84 GType gst_control_point_get_type (void);
87 * GstTimedValueControlSource:
89 * The instance structure of #GstControlSource.
91 struct _GstTimedValueControlSource {
92 GstControlSource parent;
97 GSequence *values; /* List of GstControlPoint */
98 gint nvalues; /* Number of control points */
102 GstTimedValueControlSourcePrivate *priv;
103 gpointer _gst_reserved[GST_PADDING];
106 struct _GstTimedValueControlSourceClass {
107 GstControlSourceClass parent_class;
110 gpointer _gst_reserved[GST_PADDING];
113 #define GST_TIMED_VALUE_CONTROL_SOURCE_LOCK(o) \
114 g_mutex_lock(&((GstTimedValueControlSource *)o)->lock)
115 #define GST_TIMED_VALUE_CONTROL_SOURCE_UNLOCK(o) \
116 g_mutex_unlock(&((GstTimedValueControlSource *)o)->lock)
118 GType gst_timed_value_control_source_get_type (void);
122 GSequenceIter * gst_timed_value_control_source_find_control_point_iter (
123 GstTimedValueControlSource * self,
124 GstClockTime timestamp);
126 gboolean gst_timed_value_control_source_set (GstTimedValueControlSource * self,
127 GstClockTime timestamp,
128 const gdouble value);
129 gboolean gst_timed_value_control_source_set_from_list (GstTimedValueControlSource * self,
130 const GSList * timedvalues);
131 gboolean gst_timed_value_control_source_unset (GstTimedValueControlSource * self,
132 GstClockTime timestamp);
133 void gst_timed_value_control_source_unset_all (GstTimedValueControlSource *self);
134 GList * gst_timed_value_control_source_get_all (GstTimedValueControlSource * self);
135 gint gst_timed_value_control_source_get_count (GstTimedValueControlSource * self);
136 void gst_timed_value_control_invalidate_cache (GstTimedValueControlSource * self);
138 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
139 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTimedValueControlSource, gst_object_unref)
144 #endif /* __GST_TIMED_VALUE_CONTROL_SOURCE_H__ */