gstreamermm: Gst::Structure Class Reference

gstreamermm 0.10.11

- Main Page
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Related Functions
Gst::Structure Class Reference

A generic class containing fields of names and values. More...

List of all members.

## Public Types
typedef sigc::slot< bool, const Glib::ustring &, const Glib::ValueBase& > | SlotForeach
| For example, bool on_foreach(const Glib::ustring& id, const Glib::ValueBase& value);.
typedef sigc::slot< bool, const Glib::ustring &, Glib::ValueBase& > | SlotMap
| For example, bool on_map(const Glib::ustring& id, Glib::ValueBase& value);.
## Public Member Functions
| Structure ()
| Structure (GstStructure* gobject, bool make_a_copy=true)
| Structure (const Structure& other)
Structure& | operator= (const Structure& other)
| ~Structure ()
void | swap (Structure& other)
GstStructure* | gobj ()
| Provides access to the underlying C instance.
const GstStructure* | gobj () const
| Provides access to the underlying C instance.
GstStructure* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
| Structure (const Glib::ustring& name)
| Creates a Structure with the given name.
| operator bool () const
| Use this to discover if the Structure is a valid object.
Glib::ustring | get_name () const
| Get the name of structure as a string.
bool | has_name (const Glib::ustring& name) const
| Checks if the structure has the given name.
void | set_name (const Glib::ustring& name)
| Sets the name of the structure to the given name.
Glib::QueryQuark | get_name_id () const
| Get the name of structure as a GQuark.
void | get_field (const Glib::ustring& fieldname, Glib::ValueBase&value) const
| Get the value of the field with name fieldname.
void | set_field (const Glib::ustring& fieldname, const Glib::ValueBase&value)
| Sets the field with name fieldname to value.
void | set_field (const Glib::ustring& fieldname, bool value)
| Sets the field with name fieldname to the boolean value.
void | set_field (const Glib::ustring& fieldname, int value)
| Sets the field with name fieldname to the int value.
void | set_field (const Glib::ustring& fieldname, guint value)
| Sets the field with name fieldname to the guint value.
void | set_field (const Glib::ustring& fieldname, const Fourcc&value)
| Sets the field with name fieldname to the Gst::Fourcc value.
void | set_field (const Glib::ustring& fieldname, double value)
| Sets the field with name fieldname to the double value.
void | set_field (const Glib::ustring& fieldname, const std::string&value)
| Sets the field with name fieldname to the std::string value.
void | set_field (const Glib::ustring& fieldname, const char*value)
| Sets the field with name fieldname to the string constant value.
void | set_field (const Glib::ustring& fieldname, const Glib::Date&value)
| Sets the field with name fieldname to the Glib::Date value.
void | set_field (const Glib::ustring& fieldname, const ClockTime&value)
| Sets the field with name fieldname to the Gst::ClockTime value.
void | set_field (const Glib::ustring& fieldname, GType enumtype, int value)
| Sets the field with name fieldname to the value value of the enum type enum_type.
void | set_field (const Glib::ustring& fieldname, const Gst::Fraction&value)
| Sets the field with name fieldname to the Gst::Fraction value.
void | set_field (const Glib::ustring& fieldname, const Gst::IntRange&value)
| Sets the field with name fieldname field to the Gst::IntRange value.
void | set_field (const Glib::ustring& fieldname, const Gst::DoubleRange&value)
| Sets the field with name fieldname field to the Gst::DoubleRange value.
void | set_field (const Glib::ustring& fieldname, const Gst::FractionRange&value)
| Sets the field with name fieldname field to the Gst::FractionRange value.
void | remove_field (const Glib::ustring& fieldname)
| Removes the field with name fieldname.
void | remove_all_fields ()
| Removes all fields in a GstStructure.
GType | get_field_type (const Glib::ustring& fieldname) const
| Finds the field with the given name, and returns the type of the value it contains.
bool | foreach (const SlotForeach& slot)
| Calls the provided slot once for each field in the Gst::Structure.
int | size () const
| Get the number of fields in the structure.
bool | has_field (const Glib::ustring& fieldname) const
| Check if structure contains a field named fieldname.
bool | has_field (const Glib::ustring& fieldname, GType type) const
| Check if structure contains a field named fieldname and with GType type.
bool | get_field (const Glib::ustring& fieldname, bool&value) const
| Gets the value of field fieldname into boolean value.
bool | get_field (const Glib::ustring& fieldname, int&value) const
| Gets the value of field fieldname into integer value.
bool | get_field (const Glib::ustring& fieldname, guint&value) const
| Gets the value of field fieldname into guint value.
bool | get_field (const Glib::ustring& fieldname, Fourcc&value) const
| Gets the value of field fieldname into Gst::Fourcc value.
bool | get_field (const Glib::ustring& fieldname, double&value) const
| Gets the value of field fieldname into double value.
bool | get_field (const Glib::ustring& fieldname, Glib::ustring&value) const
| Gets the value of field fieldname into Glib::ustring value.
bool | get_field (const Glib::ustring& fieldname, std::string&value) const
| Gets the value of field fieldname into std::string value.
bool | get_field (const Glib::ustring& fieldname, Glib::Date&value) const
| Gets the value of field fieldname into Glib::Date value.
bool | get_field (const Glib::ustring& fieldname, ClockTime&value) const
| Gets the value of field fieldname into Gst::ClockTime value.
bool | get_field (const Glib::ustring& fieldname, GType enumtype, int&value) const
| Gets the value of field fieldname with GType enum type enumtype into integer value.
bool | get_field (const Glib::ustring& fieldname, Gst::Fraction&value) const
| Gets the value of field fieldname into Gst::Fraction value.
bool | get_field (const Glib::ustring& fieldname, Gst::IntRange&value) const
| Gets the value of field fieldname into Gst::IntRange value.
bool | get_field (const Glib::ustring& fieldname, Gst::DoubleRange&value) const
| Gets the value of field fieldname into Gst::DoubleRange value.
bool | get_field (const Glib::ustring& fieldname, Gst::FractionRange&value) const
| Gets the value of field fieldname into Gst::FractionRange value.
bool | map_in_place (const SlotMap& slot)
| Calls the provided slot once for each field in the Gst::Structure.
Glib::ustring | get_nth_field_name (guint index) const
| Get the name of the given field number, counting from 0 onwards.
Glib::ustring | to_string () const
| Converts structure to a human-readable string representation.
bool | fixate_field_nearest_int (const Glib::ustring& name, int target)
| Fixates a Gst::Structure by changing the given field to the nearest integer to target that is a subset of the existing field.
bool | fixate_field_nearest_double (const Glib::ustring& name, double target)
| Fixates a Gst::Structure by changing the given field to the nearest double to target that is a subset of the existing field.
bool | fixate_nearest_fraction (const Glib::ustring& name, const Gst::Fraction& target)
| Fixates a Gst::Structure by changing the given field to the nearest fraction to given Gst::Fraction that is a subset of the existing field.
bool | fixate_field_boolean (const Glib::ustring& name, bool target)
| Fixates a Gst::Structure by changing the given field_name field to the given target boolean if that field is not fixed yet.
## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
static Structure | create_from_string (const Glib::ustring& the_string)
| Creates a Gst::Structure from a string representation.
## Protected Attributes
GstStructure* | gobject_
## Related Functions
(Note that these are not member functions.)
void | swap (Structure& lhs, Structure& rhs)
Gst::Structure | wrap (GstStructure* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A generic class containing fields of names and values.

A Gst::Structure is a collection of key/value pairs. The keys are expressed as GQuarks and the values can be of any GType.

In addition to the key/value pairs, a Gst::Structure also has a name. The name starts with a letter and can be folled by letters, numbers and any of "/-_.:".

Gst::Structure is used by various GStreamer subsystems to store information in a flexible and extensible way. A Gst::Structure does not have a refcount because it usually is part of a higher level object such as Gst::Caps. It provides a means to enforce mutability using the refcount of the parent.

Last reviewed on 2007-10-16 (0.10.15)

## Member Typedef Documentation

typedef sigc::slot<bool, const Glib::ustring&, const Glib::ValueBase&> Gst::Structure::SlotForeach

For example, bool on_foreach(const Glib::ustring& id, const Glib::ValueBase& value);.

The foreach function should return true if the foreach operation should continue, or false if the operation should stop with false.

typedef sigc::slot<bool, const Glib::ustring&, Glib::ValueBase&> Gst::Structure::SlotMap

For example, bool on_map(const Glib::ustring& id, Glib::ValueBase& value);.

The map function should return true if the map operation should continue, or false if the operation should stop with false.

## Constructor & Destructor Documentation

Gst::Structure::Structure | ( |  | ) |

Gst::Structure::Structure | ( | GstStructure * | gobject,
|  | bool | make_a_copy = `true`
| ) |  | `[explicit]`

Gst::Structure::Structure | ( | const Structure& | other | ) |

Gst::Structure::~Structure | ( |  | ) |

Gst::Structure::Structure | ( | const Glib::ustring & | name | ) | `[explicit]`

Creates a Structure with the given name.

You should then use set_field() to set field values.

## Member Function Documentation

static Structure Gst::Structure::create_from_string | ( | const Glib::ustring & | the_string | ) | `[static]`

Creates a Gst::Structure from a string representation.

Parameters:

  the_string | A string representation of a Gst::Structure. See to_string().

Returns:
  A Structure. This will be invalid (see operator=) when the string could not be parsed.

bool Gst::Structure::fixate_field_boolean | ( | const Glib::ustring & | name,
|  | bool | target
| ) |  |

Fixates a Gst::Structure by changing the given field_name field to the given target boolean if that field is not fixed yet.

Parameters:

  field_name | A field in structure.
  target | The target value of the fixation.

Returns:
  `true` if the structure could be fixated.

bool Gst::Structure::fixate_field_nearest_double | ( | const Glib::ustring & | name,
|  | double | target
| ) |  |

Fixates a Gst::Structure by changing the given field to the nearest double to target that is a subset of the existing field.

Parameters:

  field_name | A field in structure.
  target | The target value of the fixation.

Returns:
  `true` if the structure could be fixated.

bool Gst::Structure::fixate_field_nearest_int | ( | const Glib::ustring & | name,
|  | int | target
| ) |  |

Fixates a Gst::Structure by changing the given field to the nearest integer to target that is a subset of the existing field.

Parameters:

  field_name | A field in structure.
  target | The target value of the fixation.

Returns:
  `true` if the structure could be fixated.

bool Gst::Structure::fixate_nearest_fraction | ( | const Glib::ustring & | name,
|  | const Gst::Fraction& | target
| ) |  |

Fixates a Gst::Structure by changing the given field to the nearest fraction to given Gst::Fraction that is a subset of the existing field.

Parameters:

  field_name | A field in structure.
  target | The target value of the fixation.

Returns:
  true If the structure could be fixated.

bool Gst::Structure::foreach | ( | const SlotForeach& | slot | ) |

Calls the provided slot once for each field in the Gst::Structure.

The slot must not modify the fields. See also map_in_place().

Parameters:

  slot | A slot to call for each field.

Returns:
  true if the supplied slot returns true For each of the fields, false otherwise.

void Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | Glib::ValueBase & | value
| ) |  | const

