Caps (capabilities) are lighweight 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 get_caps pad function. This function describes the possible types that the pad can handle or produce at runtime. Caps are also attached to buffers to describe to content of the data pointed to by the buffer with set_caps. Caps attached to a Buffer allow for format negotiation upstream and downstream. A Caps can be constructed with the following code fragment:
Creating caps:
GstCaps *caps;
caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
"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 properties with ranges or lists. Use is_fixed to test for fixed caps. Only fixed caps can be set on a Pad or Buffer. Various methods exist to work with the media types such as subtracting or intersecting. Last reviewed on 2007-02-13 (0.10.10)
caps from a string representation.
newcaps. Unrefs the Caps in
the location pointed to by caps, if applicable, then modifies caps to point to This function does not take
any locks so you might want to lock the object owning caps pointer.
caps2 to caps1. The structures in freed.
If either caps is ANY, the resulting caps will be ANY.
structure to caps. The structure is not copied; caps
becomes the owner of structure.
caps1 and caps2 and reports whether the result would not be
empty
caps. The
new caps will have a refcount of 1, owned by the caller. The structures are copied as well. Note that this function is the semantic
equivalent of a ref followed by a
make_writable. If you only want to hold on to a reference to the data, you should use
ref. When you are finished with the caps, call
unref on it.
caps.
caps inplace 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 values that can be
merged are also merged.
caps.
caps that has the index index, and returns it.
non-const GstStructure *. This is for programming convenience -- the caller should be aware that structures inside a constant
Caps should not be modified. However, if you know the caps are writable, either because you
have just copied them or made them writable with make_writable, you may
modify the structure returned in the usual way, e.g. with functions like set. You
do not need to free or unref the structure returned, it belongs to the Caps. to index
caps1 and caps2, the order is defined by the
CapsIntersectMode used.
caps1 is a subset of caps2
.
caps represents any media format.
caps represents no media formats.
subset are also represented by superset.
caps. If there is only one reference count on caps,
the caller must be the owner, and so this function will return the caps object unchanged. If on the other hand there is more than one
reference on the object, a new caps object will be returned. The caller's reference on caps will be removed, and instead
the caller will own a reference to the returned object. In short, this function unrefs the caps in the argument and refs the caps that
it returns. Don't access the argument after calling this function. See
caps2 to caps1 if they are not yet
expressed by 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 be ANY.
structure to caps if its not already expressed by caps.
The structure is not copied; caps becomes the owner of structure.
caps.
parent.
field on all structures of caps to the given value
. This is a convenience function for calling set_value on all structures of
caps.
caps.
The caller becomes the owner of the returned structure. to index.
subtrahend from the minuend.
caps to a string representation. This string representation can be converted back
to a Caps by from_string. For
debugging purposes its easier to do something like this:
caps. Useful when fixating.
caps must be writable.
caps1 and caps2.
