don't break docs build
[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)          ((GstStructure *)(object))
30 #define GST_IS_STRUCTURE(object)       ((object) && (GST_STRUCTURE(object)->type == GST_TYPE_STRUCTURE))
31
32 typedef struct _GstStructure GstStructure;
33
34 typedef gboolean (*GstStructureForeachFunc) (GQuark   field_id,
35                                              const GValue * value,
36                                              gpointer user_data);
37
38 typedef gboolean (*GstStructureMapFunc)     (GQuark   field_id,
39                                              GValue * value,
40                                              gpointer user_data);
41
42 struct _GstStructure {
43   GType type;
44
45   /*< private >*/
46   GQuark name;
47
48   /* owned by parent structure, NULL if no parent */
49   gint *parent_refcount;
50
51   GArray *fields;
52
53   gpointer _gst_reserved[GST_PADDING];
54 };
55
56 GType                   gst_structure_get_type             (void);
57
58 GstStructure *          gst_structure_empty_new            (const gchar *            name);
59 GstStructure *          gst_structure_id_empty_new         (GQuark                   quark);
60 GstStructure *          gst_structure_new                  (const gchar *            name,
61                                                             const gchar *            firstfield,
62                                                             ...);
63 GstStructure *          gst_structure_new_valist           (const gchar *            name,
64                                                             const gchar *            firstfield,
65                                                             va_list                  varargs);
66 GstStructure *          gst_structure_copy                 (const GstStructure      *structure);
67 void                    gst_structure_set_parent_refcount  (GstStructure            *structure,
68                                                             gint            *refcount);
69 void                    gst_structure_free                 (GstStructure            *structure);
70
71 G_CONST_RETURN gchar *  gst_structure_get_name             (const GstStructure      *structure);
72 GQuark                  gst_structure_get_name_id          (const GstStructure      *structure);
73 gboolean                gst_structure_has_name             (const GstStructure      *structure,
74                                                             const gchar             *name);
75 void                    gst_structure_set_name             (GstStructure            *structure,
76                                                             const gchar             *name);
77
78 void                    gst_structure_id_set_value         (GstStructure            *structure,
79                                                             GQuark                   field,
80                                                             const GValue            *value);
81 void                    gst_structure_set_value            (GstStructure            *structure,
82                                                             const gchar             *fieldname,
83                                                             const GValue            *value);
84 void                    gst_structure_set                  (GstStructure            *structure,
85                                                             const gchar             *fieldname,
86                                                             ...);
87 void                    gst_structure_set_valist           (GstStructure            *structure,
88                                                             const gchar             *fieldname,
89                                                             va_list varargs);
90 G_CONST_RETURN GValue * gst_structure_id_get_value         (const GstStructure      *structure,
91                                                             GQuark                   field);
92 G_CONST_RETURN GValue * gst_structure_get_value            (const GstStructure      *structure,
93                                                             const gchar             *fieldname);
94 void                    gst_structure_remove_field         (GstStructure            *structure,
95                                                             const gchar             *fieldname);
96 void                    gst_structure_remove_fields        (GstStructure            *structure, 
97                                                              const gchar            *fieldname,
98                                                             ...);
99 void                    gst_structure_remove_fields_valist (GstStructure             *structure, 
100                                                             const gchar             *fieldname,
101                                                             va_list                  varargs);
102 void                    gst_structure_remove_all_fields    (GstStructure            *structure);
103
104 GType                   gst_structure_get_field_type       (const GstStructure      *structure,
105                                                             const gchar             *fieldname);
106 gboolean                gst_structure_foreach              (const GstStructure      *structure,
107                                                             GstStructureForeachFunc  func,
108                                                             gpointer                 user_data);
109 gboolean                gst_structure_map_in_place         (GstStructure            *structure,
110                                                             GstStructureMapFunc      func,
111                                                             gpointer                 user_data);
112 gint                    gst_structure_n_fields             (const GstStructure      *structure);
113 const gchar *           gst_structure_nth_field_name       (const GstStructure      *structure, guint index);
114 gboolean                gst_structure_has_field            (const GstStructure      *structure,
115                                                             const gchar             *fieldname);
116 gboolean                gst_structure_has_field_typed      (const GstStructure      *structure,
117                                                             const gchar             *fieldname,
118                                                             GType                    type);
119
120 /* utility functions */
121 gboolean                gst_structure_get_boolean          (const GstStructure      *structure,
122                                                             const gchar             *fieldname,
123                                                             gboolean                *value);
124 gboolean                gst_structure_get_int              (const GstStructure      *structure,
125                                                             const gchar             *fieldname,
126                                                             gint                    *value);
127 gboolean                gst_structure_get_fourcc           (const GstStructure      *structure,
128                                                             const gchar             *fieldname,
129                                                             guint32                 *value);
130 gboolean                gst_structure_get_double           (const GstStructure      *structure,
131                                                             const gchar             *fieldname,
132                                                             gdouble                 *value);
133 gboolean                gst_structure_get_date             (const GstStructure      *structure,
134                                                             const gchar             *fieldname,
135                                                             GDate                  **date_out);
136 G_CONST_RETURN gchar *  gst_structure_get_string           (const GstStructure      *structure,
137                                                             const gchar             *fieldname);
138
139 gchar *                 gst_structure_to_string            (const GstStructure      *structure);
140 GstStructure *          gst_structure_from_string          (const gchar             *string,
141                                                             gchar                  **end);
142
143 gboolean                 gst_caps_structure_fixate_field_nearest_int    (GstStructure *structure,
144                                                                          const char   *field_name,
145                                                                          int           target);
146 gboolean                 gst_caps_structure_fixate_field_nearest_double (GstStructure *structure,
147                                                                          const char   *field_name,
148                                                                          double        target);
149
150 gboolean                 gst_caps_structure_fixate_field_boolean (GstStructure *structure,
151                                                                          const char   *field_name,
152                                                                          gboolean        target);
153
154
155 G_END_DECLS
156
157 #endif
158