2002-01-15 00:41:22 +00:00
|
|
|
<!-- ##### SECTION Title ##### -->
|
|
|
|
GstCaps
|
|
|
|
|
|
|
|
<!-- ##### SECTION Short_Description ##### -->
|
|
|
|
Capabilities of pads
|
|
|
|
|
|
|
|
<!-- ##### SECTION Long_Description ##### -->
|
|
|
|
<para>
|
|
|
|
GstCaps is used to attach capabilities to a pad. Capabilities are made of
|
|
|
|
a mime-type and a set of properties. GstCaps can be named and chained into
|
|
|
|
a list, which is then a GstCaps on its own.
|
|
|
|
</para>
|
|
|
|
<para>
|
2004-02-11 20:16:33 +00:00
|
|
|
GstCaps are created with gst_caps_new_simpl(), which takes a mime type and
|
|
|
|
a list of arguments in sets of 3, terminated with NULL. Each set of 3
|
|
|
|
arguments is the name of a field, the GType of the field, and the value
|
|
|
|
of the field. The following example shows how to create a GstCaps.
|
2002-01-15 00:41:22 +00:00
|
|
|
<programlisting>
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
caps = gst_caps_new (
|
2004-02-11 20:16:33 +00:00
|
|
|
"audio/x-raw-int", /* mime type */
|
|
|
|
"channels", G_TYPE_INT, 5,
|
|
|
|
NULL);
|
2002-01-15 00:41:22 +00:00
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
The following code example is equivalent to the above example:
|
|
|
|
<programlisting>
|
|
|
|
GstCaps *caps;
|
|
|
|
|
2004-02-11 20:16:33 +00:00
|
|
|
caps = gst_caps_from_string ("audio/x-raw-int, channels = (int) 5");
|
2002-01-15 00:41:22 +00:00
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
GstCaps are refcounted with gst_caps_ref() and gst_caps_unref().
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
GstCaps can be chained with the gst_caps_append(), gst_caps_prepend() and
|
|
|
|
gst_caps_chain() functions. Use gst_caps_get_by_name() to get a named caps
|
|
|
|
structure from a chained list.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
To get the properties of a caps structure the functions
|
|
|
|
gst_caps_get_boolean(), gst_caps_get_fourcc_int(), gst_caps_get_int(),
|
|
|
|
gst_caps_get_string(), gst_caps_get_float(), which all take a property name as an argument.
|
|
|
|
</para>
|
|
|
|
<para>
|
2004-02-11 20:16:33 +00:00
|
|
|
The fields of the caps structure can be modified with gst_caps_set_simple,
|
|
|
|
which takes the caps structure to be modified, a list of arguments in
|
|
|
|
sets of 3, terminated by NULL. The format of these arguments is the
|
|
|
|
same as above.
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
<programlisting>
|
|
|
|
GstCaps *caps;
|
|
|
|
....
|
|
|
|
|
2004-02-11 20:16:33 +00:00
|
|
|
gst_caps_set_simple (caps, "channels", G_TYPE_INT, 20, NULL);
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
before modifying a GstCaps, it is a good idea to make a copy if it first with
|
|
|
|
gst_caps_copy_on_write(). This will copy the GstCaps if the refcount is >1.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
If you need a unique instance of a GstCaps you can use the convenient
|
|
|
|
GST_CAPS_FACTORY() macro as shown below.
|
|
|
|
<programlisting>
|
2004-02-11 20:16:33 +00:00
|
|
|
GstStaticCaps my_caps = GST_STATIC_CAPS (
|
|
|
|
"audio/x-raw-float, "
|
|
|
|
"channels = (int) 5; "
|
|
|
|
"audio/x-raw-int, "
|
|
|
|
"channels = (int) 5"
|
2002-01-15 00:41:22 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
void
|
|
|
|
some_function (void)
|
|
|
|
{
|
2004-02-11 20:16:33 +00:00
|
|
|
GstCaps *caps = gst_caps_copy (gst_static_caps_get (&my_caps));
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
...
|
|
|
|
}
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
2002-10-01 22:17:58 +00:00
|
|
|
<para>
|
2003-01-24 18:08:39 +00:00
|
|
|
If you want to check if a link between source and destination caps
|
2002-10-01 22:17:58 +00:00
|
|
|
is always possible, use gst_caps_is_always_compatible(), which returns
|
|
|
|
a boolean.
|
2003-01-24 18:08:39 +00:00
|
|
|
If you want to check if a link between source and destination caps
|
2002-10-01 22:17:58 +00:00
|
|
|
might be possible, use gst_caps_intersect(), which returns an intersection
|
|
|
|
of the capabilities.
|
|
|
|
</para>
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
<!-- ##### SECTION See_Also ##### -->
|
|
|
|
<para>
|
2004-02-11 20:16:33 +00:00
|
|
|
#GstStructure, #GstPad
|
2002-01-15 00:41:22 +00:00
|
|
|
</para>
|
|
|
|
|
2002-03-31 14:00:33 +00:00
|
|
|
<!-- ##### MACRO GST_TYPE_CAPS ##### -->
|
2002-01-15 00:41:22 +00:00
|
|
|
<para>
|
2002-03-31 14:00:33 +00:00
|
|
|
The GType of the caps boxed type, for use in GValues.
|
2002-01-15 00:41:22 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-02-10 23:01:55 +00:00
|
|
|
<!-- ##### STRUCT GstCaps ##### -->
|
|
|
|
<para>
|
|
|
|
The gstcaps structure
|
|
|
|
</para>
|
|
|
|
|
2004-01-07 16:32:24 +00:00
|
|
|
@type:
|
2003-02-10 23:01:55 +00:00
|
|
|
@flags:
|
2004-01-07 16:32:24 +00:00
|
|
|
@structs:
|
2004-03-15 23:11:36 +00:00
|
|
|
@_gst_reserved:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
<!-- ##### FUNCTION gst_caps_copy ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@caps:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2002-06-12 22:27:18 +00:00
|
|
|
<!-- ##### FUNCTION gst_caps_copy_1 ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@caps:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2002-01-15 00:41:22 +00:00
|
|
|
<!-- ##### FUNCTION gst_caps_append ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2004-01-07 16:32:24 +00:00
|
|
|
@caps1:
|
|
|
|
@caps2:
|
|
|
|
<!-- # Unused Parameters # -->
|
2002-01-15 00:41:22 +00:00
|
|
|
@caps:
|
|
|
|
@capstoadd:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2003-02-10 23:01:55 +00:00
|
|
|
<!-- ##### FUNCTION gst_caps_replace ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2004-01-07 16:32:24 +00:00
|
|
|
@caps:
|
2003-02-10 23:01:55 +00:00
|
|
|
@newcaps:
|
2004-01-07 16:32:24 +00:00
|
|
|
<!-- # Unused Parameters # -->
|
2003-02-10 23:01:55 +00:00
|
|
|
@oldcaps:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
|
2002-10-01 22:17:58 +00:00
|
|
|
<!-- ##### FUNCTION gst_caps_is_always_compatible ##### -->
|
2002-01-15 00:41:22 +00:00
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2004-01-07 16:32:24 +00:00
|
|
|
@caps1:
|
|
|
|
@caps2:
|
|
|
|
@Returns:
|
|
|
|
<!-- # Unused Parameters # -->
|
2002-01-15 00:41:22 +00:00
|
|
|
@fromcaps:
|
|
|
|
@tocaps:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gst_caps_normalize ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@caps:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gst_caps_intersect ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@caps1:
|
|
|
|
@caps2:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gst_caps_save_thyself ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@caps:
|
|
|
|
@parent:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION gst_caps_load_thyself ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@parent:
|
|
|
|
@Returns:
|
|
|
|
|
|
|
|
|
2004-01-07 16:32:24 +00:00
|
|
|
<!-- ##### FUNCTION gst_caps_union ##### -->
|
2002-01-15 00:41:22 +00:00
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2004-01-07 16:32:24 +00:00
|
|
|
@caps1:
|
|
|
|
@caps2:
|
|
|
|
@Returns:
|
2002-01-15 00:41:22 +00:00
|
|
|
|
|
|
|
|