2 * Copyright (C) 2001 Steve Baker <stevebaker_org@yahoo.co.uk>
4 * unitconvert.c: Conversion between units of measurement
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.
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.
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.
22 #ifndef __GST_UNITCONVERT_H__
23 #define __GST_UNITCONVERT_H__
25 #include <gst/gstobject.h>
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))
35 #define GST_UNIT_CONVERT_NAME(unitconv) (GST_OBJECT_NAME(unitconv))
36 #define GST_UNIT_CONVERT_PARENT(unitconv) (GST_OBJECT_PARENT(unitconv))
38 typedef struct _GstUnitConvertClass GstUnitConvertClass;
39 typedef struct _GstUnitConvert GstUnitConvert;
41 typedef void (*GstUnitConvertFunc) (GstUnitConvert *unitconv, GValue *from_val, GValue *to_val);
43 struct _GstUnitConvert {
46 GHashTable *convert_params;
47 GSList *convert_func_chain;
51 struct _GstUnitConvertClass {
52 GstObjectClass parent_class;
54 /* signal callbacks */
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, gchar *from_unit_named, gchar *to_unit_named);
63 gboolean gst_unitconv_convert_value(GstUnitConvert *unitconv, GValue *from_value, GValue *to_value);
65 GParamSpec* gst_unitconv_unit_spec(gchar *unit_name);
66 gboolean gst_unitconv_unit_exists(gchar *unit_name);
67 gboolean gst_unitconv_unit_is_logarithmic(gchar *unit_name);
69 gboolean gst_unitconv_register_unit(const gchar *domain_name,
70 gboolean is_domain_default,
71 gboolean is_logarithmic,
72 GParamSpec *unit_spec);
74 gboolean gst_unitconv_register_convert_func(gchar *from_unit_named, gchar *to_unit_named, GstUnitConvertFunc convert_func);
75 gboolean gst_unitconv_register_convert_property(gchar *unit_name, GParamSpec *convert_prop_spec);
79 #endif /* __GST_UNITCONVERT_H__ */