5b816c841f824ca9a5fe6b225a4ebd8f66a9e795
[platform/upstream/gstreamer.git] / libs / gst / controller / gstdirectcontrolbinding.h
1 /* GStreamer
2  *
3  * Copyright (C) 2011 Stefan Sauer <ensonic@users.sf.net>
4  *
5  * gstdirectcontrolbinding.h: Direct 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_DIRECT_CONTROL_BINDING_H__
24 #define __GST_DIRECT_CONTROL_BINDING_H__
25
26 #include <gst/gstconfig.h>
27
28 #include <glib-object.h>
29
30 #include <gst/gstcontrolsource.h>
31
32 G_BEGIN_DECLS
33
34 #define GST_TYPE_DIRECT_CONTROL_BINDING \
35   (gst_direct_control_binding_get_type())
36 #define GST_DIRECT_CONTROL_BINDING(obj) \
37   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DIRECT_CONTROL_BINDING,GstDirectControlBinding))
38 #define GST_DIRECT_CONTROL_BINDING_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DIRECT_CONTROL_BINDING,GstDirectControlBindingClass))
40 #define GST_IS_DIRECT_CONTROL_BINDING(obj) \
41   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DIRECT_CONTROL_BINDING))
42 #define GST_IS_DIRECT_CONTROL_BINDING_CLASS(klass) \
43   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DIRECT_CONTROL_BINDING))
44 #define GST_DIRECT_CONTROL_BINDING_GET_CLASS(obj) \
45   (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstDirectControlBindingClass))
46
47 typedef struct _GstDirectControlBinding GstDirectControlBinding;
48 typedef struct _GstDirectControlBindingClass GstDirectControlBindingClass;
49
50 /**
51  * GstDirectControlBindingConvertValue:
52  * @self: the #GstDirectControlBinding instance
53  * @src_value: the value returned by the cotnrol source
54  * @dest_value: the target location
55  *
56  * Function to map a control-value to the target plain data type.
57  */
58 typedef void (* GstDirectControlBindingConvertValue) (GstDirectControlBinding *self, gdouble src_value, gpointer dest_value);
59
60 /**
61  * GstDirectControlBindingConvertGValue:
62  * @self: the #GstDirectControlBinding instance
63  * @src_value: the value returned by the cotnrol source
64  * @dest_value: the target GValue
65  *
66  * Function to map a control-value to the target GValue.
67  */
68 typedef void (* GstDirectControlBindingConvertGValue) (GstDirectControlBinding *self, gdouble src_value, GValue *dest_value);
69
70 /**
71  * GstDirectControlBinding:
72  * @name: name of the property of this binding
73  *
74  * The instance structure of #GstDirectControlBinding.
75  */
76 struct _GstDirectControlBinding {
77   GstControlBinding parent;
78   
79   /*< private >*/
80   GstControlSource *cs;    /* GstControlSource for this property */
81   GValue cur_value;
82   gdouble last_value;
83   gint byte_size;
84
85   GstDirectControlBindingConvertValue convert_value;
86   GstDirectControlBindingConvertGValue convert_g_value;
87
88   union {
89     gpointer _gst_reserved[GST_PADDING];
90     struct {
91       gboolean want_absolute;
92     } abi;
93   } ABI;};
94
95 /**
96  * GstDirectControlBindingClass:
97  * @parent_class: Parent class
98  * @convert: Class method to convert control-values
99  *
100  * The class structure of #GstDirectControlBinding.
101  */
102
103 struct _GstDirectControlBindingClass
104 {
105   GstControlBindingClass parent_class;
106
107   /*< private >*/
108   gpointer _gst_reserved[GST_PADDING];
109 };
110
111 GType gst_direct_control_binding_get_type (void);
112
113 /* Functions */
114
115 GstControlBinding * gst_direct_control_binding_new (GstObject * object, const gchar * property_name,
116                                                     GstControlSource * cs);
117
118 GstControlBinding * gst_direct_control_binding_new_absolute (GstObject * object, const gchar * property_name, 
119                                                     GstControlSource * cs);
120
121 G_END_DECLS
122
123 #endif /* __GST_DIRECT_CONTROL_BINDING_H__ */