| 1 |
/* GStreamer |
| 2 |
* |
| 3 |
* Copyright (C) 2007 Sebastian Dröge <[email protected]> |
| 4 |
* 2011 Stefan Sauer <[email protected]> |
| 5 |
* |
| 6 |
* gsttimedvaluecontrolsource.h: Base class for timeed value based control |
| 7 |
* sources |
| 8 |
* |
| 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. |
| 13 |
* |
| 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. |
| 18 |
* |
| 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. |
| 23 |
*/ |
| 24 |
|
| 25 |
#ifndef __GST_TIMED_VALUE_CONTROL_SOURCE_H__ |
| 26 |
#define __GST_TIMED_VALUE_CONTROL_SOURCE_H__ |
| 27 |
|
| 28 |
#include <glib-object.h> |
| 29 |
#include <gst/gst.h> |
| 30 |
#include <gst/controller/controller-prelude.h> |
| 31 |
|
| 32 |
G_BEGIN_DECLS |
| 33 |
|
| 34 |
#define GST_TYPE_TIMED_VALUE_CONTROL_SOURCE \ |
| 35 |
(gst_timed_value_control_source_get_type ()) |
| 36 |
#define GST_TIMED_VALUE_CONTROL_SOURCE(obj) \ |
| 37 |
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSource)) |
| 38 |
#define GST_TIMED_VALUE_CONTROL_SOURCE_CLASS(vtable) \ |
| 39 |
(G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSourceClass)) |
| 40 |
#define GST_IS_TIMED_VALUE_CONTROL_SOURCE(obj) \ |
| 41 |
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE)) |
| 42 |
#define GST_IS_TIMED_VALUE_CONTROL_SOURCE_CLASS(vtable) \ |
| 43 |
(G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE)) |
| 44 |
#define GST_TIMED_VALUE_CONTROL_SOURCE_GET_CLASS(inst) \ |
| 45 |
(G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSourceClass)) |
| 46 |
|
| 47 |
typedef struct _GstTimedValueControlSource GstTimedValueControlSource; |
| 48 |
typedef struct _GstTimedValueControlSourceClass GstTimedValueControlSourceClass; |
| 49 |
typedef struct _GstTimedValueControlSourcePrivate GstTimedValueControlSourcePrivate; |
| 50 |
typedef struct _GstControlPoint GstControlPoint; |
| 51 |
|
| 52 |
/** |
| 53 |
* GstControlPoint: |
| 54 |
* @timestamp: timestamp of the value change |
| 55 |
* @value: the new value |
| 56 |
* |
| 57 |
* An internal structure for value+time and various temporary |
| 58 |
* values used for interpolation. This "inherits" from |
| 59 |
* GstTimedValue. |
| 60 |
*/ |
| 61 |
struct _GstControlPoint |
| 62 |
{ |
| 63 |
/* fields from GstTimedValue. DO NOT CHANGE! */ |
| 64 |
GstClockTime timestamp; |
| 65 |
gdouble value; |
| 66 |
|
| 67 |
/*< private >*/ |
| 68 |
|
| 69 |
/* Caches for the interpolators */ |
| 70 |
/* FIXME: we should not have this here already ... */ |
| 71 |
union { |
| 72 |
struct { /* 16 bytes */ |
| 73 |
gdouble h; |
| 74 |
gdouble z; |
| 75 |
} cubic; |
| 76 |
struct { /* 24 bytes */ |
| 77 |
gdouble c1s, c2s, c3s; |
| 78 |
} cubic_monotonic; |
| 79 |
guint8 _gst_reserved[64]; |
| 80 |
} cache; |
| 81 |
}; |
| 82 |
|
| 83 |
GST_CONTROLLER_API |
| 84 |
GType gst_control_point_get_type (void); |
| 85 |
|
| 86 |
/** |
| 87 |
* GstTimedValueControlSource: |
| 88 |
* |
| 89 |
* The instance structure of #GstControlSource. |
| 90 |
*/ |
| 91 |
struct _GstTimedValueControlSource { |
| 92 |
GstControlSource parent; |
| 93 |
|
| 94 |
/*< protected >*/ |
| 95 |
GMutex lock; |
| 96 |
|
| 97 |
GSequence *values; /* List of GstControlPoint */ |
| 98 |
gint nvalues; /* Number of control points */ |
| 99 |
gboolean valid_cache; |
| 100 |
|
| 101 |
/*< private >*/ |
| 102 |
GstTimedValueControlSourcePrivate *priv; |
| 103 |
gpointer _gst_reserved[GST_PADDING]; |
| 104 |
}; |
| 105 |
|
| 106 |
struct _GstTimedValueControlSourceClass { |
| 107 |
GstControlSourceClass parent_class; |
| 108 |
|
| 109 |
/*< private >*/ |
| 110 |
gpointer _gst_reserved[GST_PADDING]; |
| 111 |
}; |
| 112 |
|
| 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) |
| 117 |
|
| 118 |
GST_CONTROLLER_API |
| 119 |
GType gst_timed_value_control_source_get_type (void); |
| 120 |
|
| 121 |
/* Functions */ |
| 122 |
|
| 123 |
GST_CONTROLLER_API |
| 124 |
GSequenceIter * gst_timed_value_control_source_find_control_point_iter ( |
| 125 |
GstTimedValueControlSource * self, |
| 126 |
GstClockTime timestamp); |
| 127 |
GST_CONTROLLER_API |
| 128 |
gboolean gst_timed_value_control_source_set (GstTimedValueControlSource * self, |
| 129 |
GstClockTime timestamp, |
| 130 |
const gdouble value); |
| 131 |
GST_CONTROLLER_API |
| 132 |
gboolean gst_timed_value_control_source_set_from_list (GstTimedValueControlSource * self, |
| 133 |
const GSList * timedvalues); |
| 134 |
GST_CONTROLLER_API |
| 135 |
gboolean gst_timed_value_control_source_unset (GstTimedValueControlSource * self, |
| 136 |
GstClockTime timestamp); |
| 137 |
|
| 138 |
GST_CONTROLLER_API |
| 139 |
void gst_timed_value_control_source_unset_all (GstTimedValueControlSource *self); |
| 140 |
|
| 141 |
GST_CONTROLLER_DEPRECATED_FOR(gst_timed_value_control_source_list_control_points) |
| 142 |
GList * gst_timed_value_control_source_get_all (GstTimedValueControlSource * self); |
| 143 |
|
| 144 |
GST_CONTROLLER_API |
| 145 |
GstTimedValue * gst_timed_value_control_source_list_control_points (GstTimedValueControlSource * self, gsize * n_control_points) G_GNUC_WARN_UNUSED_RESULT; |
| 146 |
|
| 147 |
GST_CONTROLLER_API |
| 148 |
gint gst_timed_value_control_source_get_count (GstTimedValueControlSource * self); |
| 149 |
|
| 150 |
GST_CONTROLLER_API |
| 151 |
void gst_timed_value_control_invalidate_cache (GstTimedValueControlSource * self); |
| 152 |
|
| 153 |
GST_CONTROLLER_API |
| 154 |
void gst_control_point_free (GstControlPoint * cp); |
| 155 |
|
| 156 |
GST_CONTROLLER_API |
| 157 |
GstControlPoint * gst_control_point_copy (GstControlPoint * cp) G_GNUC_WARN_UNUSED_RESULT; |
| 158 |
|
| 159 |
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTimedValueControlSource, gst_object_unref) |
| 160 |
|
| 161 |
G_END_DECLS |
| 162 |
|
| 163 |
#endif /* __GST_TIMED_VALUE_CONTROL_SOURCE_H__ */ |