Get the value of the field with name fieldname.

Parameters:

  fieldname | The name of the field to get.
  value | The Value class in which to store the value.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | bool & | value
| ) |  | const

Gets the value of field fieldname into boolean value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | An output parameter that will be set with the value.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a boolean, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | int & | value
| ) |  | const

Gets the value of field fieldname into integer value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | An output parameter that will be set with the value.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain an int, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | guint & | value
| ) |  | const

Gets the value of field fieldname into guint value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | An output parameter that will be set with the value.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain an guint, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | Fourcc& | value
| ) |  | const

Gets the value of field fieldname into Gst::Fourcc value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | An output parameter that will be set with the value.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a Gst::Fourcc, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | double & | value
| ) |  | const

Gets the value of field fieldname into double value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | An output parameter that will be set with the value.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a double, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | Glib::ustring & | value
| ) |  | const

Gets the value of field fieldname into Glib::ustring value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | An output parameter that will be set with the value.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a string, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | std::string & | value
| ) |  | const

Gets the value of field fieldname into std::string value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | An output parameter that will be set with the value.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a string, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | Glib::Date & | value
| ) |  | const

Gets the value of field fieldname into Glib::Date value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  date | The Glib::Date to set.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a Glib::Date, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | ClockTime& | value
| ) |  | const

