2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
5 * gstprops.h: Header for properties subsystem
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
24 #ifndef __GST_PROPS_H__
25 #define __GST_PROPS_H__
27 #include <gst/gstconfig.h>
29 #include <glib-object.h>
33 typedef struct _GstProps GstProps;
34 extern GType _gst_props_type;
36 #define GST_TYPE_PROPS (_gst_props_type)
39 GST_PROPS_END_TYPE = 0,
41 GST_PROPS_INVALID_TYPE,
45 GST_PROPS_FOURCC_TYPE,
47 GST_PROPS_STRING_TYPE,
49 GST_PROPS_VAR_TYPE, /* after this marker start the variable properties */
53 GST_PROPS_FLOAT_RANGE_TYPE,
54 GST_PROPS_INT_RANGE_TYPE,
56 GST_PROPS_LAST_TYPE = GST_PROPS_END_TYPE + 16
59 #define GST_MAKE_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
60 #define GST_STR_FOURCC(f) (guint32)(((f)[0])|((f)[1]<<8)|((f)[2]<<16)|((f)[3]<<24))
62 #define GST_PROPS_LIST(a...) GST_PROPS_LIST_TYPE,##a,NULL
63 #define GST_PROPS_GLIST(a) GST_PROPS_GLIST_TYPE,(a)
64 #define GST_PROPS_INT(a) GST_PROPS_INT_TYPE,(a)
65 #define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_TYPE,(a),(b)
66 #define GST_PROPS_FLOAT(a) GST_PROPS_FLOAT_TYPE,(a)
67 #define GST_PROPS_FLOAT_RANGE(a,b) GST_PROPS_FLOAT_RANGE_TYPE,(a),(b)
68 #define GST_PROPS_FOURCC(a) GST_PROPS_FOURCC_TYPE,(a)
69 #define GST_PROPS_BOOLEAN(a) GST_PROPS_BOOL_TYPE,(a)
70 #define GST_PROPS_STRING(a) GST_PROPS_STRING_TYPE,(a)
72 #define GST_PROPS_INT_POSITIVE GST_PROPS_INT_RANGE(0,G_MAXINT)
73 #define GST_PROPS_INT_NEGATIVE GST_PROPS_INT_RANGE(G_MININT,0)
74 #define GST_PROPS_INT_ANY GST_PROPS_INT_RANGE(G_MININT,G_MAXINT)
76 typedef struct _GstPropsEntry GstPropsEntry;
82 GList *properties; /* real properties for this property */
85 /* initialize the subsystem */
86 void _gst_props_initialize (void);
88 GstProps* gst_props_new (const gchar *firstname, ...);
89 GstProps* gst_props_newv (const gchar *firstname, va_list var_args);
90 GstProps* gst_props_empty_new (void);
92 void gst_props_unref (GstProps *props);
93 void gst_props_ref (GstProps *props);
94 void gst_props_destroy (GstProps *props);
96 void gst_props_debug (GstProps *props);
98 GstProps* gst_props_copy (GstProps *props);
99 GstProps* gst_props_copy_on_write (GstProps *props);
101 GstProps* gst_props_merge (GstProps *props, GstProps *tomerge);
103 gboolean gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops);
104 GstProps* gst_props_intersect (GstProps *props1, GstProps *props2);
105 GList* gst_props_normalize (GstProps *props);
107 GstProps* gst_props_set (GstProps *props, const gchar *name, ...);
108 gboolean gst_props_get (GstProps *props, gchar *first_name, ...);
109 gboolean gst_props_get_safe (GstProps *props, gchar *first_name, ...);
111 gboolean gst_props_has_property (GstProps *props, const gchar *name);
112 gboolean gst_props_has_property_typed (GstProps *props, const gchar *name, GstPropsType type);
113 gboolean gst_props_has_fixed_property (GstProps *props, const gchar *name);
115 const GstPropsEntry* gst_props_get_entry (GstProps *props, const gchar *name);
116 void gst_props_add_entry (GstProps *props, GstPropsEntry *entry);
118 /* working with props entries */
119 GstPropsEntry* gst_props_entry_new (const gchar *name, ...);
121 GstPropsType gst_props_entry_get_type (const GstPropsEntry *entry);
122 const gchar* gst_props_entry_get_name (const GstPropsEntry *entry);
123 gboolean gst_props_entry_is_fixed (const GstPropsEntry *entry);
125 gboolean gst_props_entry_get (const GstPropsEntry *entry, ...);
127 gboolean gst_props_entry_get_int (const GstPropsEntry *entry, gint *val);
128 gboolean gst_props_entry_get_float (const GstPropsEntry *entry, gfloat *val);
129 gboolean gst_props_entry_get_fourcc_int (const GstPropsEntry *entry, guint32 *val);
130 gboolean gst_props_entry_get_boolean (const GstPropsEntry *entry, gboolean *val);
131 gboolean gst_props_entry_get_string (const GstPropsEntry *entry, const gchar **val);
132 gboolean gst_props_entry_get_int_range (const GstPropsEntry *entry, gint *min, gint *max);
133 gboolean gst_props_entry_get_float_range (const GstPropsEntry *entry, gfloat *min, gfloat *max);
134 gboolean gst_props_entry_get_list (const GstPropsEntry *entry, const GList **val);
137 #ifndef GST_DISABLE_LOADSAVE
138 xmlNodePtr gst_props_save_thyself (GstProps *props, xmlNodePtr parent);
139 GstProps* gst_props_load_thyself (xmlNodePtr parent);
145 #endif /* __GST_PROPS_H__ */