2000-12-28 22:13:35 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
|
|
|
* gstcaps.h: Header for caps subsystem
|
2000-12-03 17:51:29 +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_CAPS_H__
|
|
|
|
#define __GST_CAPS_H__
|
|
|
|
|
2001-10-17 10:21:27 +00:00
|
|
|
#include <gst/gstconfig.h>
|
2001-01-18 11:16:53 +00:00
|
|
|
|
2000-12-07 18:37:56 +00:00
|
|
|
#include <gst/gstprops.h>
|
2000-12-03 17:51:29 +00:00
|
|
|
|
2002-04-06 18:59:39 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2000-12-03 17:51:29 +00:00
|
|
|
typedef struct _GstCaps GstCaps;
|
2000-12-11 00:04:25 +00:00
|
|
|
|
2002-03-30 17:05:03 +00:00
|
|
|
extern GType _gst_caps_type;
|
|
|
|
|
|
|
|
#define GST_TYPE_CAPS (_get_caps_type)
|
|
|
|
|
|
|
|
|
2001-03-24 17:22:03 +00:00
|
|
|
#define GST_CAPS(caps) \
|
|
|
|
((GstCaps *)(caps))
|
|
|
|
|
2002-01-13 22:22:42 +00:00
|
|
|
#define GST_CAPS_IS_FIXED(caps) ((caps)->fixed)
|
|
|
|
#define GST_CAPS_IS_CHAINED(caps) ((caps)->next)
|
|
|
|
|
2002-04-12 09:38:47 +00:00
|
|
|
/* 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 */
|
2000-12-03 17:51:29 +00:00
|
|
|
struct _GstCaps {
|
2002-01-13 22:22:42 +00:00
|
|
|
gchar *name; /* the name of this caps */
|
2002-04-12 09:38:47 +00:00
|
|
|
guint16 id; /* type id (major type) representing
|
|
|
|
the mime type */
|
2000-12-03 17:51:29 +00:00
|
|
|
|
2002-01-13 22:22:42 +00:00
|
|
|
guint refcount;
|
|
|
|
gboolean fixed; /* this caps doesn't contain variable properties */
|
2001-03-20 18:29:00 +00:00
|
|
|
|
2002-01-13 22:22:42 +00:00
|
|
|
GstProps *properties; /* properties for this capability */
|
2001-03-12 21:02:12 +00:00
|
|
|
|
2002-04-12 09:38:47 +00:00
|
|
|
GstCaps *next; /* not with a GList for efficiency */
|
2000-12-03 17:51:29 +00:00
|
|
|
};
|
|
|
|
|
2002-04-12 09:38:47 +00:00
|
|
|
/* factory macros which make it easier for plugins to instantiate */
|
|
|
|
|
2001-04-16 21:45:02 +00:00
|
|
|
#define GST_CAPS_NEW(name, type, a...) \
|
|
|
|
gst_caps_new ( \
|
|
|
|
name, \
|
|
|
|
type, \
|
|
|
|
gst_props_new ( \
|
2001-04-22 16:04:19 +00:00
|
|
|
a, \
|
2001-04-16 21:45:02 +00:00
|
|
|
NULL))
|
|
|
|
|
|
|
|
#define GST_CAPS_FACTORY(factoryname, a...) \
|
|
|
|
static GstCaps* \
|
|
|
|
factoryname (void) \
|
|
|
|
{ \
|
|
|
|
static GstCaps *caps = NULL; \
|
|
|
|
if (!caps) { \
|
2001-04-22 04:38:36 +00:00
|
|
|
caps = gst_caps_chain (a, NULL); \
|
2001-04-16 21:45:02 +00:00
|
|
|
} \
|
|
|
|
return caps; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GST_CAPS_GET(fact) (fact)()
|
|
|
|
|
|
|
|
|
2000-12-03 17:51:29 +00:00
|
|
|
/* initialize the subsystem */
|
2001-03-07 21:52:56 +00:00
|
|
|
void _gst_caps_initialize (void);
|
2000-12-03 17:51:29 +00:00
|
|
|
|
2001-04-14 18:56:37 +00:00
|
|
|
GstCaps* gst_caps_new (const gchar *name, const gchar *mime, GstProps *props);
|
2002-01-13 22:22:42 +00:00
|
|
|
GstCaps* gst_caps_new_id (const gchar *name, const guint16 id, GstProps *props);
|
2000-12-03 17:51:29 +00:00
|
|
|
|
2001-04-16 21:45:02 +00:00
|
|
|
GstCaps* gst_caps_unref (GstCaps *caps);
|
|
|
|
GstCaps* gst_caps_ref (GstCaps *caps);
|
2001-03-20 18:29:00 +00:00
|
|
|
void gst_caps_destroy (GstCaps *caps);
|
|
|
|
|
2002-03-03 00:44:41 +00:00
|
|
|
void gst_caps_debug (GstCaps *caps, const gchar *label);
|
2002-01-13 22:22:42 +00:00
|
|
|
|
2001-03-20 18:29:00 +00:00
|
|
|
GstCaps* gst_caps_copy (GstCaps *caps);
|
2002-06-12 22:26:36 +00:00
|
|
|
GstCaps* gst_caps_copy_1 (GstCaps *caps);
|
2001-03-20 18:29:00 +00:00
|
|
|
GstCaps* gst_caps_copy_on_write (GstCaps *caps);
|
|
|
|
|
2001-01-06 02:35:17 +00:00
|
|
|
const gchar* gst_caps_get_name (GstCaps *caps);
|
2001-03-07 21:52:56 +00:00
|
|
|
void gst_caps_set_name (GstCaps *caps, const gchar *name);
|
2001-01-06 02:35:17 +00:00
|
|
|
|
|
|
|
const gchar* gst_caps_get_mime (GstCaps *caps);
|
2001-03-07 21:52:56 +00:00
|
|
|
void gst_caps_set_mime (GstCaps *caps, const gchar *mime);
|
2001-01-06 02:35:17 +00:00
|
|
|
|
2001-03-07 21:52:56 +00:00
|
|
|
guint16 gst_caps_get_type_id (GstCaps *caps);
|
|
|
|
void gst_caps_set_type_id (GstCaps *caps, guint16 type_id);
|
2001-01-06 02:35:17 +00:00
|
|
|
|
2000-12-31 16:12:48 +00:00
|
|
|
GstCaps* gst_caps_set_props (GstCaps *caps, GstProps *props);
|
|
|
|
GstProps* gst_caps_get_props (GstCaps *caps);
|
2000-12-19 16:36:10 +00:00
|
|
|
|
2002-05-03 09:34:07 +00:00
|
|
|
#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)
|
2001-03-18 02:42:30 +00:00
|
|
|
|
2002-03-30 17:05:03 +00:00
|
|
|
#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)
|
2002-01-20 11:55:35 +00:00
|
|
|
|
2002-01-13 22:22:42 +00:00
|
|
|
#define gst_caps_has_property(caps, name) gst_props_has_property ((caps)->properties, name)
|
2002-06-04 21:01:58 +00:00
|
|
|
#define gst_caps_has_property_typed(caps, name, type) gst_props_has_property_typed ((caps)->properties, name, type)
|
2002-01-20 11:55:35 +00:00
|
|
|
#define gst_caps_has_fixed_property(caps, name) gst_props_has_fixed_property ((caps)->properties, name)
|
2001-03-18 02:42:30 +00:00
|
|
|
|
2001-03-12 21:02:12 +00:00
|
|
|
GstCaps* gst_caps_get_by_name (GstCaps *caps, const gchar *name);
|
|
|
|
|
2001-04-16 21:45:02 +00:00
|
|
|
GstCaps* gst_caps_chain (GstCaps *caps, ...);
|
2001-03-12 21:02:12 +00:00
|
|
|
GstCaps* gst_caps_append (GstCaps *caps, GstCaps *capstoadd);
|
|
|
|
GstCaps* gst_caps_prepend (GstCaps *caps, GstCaps *capstoadd);
|
|
|
|
|
2001-03-07 21:52:56 +00:00
|
|
|
gboolean gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps);
|
2002-01-13 22:22:42 +00:00
|
|
|
GstCaps* gst_caps_intersect (GstCaps *caps1, GstCaps *caps2);
|
|
|
|
GstCaps* gst_caps_normalize (GstCaps *caps);
|
2000-12-03 17:51:29 +00:00
|
|
|
|
2001-10-17 10:21:27 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE
|
2001-03-07 21:52:56 +00:00
|
|
|
xmlNodePtr gst_caps_save_thyself (GstCaps *caps, xmlNodePtr parent);
|
|
|
|
GstCaps* gst_caps_load_thyself (xmlNodePtr parent);
|
2001-10-17 10:21:27 +00:00
|
|
|
#endif
|
2000-12-11 00:04:25 +00:00
|
|
|
|
2002-04-06 18:59:39 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2000-12-03 17:51:29 +00:00
|
|
|
#endif /* __GST_CAPS_H__ */
|