Class (GI Class)

GstApp-1.0GstAppAppSrc

The appsrc element can be used by applications to insert data into a GStreamer pipeline. Unlike most GStreamer elements, appsrc provides external API functions.

appsrc can be used by linking with the libgstapp library to access the methods directly or by using the appsrc action signals.

Before operating appsrc, the caps property must be set to fixed caps describing the format of the data that will be pushed with appsrc. An exception to this is when pushing buffers with unknown caps, in which case no caps should be set. This is typically true of file-like sources that push raw byte buffers. If you don't want to explicitly set the caps, you can use gst_app_src_push_sample. This method gets the caps associated with the sample and sets them on the appsrc replacing any previously set caps (if different from sample's caps).

The main way of handing data to the appsrc element is by calling the gst_app_src_push_buffer() method or by emitting the push-buffer action signal. This will put the buffer onto a queue from which appsrc will read from in its streaming thread. It is important to note that data transport will not happen from the thread that performed the push-buffer call.

The "max-bytes", "max-buffers" and "max-time" properties control how much data can be queued in appsrc before appsrc considers the queue full. A filled internal queue will always signal the "enough-data" signal, which signals the application that it should stop pushing data into appsrc. The "block" property will cause appsrc to block the push-buffer method until free data becomes available again.

When the internal queue is running out of data, the "need-data" signal is emitted, which signals the application that it should start pushing more data into appsrc.

In addition to the "need-data" and "enough-data" signals, appsrc can emit the "seek-data" signal when the "stream-mode" property is set to "seekable" or "random-access". The signal argument will contain the new desired position in the stream expressed in the unit set with the "format" property. After receiving the seek-data signal, the application should push-buffers from the new position.

These signals allow the application to operate the appsrc in two different ways:

The push mode, in which the application repeatedly calls the push-buffer/push-sample method with a new buffer/sample. Optionally, the queue size in the appsrc can be controlled with the enough-data and need-data signals by respectively stopping/starting the push-buffer/push-sample calls. This is a typical mode of operation for the stream-type "stream" and "seekable". Use this mode when implementing various network protocols or hardware devices.

The pull mode, in which the need-data signal triggers the next push-buffer call. This mode is typically used in the "random-access" stream-type. Use this mode for file access or other randomly accessible sources. In this mode, a buffer of exactly the amount of bytes given by the need-data signal should be pushed into appsrc.

In all modes, the size property on appsrc should contain the total stream size in bytes. Setting this property is mandatory in the random-access mode. For the stream and seekable modes, setting this property is optional but recommended.

When the application has finished pushing data into appsrc, it should call gst_app_src_end_of_stream() or emit the end-of-stream action signal. After this call, no more buffers can be pushed into appsrc until a flushing seek occurs or the state of the appsrc has gone through READY.

Hierarchy (View Summary)

Implements

Index

Constructors

Properties

Properties - Inherited from GstBase

Accessors

Accessors - Inherited from GstBase

Methods

Methods - Inherited from GstBase

abort_state add_control_binding add_pad add_property_deep_notify_watch add_property_notify_watch call_async change_state continue_state create_all_pads decorate_stream_id default_error foreach_pad foreach_sink_pad foreach_src_pad get_allocator get_base_time get_blocksize get_buffer_pool get_bus get_clock get_compatible_pad get_compatible_pad_template get_context get_context_unlocked get_contexts get_control_binding get_control_rate get_current_clock_time get_current_running_time get_do_timestamp get_factory get_g_value_array get_metadata get_name get_pad_template get_pad_template_list get_parent get_path_string get_request_pad get_start_time get_state get_static_pad get_value has_active_control_bindings has_ancestor has_as_ancestor has_as_parent is_async is_locked_state iterate_pads iterate_sink_pads iterate_src_pads link link_filtered link_pads link_pads_filtered link_pads_full lost_state message_full message_full_with_details negotiate new_seamless_segment new_segment no_more_pads post_message provide_clock push_segment query query_convert query_duration query_latency query_position release_request_pad remove_control_binding remove_pad remove_property_notify_watch request_pad request_pad_simple seek seek_simple send_event set_async set_automatic_eos set_base_time set_blocksize set_bus set_clock set_context set_control_binding_disabled set_control_bindings_disabled set_control_rate set_do_timestamp set_dynamic_size set_format set_live set_locked_state set_name set_parent set_start_time set_state start_complete start_wait submit_buffer_list suggest_next_sync sync_state_with_parent sync_values unlink unlink_pads unparent vfunc_alloc vfunc_change_state vfunc_create vfunc_decide_allocation vfunc_deep_notify vfunc_do_seek vfunc_event vfunc_fill vfunc_fixate vfunc_get_caps vfunc_get_size vfunc_get_state vfunc_get_times vfunc_is_seekable vfunc_negotiate vfunc_no_more_pads vfunc_pad_added vfunc_pad_removed vfunc_post_message vfunc_prepare_seek_segment vfunc_provide_clock vfunc_query vfunc_release_pad vfunc_request_new_pad vfunc_send_event vfunc_set_bus vfunc_set_caps vfunc_set_clock vfunc_set_context vfunc_set_state vfunc_start vfunc_state_changed vfunc_stop vfunc_unlock vfunc_unlock_stop wait_playing _classInit add_metadata add_pad_template add_static_metadata add_static_pad_template add_static_pad_template_with_gtype check_uniqueness compat_control default_deep_notify find_property get_metadata get_pad_template get_pad_template_list install_properties install_property interface_find_property interface_install_property interface_list_properties list_properties make_from_uri newv override_property register replace set_metadata set_static_metadata state_change_return_get_name state_get_name type_set_skip_documentation

Constructors

Properties

Compile-time signal type information.

This instance property is generated only for TypeScript type checking. It is not defined at runtime and should not be accessed in JS code.

basesrc: GstBase.BaseSrc
is_live: any

Instruct the source to behave like a live source. This includes that it will only push out buffers in the PLAYING state.

Properties - Inherited from GstBase

base_time: number
bus: Gst.Bus
can_activate_push: boolean
clock: Gst.Clock
clock_id: any
current_state: Gst.State
element: Gst.Element
flags: number
last_return: Gst.StateChangeReturn
live_running: boolean
need_newsegment: boolean
next_state: Gst.State
num_buffers_left: number
numpads: number
numsinkpads: number
numsrcpads: number
object: Gst.Object
pads: Gst.Pad[]
pads_cookie: number
pending_state: Gst.State
random_access: boolean
running: boolean
sinkpads: Gst.Pad[]
srcpad: Gst.Pad
srcpads: Gst.Pad[]
start_time: number
state_cookie: number
target_state: Gst.State

