Class (GI Struct)

Gst-1.0GstEvent

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_send_event() and elements will use gst_pad_send_event() or gst_pad_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 gst_event_new_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");
...
Index

Constructors

  • Parameters

    • Optionalproperties: Partial<
          {
              mini_object: MiniObject;
              seqnum: number;
              timestamp: number;
              type: Gst.EventType;
          },
      >

    Returns Gst.Event

Properties

seqnum: number
timestamp: number
$gtype: GType<Gst.Event>

Methods

  • Retrieve the accumulated running time offset of the event.

    Events passing through GstPads that have a running time offset set via gst_pad_set_offset() will get their offset adjusted according to the pad's offset.

    If the event contains any information that related to the running time, this information will need to be updated before usage with this offset.

    Returns number

    The event's running time offset MT safe.

  • Retrieve the sequence number of a event.

    Events have ever-incrementing sequence numbers, which may also be set explicitly via gst_event_set_seqnum(). Sequence numbers are typically used to indicate that a event corresponds to some other set of events or messages, for example an EOS event 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 number

    The event's sequence number. MT safe.

  • Access the structure of the event.

    Returns Structure

    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 you free the event. MT safe.

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

    Parameters

    • name: string

      name to check

    Returns boolean

    true if name matches the name of the event structure.

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

    Parameters

    • name: number

      name to check as a GQuark

    Returns boolean

    true if name matches the name of the event structure.

  • Tests if you can safely modify event. It is only safe to modify event when there is only one owner of the event - ie, the object is writable.

    Returns boolean

  • Returns a writable copy of event.

    If there is only one reference count on event, the caller must be the owner, and so this function will return the event object unchanged. If on the other hand there is more than one reference on the object, a new event object will be returned. The caller's reference on event will be removed, and instead the caller will own a reference to the returned object.

    In short, this function unrefs the event in the argument and refs the event that it returns. Don't access the argument after calling this function. See also: gst_event_ref().

    Returns Gst.Event

    a writable event which may or may not be the same as event

  • Parse the FLUSH_STOP event and retrieve the reset_time member.

    Returns boolean

  • Extract timestamp and duration from a new GAP event.

    Returns [number, number]

  • Returns [boolean, number]

    true if a group id was set on the event and could be parsed, false otherwise.

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

    Returns [number, number, number]

  • 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.

    Returns [string, Gst.Buffer, string]

  • Get the type, proportion, diff and timestamp in the qos event. See gst_event_new_qos() for more information about the different QoS values.

    timestamp will be adjusted for any pad offsets of pads it was passing through.

    Returns [Gst.QOSType, number, number, number]

  • Retrieve the trickmode interval that may have been set on a seek event with gst_event_set_seek_trickmode_interval().

    Returns number

  • 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.

    Returns Segment

  • Parse the SELECT_STREAMS event and retrieve the contained streams.

    Returns string[]

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

    Returns number

  • 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.

    Returns string

  • 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.

    Returns TagList

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

    Returns [Toc, boolean]

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

    Returns string

  • 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.

    Use gst_util_group_id_next() to get a new group id.

    Parameters

    • group_id: number

      the group id to set

    Returns void

  • Set the running time offset of a event. See gst_event_get_running_time_offset() for more information.

    MT safe.

    Parameters

    • offset: number

      A the new running time offset

    Returns void

  • 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.

    Parameters

    • interval: number

    Returns void

  • Set the sequence number of a event.

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

    MT safe.

    Parameters

    • seqnum: number

      A sequence number.

    Returns void

  • Get a writable version of the structure.

    Returns Structure

    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 you free the event. This function ensures that event is writable, and if so, will never return null. MT safe.

  • Parameters

    • rate_multiplier: number
    • running_time: number
    • upstream_running_time: number

    Returns Gst.Event