hacking. Add value_compare, value_union, and value_intersect functions
[platform/upstream/gstreamer.git] / gst / gststructure.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  */
19
20 #ifndef __GST_STRUCTURE_H__
21 #define __GST_STRUCTURE_H__
22
23 #include <gst/gstconfig.h>
24 #include <glib-object.h>
25
26 G_BEGIN_DECLS
27
28 typedef struct _GstStructure GstStructure;
29 typedef struct _GstStructureField GstStructureField;
30
31 typedef void (*GstStructureForeachFunc) (GstStructure *structure,
32     GQuark field_id, GValue *value, gpointer user_data);
33
34 struct _GstStructure {
35   int len;
36
37   GQuark name;
38
39   GArray *fields;
40 };
41
42 struct _GstStructureField {
43   GQuark name;
44   GValue value;
45 };
46
47 #define GST_STRUCTURE_FIELD(structure, index) \
48     &g_array_index((structure)->fields, GstStructureField, (index))
49
50 GType gst_structure_get_type(void);
51 void _gst_structure_initialize(void);
52
53 GstStructure *gst_structure_empty_new(const gchar *name);
54 GstStructure *gst_structure_new(const gchar *name,
55     const gchar *firstfield, ...);
56 GstStructure *gst_structure_new_valist(const gchar *name,
57     const gchar *firstfield, va_list varargs);
58 GstStructure *gst_structure_copy(GstStructure *structure);
59 void gst_structure_free(GstStructure *structure);
60
61 const gchar *gst_structure_get_name(GstStructure *structure);
62 void gst_structure_set_name(GstStructure *structure, const gchar *name);
63 void gst_structure_set_field(GstStructure *structure,
64     GstStructureField *field);
65
66 void gst_structure_id_set_value(GstStructure *structure, GQuark field,
67     GValue *value);
68 void gst_structure_set_value(GstStructure *structure, const gchar *field,
69     GValue *value);
70 void gst_structure_set(GstStructure *structure, const gchar *field, ...);
71 void gst_structure_set_valist(GstStructure *structure, const gchar *field,
72     va_list varargs);
73 const GValue *gst_structure_get_value(GstStructure *structure, const gchar *field);
74 GstStructureField *gst_structure_get_field(GstStructure *structure,
75         const gchar *fieldname);
76 GstStructureField *gst_structure_id_get_field(GstStructure *structure,
77         GQuark fieldname);
78 void gst_structure_remove_field(GstStructure *structure, const gchar *field);
79
80 GType gst_structure_get_field_type(GstStructure *structure,
81     const gchar *field);
82 void gst_structure_field_foreach (GstStructure *structure,
83     GstStructureForeachFunc func, gpointer user_data);
84 gint gst_structure_n_fields(GstStructure *structure);
85 gboolean gst_structure_has_field(GstStructure *structure, const gchar *field);
86 gboolean gst_structure_has_field_typed(GstStructure *structure,
87     const gchar *field, GType type);
88
89 /* utility functions */
90
91 gboolean gst_structure_get_boolean(GstStructure *structure, const gchar *field,
92     gboolean *value);
93 gboolean gst_structure_get_int(GstStructure *structure, const gchar *field,
94     gint *value);
95 gboolean gst_structure_get_fourcc(GstStructure *structure, const gchar *field,
96     guint32 *value);
97 gboolean gst_structure_get_double(GstStructure *structure, const gchar *field,
98     gdouble *value);
99 const gchar *gst_structure_get_string(GstStructure *structure,
100     const gchar *field);
101
102 gchar * gst_structure_to_string(GstStructure *structure);
103 GstStructure * gst_structure_from_string (const gchar *string);
104
105
106 G_END_DECLS
107
108 #endif
109