Accessors

  • get block(): boolean

    When max-bytes are queued and after the enough-data signal has been emitted, block any further push-buffer calls until the amount of queued bytes drops below the max-bytes limit.

    Returns boolean

  • set block(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get current_level_buffers(): number

    The number of currently queued buffers inside appsrc.

    Returns number

    1.20

  • get duration(): number

    The total duration in nanoseconds of the data stream. If the total duration is known, it is recommended to configure it with this property.

    Returns number

    1.10

  • set duration(val: number): void

    Parameters

    • val: number

    Returns void

  • get emit_signals(): boolean

    Make appsrc emit the "need-data", "enough-data" and "seek-data" signals. This option is by default enabled for backwards compatibility reasons but can disabled when needed because signal emission is expensive.

    Returns boolean

  • set emit_signals(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get emitSignals(): boolean

    Make appsrc emit the "need-data", "enough-data" and "seek-data" signals. This option is by default enabled for backwards compatibility reasons but can disabled when needed because signal emission is expensive.

    Returns boolean

  • set emitSignals(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get handle_segment_change(): boolean

    When enabled, appsrc will check GstSegment in GstSample which was pushed via gst_app_src_push_sample() or "push-sample" signal action. If a GstSegment is changed, corresponding segment event will be followed by next data flow.

    FIXME: currently only GST_FORMAT_TIME format is supported and therefore GstAppSrc::format should be time. However, possibly GstApp.AppSrc can support other formats.

    Returns boolean

    1.18

  • set handle_segment_change(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get handleSegmentChange(): boolean

    When enabled, appsrc will check GstSegment in GstSample which was pushed via gst_app_src_push_sample() or "push-sample" signal action. If a GstSegment is changed, corresponding segment event will be followed by next data flow.

    FIXME: currently only GST_FORMAT_TIME format is supported and therefore GstAppSrc::format should be time. However, possibly GstApp.AppSrc can support other formats.

    Returns boolean

    1.18

  • set handleSegmentChange(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get max_buffers(): number

    The maximum amount of buffers that can be queued internally. After the maximum amount of buffers are queued, appsrc will emit the "enough-data" signal.

    Returns number

    1.20

  • set max_buffers(val: number): void

    Parameters

    • val: number

    Returns void

  • get max_bytes(): number

    The maximum amount of bytes that can be queued internally. After the maximum amount of bytes are queued, appsrc will emit the "enough-data" signal.

    Returns number

  • set max_bytes(val: number): void

    Parameters

    • val: number

    Returns void

  • get max_time(): number

    The maximum amount of time that can be queued internally. After the maximum amount of time are queued, appsrc will emit the "enough-data" signal.

    Returns number

    1.20

  • set max_time(val: number): void

    Parameters

    • val: number

    Returns void

  • get maxBuffers(): number

    The maximum amount of buffers that can be queued internally. After the maximum amount of buffers are queued, appsrc will emit the "enough-data" signal.

    Returns number

    1.20

  • set maxBuffers(val: number): void

    Parameters

    • val: number

    Returns void

  • get maxBytes(): number

    The maximum amount of bytes that can be queued internally. After the maximum amount of bytes are queued, appsrc will emit the "enough-data" signal.

    Returns number

  • set maxBytes(val: number): void

    Parameters

    • val: number

    Returns void

  • get maxTime(): number

    The maximum amount of time that can be queued internally. After the maximum amount of time are queued, appsrc will emit the "enough-data" signal.

    Returns number

    1.20

  • set maxTime(val: number): void

    Parameters

    • val: number

    Returns void

  • get min_percent(): number

    Make appsrc emit the "need-data" signal when the amount of bytes in the queue drops below this percentage of max-bytes.

    Returns number

  • set min_percent(val: number): void

    Parameters

    • val: number

    Returns void

Accessors - Inherited from GstBase

  • get automatic_eos(): boolean

    See gst_base_src_set_automatic_eos()

    Returns boolean

    1.24

  • set automatic_eos(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get automaticEos(): boolean

    See gst_base_src_set_automatic_eos()

    Returns boolean

    1.24

  • set automaticEos(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get parent(): Gst.Object

    The parent of the object. Please note, that when changing the 'parent' property, we don't emit GObject.Object::notify and Gst.Object.SignalSignatures.deep_notify | Gst.Object::deep-notify signals due to locking issues. In some cases one can use Gst.Bin.SignalSignatures.element_added | Gst.Bin::element-added or Gst.Bin.SignalSignatures.element_removed | Gst.Bin::element-removed signals on the parent to achieve a similar effect.

    Returns Gst.Object

  • set parent(val: Gst.Object): void

    Parameters

    Returns void

Methods

  • Creates a binding between source_property on source and target_property on target.

    Whenever the source_property is changed the target_property is updated using the same value. For instance:

      g_object_bind_property (action, "active", widget, "sensitive", 0);
    

    Will result in the "sensitive" property of the widget GObject.Object instance to be updated with the same value of the "active" property of the action GObject.Object instance.

    If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well.

    The binding will automatically be removed when either the source or the target instances are finalized. To remove the binding without affecting the source and the target you can just call g_object_unref() on the returned GObject.Binding instance.

    Removing the binding by calling g_object_unref() on it must only be done if the binding, source and target are only used from a single thread and it is clear that both source and target outlive the binding. Especially it is not safe to rely on this if the binding, source or target can be finalized from different threads. Keep another reference to the binding and use g_binding_unbind() instead to be on the safe side.

    A GObject.Object can have multiple bindings.

    Parameters

    Returns GObject.Binding

    the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.

  • Complete version of g_object_bind_property().

    Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

    If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well. The transform_from function is only used in case of bidirectional bindings, otherwise it will be ignored

    The binding will automatically be removed when either the source or the target instances are finalized. This will release the reference that is being held on the GObject.Binding instance; if you want to hold on to the GObject.Binding instance, you will need to hold a reference to it.

    To remove the binding, call g_binding_unbind().

    A GObject.Object can have multiple bindings.

    The same user_data parameter will be used for both transform_to and transform_from transformation functions; the notify function will be called once, when the binding is removed. If you need different data for each transformation function, please use g_object_bind_property_with_closures() instead.

    Parameters

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target GObject.Object

    • target_property: string

      the property on target to bind

    • flags: GObject.BindingFlags

      flags to pass to GObject.Binding

    • Optionaltransform_to: BindingTransformFunc

      the transformation function from the source to the target, or null to use the default

    • Optionaltransform_from: BindingTransformFunc

      the transformation function from the target to the source, or null to use the default

    • Optionalnotify: DestroyNotify

      a function to call when disposing the binding, to free resources used by the transformation functions, or null if not required

    Returns GObject.Binding

    the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.

  • Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

    This function is the language bindings friendly version of g_object_bind_property_full(), using GClosures instead of function pointers.

    Parameters

    • ...args: never[]

      the property on source to bind

    Returns any

    the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.

  • Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.

    Parameters

    • id: number

      Handler ID of the handler to be disconnected

    Returns void

  • Indicates to the appsrc element that the last buffer queued in the element is the last buffer of the stream.

    Returns Gst.FlowReturn

    #GST_FLOW_OK when the EOS was successfully queued. #GST_FLOW_FLUSHING when appsrc is not PAUSED or PLAYING.

  • Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one GObject.Object::notify signal is emitted for each property modified while the object is frozen.

    This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

    Returns void

  • Get the number of currently queued buffers inside appsrc.

    Returns number

    The number of currently queued buffers.

  • Get the number of currently queued bytes inside appsrc.

    Returns number

    The number of currently queued bytes.

  • Get the amount of currently queued time inside appsrc.

    Returns number

    The amount of currently queued time.

  • Gets a named field from the objects table of associations (see g_object_set_data()).

    Parameters

    • key: string

      name of the key for that association

    Returns any

    the data if found, or null if no such data exists.

  • Get the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is not known.

    Returns number

    the duration of the stream previously set with gst_app_src_set_duration();

  • Check if appsrc will emit the "new-preroll" and "new-buffer" signals.

    Returns boolean

    true if appsrc is emitting the "new-preroll" and "new-buffer" signals.

  • Retrieve the min and max latencies in min and max respectively.

    Returns [number, number]

  • Get the maximum amount of buffers that can be queued in appsrc.

    Returns number

    The maximum amount of buffers that can be queued.

  • Get the maximum amount of bytes that can be queued in appsrc.

    Returns number

    The maximum amount of bytes that can be queued.

  • Get the maximum amount of time that can be queued in appsrc.

    Returns number

    The maximum amount of time that can be queued.

  • Gets a property of an object.

    The value can be:

    • an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
    • a GObject.Value initialized with the expected type of the property
    • a GObject.Value initialized with a type to which the expected type of the property can be transformed

    In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.

    Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.

    Parameters

    • property_name: string

      The name of the property to get

    • value: any

      Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type

    Returns any

  • Gets the list of protocols supported by handler. This list may not be modified.

    Returns string[]

    the supported protocols. Returns null if the handler isn't implemented properly, or the handler doesn't support any protocols.

  • Get the size of the stream in bytes. A value of -1 means that the size is not known.

    Returns number

    the size of the stream previously set with gst_app_src_set_size();

  • Gets the currently handled URI.

    Returns string

    the URI currently handled by the handler. Returns null if there are no URI currently handled. The returned string must be freed with g_free() when no longer needed.

  • Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

    Parameters

    • names: string[]

      the names of each property to get

    • values: any[]

      the values of each property to get

    Returns void

  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    • property_name: string

      the name of a property installed on the class of object.

    Returns void

  • Emits a "notify" signal for the property specified by pspec on object.

    This function omits the property name lookup, hence it is faster than g_object_notify().

    One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:

      typedef enum
    {
    PROP_FOO = 1,
    PROP_LAST
    } MyObjectProperty;

    static GParamSpec *properties[PROP_LAST];

    static void
    my_object_class_init (MyObjectClass *klass)
    {
    properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
    0, 100,
    50,
    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
    g_object_class_install_property (gobject_class,
    PROP_FOO,
    properties[PROP_FOO]);
    }

    and then notify a change on the "foo" property with:

      g_object_notify_by_pspec (self, properties[PROP_FOO]);
    

    Parameters

    Returns void

  • Adds a buffer to the queue of buffers that the appsrc element will push to its source pad. This function takes ownership of the buffer.

    When the block property is TRUE, this function can block until free space becomes available in the queue.

    Parameters

    Returns Gst.FlowReturn

    #GST_FLOW_OK when the buffer was successfully queued. #GST_FLOW_FLUSHING when appsrc is not PAUSED or PLAYING. #GST_FLOW_EOS when EOS occurred.

  • Adds a buffer list to the queue of buffers and buffer lists that the appsrc element will push to its source pad. This function takes ownership of buffer_list.

    When the block property is TRUE, this function can block until free space becomes available in the queue.

    Parameters

    Returns Gst.FlowReturn

    #GST_FLOW_OK when the buffer list was successfully queued. #GST_FLOW_FLUSHING when appsrc is not PAUSED or PLAYING. #GST_FLOW_EOS when EOS occurred.

  • Extract a buffer from the provided sample and adds it to the queue of buffers that the appsrc element will push to its source pad. Any previous caps that were set on appsrc will be replaced by the caps associated with the sample if not equal.

    This function does not take ownership of the sample so the sample needs to be unreffed after calling this function.

    When the block property is TRUE, this function can block until free space becomes available in the queue.

    Parameters

    Returns Gst.FlowReturn

    #GST_FLOW_OK when the buffer was successfully queued. #GST_FLOW_FLUSHING when appsrc is not PAUSED or PLAYING. #GST_FLOW_EOS when EOS occurred.

  • Increases the reference count of object.

    Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type of object will be propagated to the return type (using the GCC typeof() extension), so any casting the caller needs to do on the return type must be explicit.

    Returns GObject.Object

    the same object

  • Parameters

    • ...args: never[]

    Returns any

  • Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.

    In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.

    Since GLib 2.56, the type of object will be propagated to the return type under the same conditions as for g_object_ref().

    Returns GObject.Object

    object

  • Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.

    Parameters

    • properties: { [key: string]: any }

      Object containing the properties to set

    Returns void

  • Set the capabilities on the appsrc element. This function takes a copy of the caps structure. After calling this method, the source will only produce caps that match caps. caps must be fixed and the caps on the buffers must match the caps or left NULL.

    Parameters

    Returns void

  • Parameters

    • ...args: never[]

    Returns any

  • Each object carries around a table of associations from strings to pointers. This function lets you set an association.

    If the object already had an association with that name, the old association will be destroyed.

    Internally, the key is converted to a GLib.Quark using g_quark_from_string(). This means a copy of key is kept permanently (even after object has been finalized) — so it is recommended to only use a small, bounded set of values for key in your program, to avoid the GLib.Quark storage growing unbounded.

    Parameters

    • key: string

      name of the key

    • Optionaldata: any

      data to associate with that key

    Returns void

  • Set the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is not known.

    Parameters

    • duration: number

      the duration to set

    Returns void

  • Make appsrc emit the "new-preroll" and "new-buffer" signals. This option is by default disabled because signal emission is expensive and unneeded when the application prefers to operate in pull mode.

    Parameters

    • emit: boolean

      the new state

    Returns void

  • Configure the min and max latency in src. If min is set to -1, the default latency calculations for pseudo-live sources will be used.

    Parameters

    • min: number

      the min latency

    • max: number

      the max latency

    Returns void

  • Set the maximum amount of buffers that can be queued in appsrc. After the maximum amount of buffers are queued, appsrc will emit the "enough-data" signal.

    Parameters

    • max: number

      the maximum number of buffers to queue

    Returns void

  • Set the maximum amount of bytes that can be queued in appsrc. After the maximum amount of bytes are queued, appsrc will emit the "enough-data" signal.

    Parameters

    • max: number

      the maximum number of bytes to queue

    Returns void

  • Set the maximum amount of time that can be queued in appsrc. After the maximum amount of time are queued, appsrc will emit the "enough-data" signal.

    Parameters

    • max: number

      the maximum amonut of time to queue

    Returns void

  • Set the size of the stream in bytes. A value of -1 means that the size is not known.

    Parameters

    • size: number

      the size to set

    Returns void

  • Tries to set the URI of the given handler.

    Parameters

    • uri: string

      URI to set

    Returns boolean

    true if the URI was set successfully, else false.

  • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

    Parameters

    • key: string

      name of the key

    Returns any

    the data if found, or null if no such data exists.

  • This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

    void
    object_add_to_user_list (GObject *object,
    const gchar *new_string)
    {
    // the quark, naming the object data
    GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
    // retrieve the old string list
    GList *list = g_object_steal_qdata (object, quark_string_list);

    // prepend new string
    list = g_list_prepend (list, g_strdup (new_string));
    // this changed 'list', so we need to set it again
    g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
    }
    static void
    free_string_list (gpointer data)
    {
    GList *node, *list = data;

    for (node = list; node; node = node->next)
    g_free (node->data);
    g_list_free (list);
    }

    Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().

    Parameters

    • quark: number

      A GLib.Quark, naming the user data pointer

    Returns any

    The user data pointer set, or null

  • Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

    Duplicate notifications for each property are squashed so that at most one GObject.Object::notify signal is emitted for each property, in the reverse order in which they have been queued.

    It is an error to call this function when the freeze count is zero.

    Returns void

  • Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

    If the pointer to the GObject.Object may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to null rather than retain a dangling pointer to a potentially invalid GObject.Object instance. Use g_clear_object() for this.

    Returns void

  • the constructed function is called by g_object_new() as the final step of the object creation process. At the point of the call, all construction properties have been set on the object. The purpose of this call is to allow for object initialisation steps that can only be performed after construction properties have been set. constructed implementors should chain up to the constructed call of their parent class to allow it to complete its initialisation.

    Returns void

  • the dispose function is supposed to drop all references to other objects, but keep the instance otherwise intact, so that client method invocations still work. It may be run multiple times (due to reference loops). Before returning, dispose should chain up to the dispose method of the parent class.

    Returns void

  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    Returns void

  • Extract a buffer from the provided sample and adds it to the queue of buffers that the appsrc element will push to its source pad. Any previous caps that were set on appsrc will be replaced by the caps associated with the sample if not equal.

    This function does not take ownership of the sample so the sample needs to be unreffed after calling this function.

    When the block property is TRUE, this function can block until free space becomes available in the queue.

    Parameters

    Returns Gst.FlowReturn

  • the generic setter for all properties of this type. Should be overridden for every type with properties. If implementations of set_property don't emit property change notification explicitly, this will be done implicitly by the type system. However, if the notify signal is emitted explicitly, the type system will not emit it a second time.

    Parameters

    Returns void

  • This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

    Parameters

    Returns void

Methods - Inherited from GstBase

  • Abort the state change of the element. This function is used by elements that do asynchronous state changes and find out something is wrong.

    This function should be called with the STATE_LOCK held.

    MT safe.

    Returns void

  • Adds a pad (link point) to element. pad's parent will be set to element; see gst_object_set_parent() for refcounting information.

    Pads are automatically activated when added in the PAUSED or PLAYING state.

    The pad and the element should be unlocked when calling this function.

    This function will emit the Gst.Element.SignalSignatures.pad_added | Gst.Element::pad-added signal on the element.

    Parameters

    Returns boolean

    true if the pad could be added. This function can fail when a pad with the same name already existed or the pad already had another parent. MT safe.

  • Parameters

    • property_name: string

      name of property to watch for changes, or NULL to watch all properties

    • include_value: boolean

      whether to include the new property value in the message

    Returns number

    a watch id, which can be used in connection with gst_element_remove_property_notify_watch() to remove the watch again.

  • Parameters

    • property_name: string

      name of property to watch for changes, or NULL to watch all properties

    • include_value: boolean

      whether to include the new property value in the message

    Returns number

    a watch id, which can be used in connection with gst_element_remove_property_notify_watch() to remove the watch again.

  • Calls func from another thread and passes user_data to it. This is to be used for cases when a state change has to be performed from a streaming thread, directly via gst_element_set_state() or indirectly e.g. via SEEK events.

    Calling those functions directly from the streaming thread will cause deadlocks in many situations, as they might involve waiting for the streaming thread to shut down from this very streaming thread.

    MT safe.

    Parameters

    Returns void

  • Commit the state change of the element and proceed to the next pending state if any. This function is used by elements that do asynchronous state changes. The core will normally call this method automatically when an element returned Gst.StateChangeReturn.SUCCESS from the state change function.

    If after calling this method the element still has not reached the pending state, the next state change is performed.

    This method is used internally and should normally not be called by plugins or applications.

    This function must be called with STATE_LOCK held.

    Parameters

    Returns Gst.StateChangeReturn

    The result of the commit state change. MT safe.

  • Creates a stream-id for element by combining the upstream information with the stream_id.

    This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending stream_id to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don't implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead.

    Since stream IDs are sorted alphabetically, any numbers in the stream ID should be printed with a fixed number of characters, preceded by 0's, such as by using the format %03u instead of %u.

    Parameters

    • stream_id: string

      The stream-id

    Returns string

    A stream-id for element.

  • A default error function that uses g_printerr() to display the error message and the optional debug string..

    The default handler will simply print the error string using g_print.

    Parameters

    • error: GLib.Error

      the GError.

    • Optionaldebug: string

      an additional debug information string, or null

    Returns void

  • Call func with user_data for each of element's pads. func will be called exactly once for each pad that exists at the time of this call, unless one of the calls to func returns false in which case we will stop iterating pads and return early. If new pads are added or pads are removed while pads are being iterated, this will not be taken into account until next time this function is used.

    Parameters

    Returns boolean

    false if element had no pads or if one of the calls to func returned false.

  • Call func with user_data for each of element's sink pads. func will be called exactly once for each sink pad that exists at the time of this call, unless one of the calls to func returns false in which case we will stop iterating pads and return early. If new sink pads are added or sink pads are removed while the sink pads are being iterated, this will not be taken into account until next time this function is used.

    Parameters

    Returns boolean

    false if element had no sink pads or if one of the calls to func returned false.

  • Call func with user_data for each of element's source pads. func will be called exactly once for each source pad that exists at the time of this call, unless one of the calls to func returns false in which case we will stop iterating pads and return early. If new source pads are added or source pads are removed while the source pads are being iterated, this will not be taken into account until next time this function is used.

    Parameters

    Returns boolean

    false if element had no source pads or if one of the calls to func returned false.

  • Returns the base time of the element. The base time is the absolute time of the clock when this element was last put to PLAYING. Subtracting the base time from the clock time gives the running time of the element.

    Returns number

    the base time of the element. MT safe.

  • Gets the currently configured clock of the element. This is the clock as was last set with gst_element_set_clock().

    Elements in a pipeline will only have their clock set when the pipeline is in the PLAYING state.

    Returns Gst.Clock

    the Gst.Clock of the element. unref after usage. MT safe.

  • Looks for an unlinked pad to which the given pad can link. It is not guaranteed that linking the pads will work, though it should work in most cases.

    This function will first attempt to find a compatible unlinked ALWAYS pad, and if none can be found, it will request a compatible REQUEST pad by looking at the templates of element.

    Parameters

    Returns Gst.Pad

    the Gst.Pad to which a link can be made, or null if one cannot be found. gst_object_unref() after usage.

  • Obtain the control-rate for this object. Audio processing Gst.Element objects will use this rate to sub-divide their processing loop and call gst_object_sync_values() in between. The length of the processing segment should be up to control-rate nanoseconds.

    If the object is not under property control, this will return GST_CLOCK_TIME_NONE. This allows the element to avoid the sub-dividing.

    The control-rate is not expected to change if the element is in Gst.State.PAUSED or Gst.State.PLAYING.

    Returns number

    the control rate in nanoseconds

  • Returns the current clock time of the element, as in, the time of the element's clock, or GST_CLOCK_TIME_NONE if there is no clock.

    Returns number

    the clock time of the element, or GST_CLOCK_TIME_NONE if there is no clock.

  • Returns the running time of the element. The running time is the element's clock time minus its base time. Will return GST_CLOCK_TIME_NONE if the element has no clock, or if its base time has not been set.

    Returns number

    the running time of the element, or GST_CLOCK_TIME_NONE if the element has no clock or its base time has not been set.

  • Gets a number of GValues for the given controlled property starting at the requested time. The array values need to hold enough space for n_values of GObject.Value.

    This function is useful if one wants to e.g. draw a graph of the control curve or apply a control curve sample by sample.

    Parameters

    • property_name: string

      the name of the property to get

    • timestamp: number

      the time that should be processed

    • interval: number

      the time spacing between subsequent values

    • values: any[]

      array to put control-values in

    Returns boolean

    true if the given array could be filled, false otherwise

  • Returns a copy of the name of object. Caller should g_free() the return value after usage. For a nameless object, this returns null, which you can safely g_free() as well.

    Free-function: g_free

    Returns string

    the name of object. g_free() after usage. MT safe. This function grabs and releases object's LOCK.

  • Returns the parent of object. This function increases the refcount of the parent object so you should gst_object_unref() it after usage.

    Returns Gst.Object

    parent of object, this can be null if object has no parent. unref after usage. MT safe. Grabs and releases object's LOCK.

  • Generates a string describing the path of object in the object hierarchy. Only useful (or used) for debugging.

    Free-function: g_free

    Returns string

    a string describing the path of object. You must g_free() the string after usage. MT safe. Grabs and releases the Gst.Object's LOCK for all objects in the hierarchy.

  • The name of this function is confusing to people learning GStreamer. gst_element_request_pad_simple() aims at making it more explicit it is a simplified gst_element_request_pad().

    Parameters

    • name: string

      the name of the request Gst.Pad to retrieve.

    Returns Gst.Pad

    requested Gst.Pad if found, otherwise null. Release after usage.

  • Returns the start time of the element. The start time is the running time of the clock when this element was last put to PAUSED.

    Usually the start_time is managed by a toplevel element such as Gst.Pipeline.

    MT safe.

    Returns number

    the start time of the element.

  • Retrieves a pad from element by name. This version only retrieves already-existing (i.e. 'static') pads.

    Parameters

    • name: string

      the name of the static Gst.Pad to retrieve.

    Returns Gst.Pad

    the requested Gst.Pad if found, otherwise null. unref after usage. MT safe.

  • Gets the value for the given controlled property at the requested time.

    Parameters

    • property_name: string

      the name of the property to get

    • timestamp: number

      the time the control-change should be read from

    Returns GObject.Value

    the GValue of the property at the given time, or null if the property isn't controlled.

  • Checks if the state of an element is locked. If the state of an element is locked, state changes of the parent don't affect the element. This way you can leave currently unused elements inside bins. Just lock their state before changing the state from #GST_STATE_NULL.

    MT safe.

    Returns boolean

    true, if the element's state is locked.

  • Retrieves an iterator of element's pads. The iterator should be freed after usage. Also more specialized iterators exists such as gst_element_iterate_src_pads() or gst_element_iterate_sink_pads().

    The order of pads returned by the iterator will be the order in which the pads were added to the element.

    Returns Iterator

    the Gst.Iterator of Gst.Pad. MT safe.

  • Links src to dest. The link must be from source to destination; the other direction will not be tried. The function looks for existing pads that aren't linked yet. It will request new pads if necessary. Such pads need to be released manually when unlinking. If multiple links are possible, only one is established.

    Make sure you have added your elements to a bin or pipeline with gst_bin_add() before trying to link them.

    Parameters

    Returns boolean

    true if the elements could be linked, false otherwise.

  • Links src to dest using the given caps as filtercaps. The link must be from source to destination; the other direction will not be tried. The function looks for existing pads that aren't linked yet. It will request new pads if necessary. If multiple links are possible, only one is established.

    Make sure you have added your elements to a bin or pipeline with gst_bin_add() before trying to link them.

    Parameters

    Returns boolean

    true if the pads could be linked, false otherwise.

  • Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails.

    Parameters

    • srcpadname: string

      the name of the Gst.Pad in source element or null for any pad.

    • dest: Gst.Element

      the Gst.Element containing the destination pad.

    • Optionaldestpadname: string

      the name of the Gst.Pad in destination element, or null for any pad.

    Returns boolean

    true if the pads could be linked, false otherwise.

  • Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails. If caps is not null, makes sure that the caps of the link is a subset of caps.

    Parameters

    • srcpadname: string

      the name of the Gst.Pad in source element or null for any pad.

    • dest: Gst.Element

      the Gst.Element containing the destination pad.

    • Optionaldestpadname: string

      the name of the Gst.Pad in destination element or null for any pad.

    • Optionalfilter: Gst.Caps

      the Gst.Caps to filter the link, or null for no filter.

    Returns boolean

    true if the pads could be linked, false otherwise.

  • Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails.

    Calling gst_element_link_pads_full() with flags == Gst.PadLinkCheck.DEFAULT is the same as calling gst_element_link_pads() and the recommended way of linking pads with safety checks applied.

    This is a convenience function for gst_pad_link_full().

    Parameters

    Returns boolean

    true if the pads could be linked, false otherwise.

  • Brings the element to the lost state. The current state of the element is copied to the pending state so that any call to gst_element_get_state() will return Gst.StateChangeReturn.ASYNC.

    An ASYNC_START message is posted. If the element was PLAYING, it will go to PAUSED. The element will be restored to its PLAYING state by the parent pipeline when it prerolls again.

    This is mostly used for elements that lost their preroll buffer in the Gst.State.PAUSED or Gst.State.PLAYING state after a flush, they will go to their pending state again when a new preroll buffer is queued. This function can only be called when the element is currently not in error or an async state change.

    This function is used internally and should normally not be called from plugins or applications.

    Returns void

  • Post an error, warning or info message on the bus from inside an element.

    type must be of #GST_MESSAGE_ERROR, #GST_MESSAGE_WARNING or #GST_MESSAGE_INFO.

    MT safe.

    Parameters

    • type: Gst.MessageType
    • domain: number

      the GStreamer GError domain this message belongs to

    • code: number

      the GError code belonging to the domain

    • text: string

      an allocated text string to be used as a replacement for the default message connected to code, or null

    • debug: string

      an allocated debug message to be used as a replacement for the default debugging information, or null

    • file: string

      the source code file where the error was generated

    • _function: string

      the source code function where the error was generated

    • line: number

      the source code line where the error was generated

    Returns void

  • Post an error, warning or info message on the bus from inside an element.

    type must be of #GST_MESSAGE_ERROR, #GST_MESSAGE_WARNING or #GST_MESSAGE_INFO.

    Parameters

    • type: Gst.MessageType
    • domain: number

      the GStreamer GError domain this message belongs to

    • code: number

      the GError code belonging to the domain

    • text: string

      an allocated text string to be used as a replacement for the default message connected to code, or null

    • debug: string

      an allocated debug message to be used as a replacement for the default debugging information, or null

    • file: string

      the source code file where the error was generated

    • _function: string

      the source code function where the error was generated

    • line: number

      the source code line where the error was generated

    • structure: Structure

      optional details structure

    Returns void

  • Negotiates src pad caps with downstream elements. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if GstBase.BaseSrcClass.SignalSignatures.negotiate | GstBase.BaseSrcClass::negotiate fails.

    Do not call this in the GstBase.BaseSrcClass.SignalSignatures.fill | GstBase.BaseSrcClass::fill vmethod. Call this in GstBase.BaseSrcClass.SignalSignatures.create | GstBase.BaseSrcClass::create or in GstBase.BaseSrcClass.SignalSignatures.alloc | GstBase.BaseSrcClass::alloc, before any buffer is allocated.

    Returns boolean

    true if the negotiation succeeded, else false.

  • Prepare a new seamless segment for emission downstream. This function must only be called by derived sub-classes, and only from the GstBase.BaseSrcClass.SignalSignatures.create | GstBase.BaseSrcClass::create function, as the stream-lock needs to be held.

    The format for the new segment will be the current format of the source, as configured with gst_base_src_set_format()

    Parameters

    • start: number

      The new start value for the segment

    • stop: number

      Stop value for the new segment

    • time: number

      The new time value for the start of the new segment

    Returns boolean

    true if preparation of the seamless segment succeeded.

  • Prepare a new segment for emission downstream. This function must only be called by derived sub-classes, and only from the GstBase.BaseSrcClass.SignalSignatures.create | GstBase.BaseSrcClass::create function, as the stream-lock needs to be held.

    The format for the segment must be identical with the current format of the source, as configured with gst_base_src_set_format().

    The format of src must not be Gst.Format.UNDEFINED and the format should be configured via gst_base_src_set_format() before calling this method.

    Parameters

    Returns boolean

    true if preparation of new segment succeeded.

  • Use this function to signal that the element does not expect any more pads to show up in the current pipeline. This function should be called whenever pads have been added by the element itself. Elements with #GST_PAD_SOMETIMES pad templates use this in combination with autopluggers to figure out that the element is done initializing its pads.

    This function emits the Gst.Element.SignalSignatures.no_more_pads | Gst.Element::no-more-pads signal.

    MT safe.

    Returns void

post_message

  • post_message(message: Gst.Message): boolean

    Post a message on the element's Gst.Bus. This function takes ownership of the message; if you want to access the message after this call, you should add an additional reference before calling.

    Parameters

    Returns boolean

    true if the message was successfully posted. The function returns false if the element did not have a bus. MT safe.

  • Get the clock provided by the given element.

    An element is only required to provide a clock in the PAUSED state. Some elements can provide a clock in other states.

    Returns Gst.Clock

    the GstClock provided by the element or null if no clock could be provided. Unref after usage. MT safe.

  • Send a new segment downstream. This function must only be called by derived sub-classes, and only from the GstBase.BaseSrcClass.SignalSignatures.create | GstBase.BaseSrcClass::create function, as the stream-lock needs to be held. This method also requires that an out caps has been configured, so gst_base_src_set_caps() needs to have been called before.

    The format for the segment must be identical with the current format of the source, as configured with gst_base_src_set_format().

    The format of src must not be Gst.Format.UNDEFINED and the format should be configured via gst_base_src_set_format() before calling this method.

    This is a variant of gst_base_src_new_segment() sending the segment right away, which can be useful to ensure events ordering.

    Parameters

    Returns boolean

    true if sending of new segment succeeded.

  • Performs a query on the given element.

    For elements that don't implement a query handler, this function forwards the query to a random srcpad or to the peer of a random linked sinkpad of this element.

    Please note that some queries might need a running pipeline to work.

    Parameters

    Returns boolean

    true if the query could be performed. MT safe.

  • Queries an element (usually top-level pipeline or playbin element) for the total stream duration in nanoseconds. This query will only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application will receive an ASYNC_DONE message on the pipeline bus when that is the case.

    If the duration changes for some reason, you will get a DURATION_CHANGED message on the pipeline bus, in which case you should re-query the duration using this function.

    Parameters

    Returns [boolean, number]

    true if the query could be performed.

  • Query the source for the latency parameters. live will be true when src is configured as a live source. min_latency and max_latency will be set to the difference between the running time and the timestamp of the first buffer.

    This function is mostly used by subclasses.

    Returns [boolean, boolean, number, number]

    true if the query succeeded.

  • Queries an element (usually top-level pipeline or playbin element) for the stream position in nanoseconds. This will be a value between 0 and the stream duration (if the stream duration is known). This query will usually only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application will receive an ASYNC_DONE message on the pipeline bus when that is the case.

    If one repeatedly calls this function one can also create a query and reuse it in gst_element_query().

    Parameters

    Returns [boolean, number]

    true if the query could be performed.

  • Makes the element free the previously requested pad as obtained with gst_element_request_pad().

    This does not unref the pad. If the pad was created by using gst_element_request_pad(), gst_element_release_request_pad() needs to be followed by gst_object_unref() to free the pad.

    MT safe.

    Parameters

    Returns void

  • Removes pad from element. pad will be destroyed if it has not been referenced elsewhere using gst_object_unparent().

    This function is used by plugin developers and should not be used by applications. Pads that were dynamically requested from elements with gst_element_request_pad() should be released with the gst_element_release_request_pad() function instead.

    Pads are not automatically deactivated so elements should perform the needed steps to deactivate the pad in case this pad is removed in the PAUSED or PLAYING state. See gst_pad_set_active() for more information about deactivating pads.

    The pad and the element should be unlocked when calling this function.

    This function will emit the Gst.Element.SignalSignatures.pad_removed | Gst.Element::pad-removed signal on the element.

    Parameters

    Returns boolean

    true if the pad could be removed. Can return false if the pad does not belong to the provided element. MT safe.

  • Retrieves a request pad from the element according to the provided template. Pad templates can be looked up using gst_element_factory_get_static_pad_templates().

    The pad should be released with gst_element_release_request_pad().

    Parameters

    • templ: Gst.PadTemplate

      a Gst.PadTemplate of which we want a pad of.

    • Optionalname: string

      the name of the request Gst.Pad to retrieve. Can be null.

    • Optionalcaps: Gst.Caps

      the caps of the pad we want to request. Can be null.

    Returns Gst.Pad

    requested Gst.Pad if found, otherwise null. Release after usage.

  • Retrieves a pad from the element by name (e.g. "src_%d"). This version only retrieves request pads. The pad should be released with gst_element_release_request_pad().

    This method is slower than manually getting the pad template and calling gst_element_request_pad() if the pads should have a specific name (e.g. name is "src_1" instead of "src_%u").

    Note that this function was introduced in GStreamer 1.20 in order to provide a better name to gst_element_get_request_pad(). Prior to 1.20, users should use gst_element_get_request_pad() which provides the same functionality.

    Parameters

    • name: string

      the name of the request Gst.Pad to retrieve.

    Returns Gst.Pad

    requested Gst.Pad if found, otherwise null. Release after usage.

  • Sends a seek event to an element. See gst_event_new_seek() for the details of the parameters. The seek event is sent to the element using gst_element_send_event().

    MT safe.

    Parameters

    • rate: number

      The new playback rate

    • format: Gst.Format

      The format of the seek values

    • flags: Gst.SeekFlags

      The optional seek flags.

    • start_type: Gst.SeekType

      The type and flags for the new start position

    • start: number

      The value of the new start position

    • stop_type: Gst.SeekType

      The type and flags for the new stop position

    • stop: number

      The value of the new stop position

    Returns boolean

    true if the event was handled. Flushing seeks will trigger a preroll, which will emit Gst.MessageType.ASYNC_DONE.

  • Simple API to perform a seek on the given element, meaning it just seeks to the given position relative to the start of the stream. For more complex operations like segment seeks (e.g. for looping) or changing the playback rate or seeking relative to the last configured playback segment you should use gst_element_seek().

    In a completely prerolled PAUSED or PLAYING pipeline, seeking is always guaranteed to return true on a seekable media type or false when the media type is certainly not seekable (such as a live stream).

    Some elements allow for seeking in the READY state, in this case they will store the seek event and execute it when they are put to PAUSED. If the element supports seek in READY, it will always return true when it receives the event in the READY state.

    Parameters

    • format: Gst.Format

      a Gst.Format to execute the seek in, such as #GST_FORMAT_TIME

    • seek_flags: Gst.SeekFlags

      seek options; playback applications will usually want to use GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT here

    • seek_pos: number

      position to seek to (relative to the start); if you are doing a seek in #GST_FORMAT_TIME this value is in nanoseconds - multiply with #GST_SECOND to convert seconds to nanoseconds or with #GST_MSECOND to convert milliseconds to nanoseconds.

    Returns boolean

    true if the seek operation succeeded. Flushing seeks will trigger a preroll, which will emit Gst.MessageType.ASYNC_DONE.

  • Sends an event to an element. If the element doesn't implement an event handler, the event will be pushed on a random linked sink pad for downstream events or a random linked source pad for upstream events.

    This function takes ownership of the provided event so you should gst_event_ref() it if you want to reuse the event after this call.

    MT safe.

    Parameters

    Returns boolean

    true if the event was handled. Events that trigger a preroll (such as flushing seeks and steps) will emit Gst.MessageType.ASYNC_DONE.

  • Configure async behaviour in src, no state change will block. The open, close, start, stop, play and pause virtual methods will be executed in a different thread and are thus allowed to perform blocking operations. Any blocking operation should be unblocked with the unlock vmethod.

    Parameters

    • async: boolean

      new async mode

    Returns void

  • If automatic_eos is true, src will automatically go EOS if a buffer after the total size is returned. By default this is true but sources that can't return an authoritative size and only know that they're EOS when trying to read more should set this to false.

    When src operates in Gst.Format.TIME, GstBase.BaseSrc will send an EOS when a buffer outside of the currently configured segment is pushed if automatic_eos is true. Since 1.16, if automatic_eos is false an EOS will be pushed only when the GstBase.BaseSrcClass.SignalSignatures.create | GstBase.BaseSrcClass::create implementation returns Gst.FlowReturn.EOS.

    Parameters

    • automatic_eos: boolean

      automatic eos

    Returns void

  • Set the base time of an element. See gst_element_get_base_time().

    MT safe.

    Parameters

    • time: number

      the base time to set.

    Returns void

  • Set the number of bytes that src will push out with each buffer. When blocksize is set to -1, a default length will be used.

    Parameters

    • blocksize: number

      the new blocksize in bytes

    Returns void

  • Sets the clock for the element. This function increases the refcount on the clock. Any previously set clock on the object is unreffed.

    Parameters

    Returns boolean

    true if the element accepted the clock. An element can refuse a clock when it, for example, is not able to slave its internal clock to the clock or when it requires a specific clock to operate. MT safe.

  • This function is used to disable the control bindings on a property for some time, i.e. gst_object_sync_values() will do nothing for the property.

    Parameters

    • property_name: string

      property to disable

    • disabled: boolean

      boolean that specifies whether to disable the controller or not.

    Returns void

  • This function is used to disable all controlled properties of the object for some time, i.e. gst_object_sync_values() will do nothing.

    Parameters

    • disabled: boolean

      boolean that specifies whether to disable the controller or not.

    Returns void

  • Change the control-rate for this object. Audio processing Gst.Element objects will use this rate to sub-divide their processing loop and call gst_object_sync_values() in between. The length of the processing segment should be up to control-rate nanoseconds.

    The control-rate should not change if the element is in Gst.State.PAUSED or Gst.State.PLAYING.

    Parameters

    • control_rate: number

      the new control-rate in nanoseconds.

    Returns void

  • Configure src to automatically timestamp outgoing buffers based on the current running_time of the pipeline. This property is mostly useful for live sources.

    Parameters

    • timestamp: boolean

      enable or disable timestamping

    Returns void

  • If not dynamic, size is only updated when needed, such as when trying to read past current tracked size. Otherwise, size is checked for upon each read.

    Parameters

    • dynamic: boolean

      new dynamic size mode

    Returns void

  • Sets the default format of the source. This will be the format used for sending SEGMENT events and for performing seeks.

    If a format of GST_FORMAT_BYTES is set, the element will be able to operate in pull mode if the GstBase.BaseSrcClass.SignalSignatures.is_seekable | GstBase.BaseSrcClass::is_seekable returns true.

    This function must only be called in states < Gst.State.PAUSED.

    Parameters

    Returns void

  • If the element listens to a live source, live should be set to true.

    A live source will not produce data in the PAUSED state and will therefore not be able to participate in the PREROLL phase of a pipeline. To signal this fact to the application and the pipeline, the state change return value of the live source will be GST_STATE_CHANGE_NO_PREROLL.

    Parameters

    • live: boolean

      new live-mode

    Returns void

  • Locks the state of an element, so state changes of the parent don't affect this element anymore.

    Note that this is racy if the state lock of the parent bin is not taken. The parent bin might've just checked the flag in another thread and as the next step proceed to change the child element's state.

    MT safe.

    Parameters

    • locked_state: boolean

      true to lock the element's state

    Returns boolean

    true if the state was changed, false if bad parameters were given or the elements state-locking needed no change.

  • Sets the name of object, or gives object a guaranteed unique name (if name is null). This function makes a copy of the provided name, so the caller retains ownership of the name it sent.

    Parameters

    • Optionalname: string

      new name of object

    Returns boolean

    true if the name could be set. Since Objects that have a parent cannot be renamed, this function returns false in those cases. MT safe. This function grabs and releases object's LOCK.

  • Sets the parent of object to parent. The object's reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink()).

    Parameters

    Returns boolean

    true if parent could be set or false when object already had a parent or object and parent are the same. MT safe. Grabs and releases object's LOCK.

  • Set the start time of an element. The start time of the element is the running time of the element when it last went to the PAUSED state. In READY or after a flushing seek, it is set to 0.

    Toplevel elements like Gst.Pipeline will manage the start_time and base_time on its children. Setting the start_time to #GST_CLOCK_TIME_NONE on such a toplevel element will disable the distribution of the base_time to the children and can be useful if the application manages the base_time itself, for example if you want to synchronize capture from multiple pipelines, and you can also ensure that the pipelines have the same clock.

    MT safe.

    Parameters

    • time: number

      the base time to set.

    Returns void

  • Subclasses can call this from their create virtual method implementation to submit a buffer list to be pushed out later. This is useful in cases where the create function wants to produce multiple buffers to be pushed out in one go in form of a Gst.BufferList, which can reduce overhead drastically, especially for packetised inputs (for data streams where the packetisation/chunking is not important it is usually more efficient to return larger buffers instead).

    Subclasses that use this function from their create function must return Gst.FlowReturn.OK and no buffer from their create virtual method implementation. If a buffer is returned after a buffer list has also been submitted via this function the behaviour is undefined.

    Subclasses must only call this function once per create function call and subclasses must only call this function when the source operates in push mode.

    Parameters

    Returns void

  • Returns a suggestion for timestamps where buffers should be split to get best controller results.

    Returns number

    Returns the suggested timestamp or GST_CLOCK_TIME_NONE if no control-rate was set.

  • Tries to change the state of the element to the same as its parent. If this function returns false, the state of element is undefined.

    Returns boolean

    true, if the element's state could be synced to the parent's state. MT safe.

  • Sets the properties of the object, according to the GstControlSources that (maybe) handle them and for the given timestamp.

    If this function fails, it is most likely the application developers fault. Most probably the control sources are not setup correctly.

    Parameters

    • timestamp: number

      the time that should be processed

    Returns boolean

    true if the controller values could be applied to the object properties, false otherwise

  • Unlinks all source pads of the source element with all sink pads of the sink element to which they are linked.

    If the link has been made using gst_element_link(), it could have created an requestpad, which has to be released using gst_element_release_request_pad().

    Parameters

    Returns void

  • Unlinks the two named pads of the source and destination elements.

    This is a convenience function for gst_pad_unlink().

    Parameters

    • srcpadname: string

      the name of the Gst.Pad in source element.

    • dest: Gst.Element

      a Gst.Element containing the destination pad.

    • destpadname: string

      the name of the Gst.Pad in destination element.

    Returns void

  • Clear the parent of object, removing the associated reference. This function decreases the refcount of object.

    MT safe. Grabs and releases object's lock.

    Returns void

  • Negotiates src pad caps with downstream elements. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if GstBase.BaseSrcClass.SignalSignatures.negotiate | GstBase.BaseSrcClass::negotiate fails.

    Do not call this in the GstBase.BaseSrcClass.SignalSignatures.fill | GstBase.BaseSrcClass::fill vmethod. Call this in GstBase.BaseSrcClass.SignalSignatures.create | GstBase.BaseSrcClass::create or in GstBase.BaseSrcClass.SignalSignatures.alloc | GstBase.BaseSrcClass::alloc, before any buffer is allocated.

    Returns boolean

  • Use this function to signal that the element does not expect any more pads to show up in the current pipeline. This function should be called whenever pads have been added by the element itself. Elements with #GST_PAD_SOMETIMES pad templates use this in combination with autopluggers to figure out that the element is done initializing its pads.

    This function emits the Gst.Element.SignalSignatures.no_more_pads | Gst.Element::no-more-pads signal.

    MT safe.

    Returns void

Virtualvfunc_post_message

  • Prepare the Gst.Segment that will be passed to the GstBase.BaseSrcClass.SignalSignatures.do_seek | GstBase.BaseSrcClass::do_seek vmethod for executing a seek request. Sub-classes should override this if they support seeking in formats other than the configured native format. By default, it tries to convert the seek arguments to the configured native format and prepare a segment in that format.

    Parameters

    Returns boolean

  • Retrieves a request pad from the element according to the provided template. Pad templates can be looked up using gst_element_factory_get_static_pad_templates().

    The pad should be released with gst_element_release_request_pad().

    Parameters

    • templ: Gst.PadTemplate

      a Gst.PadTemplate of which we want a pad of.

    • Optionalname: string

      the name of the request Gst.Pad to retrieve. Can be null.

    • Optionalcaps: Gst.Caps

      the caps of the pad we want to request. Can be null.

    Returns Gst.Pad

  • Sends an event to an element. If the element doesn't implement an event handler, the event will be pushed on a random linked sink pad for downstream events or a random linked source pad for upstream events.

    This function takes ownership of the provided event so you should gst_event_ref() it if you want to reuse the event after this call.

    MT safe.

    Parameters

    Returns boolean

  • Start processing. Subclasses should open resources and prepare to produce data. Implementation should call gst_base_src_start_complete() when the operation completes, either from the current thread or any other thread that finishes the start operation asynchronously.

    Returns boolean

  • Unlock any pending access to the resource. Subclasses should unblock any blocked function ASAP. In particular, any create() function in progress should be unblocked and should return GST_FLOW_FLUSHING. Any future GstBase.BaseSrcClass.SignalSignatures.create | GstBase.BaseSrcClass::create function call should also return GST_FLOW_FLUSHING until the GstBase.BaseSrcClass.SignalSignatures.unlock_stop | GstBase.BaseSrcClass::unlock_stop function has been called.

    Returns boolean

  • Clear the previous unlock request. Subclasses should clear any state they set during GstBase.BaseSrcClass.SignalSignatures.unlock | GstBase.BaseSrcClass::unlock, such as clearing command queues.

    Returns boolean

  • If the GstBase.BaseSrcClass.SignalSignatures.create | GstBase.BaseSrcClass::create method performs its own synchronisation against the clock it must unblock when going from PLAYING to the PAUSED state and call this method before continuing to produce the remaining data.

    This function will block until a state change to PLAYING happens (in which case this function returns Gst.FlowReturn.OK) or the processing must be stopped due to a state change to READY or a FLUSH event (in which case this function returns Gst.FlowReturn.FLUSHING).

    Returns Gst.FlowReturn

    Gst.FlowReturn.OK if src is PLAYING and processing can continue. Any other return value should be returned from the create vmethod.

  • Checks to see if there is any object named name in list. This function does not do any locking of any kind. You might want to protect the provided list with the lock of the owner of the list. This function will lock each Gst.Object in the list to compare the name, so be careful when passing a list with a locked object.

    Parameters

    Returns boolean

  • A default deep_notify signal callback for an object. The user data should contain a pointer to an array of strings that should be excluded from the notify. The default handler will print the new value of the property using g_print.

    MT safe. This function grabs and releases object's LOCK for getting its path string.

    Parameters

    Returns void

  • Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created GObject.ParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.

    This function is meant to be called from the interface's default vtable initialization function (the class_init member of GObject.TypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface.

    If pspec is a floating reference, it will be consumed.

    Parameters

    Returns void

  • Parameters

    • property_id: number

      the new property ID

    • name: string

      the name of a property registered in a parent class or in an interface of this class.

    Returns void

  • Create a new elementfactory capable of instantiating objects of the type and add the factory to plugin.

    Parameters

    • plugin: Gst.Plugin

      Gst.Plugin to register the element with, or null for a static element.

    • name: string

      name of elements of this type

    • rank: number

      rank of element (higher rank means more importance when autoplugging)

    • type: GType

      GType of element to register

    Returns boolean

  • Parameters

    • longname: string

      The long English name of the element. E.g. "File Sink"

    • classification: string

      String describing the type of element, as an unordered list separated with slashes ('/'). See draft-klass.txt of the design docs for more details and common types. E.g: "Sink/File"

    • description: string

      Sentence describing the purpose of the element. E.g: "Write stream to a file"

    • author: string

      Name and contact details of the author(s). Use \n to separate multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"

    Returns void

  • Parameters

    • longname: string

      The long English name of the element. E.g. "File Sink"

    • classification: string

      String describing the type of element, as an unordered list separated with slashes ('/'). See draft-klass.txt of the design docs for more details and common types. E.g: "Sink/File"

    • description: string

      Sentence describing the purpose of the element. E.g: "Write stream to a file"

    • author: string

      Name and contact details of the author(s). Use \n to separate multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"

    Returns void

  • Marks type as "documentation should be skipped". Can be useful for dynamically registered element to be excluded from plugin documentation system.

    Example:

    GType my_type;
    GTypeInfo my_type_info;

    // Fill "my_type_info"
    ...

    my_type = g_type_register_static (GST_TYPE_MY_ELEMENT, "my-type-name",
    &my_type_info, 0);
    gst_element_type_set_skip_documentation (my_type);
    gst_element_register (plugin, "my-plugin-feature-name", rank, my_type);

    Parameters

    Returns void

Interfaces

ConstructorProps
SignalSignatures