gstreamermm: Gst::Caps Class Reference

gstreamermm 1.10.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gst::Caps Class Reference

Structure describing sets of media formats. More...

`#include <gstreamermm/caps.h>`

Inheritance diagram for Gst::Caps:
[legend]

## Public Member Functions
void | reference () const
| Increment the reference count for this object. More...
void | unreference () const
| Decrement the reference count for this object. More...
GstCaps* | gobj ()
| Provides access to the underlying C instance. More...
const GstCaps* | gobj () const
| Provides access to the underlying C instance. More...
GstCaps* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
| Caps ()=delete
| Caps (const Caps&)=delete
Caps& | operator= (const Caps&)=delete
Glib::RefPtr< Gst::Caps > | copy_nth (guint nth) const
| Creates a new Gst::Caps and appends a copy of the nth structure contained in caps. More...
void | append (Glib::RefPtr< Gst::Caps >&& caps)
| Appends the structures contained in caps to caps1. More...
Glib::RefPtr< Gst::Caps > | merge (Glib::RefPtr< Gst::Caps >&& caps)
void | append_structure (const Structure& structure)
| Appends a structure to caps. More...
void | append_structure (Gst::Structure&& structure)
| Appends structure to caps. More...
void | append_structure (const Structure& structure, const CapsFeatures& features)
| Appends a structure to caps. More...
Glib::RefPtr< Gst::Caps > | merge_structure (const Structure& structure)
| Appends a structure to caps if its not already expressed by caps. More...
Glib::RefPtr< Gst::Caps > | merge_structure (const Structure& structure, const CapsFeatures& features)
| Appends a structure to caps if its not already expressed by caps. More...
const Structure | get_structure (guint idx) const
| Finds the structure in caps that has the index idx, and returns it. More...
void | remove_structure (guint idx)
| removes the structure with the given index from the list of structures contained in caps. More...
guint | size () const
| Gets the number of structures contained in caps. More...
Structure | steal_structure (guint index)
| Retrieves the structure with the given index from the list of structures contained in caps. More...
void | set_simple (const Glib::ustring& name, const Glib::ValueBase& value)
| Sets fields in a simple Gst::Caps. More...
template<class DataType , class ... DataTypes>
void | set_simple (const Glib::ustring& name, const DataType& data, DataTypes ...further_data)
| Sets fields in a simple Gst::Caps. More...
void | set_simple (const Glib::ustring& name, const char* data)
| Sets fields in a simple Gst::Caps. More...
void | set_value (const Glib::ustring& field, const Glib::ValueBase& value)
| Sets the given field on all structures of caps to the given value. More...
template<class DataType >
void | set_value (const Glib::ustring& name, const DataType& data)
| Sets the given field on all structures to the given value. More...
bool | is_any () const
| Determines if caps represents any media format. More...
bool | empty () const
| Determines if caps represents no media formats. More...
bool | is_fixed () const
| Fixed Gst::Caps describe exactly one format, that is, they have exactly one structure, and each field in the structure describes a fixed type. More...
bool | equals (const Glib::RefPtr< const Gst::Caps >& other_caps) const
| Checks if the given caps represent the same set of caps. More...
bool | equals_fixed (const Glib::RefPtr< const Gst::Caps >& other_caps) const
| Tests if two Gst::Caps are equal. More...
bool | is_always_compatible (const Glib::RefPtr< const Gst::Caps >& other_caps) const
| A given Gst::Caps structure is always compatible with another if every media format that is in the first is also contained in the second. More...
bool | is_subset (const Glib::RefPtr< const Gst::Caps >& superset_caps) const
| Checks if all caps represented by subset are also represented by superset_caps. More...
bool | can_intersect (const Glib::RefPtr< const Gst::Caps >& caps2) const
| Tries intersecting caps1 and caps2 and reports whether the result would not be empty. More...
Glib::RefPtr< Gst::Caps > | fixate () const
| Modifies the given caps into a representation with only fixed values. More...
bool | is_strictly_equal (const Glib::RefPtr< const Gst::Caps >& caps2) const
| Checks if the given caps are exactly the same set of caps. More...
Glib::RefPtr< Gst::Caps > | copy () const
| Creates a new Gst::Caps as a copy of the old caps. More...
bool | is_subset_structure (const Gst::Structure& structure) const
| Checks if structure is a subset of caps. More...
bool | is_subset_structure (const Gst::Structure& structure, const Gst::CapsFeatures& features) const
| Checks if structure is a subset of caps. More...
Glib::RefPtr< Gst::Caps > | get_intersect (const Glib::RefPtr< const Gst::Caps >& other_caps) const
| Creates a new Gst::Caps that contains all the formats that are common to both caps1 and other_caps. More...
Glib::RefPtr< Gst::Caps > | get_intersect (const Glib::RefPtr< const Gst::Caps >& other_caps, CapsIntersectMode p2) const
| Creates a new Gst::Caps that contains all the formats that are common to both caps1 and other_caps, the order is defined by the Gst::CapsIntersectMode used. More...
Glib::RefPtr< Gst::Caps > | get_normal () const
| Returns a Gst::Caps that represents the same set of formats as caps, but contains no lists. More...
Glib::RefPtr< Gst::Caps > | simplify ()
| Converts the given caps into a representation that represents the same set of formats, but in a simpler form. More...
Glib::ustring | to_string () const
| Converts caps to a string representation. More...
Glib::RefPtr< Gst::Caps > | get_difference (const Glib::RefPtr< const Gst::Caps >& subtrahend_caps) const
| Subtracts the subtrahend_caps from the minuend. More...
Glib::RefPtr< Gst::Caps > | create_writable ()
| Returns a writable copy of caps. More...
Glib::RefPtr< Gst::Caps > | truncate ()
| Discard all but the first structure from caps. More...
CapsFeatures | get_features (guint index) const
| Finds the features in caps that has the index index , and returns it. More...
void | set_features (guint index, const CapsFeatures& features)
| Sets the Gst::CapsFeatures for the structure at index. More...
Public Member Functions inherited from Gst::MiniObject
void | reference () const
| Increment the reference count for this object. More...
void | unreference () const
| Decrement the reference count for this object. More...
GstMiniObject* | gobj ()
| Provides access to the underlying C instance. More...
const GstMiniObject* | gobj () const
| Provides access to the underlying C instance. More...
GstMiniObject* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
| MiniObject ()=delete
| MiniObject (const MiniObject&)=delete
MiniObject& | operator= (const MiniObject&)=delete
| ~MiniObject ()
guint | get_flags () const
void | set_flags (const guint& value)
gint | get_refcount () const
gint | get_lockstate () const
bool | lock (LockFlags flags)
| Lock the mini-object with the specified access mode in flags. More...
void | unlock (LockFlags flags)
| Unlock the mini-object with the specified access mode in flags. More...
bool | is_writable () const
| If mini_object has the LOCKABLE flag set, check if the current EXCLUSIVE lock on object is the only one, this means that changes to the object will not be visible to any other object. More...
Glib::RefPtr< MiniObject > | create_writable ()
| Checks if a mini-object is writable. More...
void | set_qdata (GQuark quark, QuarkData* data)
| This sets an opaque, named pointer on a miniobject. More...
QuarkData* | get_qdata (GQuark quark) const
| This function gets back user data pointers stored via set_qdata(). More...
QuarkData* | steal_qdata (GQuark quark)
| This function gets back user data pointers stored via set_qdata() and removes the data from object without invoking its destroy() function (if any was set). More...
void | add_finalize_notifier (const SlotFinalizer& slot)
| Adds notifier when mini object is finalized. More...
void | remove_finalize_notifier ()
| Remove finalize notifier. More...

