Message

Messages are implemented as a subclass of GstMiniObject with a generic GstStructure 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 GstBus.

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

A GstElement usually posts messages on the bus provided by the parent container using gst_element_post_message().

Last reviewed on 2005-11-09 (0.9.4)

class Message {}

Constructors

this
this(GstMessage* gstMessage)

Sets our main struct and passes it to the parent class

this
this(ObjectGst src, TagList tagList)

Create a new tag message. The message will take ownership of the tag list. The message is posted by elements that discovered a new taglist.

this
this(ObjectGst src, int percent)

Create a new buffering message. This message can be posted by an element that needs to buffer data before it can continue processing. percent should be a value between 0 and 100. A value of 100 means that the buffering completed. When percent is < 100 the application should PAUSE a PLAYING pipeline. When percent is 100, the application can set the pipeline (back) to PLAYING. The application must be prepared to receive BUFFERING messages in the PREROLLING state and may only set the pipeline to PLAYING after receiving a message with percent set to 100, which can happen after the pipeline completed prerolling. MT safe.

this
this(ObjectGst src, GstState oldstate, GstState newstate, GstState pending)

Create a state change message. This message is posted whenever an element changed its state.

this
this(ObjectGst src, GstFormat format, ulong amount, double rate, int flush, int intermediate, ulong duration, int eos)

This message is posted by elements when they complete a part, when intermediate set to TRUE, or a complete step operation. duration will contain the amount of time (in GST_FORMAT_TIME) of the stepped amount of media in format format.

this
this(ObjectGst src, Clock clock, int ready)

Create a clock provide message. This message is posted whenever an element is ready to provide a clock or lost its ability to provide a clock (maybe because it paused or became EOS). This message is mainly used internally to manage the clock selection.

this
this(ObjectGst src, Clock clock)

Create a clock lost message. This message is posted whenever the clock is not valid anymore. If this message is posted by the pipeline, the pipeline will select a new clock again when it goes to PLAYING. It might therefore be needed to set the pipeline to PAUSED and PLAYING again.

this
this(ObjectGst src, Structure structure)

Create a new application-typed message. GStreamer will never create these messages; they are a gift from us to you. Enjoy.

this
this(GstMessageType type, ObjectGst src, Structure structure)

Create a new custom-typed message. This can be used for anything not handled by other message-specific functions to pass a message to the app. The structure field can be NULL.

this
this(ObjectGst src, GstClockTime runningTime)

The message is posted when elements completed an ASYNC state change. running_time contains the time of the desired running_time when this elements goes to PLAYING. A value of GST_CLOCK_TIME_NONE for running_time means that the element has no clock interaction and thus doesn't care about the running_time of the pipeline.

this
this(ObjectGst src, int active, GstFormat format, ulong amount, double rate, int flush, int intermediate)

This message is posted by elements when they accept or activate a new step event for amount in format. active is set to FALSE when the element accepted the new step event and has queued it for execution in the streaming threads. active is set to TRUE when the element has activated the step operation and is now ready to start executing the step in the streaming thread. After this message is emited, the application can queue a new step operation in the element.

this
this(ObjectGst src, int live, ulong runningTime, ulong streamTime, ulong timestamp, ulong duration)

A QOS message is posted on the bus whenever an element decides to drop a buffer because of QoS reasons or whenever it changes its processing strategy because of QoS reasons (quality adjustments such as processing at lower accuracy). This message can be posted by an element that performs synchronisation against the clock (live) or it could be dropped by an element that performs QoS because of QOS events received from a downstream element (!live). running_time, stream_time, timestamp, duration should be set to the respective running-time, stream-time, timestamp and duration of the (dropped) buffer that generated the QoS event. Values can be left to GST_CLOCK_TIME_NONE when unknown.

this
this(ObjectGst src, Toc toc, int updated)

Create a new TOC message. The message is posted by elements that discovered or updated a TOC.

this
this(ObjectGst src)

Create a new stream_start message. This message is generated and posted in the sink elements of a GstBin. The bin will only forward the STREAM_START message to the application if all sinks have posted an STREAM_START message.

this
this(ObjectGst src, GstStructureChangeType type, Element owner, int busy)

Create a new structure change message. This message is posted when the structure of a pipeline is in the process of being changed, for example when pads are linked or unlinked. src should be the sinkpad that unlinked or linked.

this
this(ObjectGst src, GstState state)

This message can be posted by elements when they want to have their state changed. A typical use case would be an audio server that wants to pause the pipeline because a higher priority stream is being played.

this
this(ObjectGst src, GstStreamStatusType type, Element owner)

Create a new stream status message. This message is posted when a streaming thread is created/destroyed or when the state changed.

this
this(ObjectGst src, GstProgressType type, string code, string text)

Progress messages are posted by elements when they use an asynchronous task to perform actions triggered by a state change. code contains a well defined string describing the action. test should contain a user visible string detailing the current action.

this
this(ObjectGst src, string contextType)