Gets the value of field fieldname into Gst::ClockTime value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | An output parameter that will be set with the value.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a Gst::ClockTime, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | GType | enumtype,
|  | int & | value
| ) |  | const

Gets the value of field fieldname with GType enum type enumtype into integer value.

Caller is responsible for making sure the field exists and has the correct type. A call to this method would look like so:

     ...
     int state;
     structure.get_field("state", Glib::Value<Gst::State>::value_type(),
     state);
     ...

Parameters:

  fieldname | The name of a field.
  enumtype | The enum GType of the field.
  value | An output parameter that will be set with the value.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain an enum, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | Gst::Fraction& | value
| ) |  | const

Gets the value of field fieldname into Gst::Fraction value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | The Gst::Fraction to set.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a Gst::Fraction, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | Gst::IntRange& | value
| ) |  | const

Gets the value of field fieldname into Gst::IntRange value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | The Gst::IntRange to set.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a Gst::IntRange, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | Gst::DoubleRange& | value
| ) |  | const

Gets the value of field fieldname into Gst::DoubleRange value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | The Gst::DoubleRange to set.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a Gst::DoubleRange, this function returns false.

bool Gst::Structure::get_field | ( | const Glib::ustring & | fieldname,
|  | Gst::FractionRange& | value
| ) |  | const

