Class (GI Struct)

Gst-1.0GstMessage

Messages are implemented as a subclass of Gst.MiniObject with a generic Gst.Structure 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 Gst.Bus.

The basic use pattern of posting a message on a Gst.Bus is as follows:

  gst_bus_post (bus, `gst_message_new_eos()`);

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

Index

Constructors

Properties

Methods

add_redirect_entry get_details get_num_redirect_entries get_seqnum get_stream_status_object get_structure has_name parse_async_done parse_buffering parse_buffering_stats parse_clock_lost parse_clock_provide parse_context_type parse_device_added parse_device_changed parse_device_removed parse_error parse_error_details parse_error_writable_details parse_group_id parse_have_context parse_info parse_info_details parse_info_writable_details parse_instant_rate_request parse_new_clock parse_progress parse_property_notify parse_qos parse_qos_stats parse_qos_values parse_redirect_entry parse_request_state parse_reset_time parse_segment_done parse_segment_start parse_state_changed parse_step_done parse_step_start parse_stream_collection parse_stream_status parse_streams_selected parse_structure_change parse_tag parse_toc parse_warning parse_warning_details parse_warning_writable_details set_buffering_stats set_details set_group_id set_qos_stats set_qos_values set_seqnum set_stream_status_object streams_selected_add streams_selected_get_size streams_selected_get_stream writable_details writable_structure new_application new_async_done new_async_start new_buffering new_clock_lost new_clock_provide new_custom new_device_added new_device_changed new_device_removed new_duration_changed new_element new_eos new_error new_error_with_details new_have_context new_info new_info_with_details new_instant_rate_request new_latency new_need_context new_new_clock new_progress new_property_notify new_qos new_redirect new_request_state new_reset_time new_segment_done new_segment_start new_state_changed new_state_dirty new_step_done new_step_start new_stream_collection new_stream_start new_stream_status new_streams_selected new_structure_change new_tag new_toc new_warning new_warning_with_details take

Constructors

Properties

seqnum: number
src: Gst.Object
timestamp: number
$gtype: GType<Gst.Message>

Methods

add_redirect_entry

  • add_redirect_entry(
        location: string,
        tag_list?: TagList,
        entry_struct?: Structure,
    ): void

    Creates and appends a new entry.

    The specified location string is copied. However, ownership over the tag list and structure are transferred to the message.

    Parameters

    • location: string

      location string for the new entry

    • Optionaltag_list: TagList

      tag list for the new entry

    • Optionalentry_struct: Structure

      structure for the new entry

    Returns void

  • Returns the optional details structure of the message. May be NULL if none.

    The returned structure must not be freed.

    Returns Structure

    The details, or NULL if none.

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

    Returns number

    The message's sequence number. MT safe.

  • Extracts the object managing the streaming thread from message.

    Returns GObject.Value

    a GValue containing the object that manages the streaming thread. This object is usually of type GstTask but other types can be added in the future. The object remains valid as long as message is valid.

  • Access the structure of the message.

    Returns Structure

    The structure of the message. The structure is still owned by the message, which means that you should not free it and that the pointer becomes invalid when you free the message. MT safe.

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

    Parameters

    • name: string

      name to check

    Returns boolean

    true if name matches the name of the message structure.

  • Extract the running_time from the async_done message.

    MT safe.

    Returns number

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

    MT safe.

    Returns number

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

    MT safe.

    Returns [Gst.Clock, boolean]

  • Parse a context type from an existing GST_MESSAGE_NEED_CONTEXT message.

    Returns [boolean, string]

    a gboolean indicating if the parsing succeeded.

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

    Typical usage of this function might be:

      ...
    switch (GST_MESSAGE_TYPE (msg)) {
    case GST_MESSAGE_ERROR: {
    GError *err = NULL;
    gchar *dbg_info = NULL;

    gst_message_parse_error (msg, &err, &dbg_info);
    g_printerr ("ERROR from element %s: %s\n",
    GST_OBJECT_NAME (msg->src), err->message);
    g_printerr ("Debugging info: %s\n", (dbg_info) ? dbg_info : "none");
    g_error_free (err);
    g_free (dbg_info);
    break;
    }
    ...
    }
    ...

    MT safe.

    Returns [GLib.Error, string]

  • Extract the group from the STREAM_START message.

    Returns [boolean, number]

    true if the message had a group id set, false otherwise MT safe.

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

    Returns [GLib.Error, string]

  • Parses the rate_multiplier from the instant-rate-request message.

    Returns number

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

    Returns [boolean, number, number, number, number]

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

    Returns [Gst.Format, number, number]

  • Extract the QoS values that have been calculated/analysed from the QoS data

    MT safe.

    Returns [number, number, number]

