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 send_event and elements will use
send_event or push_event. 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
Event.seek 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");
...
- public Event.buffer_size (Format format, int64 minsize, int64 maxsize, bool @async)
Create a new buffersize event.
- public Event.caps (Caps caps)
Create a new CAPS event for caps
.
- public Event.custom (EventType type, owned Structure structure)
Create a new custom-typed event.
- public Event.eos ()
Create a new EOS event.
- public Event.flush_start ()
Allocate a new flush start event.
- public Event.flush_stop (bool reset_time)
Allocate a new flush stop event.
- public Event.gap (ClockTime timestamp, ClockTime duration)
Create a new GAP event.
- public Event.instant_rate_change (double rate_multiplier, SegmentFlags new_flags)
Create a new instant-rate-change event.
- public Event.instant_rate_sync_time (double rate_multiplier, ClockTime running_time, ClockTime upstream_running_time)
Create a new instant-rate-sync-time event.
- public Event.latency (ClockTime latency)
Create a new latency event.
- public Event.navigation (owned Structure structure)
Create a new navigation event from the given description.
- public Event.protection (string system_id, 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.
- public Event.qos (QOSType type, double proportion, ClockTimeDiff diff, ClockTime timestamp)
Allocate a new qos event with the given values.
- public Event.reconfigure ()
Create a new reconfigure event.
- public Event.seek (double rate, Format format, SeekFlags flags, SeekType start_type, int64 start, SeekType stop_type, int64 stop)
Allocate a new seek event with the given parameters.
- public Event.segment (Segment segment)
Create a new SEGMENT event for segment
.
- public Event.segment_done (Format format, int64 position)
Create a new segment-done event.
- public Event.select_streams (List<string> streams)
Allocate a new select-streams event.
- public Event.sink_message (string name, Message msg)
Create a new sink-message event.
- public Event.step (Format format, uint64 amount, double rate, bool flush, bool intermediate)
Create a new step event.
- public Event.stream_collection (StreamCollection collection)
Create a new STREAM_COLLECTION event.
- public Event.stream_group_done (uint group_id)
Create a new Stream Group Done event.
- public Event.stream_start (string stream_id)
Create a new STREAM_START event.
- public Event.tag (owned TagList taglist)
Generates a metadata tag event from the given taglist
.
- public Event.toc (Toc toc, bool updated)
Generate a TOC event from the given toc
.
- public Event.toc_select (string uid)
Generate a TOC select event with the given uid
.
- public void copy_segment (Segment segment)
Parses a segment this and copies the
Segment into the location given by segment
.
- public int64 get_running_time_offset ()
Retrieve the accumulated running time offset of the event.
- public uint32 get_seqnum ()
Retrieve the sequence number of a event.
- public unowned Structure? get_structure ()
Access the structure of the event.
- public bool has_name (string name)
Checks if this has the given
name
.
- public bool has_name_id (Quark name)
Checks if this has the given
name
.
- public void parse_buffer_size (out Format format, out int64 minsize, out int64 maxsize, out bool @async)
Get the format, minsize, maxsize and async-flag in the buffersize
event.
- public void parse_caps (out unowned Caps caps)
Get the caps from this.
- public void parse_flush_stop (out bool reset_time)
Parse the FLUSH_STOP event and retrieve the reset_time
member.
- public void parse_gap (out ClockTime timestamp, out ClockTime duration)
Extract timestamp and duration from a new GAP event.
- public void parse_gap_flags (out GapFlags flags)
Retrieve the gap flags that may have been set on a gap event with
set_gap_flags.
- public bool parse_group_id (out uint group_id)
- public void parse_instant_rate_change (out double rate_multiplier, out SegmentFlags new_flags)
Extract rate and flags from an instant-rate-change event.
- public void parse_instant_rate_sync_time (out double rate_multiplier, out ClockTime running_time, out ClockTime upstream_running_time)
Extract the rate multiplier and running times from an
instant-rate-sync-time event.
- public void parse_latency (out ClockTime latency)
Get the latency in the latency event.
- public void parse_protection (out unowned string system_id, out unowned Buffer data, out unowned string origin)
Parses an event containing protection system specific information and
stores the results in system_id
, data
and origin
.
- public void parse_qos (out QOSType type, out double proportion, out ClockTimeDiff diff, out ClockTime timestamp)
Get the type, proportion, diff and timestamp in the qos event.
- public void parse_seek (out double rate, out Format format, out SeekFlags flags, out SeekType start_type, out int64 start, out SeekType stop_type, out int64 stop)
Parses a seek this and stores the
results in the given result locations.
- public void parse_seek_trickmode_interval (out ClockTime interval)
- public void parse_segment (out unowned Segment segment)
Parses a segment this and stores the
result in the given segment
location.
- public void parse_segment_done (out Format format, out int64 position)
Extracts the position and format from the segment done message.
- public void parse_select_streams (out List<string> streams)
Parse the SELECT_STREAMS event and retrieve the contained streams.
- public void parse_sink_message (out Message msg)
Parse the sink-message event.
- public void parse_step (out Format format, out uint64 amount, out double rate, out bool flush, out bool intermediate)
Parse the step event.
- public void parse_stream (out Stream stream)
Parse a stream-start this and
extract the Stream from it.
- public void parse_stream_collection (out StreamCollection collection)
- public void parse_stream_flags (out StreamFlags flags)
- public void parse_stream_group_done (out uint group_id)
Parse a stream-group-done this and
store the result in the given group_id
location.
- public void parse_stream_start (out unowned string stream_id)
Parse a stream-id this and store the
result in the given stream_id
location.
- public void parse_tag (out unowned TagList taglist)
Parses a tag this and stores the
results in the given taglist
location.
- public void parse_toc (out Toc toc, out bool updated)
Parse a TOC this and store the
results in the given toc
and updated
locations.
- public void parse_toc_select (out string uid)
Parse a TOC select this and store
the results in the given uid
location.
- public void set_gap_flags (GapFlags flags)
Sets flags
on this to
give additional information about the reason for the GAP.
- public void set_group_id (uint group_id)
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.
- public void set_running_time_offset (int64 offset)
Set the running time offset of a event.
- public void set_seek_trickmode_interval (ClockTime interval)
Sets a trickmode interval on a (writable) seek event.
- public void set_seqnum (uint32 seqnum)
Set the sequence number of a event.
- public void set_stream (Stream stream)
Set the stream
on the stream-start
this
- public void set_stream_flags (StreamFlags flags)
- public unowned Structure writable_structure ()
Get a writable version of the structure.