gst.event

Module for [Event] class

class Event

Types 1

classEvent : gobject.boxed.Boxed

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");
 ...

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup)
GType _gType() @property
Event self()Returns `this`, for use in `with` statements.
gst.mini_object.MiniObject miniObject() @propertyGet `miniObject` field. Returns: the parent structure
gst.types.EventType type() @propertyGet `type` field. Returns: the #GstEventType of the event
void type(gst.types.EventType propval) @propertySet `type` field. Params: propval = the #GstEventType of the event
ulong timestamp() @propertyGet `timestamp` field. Returns: the timestamp of the event
void timestamp(ulong propval) @propertySet `timestamp` field. Params: propval = the timestamp of the event
uint seqnum() @propertyGet `seqnum` field. Returns: the sequence number of the event
void seqnum(uint propval) @propertySet `seqnum` field. Params: propval = the sequence number of the event
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.
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.
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.
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 #GSTFLOWEOS as a #GstFlowReturn when data...
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.
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 th...
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 downstre...
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...
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. T...
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.
gst.event.Event newNavigation(gst.structure.Structure structure)Create a new navigation event from the given description.
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 s...
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 r...
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 p...
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.
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 w...
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.
gst.event.Event newSelectStreams(string[] streams)Allocate a new select-streams event.
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.
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 ...
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.
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...
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.
gst.event.Event newTag(gst.tag_list.TagList taglist)Generates a metadata tag event from the given taglist.
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.
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.
void copySegment(gst.segment.Segment segment)Parses a segment event and copies the #GstSegment into the location given by segment.
long getRunningTimeOffset()Retrieve the accumulated running time offset of the event.
uint getSeqnum()Retrieve the sequence number of a event.
gst.structure.Structure getStructure()Access the structure of the event. Returns: The structure of the event. The structure is still owned by the event, which means that you should not free it and that the pointer becomes invalid when ...
bool hasName(string name)Checks if event has the given name. This function is usually used to check the name of a custom event.
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.
void parseBufferSize(out gst.types.Format format, out long minsize, out long maxsize, out bool async)Get the format, minsize, maxsize and async-flag in the buffersize event.
void parseCaps(out gst.caps.Caps caps)Get the caps from event. The caps remains valid as long as event remains valid.
void parseFlushStop(out bool resetTime)Parse the FLUSHSTOP event and retrieve the resettime member.
void parseGap(out gst.types.ClockTime timestamp, out gst.types.ClockTime duration)Extract timestamp and duration from a new GAP event.
void parseGapFlags(out gst.types.GapFlags flags)Retrieve the gap flags that may have been set on a gap event with [gst.event.Event.setGapFlags].
bool parseGroupId(out uint groupId)
void parseInstantRateChange(out double rateMultiplier, out gst.types.SegmentFlags newFlags)Extract rate and flags from an instant-rate-change event.
void parseInstantRateSyncTime(out double rateMultiplier, out gst.types.ClockTime runningTime, out gst.types.ClockTime upstreamRunningTime)Extract the rate multiplier and running times from an instant-rate-sync-time event.
void parseLatency(out gst.types.ClockTime latency)Get the latency in the latency event.
void parseProtection(out string systemId, out gst.buffer.Buffer data, out string origin)Parses an event containing protection system specific information and stores the results in systemid, data and origin. The data stored in systemid, origin and data are valid until event is released.
void parseQos(out gst.types.QOSType type, out double proportion, out gst.types.ClockTimeDiff diff, out 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.
void parseSeek(out double rate, out gst.types.Format format, out gst.types.SeekFlags flags, out gst.types.SeekType startType, out long start, out gst.types.SeekType stopType, out long stop)Parses a seek event and stores the results in the given result locations.
void parseSeekTrickmodeInterval(out gst.types.ClockTime interval)Retrieve the trickmode interval that may have been set on a seek event with [gst.event.Event.setSeekTrickmodeInterval].
void parseSegment(out 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...
void parseSegmentDone(out gst.types.Format format, out long position)Extracts the position and format from the segment done message.
void parseSelectStreams(out string[] streams)Parse the SELECT_STREAMS event and retrieve the contained streams.
void parseSinkMessage(out gst.message.Message msg)Parse the sink-message event. Unref msg after usage.
void parseStep(out gst.types.Format format, out ulong amount, out double rate, out bool flush, out bool intermediate)Parse the step event.
void parseStream(out gst.stream.Stream stream)Parse a stream-start event and extract the #GstStream from it.
void parseStreamCollection(out gst.stream_collection.StreamCollection collection)Retrieve new #GstStreamCollection from STREAM_COLLECTION event event.
void parseStreamGroupDone(out uint groupId)Parse a stream-group-done event and store the result in the given group_id location.
void parseStreamStart(out string streamId)Parse a stream-id event and store the result in the given streamid location. The string stored in streamid must not be modified and will remain valid only until event gets freed. Make a copy if you...
void parseTag(out 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 tagli...
void parseToc(out gst.toc.Toc toc, out bool updated)Parse a TOC event and store the results in the given toc and updated locations.
void parseTocSelect(out string uid)Parse a TOC select event and store the results in the given uid location.
void setGapFlags(gst.types.GapFlags flags)Sets flags on event to give additional information about the reason for the #GSTEVENTGAP.
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 chan...
void setRunningTimeOffset(long offset)Set the running time offset of a event. See [gst.event.Event.getRunningTimeOffset] for more information.
void setSeekTrickmodeInterval(gst.types.ClockTime interval)Sets a trickmode interval on a (writable) seek event. Elements that support TRICKMODEKEYUNITS seeks SHOULD use this as the minimal interval between each frame they may output.
void setSeqnum(uint seqnum)Set the sequence number of a event.
void setStream(gst.stream.Stream stream)Set the stream on the stream-start event
gst.structure.Structure writableStructure()Get a writable version of the structure. Returns: The structure of the event. The structure is still owned by the event, which means that you should not free it and that the pointer becomes invalid...
Constructors
this(gst.types.EventType type = gst.types.EventType.init, ulong timestamp = ulong.init, uint seqnum = uint.init)Create a `event.Event` boxed type. Params: type = the #GstEventType of the event timestamp = the timestamp of the event seqnum = the sequence number of the event
this(void * ptr, Flag!"Take" take)