gst.caps

Module for [Caps] class

class Caps

Types 1

Caps (capabilities) are lightweight refcounted objects describing media types. They are composed of an array of #GstStructure.

Caps are exposed on #GstPadTemplate to describe all possible types a given pad can handle. They are also stored in the #GstRegistry along with a description of the #GstElement.

Caps are exposed on the element pads using the [gst.pad.Pad.queryCaps] pad function. This function describes the possible types that the pad can handle or produce at runtime.

A #GstCaps 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 #GstCaps is fixed when it has no fields with ranges or lists. Use [gst.caps.Caps.isFixed] 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 #GstCaps / #GstStructure serialization into string had limited support for nested #GstCaps / #GstStructure fields. It could only support one level of nesting. Using more levels would lead to unexpected behavior when using serialization features, such as [gst.caps.Caps.toString_] or [gst.global.valueSerialize] and their counterparts.

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup)
GType _gType() @property
Caps self()Returns `this`, for use in `with` statements.
gst.mini_object.MiniObject miniObject() @propertyGet `miniObject` field. Returns: the parent type
gst.caps.Caps newAny()Creates a new #GstCaps that indicates that it is compatible with any media format. Returns: the new #GstCaps
gst.caps.Caps newEmpty()Creates a new #GstCaps that is empty. That is, the returned #GstCaps contains no media formats. The #GstCaps is guaranteed to be writable. Returns: the new #GstCaps
gst.caps.Caps newEmptySimple(string mediaType)Creates a new #GstCaps that contains one #GstStructure with name media_type.
void append(gst.caps.Caps caps2)Appends the structures contained in caps2 to caps1. The structures in caps2 are not copied -- they are transferred to caps1, and then caps2 is freed. If either caps is ANY, the resulting caps will ...
void appendStructure(gst.structure.Structure structure)Appends structure to caps. The structure is not copied; caps becomes the owner of structure.
void appendStructureFull(gst.structure.Structure structure, gst.caps_features.CapsFeatures features = null)Appends structure with features to caps. The structure is not copied; caps becomes the owner of structure.
bool canIntersect(gst.caps.Caps caps2)Tries intersecting caps1 and caps2 and reports whether the result would not be empty
gst.caps.Caps copy()Creates a new #GstCaps as a copy of the old caps. The new caps will have a refcount of 1, owned by the caller. The structures are copied as well.
gst.caps.Caps copyNth(uint nth)Creates a new #GstCaps and appends a copy of the nth structure contained in caps.
void filterAndMapInPlace(gst.types.CapsFilterMapFunc func)Calls the provided function once for each structure and caps feature in the #GstCaps. In contrast to [gst.caps.Caps.foreach_], the function may modify the structure and features. In contrast to [gs...
gst.caps.Caps fixate()Modifies the given caps into a representation with only fixed values. First the caps will be truncated and then the first structure will be fixated with [gst.structure.Structure.fixate].
bool foreach_(gst.types.CapsForeachFunc func)Calls the provided function once for each structure and caps feature in the #GstCaps. The function must not modify the fields. Also see [gst.caps.Caps.mapInPlace] and [gst.caps.Caps.filterAndMapInP...
gst.caps_features.CapsFeatures getFeatures(uint index)Finds the features in caps at index, and returns it.
uint getSize()Gets the number of structures contained in caps. Returns: the number of structures that caps contains
gst.structure.Structure getStructure(uint index)Finds the structure in caps at index, and returns it.
gst.caps.Caps intersect(gst.caps.Caps caps2)Creates a new #GstCaps that contains all the formats that are common to both caps1 and caps2. Defaults to [gst.types.CapsIntersectMode.ZigZag] mode.
gst.caps.Caps intersectFull(gst.caps.Caps caps2, gst.types.CapsIntersectMode mode)Creates a new #GstCaps that contains all the formats that are common to both caps1 and caps2, the order is defined by the #GstCapsIntersectMode used.
bool isAlwaysCompatible(gst.caps.Caps caps2)A given #GstCaps structure is always compatible with another if every media format that is in the first is also contained in the second. That is, caps1 is a subset of caps2.
bool isAny()Determines if caps represents any media format. Returns: true if caps represents any format.
bool isEmpty()Determines if caps represents no media formats. Returns: true if caps represents no formats.
bool isEqual(gst.caps.Caps caps2)Checks if the given caps represent the same set of caps.
bool isEqualFixed(gst.caps.Caps caps2)Tests if two #GstCaps are equal. This function only works on fixed #GstCaps.
bool isFixed()Fixed #GstCaps describe exactly one format, that is, they have exactly one structure, and each field in the structure describes a fixed type. Examples of non-fixed types are GSTTYPEINTRANGE and GST...
bool isStrictlyEqual(gst.caps.Caps caps2)Checks if the given caps are exactly the same set of caps.
bool isSubset(gst.caps.Caps superset)Checks if all caps represented by subset are also represented by superset.
bool isSubsetStructure(gst.structure.Structure structure)Checks if structure is a subset of caps. See [gst.caps.Caps.isSubset] for more information.
bool isSubsetStructureFull(gst.structure.Structure structure, gst.caps_features.CapsFeatures features = null)Checks if structure is a subset of caps. See [gst.caps.Caps.isSubset] for more information.
bool mapInPlace(gst.types.CapsMapFunc func)Calls the provided function once for each structure and caps feature in the #GstCaps. In contrast to [gst.caps.Caps.foreach_], the function may modify but not delete the structures and features. Th...
gst.caps.Caps merge(gst.caps.Caps caps2)Appends the structures contained in caps2 to caps1 if they are not yet expressed by caps1. The structures in caps2 are not copied -- they are transferred to a writable copy of caps1, and then caps2...
gst.caps.Caps mergeStructure(gst.structure.Structure structure)Appends structure to caps if it is not already expressed by caps.
gst.caps.Caps mergeStructureFull(gst.structure.Structure structure, gst.caps_features.CapsFeatures features = null)Appends structure with features to caps if its not already expressed by caps.
gst.caps.Caps normalize()Returns a #GstCaps that represents the same set of formats as caps, but contains no lists. Each list is expanded into separate #GstStructure.
void removeStructure(uint idx)Removes the structure with the given index from the list of structures contained in caps.
string serialize(gst.types.SerializeFlags flags)Converts caps to a string representation. This string representation can be converted back to a #GstCaps by [gst.caps.Caps.fromString].
void setFeatures(uint index, gst.caps_features.CapsFeatures features = null)Sets the features for the structure at index.
void setFeaturesSimple(gst.caps_features.CapsFeatures features = null)Sets the features for all the structures of caps.
void setValue(string field, gobject.value.Value value)Sets the given field on all structures of caps to the given value. This is a convenience function for calling [gst.structure.Structure.setValue] on all structures of caps.
gst.caps.Caps simplify()Converts the given caps into a representation that represents the same set of formats, but in a simpler form. Component structures that are identical are merged. Component structures that have va...
gst.structure.Structure stealStructure(uint index)Retrieves the structure with the given index from the list of structures contained in caps. The caller becomes the owner of the returned structure.
gst.caps.Caps subtract(gst.caps.Caps subtrahend)Subtracts the subtrahend from the minuend. > This function does not work reliably if optional properties for caps > are included on one caps and omitted on the other.
string toString_()Converts caps to a string representation. This string representation can be converted back to a #GstCaps by [gst.caps.Caps.fromString].
gst.caps.Caps truncate()Discards all but the first structure from caps. Useful when fixating.
gst.caps.Caps fromString(string string_)Converts caps from a string representation.
Constructors
this()Create a `caps.Caps` boxed type.
this(void * ptr, Flag!"Take" take)