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 */
22 #ifndef __GST_UNITCONVERT_H__
23 #define __GST_UNITCONVERT_H__
25 #include <gst/gstobject.h>
27 G_BEGIN_DECLS
28 #define GST_TYPE_UNIT_CONVERT (gst_unitconv_get_type ())
29 #define GST_UNIT_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_UNIT_CONVERT,GstUnitConvert))
30 #define GST_UNIT_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_UNIT_CONVERT,GstUnitConvert))
31 #define GST_IS_UNIT_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_UNIT_CONVERT))
32 #define GST_IS_UNIT_CONVERT_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_UNIT_CONVERT))
33 #define GST_UNIT_CONVERT_NAME(unitconv) (GST_OBJECT_NAME(unitconv))
34 #define GST_UNIT_CONVERT_PARENT(unitconv) (GST_OBJECT_PARENT(unitconv))
35 typedef struct _GstUnitConvertClass GstUnitConvertClass;
36 typedef struct _GstUnitConvert GstUnitConvert;
38 typedef void (*GstUnitConvertFunc) (GstUnitConvert * unitconv,
39 GValue * from_val, GValue * to_val);
41 struct _GstUnitConvert
42 {
43 GstObject object;
45 GHashTable *convert_params;
46 GSList *convert_func_chain;
47 GSList *temp_gvalues;
48 };
50 struct _GstUnitConvertClass
51 {
52 GstObjectClass parent_class;
54 /* signal callbacks */
55 };
57 GType gst_unitconv_get_type (void);
59 GstUnitConvert *gst_unitconv_new (void);
60 void _gst_unitconv_initialize (void);
62 gboolean gst_unitconv_set_convert_units (GstUnitConvert * unitconv,
63 gchar * from_unit_named, gchar * to_unit_named);
64 gboolean gst_unitconv_convert_value (GstUnitConvert * unitconv,
65 GValue * from_value, GValue * to_value);
67 GParamSpec *gst_unitconv_unit_spec (gchar * unit_name);
68 gboolean gst_unitconv_unit_exists (gchar * unit_name);
69 gboolean gst_unitconv_unit_is_logarithmic (gchar * unit_name);
71 gboolean gst_unitconv_register_unit (const gchar * domain_name,
72 gboolean is_domain_default,
73 gboolean is_logarithmic, GParamSpec * unit_spec);
75 gboolean gst_unitconv_register_convert_func (gchar * from_unit_named,
76 gchar * to_unit_named, GstUnitConvertFunc convert_func);
77 gboolean gst_unitconv_register_convert_property (gchar * unit_name,
78 GParamSpec * convert_prop_spec);
80 G_END_DECLS
81 #endif /* __GST_UNITCONVERT_H__ */