2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
|
|
|
* gstprops.h: Header for properties subsystem
|
2000-12-07 18:37:56 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GST_PROPS_H__
|
|
|
|
#define __GST_PROPS_H__
|
|
|
|
|
2001-10-17 10:21:27 +00:00
|
|
|
#include <gst/gstconfig.h>
|
2001-01-18 11:16:53 +00:00
|
|
|
|
2002-03-30 17:05:03 +00:00
|
|
|
#include <glib-object.h>
|
2000-12-28 22:12:02 +00:00
|
|
|
|
2002-07-08 19:07:30 +00:00
|
|
|
G_BEGIN_DECLS
|
2002-04-06 18:59:39 +00:00
|
|
|
|
2000-12-07 18:37:56 +00:00
|
|
|
typedef struct _GstProps GstProps;
|
2002-03-30 17:05:03 +00:00
|
|
|
extern GType _gst_props_type;
|
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
#define GST_PROPS_TRACE_NAME "GstProps"
|
|
|
|
|
2002-09-17 21:22:31 +00:00
|
|
|
#define GST_TYPE_PROPS (_gst_props_type)
|
2000-12-07 18:37:56 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2002-03-30 17:05:03 +00:00
|
|
|
GST_PROPS_END_TYPE = 0,
|
|
|
|
|
|
|
|
GST_PROPS_INVALID_TYPE,
|
|
|
|
|
|
|
|
GST_PROPS_INT_TYPE,
|
|
|
|
GST_PROPS_FLOAT_TYPE,
|
|
|
|
GST_PROPS_FOURCC_TYPE,
|
2002-11-27 20:47:39 +00:00
|
|
|
GST_PROPS_BOOLEAN_TYPE,
|
2002-03-30 17:05:03 +00:00
|
|
|
GST_PROPS_STRING_TYPE,
|
2002-01-13 22:22:42 +00:00
|
|
|
|
2002-03-30 17:05:03 +00:00
|
|
|
GST_PROPS_VAR_TYPE, /* after this marker start the variable properties */
|
2002-01-13 22:22:42 +00:00
|
|
|
|
2002-03-30 17:05:03 +00:00
|
|
|
GST_PROPS_LIST_TYPE,
|
2002-09-17 23:46:52 +00:00
|
|
|
GST_PROPS_GLIST_TYPE,
|
2002-03-30 17:05:03 +00:00
|
|
|
GST_PROPS_FLOAT_RANGE_TYPE,
|
|
|
|
GST_PROPS_INT_RANGE_TYPE,
|
2002-01-13 22:22:42 +00:00
|
|
|
|
2002-07-09 10:27:22 +00:00
|
|
|
GST_PROPS_LAST_TYPE = GST_PROPS_END_TYPE + 16
|
2002-03-30 17:05:03 +00:00
|
|
|
} GstPropsType;
|
2000-12-07 18:37:56 +00:00
|
|
|
|
2002-06-23 12:42:52 +00:00
|
|
|
#define GST_MAKE_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
|
|
|
|
#define GST_STR_FOURCC(f) (guint32)(((f)[0])|((f)[1]<<8)|((f)[2]<<16)|((f)[3]<<24))
|
2001-03-30 23:56:07 +00:00
|
|
|
|
2003-04-07 20:11:38 +00:00
|
|
|
#define GST_FOURCC_FORMAT "%c%c%c%c"
|
|
|
|
#define GST_FOURCC_ARGS(fourcc) \
|
2003-05-13 23:15:46 +00:00
|
|
|
((gchar) ((fourcc) &0xff)), \
|
|
|
|
((gchar) (((fourcc)>>8 )&0xff)), \
|
|
|
|
((gchar) (((fourcc)>>16)&0xff)), \
|
|
|
|
((gchar) (((fourcc)>>24)&0xff))
|
2003-04-07 20:11:38 +00:00
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#ifdef G_HAVE_ISO_VARARGS
|
2003-07-08 03:23:56 +00:00
|
|
|
# define GST_PROPS_LIST(...) GST_PROPS_LIST_TYPE,__VA_ARGS__,GST_PROPS_END_TYPE
|
2002-11-29 17:05:13 +00:00
|
|
|
#elif defined(G_HAVE_GNUC_VARARGS)
|
2003-07-08 03:23:56 +00:00
|
|
|
# define GST_PROPS_LIST(a...) GST_PROPS_LIST_TYPE,a,GST_PROPS_END_TYPE
|
2002-11-29 17:05:13 +00:00
|
|
|
#endif
|
|
|
|
|
2002-09-17 23:46:52 +00:00
|
|
|
#define GST_PROPS_GLIST(a) GST_PROPS_GLIST_TYPE,(a)
|
2002-03-30 17:05:03 +00:00
|
|
|
#define GST_PROPS_INT(a) GST_PROPS_INT_TYPE,(a)
|
|
|
|
#define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_TYPE,(a),(b)
|
2002-10-17 00:53:13 +00:00
|
|
|
#define GST_PROPS_FLOAT(a) GST_PROPS_FLOAT_TYPE,((float)(a))
|
|
|
|
#define GST_PROPS_FLOAT_RANGE(a,b) GST_PROPS_FLOAT_RANGE_TYPE,((float)(a)),((float)(b))
|
2002-03-30 17:05:03 +00:00
|
|
|
#define GST_PROPS_FOURCC(a) GST_PROPS_FOURCC_TYPE,(a)
|
2002-11-27 20:47:39 +00:00
|
|
|
#define GST_PROPS_BOOLEAN(a) GST_PROPS_BOOLEAN_TYPE,(a)
|
2002-03-30 17:05:03 +00:00
|
|
|
#define GST_PROPS_STRING(a) GST_PROPS_STRING_TYPE,(a)
|
2000-12-07 18:37:56 +00:00
|
|
|
|
2002-01-13 22:22:42 +00:00
|
|
|
#define GST_PROPS_INT_POSITIVE GST_PROPS_INT_RANGE(0,G_MAXINT)
|
|
|
|
#define GST_PROPS_INT_NEGATIVE GST_PROPS_INT_RANGE(G_MININT,0)
|
|
|
|
#define GST_PROPS_INT_ANY GST_PROPS_INT_RANGE(G_MININT,G_MAXINT)
|
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
/* propsentries are private */
|
2002-03-30 17:05:03 +00:00
|
|
|
typedef struct _GstPropsEntry GstPropsEntry;
|
2003-01-03 23:34:43 +00:00
|
|
|
extern GType _gst_props_entry_type;
|
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
#define GST_PROPS_ENTRY_TRACE_NAME "GstPropsEntry"
|
|
|
|
|
2003-01-03 23:34:43 +00:00
|
|
|
#define GST_TYPE_PROPS_ENTRY (_gst_props_entry_type)
|
2000-12-07 18:37:56 +00:00
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
typedef enum {
|
|
|
|
GST_PROPS_FIXED = (1 << 0), /* props has no variable entries */
|
|
|
|
GST_PROPS_FLOATING = (1 << 1) /* props is floating */
|
|
|
|
} GstPropsFlags;
|
|
|
|
|
|
|
|
#define GST_PROPS_FLAGS(props) ((props)->flags)
|
2003-06-13 21:26:33 +00:00
|
|
|
#define GST_PROPS_FLAG_IS_SET(props,flag) (GST_PROPS_FLAGS (props) & (flag))
|
|
|
|
#define GST_PROPS_FLAG_SET(props,flag) (GST_PROPS_FLAGS (props) |= (flag))
|
2003-02-02 19:58:11 +00:00
|
|
|
#define GST_PROPS_FLAG_UNSET(props,flag) (GST_PROPS_FLAGS (props) &= ~(flag))
|
|
|
|
|
|
|
|
#define GST_PROPS_REFCOUNT(props) ((props)->refcount)
|
|
|
|
#define GST_PROPS_PROPERTIES(props) ((props)->properties)
|
|
|
|
|
2003-06-13 21:26:33 +00:00
|
|
|
#define GST_PROPS_IS_FIXED(props) (GST_PROPS_FLAG_IS_SET ((props), GST_PROPS_FIXED))
|
|
|
|
#define GST_PROPS_IS_FLOATING(props) (GST_PROPS_FLAG_IS_SET ((props), GST_PROPS_FLOATING))
|
2003-02-02 19:58:11 +00:00
|
|
|
|
2000-12-07 18:37:56 +00:00
|
|
|
struct _GstProps {
|
2003-02-02 19:58:11 +00:00
|
|
|
gint refcount;
|
|
|
|
gint flags;
|
2001-03-20 18:29:00 +00:00
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
GList *properties; /* real property entries for this property */
|
2000-12-07 18:37:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* initialize the subsystem */
|
2002-03-30 17:05:03 +00:00
|
|
|
void _gst_props_initialize (void);
|
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
/* creating new properties */
|
2003-03-16 20:06:02 +00:00
|
|
|
GType gst_props_get_type (void);
|
2002-03-30 17:05:03 +00:00
|
|
|
GstProps* gst_props_new (const gchar *firstname, ...);
|
|
|
|
GstProps* gst_props_newv (const gchar *firstname, va_list var_args);
|
2002-05-01 19:38:58 +00:00
|
|
|
GstProps* gst_props_empty_new (void);
|
2002-03-30 17:05:03 +00:00
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
/* replace pointer to props, doing proper refcounting */
|
|
|
|
void gst_props_replace (GstProps **oldprops, GstProps *newprops);
|
|
|
|
void gst_props_replace_sink (GstProps **oldprops, GstProps *newprops);
|
|
|
|
|
|
|
|
/* lifecycle management */
|
|
|
|
GstProps* gst_props_unref (GstProps *props);
|
|
|
|
GstProps* gst_props_ref (GstProps *props);
|
|
|
|
void gst_props_sink (GstProps *props);
|
2000-12-07 18:37:56 +00:00
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
/* dump property debug info to the log */
|
2002-03-30 17:05:03 +00:00
|
|
|
void gst_props_debug (GstProps *props);
|
2000-12-19 16:36:10 +00:00
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
/* copy */
|
2002-03-30 17:05:03 +00:00
|
|
|
GstProps* gst_props_copy (GstProps *props);
|
|
|
|
GstProps* gst_props_copy_on_write (GstProps *props);
|
2001-03-20 18:29:00 +00:00
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
/* check if fromprops is subset of toprops */
|
2002-03-30 17:05:03 +00:00
|
|
|
gboolean gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops);
|
2003-02-02 19:58:11 +00:00
|
|
|
|
|
|
|
/* operation on props */
|
|
|
|
GstProps* gst_props_merge (GstProps *props, GstProps *tomerge);
|
2002-03-30 17:05:03 +00:00
|
|
|
GstProps* gst_props_intersect (GstProps *props1, GstProps *props2);
|
|
|
|
GList* gst_props_normalize (GstProps *props);
|
2001-03-20 18:29:00 +00:00
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
/* modify entries */
|
2002-03-30 17:05:03 +00:00
|
|
|
GstProps* gst_props_set (GstProps *props, const gchar *name, ...);
|
|
|
|
gboolean gst_props_get (GstProps *props, gchar *first_name, ...);
|
2002-05-08 20:00:35 +00:00
|
|
|
gboolean gst_props_get_safe (GstProps *props, gchar *first_name, ...);
|
2000-12-19 16:36:10 +00:00
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
/* query entries */
|
2002-03-30 17:05:03 +00:00
|
|
|
gboolean gst_props_has_property (GstProps *props, const gchar *name);
|
|
|
|
gboolean gst_props_has_property_typed (GstProps *props, const gchar *name, GstPropsType type);
|
|
|
|
gboolean gst_props_has_fixed_property (GstProps *props, const gchar *name);
|
2000-12-07 18:37:56 +00:00
|
|
|
|
2003-02-02 19:58:11 +00:00
|
|
|
/* add/get entries */
|
2002-05-01 19:38:58 +00:00
|
|
|
const GstPropsEntry* gst_props_get_entry (GstProps *props, const gchar *name);
|
|
|
|
void gst_props_add_entry (GstProps *props, GstPropsEntry *entry);
|
2003-02-02 19:58:11 +00:00
|
|
|
void gst_props_remove_entry (GstProps *props, GstPropsEntry *entry);
|
|
|
|
void gst_props_remove_entry_by_name (GstProps *props, const gchar *name);
|
2001-03-18 02:42:30 +00:00
|
|
|
|
2002-03-30 17:05:03 +00:00
|
|
|
/* working with props entries */
|
2003-03-16 20:06:02 +00:00
|
|
|
GType gst_props_entry_get_type (void);
|
2002-05-01 19:38:58 +00:00
|
|
|
GstPropsEntry* gst_props_entry_new (const gchar *name, ...);
|
|
|
|
|
2003-01-03 23:34:43 +00:00
|
|
|
void gst_props_entry_destroy (GstPropsEntry *entry);
|
2003-02-02 19:58:11 +00:00
|
|
|
GstPropsEntry* gst_props_entry_copy (const GstPropsEntry *entry);
|
2003-03-16 20:06:02 +00:00
|
|
|
GstPropsType gst_props_entry_get_props_type (const GstPropsEntry *entry);
|
2002-03-30 17:05:03 +00:00
|
|
|
const gchar* gst_props_entry_get_name (const GstPropsEntry *entry);
|
|
|
|
gboolean gst_props_entry_is_fixed (const GstPropsEntry *entry);
|
|
|
|
|
2002-03-31 14:04:50 +00:00
|
|
|
gboolean gst_props_entry_get (const GstPropsEntry *entry, ...);
|
2002-03-30 17:05:03 +00:00
|
|
|
|
|
|
|
gboolean gst_props_entry_get_int (const GstPropsEntry *entry, gint *val);
|
|
|
|
gboolean gst_props_entry_get_float (const GstPropsEntry *entry, gfloat *val);
|
|
|
|
gboolean gst_props_entry_get_fourcc_int (const GstPropsEntry *entry, guint32 *val);
|
|
|
|
gboolean gst_props_entry_get_boolean (const GstPropsEntry *entry, gboolean *val);
|
|
|
|
gboolean gst_props_entry_get_string (const GstPropsEntry *entry, const gchar **val);
|
|
|
|
gboolean gst_props_entry_get_int_range (const GstPropsEntry *entry, gint *min, gint *max);
|
|
|
|
gboolean gst_props_entry_get_float_range (const GstPropsEntry *entry, gfloat *min, gfloat *max);
|
|
|
|
gboolean gst_props_entry_get_list (const GstPropsEntry *entry, const GList **val);
|
2002-01-13 22:22:42 +00:00
|
|
|
|
2003-05-17 00:47:01 +00:00
|
|
|
/* for debugging purposes */
|
|
|
|
gchar * gst_props_to_string (GstProps *props);
|
|
|
|
GstProps * gst_props_from_string (gchar *str);
|
2001-03-18 02:42:30 +00:00
|
|
|
|
2001-10-17 10:21:27 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE
|
2002-03-30 17:05:03 +00:00
|
|
|
xmlNodePtr gst_props_save_thyself (GstProps *props, xmlNodePtr parent);
|
|
|
|
GstProps* gst_props_load_thyself (xmlNodePtr parent);
|
2001-10-17 10:21:27 +00:00
|
|
|
#endif
|
2000-12-11 00:04:25 +00:00
|
|
|
|
2002-03-30 17:05:03 +00:00
|
|
|
|
2002-07-08 19:07:30 +00:00
|
|
|
G_END_DECLS
|
2002-03-30 17:05:03 +00:00
|
|
|
|
2000-12-07 18:37:56 +00:00
|
|
|
#endif /* __GST_PROPS_H__ */
|