]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/blob - gst/gstvalue.h
gst-indent run on core
[glsdk/gstreamer0-10.git] / gst / gstvalue.h
1 /* GStreamer
2  * Copyright (C) <2003> David A. Schleef <ds@schleef.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
20 #ifndef __GST_VALUE_H__
21 #define __GST_VALUE_H__
23 #include <gst/gstconfig.h>
24 #include <gst/gstcaps.h>
26 G_BEGIN_DECLS
27     typedef int (*GstValueCompareFunc) (const GValue * value1,
28     const GValue * value2);
29 typedef char *(*GstValueSerializeFunc) (const GValue * value1);
30 typedef gboolean (*GstValueDeserializeFunc) (GValue * dest, const char *s);
31 typedef int (*GstValueUnionFunc) (GValue * dest, const GValue * value1,
32     const GValue * value2);
33 typedef int (*GstValueIntersectFunc) (GValue * dest, const GValue * value1,
34     const GValue * value2);
36 typedef struct _GstValueTable GstValueTable;
37 struct _GstValueTable
38 {
39   GType type;
40   GstValueCompareFunc compare;
41   GstValueSerializeFunc serialize;
42   GstValueDeserializeFunc deserialize;
44   void *_gst_reserved[GST_PADDING];
45 };
48 #define GST_MAKE_FOURCC(a,b,c,d)        (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
49 #define GST_STR_FOURCC(f)               (guint32)(((f)[0])|((f)[1]<<8)|((f)[2]<<16)|((f)[3]<<24))
51 #define GST_FOURCC_FORMAT "%c%c%c%c"
52 #define GST_FOURCC_ARGS(fourcc) \
53         ((gchar) ((fourcc)     &0xff)), \
54         ((gchar) (((fourcc)>>8 )&0xff)), \
55         ((gchar) (((fourcc)>>16)&0xff)), \
56         ((gchar) (((fourcc)>>24)&0xff))
58 #define GST_VALUE_HOLDS_FOURCC(x)       (G_VALUE_HOLDS(x, gst_type_fourcc))
59 #define GST_VALUE_HOLDS_INT_RANGE(x)    (G_VALUE_HOLDS(x, gst_type_int_range))
60 #define GST_VALUE_HOLDS_DOUBLE_RANGE(x) (G_VALUE_HOLDS(x, gst_type_double_range))
61 #define GST_VALUE_HOLDS_LIST(x)         (G_VALUE_HOLDS(x, gst_type_list))
62 #define GST_VALUE_HOLDS_CAPS(x)         (G_VALUE_HOLDS(x, GST_TYPE_CAPS))
64 #define GST_TYPE_FOURCC gst_type_fourcc
65 #define GST_TYPE_INT_RANGE gst_type_int_range
66 #define GST_TYPE_DOUBLE_RANGE gst_type_double_range
67 #define GST_TYPE_LIST gst_type_list
69 #define GST_VALUE_LESS_THAN (-1)
70 #define GST_VALUE_EQUAL 0
71 #define GST_VALUE_GREATER_THAN 1
72 #define GST_VALUE_UNORDERED 2
74 extern GType gst_type_fourcc;
75 extern GType gst_type_int_range;
76 extern GType gst_type_double_range;
77 extern GType gst_type_list;
79 /* list */
81 void gst_value_list_prepend_value (GValue * value,
82     const GValue * prepend_value);
83 void gst_value_list_append_value (GValue * value, const GValue * append_value);
84 guint gst_value_list_get_size (const GValue * value);
85 G_CONST_RETURN GValue *gst_value_list_get_value (const GValue * value,
86     guint index);
87 void gst_value_list_concat (GValue * dest, const GValue * value1,
88     const GValue * value2);
90 /* fourcc */
92 void gst_value_set_fourcc (GValue * value, guint32 fourcc);
93 guint32 gst_value_get_fourcc (const GValue * value);
95 /* int range */
97 void gst_value_set_int_range (GValue * value, int start, int end);
98 int gst_value_get_int_range_min (const GValue * value);
99 int gst_value_get_int_range_max (const GValue * value);
101 /* double range */
103 void gst_value_set_double_range (GValue * value, double start, double end);
104 double gst_value_get_double_range_min (const GValue * value);
105 double gst_value_get_double_range_max (const GValue * value);
107 /* caps */
108 G_CONST_RETURN GstCaps *gst_value_get_caps (const GValue * value);
109 void gst_value_set_caps (GValue * value, const GstCaps * caps);
111 /* compare */
113 gboolean gst_value_can_compare (const GValue * value1, const GValue * value2);
114 int gst_value_compare (const GValue * value1, const GValue * value2);
116 /* union */
118 gboolean gst_value_can_union (const GValue * value1, const GValue * value2);
119 gboolean gst_value_union (GValue * dest, const GValue * value1,
120     const GValue * value2);
121 void gst_value_register_union_func (GType type1, GType type2,
122     GstValueUnionFunc func);
124 /* intersection */
126 gboolean gst_value_can_intersect (const GValue * value1, const GValue * value2);
127 gboolean gst_value_intersect (GValue * dest, const GValue * value1,
128     const GValue * value2);
129 void gst_value_register_intersect_func (GType type1, GType type2,
130     GstValueIntersectFunc func);
132 /* */
134 void gst_value_register (const GstValueTable * table);
135 void gst_value_init_and_copy (GValue * dest, const GValue * src);
136 void _gst_value_initialize (void);
138 gchar *gst_value_serialize (const GValue * value);
139 gboolean gst_value_deserialize (GValue * dest, const gchar * src);
142 G_END_DECLS
143 #endif