gstreamermm: Gst::Message Class Reference

gstreamermm 1.10.0

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

A class that represents lightweight objects to signal the application of pipeline events. More...

`#include <gstreamermm/message.h>`

Inheritance diagram for Gst::Message:
[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...
GstMessage* | gobj ()
| Provides access to the underlying C instance. More...
const GstMessage* | gobj () const
| Provides access to the underlying C instance. More...
GstMessage* | 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...
| Message ()=delete
| Message (const Message&)=delete
Message& | operator= (const Message&)=delete
Gst::Structure | get_structure () const
| Access the structure of the message. More...
Glib::RefPtr< Gst::Message > | create_writable ()
| Checks if a message is writable. More...
guint32 | get_seqnum () const
| Retrieve the sequence number of a message. More...
void | set_seqnum (guint32 seqnum)
| Set the sequence number of a message. More...
Glib::RefPtr< Gst::Message > | copy () const
| Creates a copy of the message. More...
MessageType | get_message_type () const
| Get the GstMessageType of message. More...
Gst::ClockTime | get_timestamp () const
| Get the timestamp of message. More...
Glib::RefPtr< Gst::Object > | get_source ()
| Get the object that posted the message. More...
Glib::RefPtr< const Gst::Object > | get_source () const
bool | has_name (const Glib::ustring& name) const
| Checks if message has the given name. 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...

## 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::Message > | wrap (GstMessage* 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

A class that represents lightweight objects to signal the application of pipeline events.

Messages are implemented as a subclass of Gst::MiniObject with a generic Gst::Structure as the content. This allows for writing custom messages without requiring an API change while allowing a wide range of different types of messages.

Messages are posted by objects in the pipeline and are passed to the application using the Gst::Bus.

The basic use pattern of posting a message on a Gst::Bus is as follows:

bus->post(Gst::MessageEos::create(my_element));

Last reviewed on 2016-06-06 (1.8.0)

## Constructor & Destructor Documentation

## ◆ Message() [1/2]

Gst::Message::Message | ( |  | ) |
| delete

## ◆ Message() [2/2]

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

## Member Function Documentation

## ◆ copy()

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

Creates a copy of the message.

Returns a copy of the message.

Returns
  A new copy of msg.

MT safe.

## ◆ create_writable()

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

Checks if a message is writable.

If not, a writable copy is made and returned.

Returns
  A Gst::Message (possibly the same pointer) that is writable.

## ◆ get_message_type()

MessageType Gst::Message::get_message_type | ( |  | ) | const

Get the GstMessageType of message.

## ◆ get_seqnum()

guint32 Gst::Message::get_seqnum | ( |  | ) | const

Retrieve the sequence number of a message.

Messages have ever-incrementing sequence numbers, which may also be set explicitly via gst_message_set_seqnum(). Sequence numbers are typically used to indicate that a message corresponds to some other set of messages or events, for example a SEGMENT_DONE message corresponding to a SEEK event. It is considered good practice to make this correspondence when possible, though it is not required.

Note that events and messages share the same sequence number incrementor; two events or messages will never have the same sequence number unless that correspondence was made explicitly.

Returns
  The message's sequence number.

MT safe.

## ◆ get_source() [1/2]

Glib::RefPtr<Gst::Object> Gst::Message::get_source | ( |  | ) |

Get the object that posted the message.

## ◆ get_source() [2/2]

Glib::RefPtr<const Gst::Object> Gst::Message::get_source | ( |  | ) | const

## ◆ get_structure()

Gst::Structure Gst::Message::get_structure | ( |  | ) | const

Access the structure of the message.

Returns
  The structure of the message. The structure is still owned by the message, which means that you should not free it and that the pointer becomes invalid when you free the message.

MT safe.

## ◆ get_timestamp()

Gst::ClockTime Gst::Message::get_timestamp | ( |  | ) | const

Get the timestamp of message.

This is the timestamp when the message was created.

## ◆ gobj() [1/2]

GstMessage* Gst::Message::gobj | ( |  | ) |

Provides access to the underlying C instance.

## ◆ gobj() [2/2]

const GstMessage* Gst::Message::gobj | ( |  | ) | const

Provides access to the underlying C instance.

## ◆ gobj_copy()

GstMessage* Gst::Message::gobj_copy | ( |  | ) | const

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

## ◆ has_name()

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

Checks if message has the given name.

This function is usually used to check the name of a custom message.

Parameters

  name | Name to check.

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

## ◆ operator delete()

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

## ◆ operator=()

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

## ◆ reference()

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

Increment the reference count for this object.

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

## ◆ set_seqnum()

void Gst::Message::set_seqnum | ( | guint32 | seqnum | ) |

Set the sequence number of a message.

This function might be called by the creator of a message to indicate that the message relates to other messages or events. See gst_message_get_seqnum() for more information.

MT safe.

Parameters

  seqnum | A sequence number.

## ◆ unreference()

void Gst::Message::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::Message > wrap | ( | GstMessage * | 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.

Gst::MessageEos::create
static Glib::RefPtr< Gst::MessageEos > create(const Glib::RefPtr< Gst::Object > &src)
Create a new eos message.