use G_{BEGIN,END}_DECLS
[platform/upstream/gstreamer.git] / libs / gst / control / unitconvert.h
1 /* GStreamer
2  * Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
3  *
4  * unitconvert.c: Conversion between units of measurement
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __GST_UNITCONVERT_H__
23 #define __GST_UNITCONVERT_H__
24
25 #include <gst/gstobject.h>
26
27 G_BEGIN_DECLS
28
29 #define GST_TYPE_UNIT_CONVERT                   (gst_unitconv_get_type ())
30 #define GST_UNIT_CONVERT(obj)                   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_UNIT_CONVERT,GstUnitConvert))
31 #define GST_UNIT_CONVERT_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_UNIT_CONVERT,GstUnitConvert))
32 #define GST_IS_UNIT_CONVERT(obj)                        (G_TYPE_CHECK_INSTANCE_TYPE     ((obj), GST_TYPE_UNIT_CONVERT))
33 #define GST_IS_UNIT_CONVERT_CLASS(obj)          (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_UNIT_CONVERT))
34
35 #define GST_UNIT_CONVERT_NAME(unitconv)                         (GST_OBJECT_NAME(unitconv))
36 #define GST_UNIT_CONVERT_PARENT(unitconv)                       (GST_OBJECT_PARENT(unitconv))
37
38 typedef struct _GstUnitConvertClass GstUnitConvertClass;
39 typedef struct _GstUnitConvert GstUnitConvert;
40
41 typedef void (*GstUnitConvertFunc) (GstUnitConvert *unitconv, GValue *from_val, GValue *to_val);
42
43 struct _GstUnitConvert {
44         GstObject               object;
45
46         GHashTable *convert_params;
47         GSList *convert_func_chain;
48         GSList *temp_gvalues;
49 };
50
51 struct _GstUnitConvertClass {
52         GstObjectClass parent_class;
53
54         /* signal callbacks */
55 };
56
57 GstUnitConvert* gst_unitconv_new ();
58 void _gst_unitconv_initialize (void);
59
60 gboolean gst_unitconv_set_convert_units(GstUnitConvert *unitconv, gchar *from_unit_named, gchar *to_unit_named);
61 gboolean gst_unitconv_convert_value(GstUnitConvert *unitconv, GValue *from_value, GValue *to_value);
62
63 GParamSpec* gst_unitconv_unit_spec(gchar *unit_name);
64 gboolean gst_unitconv_unit_exists(gchar *unit_name);
65 gboolean gst_unitconv_unit_is_logarithmic(gchar *unit_name);
66
67 gboolean gst_unitconv_register_unit(const gchar *domain_name, 
68                                     gboolean is_domain_default, 
69                                     gboolean is_logarithmic,
70                                     GParamSpec *unit_spec);
71
72 gboolean gst_unitconv_register_convert_func(gchar *from_unit_named, gchar *to_unit_named, GstUnitConvertFunc convert_func);
73 gboolean gst_unitconv_register_convert_property(gchar *unit_name, GParamSpec *convert_prop_spec);
74
75 G_END_DECLS
76
77 #endif /* __GST_UNITCONVERT_H__ */