Event

The event class provides factory methods to construct events for sending and functions to query (parse) received events.

Events are usually created with gst_event_new_*() which takes event-type specific parameters as arguments. To send an event application will usually use gst.element.Element.sendEvent and elements will use gst.pad.Pad.sendEvent or gst.pad.Pad.pushEvent. The event should be unreffed with gst_event_unref() if it has not been sent.

Events that have been received can be parsed with their respective gst_event_parse_*() functions. It is valid to pass null for unwanted details.

Events are passed between elements in parallel to the data stream. Some events are serialized with buffers, others are not. Some events only travel downstream, others only upstream. Some events can travel both upstream and downstream.

The events are used to signal special conditions in the datastream such as EOS (end of stream) or the start of a new stream-segment. Events are also used to flush the pipeline of any pending data.

Most of the event API is used inside plugins. Applications usually only construct and use seek events. To do that gst.event.Event.newSeek is used to create a seek event. It takes the needed parameters to specify seeking time and mode.

GstEvent *event;
gboolean result;
...
// construct a seek event to play the media from second 2 to 5, flush
// the pipeline to decrease latency.
event = gst_event_new_seek (1.0,
   GST_FORMAT_TIME,
   GST_SEEK_FLAG_FLUSH,
   GST_SEEK_TYPE_SET, 2 * GST_SECOND,
   GST_SEEK_TYPE_SET, 5 * GST_SECOND);
...
result = gst_element_send_event (pipeline, event);
if (!result)
  g_warning ("seek failed");
...
class Event : Boxed {}

Members

Functions

copySegment
void copySegment(gst.segment.Segment segment)

Parses a segment event and copies the #GstSegment into the location given by segment.

getRunningTimeOffset
long getRunningTimeOffset()

Retrieve the accumulated running time offset of the event.

getSeqnum
uint getSeqnum()

Retrieve the sequence number of a event.

getStructure
gst.structure.Structure getStructure()

Access the structure of the event.

hasName
bool hasName(string name)

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

hasNameId
bool hasNameId(glib.types.Quark name)

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

parseBufferSize
void parseBufferSize(gst.types.Format format, long minsize, long maxsize, bool async)

Get the format, minsize, maxsize and async-flag in the buffersize event.

parseCaps
void parseCaps(gst.caps.Caps caps)

Get the caps from event. The caps remains valid as long as event remains valid.

parseFlushStop
void parseFlushStop(bool resetTime)

Parse the FLUSH_STOP event and retrieve the reset_time member.

parseGap
void parseGap(gst.types.ClockTime timestamp, gst.types.ClockTime duration)

Extract timestamp and duration from a new GAP event.

parseGapFlags
void parseGapFlags(gst.types.GapFlags flags)

Retrieve the gap flags that may have been set on a gap event with gst.event.Event.setGapFlags.

parseGroupId
bool parseGroupId(uint groupId)
parseInstantRateChange
void parseInstantRateChange(double rateMultiplier, gst.types.SegmentFlags newFlags)

Extract rate and flags from an instant-rate-change event.

parseInstantRateSyncTime
void parseInstantRateSyncTime(double rateMultiplier, gst.types.ClockTime runningTime, gst.types.ClockTime upstreamRunningTime)

Extract the rate multiplier and running times from an instant-rate-sync-time event.

parseLatency
void parseLatency(gst.types.ClockTime latency)

Get the latency in the latency event.

parseProtection
void parseProtection(string systemId, gst.buffer.Buffer data, string origin)

Parses an event containing protection system specific information and stores the results in system_id, data and origin. The data stored in system_id, origin and data are valid until event is released.

parseQos
void parseQos(gst.types.QOSType type, double proportion, gst.types.ClockTimeDiff diff, gst.types.ClockTime timestamp)

Get the type, proportion, diff and timestamp in the qos event. See gst.event.Event.newQos for more information about the different QoS values.

parseSeek
void parseSeek(double rate, gst.types.Format format, gst.types.SeekFlags flags, gst.types.SeekType startType, long start, gst.types.SeekType stopType, long stop)

Parses a seek event and stores the results in the given result locations.

parseSeekTrickmodeInterval
void parseSeekTrickmodeInterval(gst.types.ClockTime interval)

Retrieve the trickmode interval that may have been set on a seek event with gst.event.Event.setSeekTrickmodeInterval.

parseSegment
void parseSegment(gst.segment.Segment segment)

Parses a segment event and stores the result in the given segment location. segment remains valid only until the event is freed. Don't modify the segment and make a copy if you want to modify it or store it for later use.

