2 * Copyright (C) <2003> David A. Schleef <ds@schleef.org>
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.
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.
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.
20 #ifndef __GST_STRUCTURE_H__
21 #define __GST_STRUCTURE_H__
23 #include <gst/gstconfig.h>
24 #include <glib-object.h>
28 typedef struct _GstStructure GstStructure;
29 typedef struct _GstStructureField GstStructureField;
31 typedef void (*GstStructureForeachFunc) (GstStructure *structure,
32 GQuark field_id, GValue *value, gpointer user_data);
34 struct _GstStructure {
42 struct _GstStructureField {
47 #define GST_STRUCTURE_FIELD(structure, index) \
48 &g_array_index((structure)->fields, GstStructureField, (index))
50 GType gst_structure_get_type(void);
51 void _gst_structure_initialize(void);
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);
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);
66 void gst_structure_id_set_value(GstStructure *structure, GQuark field,
68 void gst_structure_set_value(GstStructure *structure, const gchar *field,
70 void gst_structure_set(GstStructure *structure, const gchar *field, ...);
71 void gst_structure_set_valist(GstStructure *structure, const gchar *field,
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,
78 void gst_structure_remove_field(GstStructure *structure, const gchar *field);
80 GType gst_structure_get_field_type(GstStructure *structure,
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);
89 /* utility functions */
91 gboolean gst_structure_get_boolean(GstStructure *structure, const gchar *field,
93 gboolean gst_structure_get_int(GstStructure *structure, const gchar *field,
95 gboolean gst_structure_get_fourcc(GstStructure *structure, const gchar *field,
97 gboolean gst_structure_get_double(GstStructure *structure, const gchar *field,
99 const gchar *gst_structure_get_string(GstStructure *structure,
102 gchar * gst_structure_to_string(GstStructure *structure);
103 GstStructure * gst_structure_from_string (const gchar *string);