This message is posted when an element needs a specific GstContext. Since 1.2

this
this(ObjectGst src, Context context)

This message is posted when an element has a new local GstContext. Since 1.2

Members

Functions

copy
Message copy()

Creates a copy of the message. Returns a copy of the message.

doref
Message doref()

Convenience macro to increase the reference count of the message.

getMessageStruct
GstMessage* getMessageStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getSeqnum
uint getSeqnum()

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.

getStreamStatusObject
Value getStreamStatusObject()

Extracts the object managing the streaming thread from message.

getStruct
void* getStruct()

the main Gtk struct as a void*

getStructure
Structure getStructure()

Access the structure of the message.

hasName
int hasName(string name)

Checks if message has the given name. This function is usually used to check the name of a custom message.

parseAsyncDone
void parseAsyncDone(GstClockTime runningTime)

Extract the running_time from the async_done message. MT safe.

parseBuffering
void parseBuffering(int percent)

Extracts the buffering percent from the GstMessage. see also gst_message_new_buffering(). MT safe.

parseBufferingStats
void parseBufferingStats(GstBufferingMode mode, int avgIn, int avgOut, long bufferingLeft)

Extracts the buffering stats values from message.

parseClockLost
void parseClockLost(Clock clock)

Extracts the lost clock from the GstMessage. The clock object returned remains valid until the message is freed. MT safe.

parseClockProvide
void parseClockProvide(Clock clock, int ready)

Extracts the clock and ready flag from the GstMessage. The clock object returned remains valid until the message is freed. MT safe.

parseContextType
int parseContextType(string contextType)

Parse a context type from an existing GST_MESSAGE_NEED_CONTEXT message. Since 1.2

parseError
void parseError(ErrorG gerror, string dbug)

Extracts the GError and debug string from the GstMessage. The values returned in the output arguments are copies; the caller must free them when done.

parseGroupId
int parseGroupId(uint groupId)

Extract the group from the STREAM_START message. Since 1.2

parseHaveContext
void parseHaveContext(Context context)

Extract the context from the HAVE_CONTEXT message. MT safe. Since 1.2

parseInfo
void parseInfo(ErrorG gerror, string dbug)

Extracts the GError and debug string from the GstMessage. The values returned in the output arguments are copies; the caller must free them when done. MT safe.

parseNewClock
void parseNewClock(Clock clock)

Extracts the new clock from the GstMessage. The clock object returned remains valid until the message is freed. MT safe.

parseProgress
void parseProgress(GstProgressType type, string code, string text)

Parses the progress type, code and text.

parseQos
void parseQos(int live, ulong* runningTime, ulong streamTime, ulong timestamp, ulong duration)

Extract the timestamps and live status from the QoS message. The returned values give the running_time, stream_time, timestamp and duration of the dropped buffer. Values of GST_CLOCK_TIME_NONE mean unknown values. MT safe.

parseQosStats
void parseQosStats(GstFormat format, ulong processed, ulong dropped)

Extract the QoS stats representing the history of the current continuous pipeline playback period. When format is GST_FORMAT_UNDEFINED both dropped and processed are invalid. Values of -1 for either processed or dropped mean unknown values. MT safe.

parseQosValues
void parseQosValues(long jitter, double proportion, int quality)

Extract the QoS values that have been calculated/analysed from the QoS data MT safe.

parseRequestState
void parseRequestState(GstState state)

Extract the requested state from the request_state message. MT safe.

parseResetTime
void parseResetTime(GstClockTime* runningTime)

Extract the running-time from the RESET_TIME message. MT safe.

parseSegmentDone
void parseSegmentDone(GstFormat format, long position)

Extracts the position and format from the segment done message. MT safe.

parseSegmentStart
void parseSegmentStart(GstFormat format, long position)

Extracts the position and format from the segment start message. MT safe.

parseStateChanged
void parseStateChanged(GstState oldstate, GstState newstate, GstState pending)

Extracts the old and new states from the GstMessage.

parseStepDone
void parseStepDone(GstFormat format, ulong amount, double rate, int flush, int intermediate, ulong duration, int eos)

Extract the values the step_done message. MT safe.

parseStepStart
void parseStepStart(int active, GstFormat format, ulong amount, double rate, int flush, int intermediate)

Extract the values from step_start message. MT safe.

parseStreamStatus
void parseStreamStatus(GstStreamStatusType type, Element owner)

Extracts the stream status type and owner the GstMessage. The returned owner remains valid for as long as the reference to message is valid and should thus not be unreffed. MT safe.

parseStructureChange
void parseStructureChange(GstStructureChangeType type, Element owner, int busy)

Extracts the change type and completion status from the GstMessage. MT safe.

parseToc
void parseToc(Toc toc, int updated)

Extract thef TOC from the GstMessage. The TOC returned in the output argument is a copy; the caller must free it with gst_toc_unref() when done. MT safe.

parseWarning
void parseWarning(ErrorG gerror, string dbug)

