gst/gststructure.c (gst_structure_get_type): Ditto
[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 #define GST_TYPE_STRUCTURE             (gst_structure_get_type ())
29 #define GST_STRUCTURE(object)          (G_TYPE_CHECK_INSTANCE_CAST ((object), GST_TYPE_STRUCTURE, GstStructure))
30 #define GST_IS_STRUCTURE(object)       (G_TYPE_CHECK_INSTANCE_TYPE ((object), GST_TYPE_STRUCTURE))
31
32 typedef struct _GstStructure GstStructure;
33
34 typedef gboolean (*GstStructureForeachFunc) (GQuark   field_id,
35                                              GValue * value,
36                                              gpointer user_data);
37
38 struct _GstStructure {
39   GType type;
40
41   GQuark name;
42
43   GArray *fields;
44 };
45
46 GType                   gst_structure_get_type             (void) G_GNUC_CONST;
47
48 GstStructure *          gst_structure_empty_new            (const gchar *            name);
49 GstStructure *          gst_structure_id_empty_new         (GQuark                   quark);
50 GstStructure *          gst_structure_new                  (const gchar *            name,
51                                                             const gchar *            firstfield,
52                                                             ...);
53 GstStructure *          gst_structure_new_valist           (const gchar *            name,
54                                                             const gchar *            firstfield,
55                                                             va_list                  varargs);
56 GstStructure *          gst_structure_copy                 (const GstStructure      *structure);
57 void                    gst_structure_free                 (GstStructure            *structure);
58
59 G_CONST_RETURN gchar *  gst_structure_get_name             (const GstStructure      *structure);
60 void                    gst_structure_set_name             (GstStructure            *structure,
61                                                             const gchar             *name);
62
63 void                    gst_structure_id_set_value         (GstStructure            *structure,
64                                                             GQuark                   field,
65                                                             const GValue            *value);
66 void                    gst_structure_set_value            (GstStructure            *structure,
67                                                             const gchar             *fieldname,
68                                                             const GValue            *value);
69 void                    gst_structure_set                  (GstStructure            *structure,
70                                                             const gchar             *fieldname,
71                                                             ...);
72 void                    gst_structure_set_valist           (GstStructure            *structure,
73                                                             const gchar             *fieldname,
74                                                             va_list varargs);
75 G_CONST_RETURN GValue * gst_structure_id_get_value         (const GstStructure      *structure,
76                                                             GQuark                   field);
77 G_CONST_RETURN GValue * gst_structure_get_value            (const GstStructure      *structure,
78                                                             const gchar             *fieldname);
79 void                    gst_structure_remove_field         (GstStructure            *structure,
80                                                             const gchar             *fieldname);
81 void                    gst_structure_remove_fields        (GstStructure            *structure, 
82                                                              const gchar            *fieldname,
83                                                             ...);
84 void                    gst_structure_remove_fields_valist (GstStructure             *structure, 
85                                                             const gchar             *fieldname,
86                                                             va_list                  varargs);
87 void                    gst_structure_remove_all_fields    (GstStructure            *structure);
88
89 GType                   gst_structure_get_field_type       (const GstStructure      *structure,
90                                                             const gchar             *fieldname);
91 gboolean                gst_structure_foreach              (GstStructure            *structure,
92                                                             GstStructureForeachFunc  func,
93                                                             gpointer                 user_data);
94 gint                    gst_structure_n_fields             (const GstStructure      *structure);
95 gboolean                gst_structure_has_field            (const GstStructure      *structure,
96                                                             const gchar             *fieldname);
97 gboolean                gst_structure_has_field_typed      (const GstStructure      *structure,
98                                                             const gchar             *fieldname,
99                                                             GType                    type);
100
101 /* utility functions */
102 gboolean                gst_structure_get_boolean          (const GstStructure      *structure,
103                                                             const gchar             *fieldname,
104                                                             gboolean                *value);
105 gboolean                gst_structure_get_int              (const GstStructure      *structure,
106                                                             const gchar             *fieldname,
107                                                             gint                    *value);
108 gboolean                gst_structure_get_fourcc           (const GstStructure      *structure,
109                                                             const gchar             *fieldname,
110                                                             guint32                 *value);
111 gboolean                gst_structure_get_double           (const GstStructure      *structure,
112                                                             const gchar             *fieldname,
113                                                             gdouble                 *value);
114 G_CONST_RETURN gchar *  gst_structure_get_string           (const GstStructure      *structure,
115                                                             const gchar             *fieldname);
116
117 gchar *                 gst_structure_to_string            (const GstStructure      *structure);
118 GstStructure *          gst_structure_from_string          (const gchar             *string,
119                                                             gchar                  **end);
120
121 G_END_DECLS
122
123 #endif
124