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 struct _GstStructure {
39 struct _GstStructureField {
44 #define GST_STRUCTURE_FIELD(structure, index) \
45 &g_array_index((structure)->fields, GstStructureField, (index))
47 GType gst_structure_get_type(void);
48 void _gst_structure_initialize(void);
50 GstStructure *gst_structure_empty_new(const gchar *name);
51 GstStructure *gst_structure_new(const gchar *name,
52 const gchar *firstfield, ...);
53 GstStructure *gst_structure_new_valist(const gchar *name,
54 const gchar *firstfield, va_list varargs);
55 GstStructure *gst_structure_dup(GstStructure *structure);
56 void gst_structure_free(GstStructure *structure);
58 const gchar *gst_structure_get_name(GstStructure *structure);
59 void gst_structure_set_name(GstStructure *structure, const gchar *name);
60 void gst_structure_set_field(GstStructure *structure,
61 GstStructureField *field);
63 void gst_structure_id_set_value(GstStructure *structure, GQuark field,
65 void gst_structure_set_value(GstStructure *structure, const gchar *field,
67 void gst_structure_set(GstStructure *structure, const gchar *field, ...);
68 void gst_structure_set_valist(GstStructure *structure, const gchar *field,
70 const GValue *gst_structure_get(GstStructure *structure, const gchar *field);
71 GstStructureField *gst_structure_get_field(GstStructure *structure,
72 const gchar *fieldname);
73 GstStructureField *gst_structure_id_get_field(GstStructure *structure,
75 void gst_structure_remove_field(GstStructure *structure, const gchar *field);
77 GType gst_structure_get_field_type(GstStructure *structure,
79 gint gst_structure_n_fields(GstStructure *structure);
80 gboolean gst_structure_has_field(GstStructure *structure, const gchar *field);
81 gboolean gst_structure_has_field_typed(GstStructure *structure,
82 const gchar *field, GType type);
84 /* utility functions */
86 gboolean gst_structure_get_boolean(GstStructure *structure, const gchar *field,
88 gboolean gst_structure_get_int(GstStructure *structure, const gchar *field,
90 gboolean gst_structure_get_fourcc(GstStructure *structure, const gchar *field,
92 gboolean gst_structure_get_double(GstStructure *structure, const gchar *field,
94 const gchar *gst_structure_get_string(GstStructure *structure,
97 gchar * gst_structure_to_string(GstStructure *structure);
98 GstStructure * gst_structure_from_string (const gchar *string);