Extracts the GError and debug string from the GstMessage. The values returned in the output arguments are copies; the caller must free them when done. MT safe.

setBufferingStats
void setBufferingStats(GstBufferingMode mode, int avgIn, int avgOut, long bufferingLeft)

Configures the buffering stats values in message.

setGroupId
void setGroupId(uint groupId)

Sets the group id on the stream-start message. All streams that have the same group id are supposed to be played together, i.e. all streams inside a container file should have the same group id but different stream ids. The group id should change each time the stream is started, resulting in different group ids each time a file is played for example. MT safe. Since 1.2

setQosStats
void setQosStats(GstFormat format, ulong processed, ulong dropped)

Set the QoS stats representing the history of the current continuous pipeline playback period. When format is GST_FORMAT_UNDEFINED both dropped and processed are invalid. Values of -1 for either processed or dropped mean unknown values. MT safe.

setQosValues
void setQosValues(long jitter, double proportion, int quality)

Set the QoS values that have been calculated/analysed from the QoS data MT safe.

setSeqnum
void setSeqnum(uint 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.

setStreamStatusObject
void setStreamStatusObject(Value object)

Configures the object handling the streaming thread. This is usually a GstTask object but other objects might be added in the future.

src
ObjectGst src()

Get the src (the element that originated the message) of the message.

type
GstMessageType type()

Get the type of the message.

unref
void unref()

Convenience macro to decrease the reference count of the message, possibly freeing it.

Static functions

newAsyncDone
Message newAsyncDone(ObjectGst src, GstClockTime runningTime)

The message is posted when elements completed an ASYNC state change. running_time contains the time of the desired running_time when this elements goes to PLAYING. A value of GST_CLOCK_TIME_NONE for running_time means that the element has no clock interaction and thus doesn't care about the running_time of the pipeline.

newAsyncStart
Message newAsyncStart(ObjectGst src)

This message is posted by elements when they start an ASYNC state change.

newDurationChanged
Message newDurationChanged(ObjectGst src)

Create a new duration changed message. This message is posted by elements that know the duration of a stream when the duration changes. This message is received by bins and is used to calculate the total duration of a pipeline. Elements may post a duration message with a duration of GST_CLOCK_TIME_NONE to indicate that the duration has changed and the cached duration should be discarded. The new duration can then be retrieved via a query.

newEOS
Message newEOS(ObjectGst src)

Create a new eos message. This message is generated and posted in the sink elements of a GstBin. The bin will only forward the EOS message to the application if all sinks have posted an EOS message. MT safe.

newElement
Message newElement(ObjectGst src, Structure structure)

Create a new element-specific message. This is meant as a generic way of allowing one-way communication from an element to an application, for example "the firewire cable was unplugged". The format of the message should be documented in the element's documentation. The structure field can be NULL. MT safe.

newError
Message newError(ObjectGst src, ErrorG error, string dbug)

Create a new error message. The message will copy error and debug. This message is posted by element when a fatal event occured. The pipeline will probably (partially) stop. The application receiving this message should stop the pipeline. MT safe.

newInfo
Message newInfo(ObjectGst src, ErrorG error, string dbug)

Create a new info message. The message will make copies of error and debug. MT safe. Since 0.10.12

newLatency
Message newLatency(ObjectGst src)

This message can be posted by elements when their latency requirements have changed.

newNewClock
Message newNewClock(ObjectGst src, Clock clock)

Create a new clock message. This message is posted whenever the pipeline selectes a new clock for the pipeline. MT safe.

newSegmentDone
Message newSegmentDone(ObjectGst src, GstFormat format, long position)

Create a new segment done message. This message is posted by elements that finish playback of a segment as a result of a segment seek. This message is received by the application after all elements that posted a segment_start have posted the segment_done. MT safe.

newSegmentStart
Message newSegmentStart(ObjectGst src, GstFormat format, long position)

Create a new segment message. This message is posted by elements that start playback of a segment as a result of a segment seek. This message is not received by the application but is used for maintenance reasons in container elements. MT safe.

newStateDirty
Message newStateDirty(ObjectGst src)

Create a state dirty message. This message is posted whenever an element changed its state asynchronously and is used internally to update the states of container objects. MT safe.

newWarning
Message newWarning(ObjectGst src, ErrorG error, string dbug)

Create a new warning message. The message will make copies of error and debug. MT safe.

replace
int replace(Message oldMessage, Message newMessage)

Modifies a pointer to a GstMessage to point to a different GstMessage. The modification is done atomically (so this is useful for ensuring thread safety in some cases), and the reference counts are updated appropriately (the old message is unreffed, the new one is reffed). Either new_message or the GstMessage pointed to by old_message may be NULL.

typeGetName
string typeGetName(GstMessageType type)

Get a printable name for the given message type. Do not modify or free.

typeToQuark
GQuark typeToQuark(GstMessageType type)

Get the unique quark for the given message type.

Variables

gstMessage
GstMessage* gstMessage;

the main Gtk struct

Meta