parseSegmentDone
void parseSegmentDone(gst.types.Format format, long position)

Extracts the position and format from the segment done message.

parseSelectStreams
void parseSelectStreams(string[] streams)

Parse the SELECT_STREAMS event and retrieve the contained streams.

parseSinkMessage
void parseSinkMessage(gst.message.Message msg)

Parse the sink-message event. Unref msg after usage.

parseStep
void parseStep(gst.types.Format format, ulong amount, double rate, bool flush, bool intermediate)

Parse the step event.

parseStream
void parseStream(gst.stream.Stream stream)

Parse a stream-start event and extract the #GstStream from it.

parseStreamCollection
void parseStreamCollection(gst.stream_collection.StreamCollection collection)

Retrieve new #GstStreamCollection from STREAM_COLLECTION event event.

parseStreamFlags
void parseStreamFlags(gst.types.StreamFlags flags)
parseStreamGroupDone
void parseStreamGroupDone(uint groupId)

Parse a stream-group-done event and store the result in the given group_id location.

parseStreamStart
void parseStreamStart(string streamId)

Parse a stream-id event and store the result in the given stream_id location. The string stored in stream_id must not be modified and will remain valid only until event gets freed. Make a copy if you want to modify it or store it for later use.

parseTag
void parseTag(gst.tag_list.TagList taglist)

Parses a tag event and stores the results in the given taglist location. No reference to the taglist will be returned, it remains valid only until the event is freed. Don't modify or free the taglist, make a copy if you want to modify it or store it for later use.

parseToc
void parseToc(gst.toc.Toc toc, bool updated)

Parse a TOC event and store the results in the given toc and updated locations.

parseTocSelect
void parseTocSelect(string uid)

Parse a TOC select event and store the results in the given uid location.

setGapFlags
void setGapFlags(gst.types.GapFlags flags)

Sets flags on event to give additional information about the reason for the #GST_EVENT_GAP.

setGroupId
void setGroupId(uint groupId)

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.

setRunningTimeOffset
void setRunningTimeOffset(long offset)

Set the running time offset of a event. See gst.event.Event.getRunningTimeOffset for more information.

setSeekTrickmodeInterval
void setSeekTrickmodeInterval(gst.types.ClockTime interval)

Sets a trickmode interval on a (writable) seek event. Elements that support TRICKMODE_KEY_UNITS seeks SHOULD use this as the minimal interval between each frame they may output.

setSeqnum
void setSeqnum(uint seqnum)

Set the sequence number of a event.

setStream
void setStream(gst.stream.Stream stream)

Set the stream on the stream-start event

setStreamFlags
void setStreamFlags(gst.types.StreamFlags flags)
writableStructure
gst.structure.Structure writableStructure()

Get a writable version of the structure.

Static functions

newBufferSize
gst.event.Event newBufferSize(gst.types.Format format, long minsize, long maxsize, bool async)

Create a new buffersize event. The event is sent downstream and notifies elements that they should provide a buffer of the specified dimensions.

newCaps
gst.event.Event newCaps(gst.caps.Caps caps)

Create a new CAPS event for caps. The caps event can only travel downstream synchronized with the buffer flow and contains the format of the buffers that will follow after the event.

newCustom
gst.event.Event newCustom(gst.types.EventType type, gst.structure.Structure structure)

Create a new custom-typed event. This can be used for anything not handled by other event-specific functions to pass an event to another element.

newEos
gst.event.Event newEos()

Create a new EOS event. The eos event can only travel downstream synchronized with the buffer flow. Elements that receive the EOS event on a pad can return #GST_FLOW_EOS as a #GstFlowReturn when data after the EOS event arrives.

newFlushStart
gst.event.Event newFlushStart()

Allocate a new flush start event. The flush start event can be sent upstream and downstream and travels out-of-bounds with the dataflow.

newFlushStop
gst.event.Event newFlushStop(bool resetTime)

Allocate a new flush stop event. The flush stop event can be sent upstream and downstream and travels serialized with the dataflow. It is typically sent after sending a FLUSH_START event to make the pads accept data again.

newGap
gst.event.Event newGap(gst.types.ClockTime timestamp, gst.types.ClockTime duration)

Create a new GAP event. A gap event can be thought of as conceptually equivalent to a buffer to signal that there is no data for a certain amount of time. This is useful to signal a gap to downstream elements which may wait for data, such as muxers or mixers or overlays, especially for sparse streams such as subtitle streams.

newInstantRateChange
gst.event.Event newInstantRateChange(double rateMultiplier, gst.types.SegmentFlags newFlags)

