#ifndef __GST_CAPS_H__
#define __GST_CAPS_H__
-#include <parser.h> // NOTE: this is xml-config's fault
-
-// Include compatability defines: if libxml hasn't already defined these,
-// we have an old version 1.x
-#ifndef xmlChildrenNode
-#define xmlChildrenNode childs
-#define xmlRootNode root
-#endif
-
#include <gst/gstprops.h>
+G_BEGIN_DECLS
+
typedef struct _GstCaps GstCaps;
+extern GType _gst_caps_type;
+
+#define GST_TYPE_CAPS (_gst_caps_type)
+
+
#define GST_CAPS(caps) \
((GstCaps *)(caps))
-#define GST_CAPS_LOCK(caps) (g_mutex_lock(GST_CAPS(caps)->lock))
-#define GST_CAPS_TRYLOCK(caps) (g_mutex_trylock(GST_CAPS(caps)->lock))
-#define GST_CAPS_UNLOCK(caps) (g_mutex_unlock(GST_CAPS(caps)->lock))
+#define GST_CAPS_IS_FIXED(caps) ((caps)->fixed)
+#define GST_CAPS_IS_CHAINED(caps) ((caps)->next)
+/* CR1: id is an int corresponding to the quark for the mime type because
+ * it's really fast when doing a first-pass check for caps compatibility */
struct _GstCaps {
- gchar *name; /* the name of this caps */
- guint16 id; /* type id (major type) */
+ gchar *name; /* the name of this caps */
+ guint16 id; /* type id (major type) representing
+ the mime type */
- guint refcount;
- GMutex *lock; /* global lock for this capability */
+ guint refcount;
+ gboolean fixed; /* this caps doesn't contain variable properties */
- GstProps *properties; /* properties for this capability */
+ GstProps *properties; /* properties for this capability */
- GstCaps *next;
+ GstCaps *next; /* not with a GList for efficiency */
};
+/* factory macros which make it easier for plugins to instantiate */
+
#define GST_CAPS_NEW(name, type, a...) \
gst_caps_new ( \
name, \
void _gst_caps_initialize (void);
GstCaps* gst_caps_new (const gchar *name, const gchar *mime, GstProps *props);
+GstCaps* gst_caps_new_id (const gchar *name, const guint16 id, GstProps *props);
GstCaps* gst_caps_unref (GstCaps *caps);
GstCaps* gst_caps_ref (GstCaps *caps);
void gst_caps_destroy (GstCaps *caps);
+void gst_caps_debug (GstCaps *caps, const gchar *label);
+
GstCaps* gst_caps_copy (GstCaps *caps);
+GstCaps* gst_caps_copy_1 (GstCaps *caps);
GstCaps* gst_caps_copy_on_write (GstCaps *caps);
const gchar* gst_caps_get_name (GstCaps *caps);
GstCaps* gst_caps_set_props (GstCaps *caps, GstProps *props);
GstProps* gst_caps_get_props (GstCaps *caps);
-#define gst_caps_set(caps, name, args...) gst_props_set ((caps)->properties, name, args)
+#define gst_caps_set(caps, name, args...) gst_props_set ((caps)->properties, name, ##args)
+#define gst_caps_get(caps, name, args...) gst_props_get ((caps)->properties, name, ##args)
-#define gst_caps_get_int(caps, name) gst_props_get_int ((caps)->properties, name)
-#define gst_caps_get_fourcc_int(caps, name) gst_props_get_fourcc_int ((caps)->properties, name)
-#define gst_caps_get_boolean(caps, name) gst_props_get_boolean ((caps)->properties, name)
-#define gst_caps_get_string(caps, name) gst_props_get_string ((caps)->properties, name)
+#define gst_caps_get_int(caps,name,res) gst_props_entry_get_int(gst_props_get_entry((caps)->properties,name),res)
+#define gst_caps_get_float(caps,name,res) gst_props_entry_get_float(gst_props_get_entry((caps)->properties,name),res)
+#define gst_caps_get_fourcc_int(caps,name,res) gst_props_entry_get_fourcc_int(gst_props_get_entry((caps)->properties,name),res)
+#define gst_caps_get_boolean(caps,name,res) gst_props_entry_get_boolean(gst_props_get_entry((caps)->properties,name),res)
+#define gst_caps_get_string(caps,name,res) gst_props_entry_get_string(gst_props_get_entry((caps)->properties,name),res)
+
+#define gst_caps_has_property(caps, name) gst_props_has_property ((caps)->properties, name)
+#define gst_caps_has_property_typed(caps, name, type) gst_props_has_property_typed ((caps)->properties, name, type)
+#define gst_caps_has_fixed_property(caps, name) gst_props_has_fixed_property ((caps)->properties, name)
GstCaps* gst_caps_get_by_name (GstCaps *caps, const gchar *name);
GstCaps* gst_caps_append (GstCaps *caps, GstCaps *capstoadd);
GstCaps* gst_caps_prepend (GstCaps *caps, GstCaps *capstoadd);
-gboolean gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps);
+gboolean gst_caps_is_always_compatible (GstCaps *fromcaps, GstCaps *tocaps);
+GstCaps* gst_caps_intersect (GstCaps *caps1, GstCaps *caps2);
+GstCaps* gst_caps_normalize (GstCaps *caps);
+#ifndef GST_DISABLE_LOADSAVE
xmlNodePtr gst_caps_save_thyself (GstCaps *caps, xmlNodePtr parent);
GstCaps* gst_caps_load_thyself (xmlNodePtr parent);
+#endif
+
+G_END_DECLS
#endif /* __GST_CAPS_H__ */