Caps (capabilities) are lightweight refcounted objects describing media types.
They are composed of an array of Structure.
Caps are exposed on PadTemplate to describe all possible types a given pad can handle.
They are also stored in the Registry along with a description of the
Element.
Caps are exposed on the element pads using the query_caps pad function. This
function describes the possible types that the pad can handle or produce at runtime.
A Caps can be constructed with the following code fragment:
``` C GstCaps *caps = gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING, "I420", "framerate", GST_TYPE_FRACTION, 25, 1,
"pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, "width", G_TYPE_INT, 320, "height", G_TYPE_INT, 240, NULL); ```
A Caps is fixed when it has no fields with ranges or lists. Use
is_fixed to test for fixed caps. Fixed caps can be used in a caps event to notify
downstream elements of the current media type.
Various methods exist to work with the media types such as subtracting or intersecting.
Be aware that until 1.20 the Caps / Structure serialization
into string had limited support for nested Caps / Structure
fields. It could only support one level of nesting. Using more levels would lead to unexpected behavior when using serialization
features, such as to_string or
serialize and their counterparts.
- public bool @foreach (CapsForeachFunc func)
Calls the provided function once for each structure and caps feature
in the Caps.
- public void append (owned Caps caps2)
Appends the structures contained in caps2
to
this.
- public void append_structure (owned Structure structure)
Appends structure
to this
.
- public void append_structure_full (owned Structure structure, owned CapsFeatures? features = null)
Appends structure
with features
to
this.
- public bool can_intersect (Caps caps2)
Tries intersecting this and
caps2
and reports whether the result would not be empty
- public Caps copy ()
Creates a new Caps as a copy of the old
this.
- public Caps copy_nth (uint nth)
Creates a new Caps and appends a copy of
the nth structure contained in this.
- public void filter_and_map_in_place (CapsFilterMapFunc func)
Calls the provided function once for each structure and caps feature
in the Caps.
- public Caps fixate ()
Modifies the given this into a
representation with only fixed values.
- public unowned CapsFeatures? get_features (uint index)
Finds the features in this at
index
, and returns it.
- public uint get_size ()
Gets the number of structures contained in
this.
- public unowned Structure get_structure (uint index)
Finds the structure in this at
index
, and returns it.
- public Caps intersect (Caps caps2, CapsIntersectMode mode = ZIG_ZAG)
Creates a new Caps that contains all the
formats that are common to both this and caps2
, the order is defined by the
CapsIntersectMode used.
- public bool is_always_compatible (Caps caps2)
A given Caps structure is always compatible
with another if every media format that is in the first is also contained in the second.
- public bool is_any ()
Determines if this represents any
media format.
- public bool is_empty ()
Determines if this represents no
media formats.
- public bool is_equal (Caps caps2)
Checks if the given caps represent the same set of caps.
- public bool is_equal_fixed (Caps caps2)
Tests if two Caps are equal.
- public bool is_fixed ()
Fixed Caps describe exactly one format,
that is, they have exactly one structure, and each field in the structure describes a fixed type.
- public bool is_strictly_equal (Caps caps2)
Checks if the given caps are exactly the same set of caps.
- public bool is_subset (Caps superset)
Checks if all caps represented by this
are also represented by superset
.
- public bool is_subset_structure (Structure structure)
Checks if structure
is a subset of
this.
- public bool is_subset_structure_full (Structure structure, CapsFeatures? features)
Checks if structure
is a subset of
this.
- public bool map_in_place (CapsMapFunc func)
Calls the provided function once for each structure and caps feature
in the Caps.
- public Caps merge (owned Caps caps2)
Appends the structures contained in caps2
to
this if they are not yet expressed by this.
- public Caps merge_structure (owned Structure structure)
Appends structure
to this
if it is not already expressed by this.
- public Caps merge_structure_full (owned Structure structure, owned CapsFeatures? features)
Appends structure
with features
to
this if its not already expressed by this.
- public Caps normalize ()
Returns a Caps that represents the same set
of formats as this, but contains no lists.
- public void remove_structure (uint idx)
Removes the structure with the given index from the list of structures
contained in this.
- public string serialize (SerializeFlags flags)
Converts this to a string
representation.
- public void set_features (uint index, owned CapsFeatures? features)
Sets the features
for the structure at index
.
- public void set_features_simple (owned CapsFeatures? features)
Sets the features
for all the structures of
this.
- public void set_simple (string field, ...)
Sets fields in a Caps.
- public void set_simple_valist (string field, va_list varargs)
Sets fields in a Caps.
- public void set_value (string field, Value value)
Sets the given field
on all structures of
this to the given value
.
- public Caps simplify ()
Converts the given this into a
representation that represents the same set of formats, but in a simpler form.
- public Structure? steal_structure (uint index)
Retrieves the structure with the given index from the list of
structures contained in this.
- public Caps subtract (Caps subtrahend)
Subtracts the subtrahend
from the
this.
- public string to_string ()
Converts this to a string
representation.
- public Caps truncate ()
Discards all but the first structure from
this.