## Static Public Member Functions
static Glib::RefPtr< Caps > | create ()
template<class ... DataTypes>
static Glib::RefPtr< Gst::Caps > | create_simple (const Glib::ustring& media_type, DataTypes... further_data)
| Creates a new Gst::Caps that contains one Gst::Structure. More...
static Glib::RefPtr< Gst::Caps > | create (const Structure& first_struct)
| Creates a new Gst::Caps and adds the given Gst::Structure. More...
static Glib::RefPtr< Gst::Caps > | create_from_string (const Glib::ustring&string)
| Converts caps from a string representation. More...
static Glib::RefPtr< Gst::Caps > | create_any ()
| Creates a new Gst::Caps that indicates that it is compatible with any media format. More...

## Protected Member Functions
void | operator delete (void*, std::size_t)
Protected Member Functions inherited from Gst::MiniObject
void | operator delete (void*, std::size_t)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gst::Caps > | wrap (GstCaps* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gst::MiniObject
Glib::RefPtr< Gst::MiniObject > | wrap (GstMiniObject* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Gst::MiniObject
typedef sigc::slot< void > | SlotFinalizer

## Detailed Description

Structure describing sets of media formats.

Caps (capabilities) are lightweight refcounted objects describing media types.

They are composed of an array of Gst::Structure.

Caps are exposed on Gst::PadTemplate to describe all possible types a given pad can handle. They are also stored in the Gst::Registry along with a description of the Gst::Element.

Caps are exposed on the element pads using the Gst::Pad::query_caps() pad method. This function describes the possible types that the pad can handle or produce at runtime.

Glib::RefPtr<Gst::Caps> caps = Gst::Caps::create_simple("video/x-raw",
"format", Gst::Fourcc('I', '4', '2', '0'),
"framerate", Gst::Fraction(25, 1),
"pixel-aspect-ratio", Gst::Fraction(1, 1),
"width", 320,
"height", 240);

A Gst::Caps is fixed when it has no properties with ranges or lists. Use Gst::Caps::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 the current Gst::Caps / Gst::Structure serialization into string has limited support for nested Gst::Caps / Gst::Structure fields. It can only support one level of nesting. Using more levels will lead to unexpected behavior when using serialization features, such as Gst::Caps::to_string() or gst_value_serialize() and their counterparts.

Last reviewed on 2016-05-16 (1.8.0)

## Constructor & Destructor Documentation

## ◆ Caps() [1/2]

Gst::Caps::Caps | ( |  | ) |
| delete

## ◆ Caps() [2/2]

Gst::Caps::Caps | ( | const Caps& |  | ) |
| delete

## Member Function Documentation

## ◆ append()

void Gst::Caps::append | ( | Glib::RefPtr< Gst::Caps >&& | caps | ) |

Appends the structures contained in caps to caps1.

The structures in caps are not copied – they are transferred to caps1, and then caps is freed. If either caps is ANY, the resulting caps will be ANY.

Parameters

  caps | The Gst::Caps to append.

## ◆ append_structure() [1/3]

void Gst::Caps::append_structure | ( | const Structure& | structure | ) |

Appends a structure to caps.

Parameters

  structure | The Gst::Structure to append.

## ◆ append_structure() [2/3]

void Gst::Caps::append_structure | ( | Gst::Structure&& | structure | ) |

Appends structure to caps.

The structure is not copied; caps becomes the owner of structure.

Parameters

  structure | The Gst::Structure to append.

## ◆ append_structure() [3/3]

void Gst::Caps::append_structure | ( | const Structure& | structure,
|  | const CapsFeatures& | features
| ) |  |

Appends a structure to caps.

Parameters

  structure | The Gst::Structure to append.
  features | The Gst::CapsFeatures to append.

## ◆ can_intersect()

bool Gst::Caps::can_intersect | ( | const Glib::RefPtr< const Gst::Caps >& | caps2 | ) | const

Tries intersecting caps1 and caps2 and reports whether the result would not be empty.

Parameters

  caps2 | A Gst::Caps to intersect.

Returns
  `true` if intersection would be not empty.

## ◆ copy()

Glib::RefPtr<Gst::Caps> Gst::Caps::copy | ( |  | ) | const

Creates a new Gst::Caps 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.

Note that this function is the semantic equivalent of a ref() followed by a gst_caps_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.

Returns
  The new Gst::Caps.

## ◆ copy_nth()

Glib::RefPtr<Gst::Caps> Gst::Caps::copy_nth | ( | guint | nth | ) | const

Creates a new Gst::Caps and appends a copy of the nth structure contained in caps.

Parameters

  nth | The nth structure to copy.

Returns
  The new Gst::Caps.

## ◆ create() [1/2]

static Glib::RefPtr<Caps> Gst::Caps::create | ( |  | ) |
| static

## ◆ create() [2/2]

static Glib::RefPtr<Gst::Caps> Gst::Caps::create | ( | const Structure& | first_struct | ) |
| static

Creates a new Gst::Caps and adds the given Gst::Structure.

Use append_structure() to add additional structures.

Parameters

  first_struct | The first structure to add.

Returns
  Returns the new Gst::Caps.

## ◆ create_any()

static Glib::RefPtr<Gst::Caps> Gst::Caps::create_any | ( |  | ) |
| static

Creates a new Gst::Caps that indicates that it is compatible with any media format.

Returns
  The new Gst::Caps.

## ◆ create_from_string()

static Glib::RefPtr<Gst::Caps> Gst::Caps::create_from_string | ( | const Glib::ustring & | string | ) |
| static

Converts caps from a string representation.

The current implementation of serialization will lead to unexpected results when there are nested Gst::Caps / Gst::Structure deeper than one level.

Parameters

  string | A string to convert to Gst::Caps.

Returns
  A newly allocated Gst::Caps.

## ◆ create_simple()

template <class ... DataTypes>

static Glib::RefPtr<Gst::Caps> Gst::Caps::create_simple | ( | const Glib::ustring & | media_type,
|  | DataTypes... | further_data
| ) |  |
| static

Creates a new Gst::Caps that contains one Gst::Structure.

Parameters

  media_type | The media type of the structure.
  ...further_data | further data to set in format: name, data (data value can be any supported C++ type).

Returns
  The new Gst::Caps.

## ◆ create_writable()

Glib::RefPtr<Gst::Caps> Gst::Caps::create_writable | ( |  | ) |

Returns a writable copy of caps.

If there is only one reference count on Gst::Caps object , 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.

Returns
  A buffer (possibly the same pointer) that is writable.

## ◆ empty()

bool Gst::Caps::empty | ( |  | ) | const

Determines if caps represents no media formats.

Returns
  `true` if caps represents no formats.

## ◆ equals()

bool Gst::Caps::equals | ( | const Glib::RefPtr< const Gst::Caps >& | other_caps | ) | const

Checks if the given caps represent the same set of caps.

Parameters

  other_caps | Another Gst::Caps.

Returns
  `true` if both caps are equal.

## ◆ equals_fixed()

bool Gst::Caps::equals_fixed | ( | const Glib::RefPtr< const Gst::Caps >& | other_caps | ) | const

Tests if two Gst::Caps are equal.

This function only works on fixed Gst::Caps.

Parameters

  other_caps | The Gst::Caps to test.

Returns
  `true` if the arguments represent the same format.

## ◆ fixate()

Glib::RefPtr<Gst::Caps> Gst::Caps::fixate | ( |  | ) | const

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::fixate().

This function takes ownership of caps and will call gst_caps_make_writable() on it so you must not use caps afterwards unless you keep an additional reference to it with ref().

Returns
  The fixated caps.

## ◆ get_difference()

Glib::RefPtr<Gst::Caps> Gst::Caps::get_difference | ( | const Glib::RefPtr< const Gst::Caps >& | subtrahend_caps | ) | const

Subtracts the subtrahend_caps from the minuend.

<note>This function does not work reliably if optional properties for caps are included on one caps and omitted on the other.</note>

Parameters

  subtrahend_caps | Gst::Caps to subtract.

Returns
  The resulting caps.

## ◆ get_features()

CapsFeatures Gst::Caps::get_features | ( | guint | index | ) | const

Finds the features in caps that has the index index , and returns it.

Parameters

  index | the index of the structure.

Returns
  The new Gst::CapsFeatures corresponding to index.

## ◆ get_intersect() [1/2]

Glib::RefPtr<Gst::Caps> Gst::Caps::get_intersect | ( | const Glib::RefPtr< const Gst::Caps >& | other_caps | ) | const

Creates a new Gst::Caps that contains all the formats that are common to both caps1 and other_caps.

Defaults to Gst::CAPS_INTERSECT_ZIG_ZAG mode.

Parameters

  other_caps | A Gst::Caps to intersect.

Returns
  The new Gst::Caps.

## ◆ get_intersect() [2/2]

Glib::RefPtr<Gst::Caps> Gst::Caps::get_intersect | ( | const Glib::RefPtr< const Gst::Caps >& | other_caps,
|  | CapsIntersectMode | p2
| ) |  | const

Creates a new Gst::Caps that contains all the formats that are common to both caps1 and other_caps, the order is defined by the Gst::CapsIntersectMode used.

Parameters

  other_caps | A Gst::Caps to intersect.
  p2 | The intersection algorithm/mode to use.

Returns
  The new Gst::Caps.

## ◆ get_normal()

Glib::RefPtr<Gst::Caps> Gst::Caps::get_normal | ( |  | ) | const

Returns a Gst::Caps that represents the same set of formats as caps, but contains no lists.

Each list is expanded into separate GstStructures.

This function takes ownership of caps and will call gst_caps_make_writable() on it so you must not use caps afterwards unless you keep an additional reference to it with ref().

Returns
  The normalized Gst::Caps.

## ◆ get_structure()

const Structure Gst::Caps::get_structure | ( | guint | idx | ) | const

Finds the structure in caps that has the index idx, and returns it.

Parameters

  idx | The index of the structure.

Returns
  The Gst::Structure corresponding to index.

## ◆ gobj() [1/2]

GstCaps* Gst::Caps::gobj | ( |  | ) |

Provides access to the underlying C instance.

## ◆ gobj() [2/2]

const GstCaps* Gst::Caps::gobj | ( |  | ) | const

Provides access to the underlying C instance.

## ◆ gobj_copy()

GstCaps* Gst::Caps::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ is_always_compatible()

bool Gst::Caps::is_always_compatible | ( | const Glib::RefPtr< const Gst::Caps >& | other_caps | ) | const

A given Gst::Caps 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 other_caps.

Parameters

  other_caps | The Gst::Caps to test.

Returns
  `true` if caps1 is a subset of other_caps.

## ◆ is_any()

bool Gst::Caps::is_any | ( |  | ) | const

Determines if caps represents any media format.

Returns
  `true` if caps represents any format.

## ◆ is_fixed()

bool Gst::Caps::is_fixed | ( |  | ) | const

Fixed Gst::Caps 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 GST_TYPE_INT_RANGE and GST_TYPE_LIST.

Returns
  `true` if caps is fixed.

## ◆ is_strictly_equal()

bool Gst::Caps::is_strictly_equal | ( | const Glib::RefPtr< const Gst::Caps >& | caps2 | ) | const

Checks if the given caps are exactly the same set of caps.

Parameters

  caps2 | Another Gst::Caps.

Returns
  `true` if both caps are strictly equal.

## ◆ is_subset()

bool Gst::Caps::is_subset | ( | const Glib::RefPtr< const Gst::Caps >& | superset_caps | ) | const

Checks if all caps represented by subset are also represented by superset_caps.

Parameters

  superset_caps | A potentially greater Gst::Caps.

Returns
  `true` if subset is a subset of superset_caps.

## ◆ is_subset_structure() [1/2]

bool Gst::Caps::is_subset_structure | ( | const Gst::Structure& | structure | ) | const

Checks if structure is a subset of caps.

See is_subset() for more information.

Parameters

  structure | A potential Gst::Structure subset of caps.

Returns
  `true` if structure is a subset of caps.

## ◆ is_subset_structure() [2/2]

bool Gst::Caps::is_subset_structure | ( | const Gst::Structure& | structure,
|  | const Gst::CapsFeatures& | features
| ) |  | const

Checks if structure is a subset of caps.

See is_subset() for more information.

Parameters

  structure | A potential Gst::Structure subset of caps.
  features | A Gst::CapsFeatures for structure.

Returns
  `true` if structure is a subset of caps.

## ◆ merge()

Glib::RefPtr<Gst::Caps> Gst::Caps::merge | ( | Glib::RefPtr< Gst::Caps >&& | caps | ) |

## ◆ merge_structure() [1/2]

Glib::RefPtr<Gst::Caps> Gst::Caps::merge_structure | ( | const Structure& | structure | ) |

Appends a structure to caps if its not already expressed by caps.

Parameters

  structure | The Gst::Structure to merge.

## ◆ merge_structure() [2/2]

Glib::RefPtr<Gst::Caps> Gst::Caps::merge_structure | ( | const Structure& | structure,
|  | const CapsFeatures& | features
| ) |  |

Appends a structure to caps if its not already expressed by caps.

Parameters

  structure | The Gst::Structure to merge.
  features | The Gst::CapsFeatures to merge.

## ◆ operator delete()

void Gst::Caps::operator delete | ( | void * | ,
|  | std::size_t |
| ) |  |
| protected

## ◆ operator=()

Caps& Gst::Caps::operator= | ( | const Caps& |  | ) |
| delete

## ◆ reference()

void Gst::Caps::reference | ( |  | ) | const

Increment the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

## ◆ remove_structure()

void Gst::Caps::remove_structure | ( | guint | idx | ) |

removes the structure with the given index from the list of structures contained in caps.

Parameters

  idx | Index of the structure to remove.

## ◆ set_features()

void Gst::Caps::set_features | ( | guint | index,
|  | const CapsFeatures& | features
| ) |  |

Sets the Gst::CapsFeatures for the structure at index.

Parameters

  index | The index of the structure.
  features | The Gst::CapsFeatures to set.

## ◆ set_simple() [1/3]

void Gst::Caps::set_simple | ( | const Glib::ustring & | name,
|  | const Glib::ValueBase & | value
| ) |  |

Sets fields in a simple Gst::Caps.

A simple Gst::Caps is one that only has one structure. This method, like the Gst::Structure::set_field() methods, translates certain GTypes to GStreamer specific GTypes for functional compatibility.

Parameters

  name | Field to set.
  value | The value which the field should be set to.

## ◆ set_simple() [2/3]

template <class DataType , class ... DataTypes>

void Gst::Caps::set_simple | ( | const Glib::ustring & | name,
|  | const DataType & | data,
|  | DataTypes ... | further_data
| ) |  |

Sets fields in a simple Gst::Caps.

A simple Gst::Caps is one that only has one structure. This method, like the Gst::Structure::set_field() methods, translates certain GTypes to GStreamer specific GTypes for functional compatibility.

Parameters

  name | Field to set.
  data | A value which the field should be set to (this can be any supported C++ type).
  ...further_data | further data to set in format: name, data.

## ◆ set_simple() [3/3]

void Gst::Caps::set_simple | ( | const Glib::ustring & | name,
|  | const char * | data
| ) |  |

Sets fields in a simple Gst::Caps.

A simple Gst::Caps is one that only has one structure.

Parameters

  name | Field to set.
  data | A C string (const char*) which the field should be set to.

## ◆ set_value() [1/2]

void Gst::Caps::set_value | ( | const Glib::ustring & | field,
|  | const Glib::ValueBase & | value
| ) |  |

Sets the given field on all structures of caps to the given value.

This is a convenience function for calling Gst::Structure::set_value() on all structures of caps.

Parameters

  field | Name of the field to set.
  value | Value to set the field to.

## ◆ set_value() [2/2]

template <class DataType >

void Gst::Caps::set_value | ( | const Glib::ustring & | name,
|  | const DataType & | data
| ) |  |

Sets the given field on all structures to the given value.

This is a convenience function for calling Gst::Structure::set_value() on all structures.

Parameters

  name | Field to set.
  data | A value which the field should be set to (this can be any supported C++ type).

## ◆ simplify()

Glib::RefPtr<Gst::Caps> Gst::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 values that can be merged are also merged.

This function takes ownership of caps and will call gst_caps_make_writable() on it if necessary, so you must not use caps afterwards unless you keep an additional reference to it with ref().

This method does not preserve the original order of caps.

Returns
  The simplified caps.

## ◆ size()

guint Gst::Caps::size | ( |  | ) | const

Gets the number of structures contained in caps.

Returns
  The number of structures that caps contains.

## ◆ steal_structure()

Structure Gst::Caps::steal_structure | ( | guint | 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.

Parameters

  index | Index of the structure to retrieve.

Returns
  A pointer to the Gst::Structure corresponding to index.

## ◆ to_string()

Glib::ustring Gst::Caps::to_string | ( |  | ) | const

Converts caps to a string representation.

This string representation can be converted back to a Gst::Caps by from_string().

For debugging purposes its easier to do something like this:

[C example ellipted] This prints the caps in human readable form.

The current implementation of serialization will lead to unexpected results when there are nested Gst::Caps / Gst::Structure deeper than one level.

Returns
  A newly allocated string representing caps.

## ◆ truncate()

Glib::RefPtr<Gst::Caps> Gst::Caps::truncate | ( |  | ) |

Discard all but the first structure from caps.

Useful when fixating.

Returns
  Truncated caps.

## ◆ unreference()

void Gst::Caps::unreference | ( |  | ) | const

Decrement the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gst::Caps > wrap | ( | GstCaps * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.