Create a new instant-rate-change event. This event is sent by seek handlers (e.g. demuxers) when receiving a seek with the gst.types.SeekFlags.InstantRateChange and signals to downstream elements that the playback rate in the existing segment should be immediately multiplied by the rate_multiplier factor.

newInstantRateSyncTime
gst.event.Event newInstantRateSyncTime(double rateMultiplier, gst.types.ClockTime runningTime, gst.types.ClockTime upstreamRunningTime)

Create a new instant-rate-sync-time event. This event is sent by the pipeline to notify elements handling the instant-rate-change event about the running-time when the new rate should be applied. The running time may be in the past when elements handle this event, which can lead to switching artifacts. The magnitude of those depends on the exact timing of event delivery to each element and the magnitude of the change in playback rate being applied.

newLatency
gst.event.Event newLatency(gst.types.ClockTime latency)

Create a new latency event. The event is sent upstream from the sinks and notifies elements that they should add an additional latency to the running time before synchronising against the clock.

newNavigation
gst.event.Event newNavigation(gst.structure.Structure structure)

Create a new navigation event from the given description.

newProtection
gst.event.Event newProtection(string systemId, gst.buffer.Buffer data, string origin)

Creates a new event containing information specific to a particular protection system (uniquely identified by system_id), by which that protection system can acquire key(s) to decrypt a protected stream.

newQos
gst.event.Event newQos(gst.types.QOSType type, double proportion, gst.types.ClockTimeDiff diff, gst.types.ClockTime timestamp)

Allocate a new qos event with the given values. The QOS event is generated in an element that wants an upstream element to either reduce or increase its rate because of high/low CPU load or other resource usage such as network performance or throttling. Typically sinks generate these events for each buffer they receive.

newReconfigure
gst.event.Event newReconfigure()

Create a new reconfigure event. The purpose of the reconfigure event is to travel upstream and make elements renegotiate their caps or reconfigure their buffer pools. This is useful when changing properties on elements or changing the topology of the pipeline.

newSeek
gst.event.Event newSeek(double rate, gst.types.Format format, gst.types.SeekFlags flags, gst.types.SeekType startType, long start, gst.types.SeekType stopType, long stop)

Allocate a new seek event with the given parameters.

newSegment
gst.event.Event newSegment(gst.segment.Segment segment)

Create a new SEGMENT event for segment. The segment event can only travel downstream synchronized with the buffer flow and contains timing information and playback properties for the buffers that will follow.

newSegmentDone
gst.event.Event newSegmentDone(gst.types.Format format, long position)

Create a new segment-done event. This event is sent by elements that finish playback of a segment as a result of a segment seek.

newSelectStreams
gst.event.Event newSelectStreams(string[] streams)

Allocate a new select-streams event.

newSinkMessage
gst.event.Event newSinkMessage(string name, gst.message.Message msg)

Create a new sink-message event. The purpose of the sink-message event is to instruct a sink to post the message contained in the event synchronized with the stream.

newStep
gst.event.Event newStep(gst.types.Format format, ulong amount, double rate, bool flush, bool intermediate)

Create a new step event. The purpose of the step event is to instruct a sink to skip amount (expressed in format) of media. It can be used to implement stepping through the video frame by frame or for doing fast trick modes.

newStreamCollection
gst.event.Event newStreamCollection(gst.stream_collection.StreamCollection collection)

Create a new STREAM_COLLECTION event. The stream collection event can only travel downstream synchronized with the buffer flow.

newStreamGroupDone
gst.event.Event newStreamGroupDone(uint groupId)

Create a new Stream Group Done event. The stream-group-done event can only travel downstream synchronized with the buffer flow. Elements that receive the event on a pad should handle it mostly like EOS, and emit any data or pending buffers that would depend on more data arriving and unblock, since there won't be any more data.

newStreamStart
gst.event.Event newStreamStart(string streamId)

Create a new STREAM_START event. The stream start event can only travel downstream synchronized with the buffer flow. It is expected to be the first event that is sent for a new stream.

newTag
gst.event.Event newTag(gst.tag_list.TagList taglist)

Generates a metadata tag event from the given taglist.

newToc
gst.event.Event newToc(gst.toc.Toc toc, bool updated)

Generate a TOC event from the given toc. The purpose of the TOC event is to inform elements that some kind of the TOC was found.

newTocSelect
gst.event.Event newTocSelect(string uid)

Generate a TOC select event with the given uid. The purpose of the TOC select event is to start playback based on the TOC's entry with the given uid.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.