Gets the value of field fieldname into Gst::FractionRange value.

The caller is responsible for making sure the field exists and has the correct type.

Parameters:

  fieldname | The name of a field.
  value | The Gst::FractionRange to set.

Returns:
  true if value could be set correctly. If there was no field with fieldname or the existing field did not contain a Gst::FractionRange, this function returns false.

GType Gst::Structure::get_field_type | ( | const Glib::ustring & | fieldname | ) | const

Finds the field with the given name, and returns the type of the value it contains.

If the field is not found, G_TYPE_INVALID is returned.

Parameters:

  fieldname | The name of the field.

Returns:
  The Value of the field.

Glib::ustring Gst::Structure::get_name | ( |  | ) | const

Get the name of structure as a string.

Returns:
  The name of the structure.

Glib::QueryQuark Gst::Structure::get_name_id | ( |  | ) | const

Get the name of structure as a GQuark.

Returns:
  The quark representing the name of the structure.

Glib::ustring Gst::Structure::get_nth_field_name | ( | guint | index | ) | const

Get the name of the given field number, counting from 0 onwards.

Parameters:

  index | The index to get the name of.

Returns:
  The name of the given field number.

static GType Gst::Structure::get_type | ( |  | ) | `[static]`

Get the GType for this class, for use with the underlying GObject type system.

GstStructure* Gst::Structure::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C instance.

const GstStructure* Gst::Structure::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C instance.

GstStructure* Gst::Structure::gobj_copy | ( |  | ) | const

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

bool Gst::Structure::has_field | ( | const Glib::ustring & | fieldname | ) | const

Check if structure contains a field named fieldname.

Parameters:

  fieldname | The name of a field.

Returns:
  `true` if the structure contains a field with the given name.

bool Gst::Structure::has_field | ( | const Glib::ustring & | fieldname,
|  | GType | type
| ) |  | const

Check if structure contains a field named fieldname and with GType type.

Parameters:

  fieldname | The name of a field.
  type | The type of a value.

Returns:
  `true` if the structure contains a field with the given name and type.

bool Gst::Structure::has_name | ( | const Glib::ustring & | name | ) | const

Checks if the structure has the given name.

Parameters:

  name | Structure name to check for.

Returns:
  `true` if name matches the name of the structure.

bool Gst::Structure::map_in_place | ( | const SlotMap& | slot | ) |

Calls the provided slot once for each field in the Gst::Structure.

In contrast to foreach(), the function may modify but not delete the fields. The structure must be mutable.

Parameters:

  slot | A slot to call for each field.

Returns:
  true if the supplied slot returns true For each of the fields, false otherwise.

Gst::Structure::operator bool | ( |  | ) | const

Use this to discover if the Structure is a valid object.

Structure& Gst::Structure::operator= | ( | const Structure& | other | ) |

void Gst::Structure::remove_all_fields | ( |  | ) |

Removes all fields in a GstStructure.

void Gst::Structure::remove_field | ( | const Glib::ustring & | fieldname | ) |

Removes the field with name fieldname.

If the field with the given name does not exist, the structure is unchanged.

Parameters:

  fieldname | The name of the field to remove.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | const Glib::ValueBase & | value
| ) |  |

Sets the field with name fieldname to value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | bool | value
| ) |  |

Sets the field with name fieldname to the boolean value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | int | value
| ) |  |

