1 | /* GStreamer |
2 | * |
3 | * Copyright (C) 2007 Sebastian Dröge <[email protected]> |
4 | * |
5 | * gstcontrolsource.h: Interface declaration 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_SOURCE_H__ |
24 | #define __GST_CONTROL_SOURCE_H__ |
25 | |
26 | #include <gst/gstconfig.h> |
27 | |
28 | #include <glib-object.h> |
29 | |
30 | #include <gst/gstclock.h> |
31 | |
32 | G_BEGIN_DECLS |
33 | |
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)) |
46 | |
47 | typedef struct _GstControlSource GstControlSource; |
48 | typedef struct _GstControlSourceClass GstControlSourceClass; |
49 | typedef struct _GstTimedValue GstTimedValue; |
50 | typedef struct _GstValueArray GstValueArray; |
51 | |
52 | /** |
53 | * GstTimedValue: |
54 | * @timestamp: timestamp of the value change |
55 | * @value: the corresponding value |
56 | * |
57 | * Structure for saving a timestamp and a value. |
58 | */ |
59 | struct _GstTimedValue |
60 | { |
61 | GstClockTime timestamp; |
62 | gdouble value; |
63 | }; |
64 | |
65 | /** |
66 | * GstControlSourceGetValue: |
67 | * @self: the #GstControlSource instance |
68 | * @timestamp: timestamp for which a value should be calculated |
69 | * @value: a value which will be set to the result. |
70 | * |
71 | * Function for returning a value for a given timestamp. |
72 | * |
73 | * Returns: %TRUE if the value was successfully calculated. |
74 | * |
75 | */ |
76 | typedef gboolean (* GstControlSourceGetValue) (GstControlSource *self, |
77 | GstClockTime timestamp, gdouble *value); |
78 | |
79 | /** |
80 | * GstControlSourceGetValueArray: |
81 | * @self: the #GstControlSource instance |
82 | * @timestamp: timestamp for which a value should be calculated |
83 | * @interval: the time spacing between subsequent values |
84 | * @n_values: the number of values |
85 | * @values: array to put control-values in |
86 | * |
87 | * Function for returning an array of values for starting at a given timestamp. |
88 | * |
89 | * Returns: %TRUE if the values were successfully calculated. |
90 | * |
91 | */ |
92 | typedef gboolean (* GstControlSourceGetValueArray) (GstControlSource *self, |
93 | GstClockTime timestamp, GstClockTime interval, guint n_values, gdouble *values); |
94 | |
95 | /** |
96 | * GstControlSource: |
97 | * @get_value: Function for returning a value for a given timestamp |
98 | * @get_value_array: Function for returning a values array for a given timestamp |
99 | * |
100 | * The instance structure of #GstControlSource. |
101 | */ |
102 | struct _GstControlSource { |
103 | GstObject parent; |
104 | |
105 | /*< public >*/ |
106 | GstControlSourceGetValue get_value; /* Returns the value for a property at a given timestamp */ |
107 | GstControlSourceGetValueArray get_value_array; /* Returns values for a property in a given timespan */ |
108 | |
109 | /*< private >*/ |
110 | gpointer _gst_reserved[GST_PADDING]; |
111 | }; |
112 | |
113 | /** |
114 | * GstControlSourceClass: |
115 | * @parent_class: Parent class |
116 | * |
117 | * The class structure of #GstControlSource. |
118 | */ |
119 | |
120 | struct _GstControlSourceClass |
121 | { |
122 | GstObjectClass parent_class; |
123 | |
124 | /*< private >*/ |
125 | gpointer _gst_reserved[GST_PADDING]; |
126 | }; |
127 | |
128 | GST_API |
129 | GType gst_control_source_get_type (void); |
130 | |
131 | /* Functions */ |
132 | |
133 | GST_API |
134 | gboolean gst_control_source_get_value (GstControlSource *self, GstClockTime timestamp, |
135 | gdouble *value); |
136 | GST_API |
137 | gboolean gst_control_source_get_value_array (GstControlSource *self, GstClockTime timestamp, |
138 | GstClockTime interval, guint n_values, |
139 | gdouble *values); |
140 | #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC |
141 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstControlSource, gst_object_unref) |
142 | #endif |
143 | |
144 | #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC |
145 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstValueArray, gst_object_unref) |
146 | #endif |
147 | |
148 | G_END_DECLS |
149 | |
150 | #endif /* __GST_CONTROL_SOURCE_H__ */ |
151 | |