GstCaps
Capabilities of pads
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.
GstCaps are created with gst_caps_new(), which takes a name, a mime type and
a pointer to a #GstProps. A convenience macro with a cleaner syntax is
available to create a caps with GST_CAPS_NEW(). The following example shows how
to create a GstCaps.
GstCaps *caps;
caps = gst_caps_new (
"my_caps", /* capability name */
"audio/raw", /* mime type */
gst_props_new ( /* properties */
"format", GST_PROPS_STRING ("float"),
"layout", GST_PROPS_INT (5),
NULL));
The following code example is equivalent to the above example:
GstCaps *caps;
caps = GST_CAPS_NEW (
"my_caps", /* capability name */
"audio/raw", /* mime type */
"format", GST_PROPS_STRING ("float"),
"channels", GST_PROPS_INT (5)
);
GstCaps are refcounted with gst_caps_ref() and gst_caps_unref().
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.
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.
The properties of the caps structure can be modified with gst_caps_set, which
takes a list of key value pairs in the #GstProps syntax as shown by this example:
GstCaps *caps;
....
gst_caps_set (caps, "format", GST_PROPS_STRING ("int"), NULL);
gst_caps_set (caps, "channels", GST_PROPS_INT (20), NULL);
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.
If you need a unique instance of a GstCaps you can use the convenient
GST_CAPS_FACTORY() macro as shown below.
GST_CAPS_FACTORY (my_caps,
GST_CAPS_NEW (
"caps1",
"audio/raw",
"format", GST_PROPS_STRING ("float"),
"channels", GST_PROPS_INT (5)
),
GST_CAPS_NEW (
"caps2",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"channels", GST_PROPS_INT (5)
)
)
void
some_function (void)
{
GstCaps *caps = GST_CAPS_GET (my_caps);
...
}
#GstProps, #GstPad
Lock the caps structure
@caps: The caps structure to lock
Try to lock the caps structure
@caps: The caps structure to try to lock
Unlock the caps structure
@caps: The caps structure to unlock
A convenience macro to create a new GstCaps structure.
@name: the name of the caps structure
@type: the mime type of the caps structure
@a...: the properties of this caps stucture.
A convenience macro to create a GstCaps factory.
@factoryname: the name of the factory
@a...: the caps to create with this factory, usualy specified
with GST_CAPS_NEW()
A convenience macro to get a GstCaps from the given capsfactory.
@fact: the factory to use.
@caps:
@caps:
@name: the name of the capability, for the application
@id: the typeid of the capability
@refcount: a refcounter for this caps structure
@lock: the lock for this caps structure
@fixed:
@properties: the properties of the capability
@next: a pointer to the next caps.
@name:
@mime:
@props:
@Returns:
@name:
@id:
@props:
@Returns:
@caps:
@caps:
@Returns:
@caps:
@Returns:
@caps:
@Returns:
@caps:
@Returns:
@caps:
@Varargs:
@Returns:
@caps:
@capstoadd:
@Returns:
@caps:
@capstoadd:
@Returns:
@caps:
@name:
@caps:
@Returns:
@caps:
@type_id:
@Param2:
@typeid:
@caps:
@Returns:
@caps:
@mime:
@caps:
@Returns:
@caps:
@props:
@Returns:
@caps:
@Returns:
@fromcaps:
@tocaps:
@Returns:
@caps:
@name:
@caps:
@Returns:
Set a property of a caps structure.
@caps: the caps structure to modify
@name: the name of the property to change
@args...: the new value of the property
@caps1:
@caps2:
@Returns:
Get the value of the named property as a boolean.
@caps: the caps to query
@name: the name of the property to get
@caps:
@name:
@Returns:
Get the value of the named property as a fourcc.
@caps: the caps to query
@name: the name of the property to get
Get the value of the named property as an int.
@caps: the caps to query
@name: the name of the property to get
Get the value of the named property as a string.
@caps: the caps to query
@name: the name of the property to get
Get the value of the named property as a float.
@caps: the caps to query
@name: the name of the property to get
@caps:
@parent:
@Returns:
@parent:
@Returns:
@caps: