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