parse_redirect_entry

  • parse_redirect_entry(entry_index: number): [string, TagList, Structure]

    Parses the location and/or structure from the entry with the given index. The index must be between 0 and gst_message_get_num_redirect_entries() - 1. Returned pointers are valid for as long as this message exists.

    Parameters

    • entry_index: number

      index of the entry to parse

    Returns [string, TagList, Structure]

  • Extract the running-time from the RESET_TIME message.

    MT safe.

    Returns number

  • Extracts the old and new states from the GstMessage.

    Typical usage of this function might be:

      ...
    switch (GST_MESSAGE_TYPE (msg)) {
    case GST_MESSAGE_STATE_CHANGED: {
    GstState old_state, new_state;

    gst_message_parse_state_changed (msg, &old_state, &new_state, NULL);
    g_print ("Element %s changed state from %s to %s.\n",
    GST_OBJECT_NAME (msg->src),
    gst_element_state_get_name (old_state),
    gst_element_state_get_name (new_state));
    break;
    }
    ...
    }
    ...

    MT safe.

    Returns [Gst.State, Gst.State, Gst.State]

  • Extract the values the step_done message.

    MT safe.

    Returns [Gst.Format, number, number, boolean, boolean, number, boolean]

  • Extract the values from step_start message.

    MT safe.

    Returns [boolean, Gst.Format, number, number, boolean, boolean]

  • Extracts the tag list from the GstMessage. The tag list returned in the output argument is a copy; the caller must free it when done.

    Typical usage of this function might be:

      ...
    switch (GST_MESSAGE_TYPE (msg)) {
    case GST_MESSAGE_TAG: {
    GstTagList *tags = NULL;

    gst_message_parse_tag (msg, &tags);
    g_print ("Got tags from element %s\n", GST_OBJECT_NAME (msg->src));
    handle_tags (tags);
    gst_tag_list_unref (tags);
    break;
    }
    ...
    }
    ...

    MT safe.

    Returns TagList

  • Extract the TOC from the Gst.Message. The TOC returned in the output argument is a copy; the caller must free it with gst_toc_unref() when done.

    MT safe.

    Returns [Toc, boolean]

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

    Returns [GLib.Error, string]

  • Configures the buffering stats values in message.

    Parameters

    • mode: Gst.BufferingMode

      a buffering mode

    • avg_in: number

      the average input rate

    • avg_out: number

      the average output rate

    • buffering_left: number

      amount of buffering time left in milliseconds

    Returns void

  • Add details to message. Will fail if the message already has details set on it or if it is not writable.

    Parameters

    • Optionaldetails: Structure

      A GstStructure with details

    Returns void

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

    Parameters

    • group_id: number

      the group id

    Returns void

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

    Parameters

    • format: Gst.Format

      Units of the 'processed' and 'dropped' fields. Video sinks and video filters will use GST_FORMAT_BUFFERS (frames). Audio sinks and audio filters will likely use GST_FORMAT_DEFAULT (samples).

    • processed: number

      Total number of units correctly processed since the last state change to READY or a flushing operation.

    • dropped: number

      Total number of units dropped since the last state change to READY or a flushing operation.

    Returns void

  • Set the QoS values that have been calculated/analysed from the QoS data

    MT safe.

    Parameters

    • jitter: number

      The difference of the running-time against the deadline.

    • proportion: number

      Long term prediction of the ideal rate relative to normal rate to get optimal quality.

    • quality: number

      An element dependent integer value that specifies the current quality level of the element. The default maximum quality is 1000000.

    Returns void

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

    Parameters

    • seqnum: number

      A sequence number.

    Returns void

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

    Parameters

    • object: any

      the object controlling the streaming

    Returns void

  • Returns the number of streams contained in the message.

    Returns number

    The number of streams contained within.

  • Returns the details structure of the message. If not present it will be created. Use this function (instead of gst_message_get_details()) if you want to write to the details structure.

    The returned structure must not be freed.

    Returns Structure

    The details

  • Get a writable version of the structure.

    Returns Structure

    The structure of the message. The structure is still owned by the message, which means that you should not free it and that the pointer becomes invalid when you free the message. This function ensures that message is writable, and if so, will never return null. MT safe.

  • Parameters

    • src: Gst.Object
    • live: boolean
    • running_time: number
    • stream_time: number
    • timestamp: number
    • duration: number

    Returns Gst.Message

  • Parameters

    • src: Gst.Object
    • format: Gst.Format
    • amount: number
    • rate: number
    • flush: boolean
    • intermediate: boolean
    • duration: number
    • eos: boolean

    Returns Gst.Message