Sets the field with name fieldname to the int value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | guint | value
| ) |  |

Sets the field with name fieldname to the guint value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | const Fourcc& | value
| ) |  |

Sets the field with name fieldname to the Gst::Fourcc value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed. Please note that when setting fields to special gstreamermm types such as Gst::Fourcc and Gst::Fraction and Glib::Date they are converted to the GStreamer GTypes and thus when attempting to get these fields back as GValues, they will have the GStreamer GType.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | double | value
| ) |  |

Sets the field with name fieldname to the double value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | const std::string & | value
| ) |  |

Sets the field with name fieldname to the std::string value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | const char * | value
| ) |  |

Sets the field with name fieldname to the string constant value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | const Glib::Date & | value
| ) |  |

Sets the field with name fieldname to the Glib::Date value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed. Please note that when setting fields to special types such as Gst::Fourcc and Gst::Fraction and Glib::Date they are converted to the GStreamer GTypes and thus when attempting to get these fields back as GValues, they will have the GStreamer GType.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | const ClockTime& | value
| ) |  |

Sets the field with name fieldname to the Gst::ClockTime value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | GType | enumtype,
|  | int | value
| ) |  |

Sets the field with name fieldname to the value value of the enum type enum_type.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed. Caller is responsible for making sure that value is a valid enumtype. A call to this method would look like so:

     ...
     structure.set_field("state", Glib::Value<Gst::State>::value_type(),
     Gst::STATE_PAUSED);
     ...

Parameters:

  fieldname | The name of the field to set.
  enumtype | The enum GType that value should be treated as.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | const Gst::Fraction& | value
| ) |  |

Sets the field with name fieldname to the Gst::Fraction value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed. Please note that when setting fields to special types such as Gst::Fourcc and Gst::Fraction and Glib::Date they are converted to the GStreamer GTypes and thus when attempting to get these fields back as GValues, they will have the GStreamer GType.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | const Gst::IntRange& | value
| ) |  |

Sets the field with name fieldname field to the Gst::IntRange value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed. Please note that when setting fields to special types such as Gst::Fourcc and Gst::Fraction and Glib::Date they are converted to the GStreamer GTypes and thus when attempting to get these fields back as GValues, they will have the GStreamer GType.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | const Gst::DoubleRange& | value
| ) |  |

Sets the field with name fieldname field to the Gst::DoubleRange value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed. Please note that when setting fields to special types such as Gst::Fourcc and Gst::Fraction and Glib::Date they are converted to the GStreamer GTypes and thus when attempting to get these fields back as GValues, they will have the GStreamer GType.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_field | ( | const Glib::ustring & | fieldname,
|  | const Gst::FractionRange& | value
| ) |  |

Sets the field with name fieldname field to the Gst::FractionRange value.

If the field does not exist, it is created. If the field exists, the previous value is replaced and freed. Please note that when setting fields to special types such as Gst::Fourcc and Gst::Fraction and Glib::Date they are converted to the GStreamer GTypes and thus when attempting to get these fields back as GValues, they will have the GStreamer GType.

Parameters:

  fieldname | The name of the field to set.
  value | The value to set the field to.

void Gst::Structure::set_name | ( | const Glib::ustring & | name | ) |

Sets the name of the structure to the given name.

The string provided is copied before being used. It must not be empty, start with a letter and can be followed by letters, numbers and any of "/-_.:".

Parameters:

  name | The new name of the structure.

int Gst::Structure::size | ( |  | ) | const

Get the number of fields in the structure.

Returns:
  The number of fields in the structure.

void Gst::Structure::swap | ( | Structure& | other | ) |

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

Converts structure to a human-readable string representation.

For debugging purposes its easier to do something like this:

[C example ellipted] This prints the structure in human readble form.

Free-function: g_free

Returns:
  (transfer full)L a pointer to string allocated by Glib::malloc(). Glib::free() after usage.

## Friends And Related Function Documentation

void swap | ( | Structure& | lhs,
|  | Structure& | rhs
| ) |  | `[related]`

Parameters:

  lhs | The left-hand side
  rhs | The right-hand side

Gst::Structure wrap | ( | GstStructure * | 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.

## Member Data Documentation

GstStructure* Gst::Structure::gobject_`[protected]`

The documentation for this class was generated from the following file:

- gstreamermm/structure.h