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 */
52 GST_PROPS_FLOAT_RANGE_TYPE,
53 GST_PROPS_INT_RANGE_TYPE,
55 GST_PROPS_LAST_TYPE = GST_PROPS_END_TYPE + 16
58 #define GST_MAKE_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
59 #define GST_STR_FOURCC(f) (guint32)(((f)[0])|((f)[1]<<8)|((f)[2]<<16)|((f)[3]<<24))
61 #define GST_PROPS_LIST(a...) GST_PROPS_LIST_TYPE,##a,NULL
62 #define GST_PROPS_INT(a) GST_PROPS_INT_TYPE,(a)
63 #define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_TYPE,(a),(b)
64 #define GST_PROPS_FLOAT(a) GST_PROPS_FLOAT_TYPE,(a)
65 #define GST_PROPS_FLOAT_RANGE(a,b) GST_PROPS_FLOAT_RANGE_TYPE,(a),(b)
66 #define GST_PROPS_FOURCC(a) GST_PROPS_FOURCC_TYPE,(a)
67 #define GST_PROPS_BOOLEAN(a) GST_PROPS_BOOL_TYPE,(a)
68 #define GST_PROPS_STRING(a) GST_PROPS_STRING_TYPE,(a)
70 #define GST_PROPS_INT_POSITIVE GST_PROPS_INT_RANGE(0,G_MAXINT)
71 #define GST_PROPS_INT_NEGATIVE GST_PROPS_INT_RANGE(G_MININT,0)
72 #define GST_PROPS_INT_ANY GST_PROPS_INT_RANGE(G_MININT,G_MAXINT)
74 typedef struct _GstPropsEntry GstPropsEntry;
80 GList *properties; /* real properties for this property */
83 /* initialize the subsystem */
84 void _gst_props_initialize (void);
86 GstProps* gst_props_new (const gchar *firstname, ...);
87 GstProps* gst_props_newv (const gchar *firstname, va_list var_args);
88 GstProps* gst_props_empty_new (void);
90 void gst_props_unref (GstProps *props);
91 void gst_props_ref (GstProps *props);
92 void gst_props_destroy (GstProps *props);
94 void gst_props_debug (GstProps *props);
96 GstProps* gst_props_copy (GstProps *props);
97 GstProps* gst_props_copy_on_write (GstProps *props);
99 GstProps* gst_props_merge (GstProps *props, GstProps *tomerge);
101 gboolean gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops);
102 GstProps* gst_props_intersect (GstProps *props1, GstProps *props2);
103 GList* gst_props_normalize (GstProps *props);
105 GstProps* gst_props_set (GstProps *props, const gchar *name, ...);
106 gboolean gst_props_get (GstProps *props, gchar *first_name, ...);
107 gboolean gst_props_get_safe (GstProps *props, gchar *first_name, ...);
109 gboolean gst_props_has_property (GstProps *props, const gchar *name);
110 gboolean gst_props_has_property_typed (GstProps *props, const gchar *name, GstPropsType type);
111 gboolean gst_props_has_fixed_property (GstProps *props, const gchar *name);
113 const GstPropsEntry* gst_props_get_entry (GstProps *props, const gchar *name);
114 void gst_props_add_entry (GstProps *props, GstPropsEntry *entry);
116 /* working with props entries */
117 GstPropsEntry* gst_props_entry_new (const gchar *name, ...);
119 GstPropsType gst_props_entry_get_type (const GstPropsEntry *entry);
120 const gchar* gst_props_entry_get_name (const GstPropsEntry *entry);
121 gboolean gst_props_entry_is_fixed (const GstPropsEntry *entry);
123 gboolean gst_props_entry_get (const GstPropsEntry *entry, ...);
125 gboolean gst_props_entry_get_int (const GstPropsEntry *entry, gint *val);
126 gboolean gst_props_entry_get_float (const GstPropsEntry *entry, gfloat *val);
127 gboolean gst_props_entry_get_fourcc_int (const GstPropsEntry *entry, guint32 *val);
128 gboolean gst_props_entry_get_boolean (const GstPropsEntry *entry, gboolean *val);
129 gboolean gst_props_entry_get_string (const GstPropsEntry *entry, const gchar **val);
130 gboolean gst_props_entry_get_int_range (const GstPropsEntry *entry, gint *min, gint *max);
131 gboolean gst_props_entry_get_float_range (const GstPropsEntry *entry, gfloat *min, gfloat *max);
132 gboolean gst_props_entry_get_list (const GstPropsEntry *entry, const GList **val);
135 #ifndef GST_DISABLE_LOADSAVE
136 xmlNodePtr gst_props_save_thyself (GstProps *props, xmlNodePtr parent);
137 GstProps* gst_props_load_thyself (xmlNodePtr parent);
143 #endif /* __GST_PROPS_H__ */