Gjsify LogoGjsify Logo

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

Index

Constructors

Properties

Methods

Constructors

Properties

base_time: number

the time of the clock right before the element is set to PLAYING. Subtracting base_time from the current clock time in the PLAYING state will yield the running_time against the clock.

field
basesrc: GstBase.BaseSrc
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.

blocksize: number
bus: Gst.Bus

the bus of the element. This bus is provided to the element by the parent element or the application. A #GstPipeline has a bus of its own.

field
can_activate_push: boolean
caps: Gst.Caps

The GstCaps that will negotiated downstream and will be put on outgoing buffers.

clock: Gst.Clock

the clock of the element. This clock is usually provided to the element by the toplevel #GstPipeline.

field
clock_id: object
contexts: Gst.Context[]

list of contexts

field
current_level_buffers: number

The number of currently queued buffers inside appsrc.

current_level_bytes: number

The number of currently queued bytes inside appsrc.

current_level_time: number

The amount of currently queued time inside appsrc.

current_state: Gst.State

the current state of an element

field
do_timestamp: boolean
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.

element: Gst.Element
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.

flags: number

flags for this object

field
format: Gst.Format

The format to use for segment events. When the source is producing timestamped buffers this property should be set to GST_FORMAT_TIME.

g_type_instance: TypeInstance
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 #GstAppSrc can support other formats.

is_live: boolean

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

last_return: Gst.StateChangeReturn

the last return value of an element state change

field
leaky_type: AppLeakyType

When set to any other value than GST_APP_LEAKY_TYPE_NONE then the appsrc will drop any buffers that are pushed into it once its internal queue is full. The selected type defines whether to drop the oldest or new buffers.

live_cond: Cond
live_lock: GLib.Mutex
live_running: boolean
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.

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.

max_latency: number
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.

min_latency: number

The minimum latency of the source. A value of -1 will use the default latency calculations of #GstBaseSrc.

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.

name: string

The name of the object

field
need_newsegment: boolean
next_state: Gst.State

the next state of an element, can be #GST_STATE_VOID_PENDING if the element is in the correct state.

field
num_buffers: number
num_buffers_left: number
numpads: number

number of pads of the element, includes both source and sink pads.

field
numsinkpads: number

number of sink pads of the element.

field
numsrcpads: number

number of source pads of the element.

field
object: any
pads: Gst.Pad[]

list of pads

field
pads_cookie: number

updated whenever the a pad is added or removed

field
parent: Gst.Object

this object's parent, weak ref

field
pending_seek: Gst.Event
pending_state: Gst.State

the final state the element should go to, can be #GST_STATE_VOID_PENDING if the element is in the correct state

field
random_access: boolean
running: boolean
segment: Gst.Segment
sinkpads: Gst.Pad[]

list of sink pads

field
size: number

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

srcpad: Gst.Pad
srcpads: Gst.Pad[]

list of source pads

field
start_time: number

the running_time of the last PAUSED state

field
state_cond: Cond

Used to signal completion of a state change

field
state_cookie: number

Used to detect concurrent execution of gst_element_set_state() and gst_element_get_state()

field
state_lock: RecMutex

Used to serialize execution of gst_element_set_state()

field
stream_type: AppStreamType

The type of stream that this source is producing. For seekable streams the application should connect to the seek-data signal.

target_state: Gst.State

the target state of an element as set by the application

field
typefind: boolean
$gtype: GType<AppSrc>
name: string

Methods

  • abort_state(): void
  • 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

  • Attach the #GstControlBinding to the object. If there already was a #GstControlBinding for this property it will be replaced.

    The object's reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink())

    Parameters

    Returns boolean

  • add_pad(pad: Gst.Pad): boolean
  • 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 #GstElement::pad-added signal on the element.

    Parameters

    • pad: Gst.Pad

      the #GstPad to add to the element.

    Returns boolean

  • add_property_deep_notify_watch(property_name: string, include_value: boolean): number
  • add_property_notify_watch(property_name: string, include_value: boolean): number
  • 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 instance to be updated with the same value of the "active" property of the action #GObject instance.

    If flags contains %G_BINDING_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 #GBinding 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 can have multiple bindings.

    Parameters

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • target_property: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    Returns Binding

  • 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

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • target_property: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    • transform_to: TClosure<any, any>

      a #GClosure wrapping the transformation function from the source to the target, or %NULL to use the default

    • transform_from: TClosure<any, any>

      a #GClosure wrapping the transformation function from the target to the source, or %NULL to use the default

    Returns Binding

  • 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

  • connect(sigName: "end-of-stream", callback: AppSrc_EndOfStreamSignalCallback): number
  • connect(sigName: "enough-data", callback: AppSrc_EnoughDataSignalCallback): number
  • connect(sigName: "need-data", callback: AppSrc_NeedDataSignalCallback): number
  • connect(sigName: "push-buffer", callback: AppSrc_PushBufferSignalCallback): number
  • connect(sigName: "push-buffer-list", callback: AppSrc_PushBufferListSignalCallback): number
  • connect(sigName: "push-sample", callback: AppSrc_PushSampleSignalCallback): number
  • connect(sigName: "seek-data", callback: AppSrc_SeekDataSignalCallback): number
  • connect(sigName: "notify::block", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::caps", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::current-level-buffers", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::current-level-bytes", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::current-level-time", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::duration", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::emit-signals", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::format", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::handle-segment-change", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::is-live", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::leaky-type", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::max-buffers", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::max-bytes", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::max-latency", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::max-time", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::min-latency", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::min-percent", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::size", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::stream-type", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: "notify::do-timestamp", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect(sigName: string, callback: ((...args: any[]) => void)): number
  • connect_after(sigName: "end-of-stream", callback: AppSrc_EndOfStreamSignalCallback): number
  • connect_after(sigName: "enough-data", callback: AppSrc_EnoughDataSignalCallback): number
  • connect_after(sigName: "need-data", callback: AppSrc_NeedDataSignalCallback): number
  • connect_after(sigName: "push-buffer", callback: AppSrc_PushBufferSignalCallback): number
  • connect_after(sigName: "push-buffer-list", callback: AppSrc_PushBufferListSignalCallback): number
  • connect_after(sigName: "push-sample", callback: AppSrc_PushSampleSignalCallback): number
  • connect_after(sigName: "seek-data", callback: AppSrc_SeekDataSignalCallback): number
  • connect_after(sigName: "notify::block", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::caps", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::current-level-buffers", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::current-level-bytes", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::current-level-time", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::duration", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::emit-signals", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::format", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::handle-segment-change", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::is-live", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::leaky-type", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::max-buffers", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::max-bytes", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::max-latency", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::max-time", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::min-latency", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::min-percent", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::size", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::stream-type", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: "notify::do-timestamp", callback: (($obj: AppSrc, pspec: ParamSpec) => void)): number
  • connect_after(sigName: string, callback: ((...args: any[]) => void)): number
  • 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_STATE_CHANGE_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

  • create_all_pads(): void
  • default_error(error: GLib.Error, debug: string): void
  • 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.

    • debug: string

      an additional debug information string, or %NULL

    Returns void

  • disconnect(id: number): void
  • emit(sigName: "end-of-stream", ...args: any[]): void
  • emit(sigName: "enough-data", ...args: any[]): void
  • emit(sigName: "need-data", length: number, ...args: any[]): void
  • emit(sigName: "push-buffer", buffer: Gst.Buffer, ...args: any[]): void
  • emit(sigName: "push-buffer-list", buffer_list: Gst.BufferList, ...args: any[]): void
  • emit(sigName: "push-sample", sample: Sample, ...args: any[]): void
  • emit(sigName: "seek-data", offset: number, ...args: any[]): void
  • emit(sigName: "notify::block", ...args: any[]): void
  • emit(sigName: "notify::caps", ...args: any[]): void
  • emit(sigName: "notify::current-level-buffers", ...args: any[]): void
  • emit(sigName: "notify::current-level-bytes", ...args: any[]): void
  • emit(sigName: "notify::current-level-time", ...args: any[]): void
  • emit(sigName: "notify::duration", ...args: any[]): void
  • emit(sigName: "notify::emit-signals", ...args: any[]): void
  • emit(sigName: "notify::format", ...args: any[]): void
  • emit(sigName: "notify::handle-segment-change", ...args: any[]): void
  • emit(sigName: "notify::is-live", ...args: any[]): void
  • emit(sigName: "notify::leaky-type", ...args: any[]): void
  • emit(sigName: "notify::max-buffers", ...args: any[]): void
  • emit(sigName: "notify::max-bytes", ...args: any[]): void
  • emit(sigName: "notify::max-latency", ...args: any[]): void
  • emit(sigName: "notify::max-time", ...args: any[]): void
  • emit(sigName: "notify::min-latency", ...args: any[]): void
  • emit(sigName: "notify::min-percent", ...args: any[]): void
  • emit(sigName: "notify::size", ...args: any[]): void
  • emit(sigName: "notify::stream-type", ...args: any[]): void
  • emit(sigName: "notify::do-timestamp", ...args: any[]): void
  • emit(sigName: string, ...args: any[]): void
  • force_floating(): void
  • This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

    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

  • 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

  • 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

  • freeze_notify(): void
  • 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::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_base_time(): number
  • 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

  • get_blocksize(): number
  • 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

  • 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

    • pad: Gst.Pad

      the #GstPad to find a compatible one for.

    • caps: Gst.Caps

      the #GstCaps to use as a filter.

    Returns Gst.Pad

  • get_context_unlocked(context_type: string): Gst.Context
  • get_control_rate(): number
  • Obtain the control-rate for this object. Audio processing #GstElement 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

  • get_current_clock_time(): number
  • get_current_level_buffers(): number
  • get_current_level_bytes(): number
  • get_current_level_time(): number
  • get_current_running_time(): number
  • 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

  • get_data(key?: string): object
  • Gets a named field from the objects table of associations (see g_object_set_data()).

    Parameters

    • Optional key: string

      name of the key for that association

    Returns object

  • get_do_timestamp(): boolean
  • get_duration(): number
  • Get the duration of the stream in nanoseconds. A value of GST_CLOCK_TIME_NONE means that the duration is not known.

    Returns number

  • get_emit_signals(): boolean
  • get_g_value_array(property_name: string, timestamp?: number, interval?: number, values?: any[]): boolean
  • 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 #GValue.

    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

    • Optional timestamp: number

      the time that should be processed

    • Optional interval: number

      the time spacing between subsequent values

    • Optional values: any[]

      array to put control-values in

    Returns boolean

  • get_latency(): [number, number]
  • get_max_buffers(): number
  • get_max_bytes(): number
  • get_max_time(): number
  • get_metadata(key: string): string
  • get_name(): string
  • 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

  • get_path_string(): string
  • get_property(property_name?: string, value?: any): void
  • Gets a property of an object.

    The value can be:

    • an empty #GValue initialized by %G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
    • a #GValue initialized with the expected type of the property
    • a #GValue 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 g_value_unset().

    Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.

    Parameters

    • Optional property_name: string

      the name of the property to get

    • Optional value: any

      return location for the property value

    Returns void

  • get_protocols(): string[]
  • get_qdata(quark: number): object
  • get_request_pad(name: string): Gst.Pad
  • 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 #GstPad to retrieve.

    Returns Gst.Pad

  • get_size(): number
  • get_start_time(): number
  • 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 #GstPipeline.

    MT safe.

    Returns number

  • Gets the state of the element.

    For elements that performed an ASYNC state change, as reported by gst_element_set_state(), this function will block up to the specified timeout value for the state change to complete. If the element completes the state change or goes into an error, this function returns immediately with a return value of %GST_STATE_CHANGE_SUCCESS or %GST_STATE_CHANGE_FAILURE respectively.

    For elements that did not return %GST_STATE_CHANGE_ASYNC, this function returns the current and pending state immediately.

    This function returns %GST_STATE_CHANGE_NO_PREROLL if the element successfully changed its state but is not able to provide data yet. This mostly happens for live sources that only produce data in %GST_STATE_PLAYING. While the state change return is equivalent to %GST_STATE_CHANGE_SUCCESS, it is returned to the application to signal that some sink elements might not be able to complete their state change because an element is not producing data to complete the preroll. When setting the element to playing, the preroll will complete and playback will start.

    Parameters

    • timeout: number

      a #GstClockTime to specify the timeout for an async state change or %GST_CLOCK_TIME_NONE for infinite timeout.

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

  • get_static_pad(name: string): Gst.Pad
  • get_uri(): string
  • get_value(property_name: string, timestamp?: number): any
  • Gets the value for the given controlled property at the requested time.

    Parameters

    • property_name: string

      the name of the property to get

    • Optional timestamp: number

      the time the control-change should be read from

    Returns any

  • getv(names: string[], values: any[]): void
  • 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

  • has_active_control_bindings(): boolean
  • Check if object has an ancestor ancestor somewhere up in the hierarchy. One can e.g. check if a #GstElement is inside a #GstPipeline.

    Parameters

    • ancestor: Gst.Object

      a #GstObject to check as ancestor

    Returns boolean

  • has_as_ancestor(ancestor: Gst.Object): boolean
  • is_async(): boolean
  • is_floating(): boolean
  • is_locked_state(): boolean
  • 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

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

  • 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

    • dest: Gst.Element

      the #GstElement containing the destination pad.

    Returns boolean

  • 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

    • dest: Gst.Element

      the #GstElement containing the destination pad.

    • filter: Gst.Caps

      the #GstCaps to filter the link, or %NULL for no filter.

    Returns boolean

  • link_pads(srcpadname: string, dest: Gst.Element, destpadname: string): boolean
  • 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 #GstPad in source element or %NULL for any pad.

    • dest: Gst.Element

      the #GstElement containing the destination pad.

    • destpadname: string

      the name of the #GstPad in destination element, or %NULL for any pad.

    Returns boolean

  • link_pads_filtered(srcpadname: string, dest: Gst.Element, destpadname: string, filter: Gst.Caps): boolean
  • 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 #GstPad in source element or %NULL for any pad.

    • dest: Gst.Element

      the #GstElement containing the destination pad.

    • destpadname: string

      the name of the #GstPad in destination element or %NULL for any pad.

    • filter: Gst.Caps

      the #GstCaps to filter the link, or %NULL for no filter.

    Returns boolean

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

    • srcpadname: string

      the name of the #GstPad in source element or %NULL for any pad.

    • dest: Gst.Element

      the #GstElement containing the destination pad.

    • destpadname: string

      the name of the #GstPad in destination element, or %NULL for any pad.

    • flags: Gst.PadLinkCheck

      the #GstPadLinkCheck to be performed when linking pads.

    Returns boolean

  • lost_state(): void
  • 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_STATE_CHANGE_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

  • message_full(type: Gst.MessageType, domain: number, code: number, text: string, debug: string, file: string, function_: string, line: number): 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

      the #GstMessageType

    • 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

  • message_full_with_details(type: Gst.MessageType, domain: number, code: number, text: string, debug: string, file: string, function_: string, line: number, structure: Gst.Structure): 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

      the #GstMessageType

    • 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: Gst.Structure

      optional details structure

    Returns void

  • negotiate(): boolean
  • Negotiates src pad caps with downstream elements. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if #GstBaseSrcClass::negotiate fails.

    Do not call this in the #GstBaseSrcClass::fill vmethod. Call this in #GstBaseSrcClass::create or in #GstBaseSrcClass::alloc, before any buffer is allocated.

    Returns boolean

  • new_seamless_segment(start: number, stop: number, time: number): boolean
  • Prepare a new seamless segment for emission downstream. This function must only be called by derived sub-classes, and only from the #GstBaseSrcClass::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

  • Prepare a new segment for emission downstream. This function must only be called by derived sub-classes, and only from the #GstBaseSrcClass::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

  • no_more_pads(): void
  • 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 #GstElement::no-more-pads signal.

    MT safe.

    Returns void

  • notify(property_name: string): 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.:

      enum
    {
    PROP_0,
    PROP_FOO,
    PROP_LAST
    };

    static GParamSpec *properties[PROP_LAST];

    static void
    my_object_class_init (MyObjectClass *klass)
    {
    properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
    0, 100,
    50,
    G_PARAM_READWRITE);
    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

    • pspec: ParamSpec

      the #GParamSpec of a property installed on the class of object.

    Returns void

  • Post a message on the element's #GstBus. 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

  • 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

  • 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

  • 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

    • sample: Sample

      a #GstSample from which buffer and caps may be extracted

    Returns Gst.FlowReturn

  • 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

  • query_convert(src_format: Gst.Format, src_val: number, dest_format: Gst.Format): [boolean, number]
  • query_duration(format: Gst.Format): [boolean, number]
  • 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]

  • query_latency(): [boolean, boolean, number, number]
  • 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]

  • query_position(format: Gst.Format): [boolean, number]
  • 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]

  • ref(...args: any[]): any
  • 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.

    Parameters

    • Rest ...args: any[]

    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

  • release_request_pad(pad: Gst.Pad): void
  • 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

    • pad: Gst.Pad

      the #GstPad to release.

    Returns void

  • remove_pad(pad: Gst.Pad): boolean
  • 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 #GstElement::pad-removed signal on the element.

    Parameters

    • pad: Gst.Pad

      the #GstPad to remove from the element.

    Returns boolean

  • remove_property_notify_watch(watch_id: number): void
  • 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 #GstPadTemplate of which we want a pad of.

    • name: string

      the name of the request #GstPad to retrieve. Can be %NULL.

    • caps: Gst.Caps

      the caps of the pad we want to request. Can be %NULL.

    Returns Gst.Pad

  • request_pad_simple(name: string): Gst.Pad
  • 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 #GstPad to retrieve.

    Returns Gst.Pad

  • run_dispose(): void
  • 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

  • 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 #GstFormat 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

  • 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

    • event: Gst.Event

      the #GstEvent to send to the element.

    Returns boolean

  • set_async(async: boolean): void
  • 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

  • set_automatic_eos(automatic_eos: boolean): 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, #GstBaseSrc 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 #GstBaseSrcClass::create implementation returns %GST_FLOW_EOS.

    Parameters

    • automatic_eos: boolean

      automatic eos

    Returns void

  • set_base_time(time: number): void
  • set_blocksize(blocksize: number): 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 bus of the element. Increases the refcount on the bus. For internal use only, unless you're testing elements.

    MT safe.

    Parameters

    • bus: Gst.Bus

      the #GstBus to set.

    Returns void

  • set_caps(caps: Gst.Caps): void
  • set_caps(caps: Gst.Caps): boolean
  • set_caps(...args: any[]): any
  • set_caps(args_or_caps: any[] | Gst.Caps): any
  • Sets the clock for the element. This function increases the refcount on the clock. Any previously set clock on the object is unreffed.

    Parameters

    • clock: Gst.Clock

      the #GstClock to set for the element.

    Returns boolean

  • set_control_binding_disabled(property_name: string, disabled: boolean): void
  • 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

  • set_control_bindings_disabled(disabled: boolean): 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

  • set_control_rate(control_rate: number): void
  • Change the control-rate for this object. Audio processing #GstElement 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

  • set_data(key: string, data?: object): void
  • 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 #GQuark 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 #GQuark storage growing unbounded.

    Parameters

    • key: string

      name of the key

    • Optional data: object

      data to associate with that key

    Returns void

  • set_do_timestamp(timestamp: boolean): 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

  • set_duration(duration: number): 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

  • set_dynamic_size(dynamic: boolean): 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

  • set_emit_signals(emit: boolean): 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

  • 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 #GstBaseSrcClass::is_seekable returns %TRUE.

    This function must only be called in states < %GST_STATE_PAUSED.

    Parameters

    Returns void

  • set_latency(min: number, max: number): 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

  • When set to any other value than GST_APP_LEAKY_TYPE_NONE then the appsrc will drop any buffers that are pushed into it once its internal queue is full. The selected type defines whether to drop the oldest or new buffers.

    Parameters

    Returns void

  • set_live(live: boolean): 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

  • set_locked_state(locked_state: boolean): boolean
  • 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

  • set_max_buffers(max: number): 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_max_bytes(max: number): 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_max_time(max: number): 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_name(name: string): boolean
  • 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

    • name: string

      new name of object

    Returns boolean

  • 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

  • set_property(property_name: string, value?: any): void
  • set_size(size: number): 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

  • set_start_time(time: number): void
  • 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 #GstPipeline 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

  • Sets the state of the element. This function will try to set the requested state by going through all the intermediary states and calling the class's state change function for each.

    This function can return #GST_STATE_CHANGE_ASYNC, in which case the element will perform the remainder of the state change asynchronously in another thread. An application can use gst_element_get_state() to wait for the completion of the state change or it can wait for a %GST_MESSAGE_ASYNC_DONE or %GST_MESSAGE_STATE_CHANGED on the bus.

    State changes to %GST_STATE_READY or %GST_STATE_NULL never return #GST_STATE_CHANGE_ASYNC.

    Parameters

    • state: Gst.State

      the element's new #GstState.

    Returns Gst.StateChangeReturn

  • set_uri(uri: string): boolean
  • Complete an asynchronous start operation. When the subclass overrides the start method, it should call gst_base_src_start_complete() when the start operation completes either from the same thread or from an asynchronous helper thread.

    Parameters

    Returns void

  • steal_data(key?: string): object
  • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

    Parameters

    • Optional key: string

      name of the key

    Returns object

  • steal_qdata(quark: number): object
  • 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 #GQuark, naming the user data pointer

    Returns object

  • 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 #GstBufferList, 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_FLOW_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

  • suggest_next_sync(): number
  • sync_state_with_parent(): boolean
  • sync_values(timestamp: number): boolean
  • 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

  • thaw_notify(): void
  • 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::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

  • 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

    • dest: Gst.Element

      the sink #GstElement to unlink.

    Returns void

  • unlink_pads(srcpadname: string, dest: Gst.Element, destpadname: string): 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 #GstPad in source element.

    • dest: Gst.Element

      a #GstElement containing the destination pad.

    • destpadname: string

      the name of the #GstPad in destination element.

    Returns void

  • unparent(): 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

  • unref(): void
  • Decrements the reference count on object. If reference count hits zero, destroy object. This function does not take the lock on object as it relies on atomic refcounting.

    The unref method should never be called with the LOCK held since this might deadlock the dispose function.

    Returns void

  • vfunc_constructed(): void
  • vfunc_decide_allocation(query: Gst.Query): boolean
  • vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: ParamSpec): void
  • vfunc_dispose(): void
  • vfunc_enough_data(): void
  • vfunc_finalize(): void
  • vfunc_get_property(property_id: number, value?: any, pspec?: ParamSpec): void
  • vfunc_get_size(): [boolean, number]
  • Gets the state of the element.

    For elements that performed an ASYNC state change, as reported by gst_element_set_state(), this function will block up to the specified timeout value for the state change to complete. If the element completes the state change or goes into an error, this function returns immediately with a return value of %GST_STATE_CHANGE_SUCCESS or %GST_STATE_CHANGE_FAILURE respectively.

    For elements that did not return %GST_STATE_CHANGE_ASYNC, this function returns the current and pending state immediately.

    This function returns %GST_STATE_CHANGE_NO_PREROLL if the element successfully changed its state but is not able to provide data yet. This mostly happens for live sources that only produce data in %GST_STATE_PLAYING. While the state change return is equivalent to %GST_STATE_CHANGE_SUCCESS, it is returned to the application to signal that some sink elements might not be able to complete their state change because an element is not producing data to complete the preroll. When setting the element to playing, the preroll will complete and playback will start.

    virtual

    Parameters

    • timeout: number

      a #GstClockTime to specify the timeout for an async state change or %GST_CLOCK_TIME_NONE for infinite timeout.

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

  • vfunc_get_times(buffer: Gst.Buffer): [number, number]
  • vfunc_get_uri(): string
  • vfunc_is_seekable(): boolean
  • vfunc_need_data(length: number): void
  • vfunc_negotiate(): boolean
  • Negotiates src pad caps with downstream elements. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if #GstBaseSrcClass::negotiate fails.

    Do not call this in the #GstBaseSrcClass::fill vmethod. Call this in #GstBaseSrcClass::create or in #GstBaseSrcClass::alloc, before any buffer is allocated.

    virtual

    Returns boolean

  • vfunc_no_more_pads(): void
  • 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 #GstElement::no-more-pads signal.

    MT safe.

    virtual

    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.

    virtual

    Parameters

    Returns void

  • vfunc_pad_added(pad: Gst.Pad): void
  • vfunc_pad_removed(pad: Gst.Pad): void
  • Post a message on the element's #GstBus. 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.

    virtual

    Parameters

    Returns boolean

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

    virtual

    Parameters

    Returns Gst.FlowReturn

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

    virtual

    Parameters

    Returns Gst.FlowReturn

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

    virtual

    Parameters

    • sample: Sample

      a #GstSample from which buffer and caps may be extracted

    Returns Gst.FlowReturn

  • 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

  • vfunc_release_pad(pad: Gst.Pad): void
  • 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().

    virtual

    Parameters

    • templ: Gst.PadTemplate

      a #GstPadTemplate of which we want a pad of.

    • name: string

      the name of the request #GstPad to retrieve. Can be %NULL.

    • caps: Gst.Caps

      the caps of the pad we want to request. Can be %NULL.

    Returns Gst.Pad

  • vfunc_seek_data(offset: number): boolean
  • vfunc_send_event(event: Gst.Event): boolean
  • 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.

    virtual

    Parameters

    • event: Gst.Event

      the #GstEvent to send to the element.

    Returns boolean

  • vfunc_set_bus(bus: Gst.Bus): void
  • vfunc_set_caps(caps: Gst.Caps): boolean
  • vfunc_set_clock(clock: Gst.Clock): boolean
  • Sets the clock for the element. This function increases the refcount on the clock. Any previously set clock on the object is unreffed.

    virtual

    Parameters

    • clock: Gst.Clock

      the #GstClock to set for the element.

    Returns boolean

  • vfunc_set_property(property_id: number, value?: any, pspec?: ParamSpec): void
  • Sets the state of the element. This function will try to set the requested state by going through all the intermediary states and calling the class's state change function for each.

    This function can return #GST_STATE_CHANGE_ASYNC, in which case the element will perform the remainder of the state change asynchronously in another thread. An application can use gst_element_get_state() to wait for the completion of the state change or it can wait for a %GST_MESSAGE_ASYNC_DONE or %GST_MESSAGE_STATE_CHANGED on the bus.

    State changes to %GST_STATE_READY or %GST_STATE_NULL never return #GST_STATE_CHANGE_ASYNC.

    virtual

    Parameters

    • state: Gst.State

      the element's new #GstState.

    Returns Gst.StateChangeReturn

  • vfunc_set_uri(uri: string): boolean
  • vfunc_start(): boolean
  • vfunc_stop(): boolean
  • vfunc_unlock(): boolean
  • vfunc_unlock_stop(): boolean
  • If the #GstBaseSrcClass::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_FLOW_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_FLOW_FLUSHING).

    Returns Gst.FlowReturn

  • watch_closure(closure: TClosure<any, any>): 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

    • closure: TClosure<any, any>

      #GClosure to watch

    Returns void

  • check_uniqueness(list: Gst.Object[], name: string): boolean
  • 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 #GstObject in the list to compare the name, so be careful when passing a list with a locked object.

    Parameters

    • list: Gst.Object[]

      a list of #GstObject to check through

    • name: string

      the name to search for

    Returns boolean

  • compat_control(what: number, data: object): number
  • 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

    • object: GObject.Object

      the #GObject that signalled the notify.

    • orig: Gst.Object

      a #GstObject that initiated the notify.

    • pspec: ParamSpec

      a #GParamSpec of the property.

    • excluded_props: string[]

      a set of user-specified properties to exclude or %NULL to show all changes.

    Returns void

  • Find the #GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    • property_name: string

      name of a property to look up.

    Returns ParamSpec

  • 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 #GParamSpec, 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 #GTypeInfo.) 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

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface.

    • pspec: ParamSpec

      the #GParamSpec for the new property

    Returns void

  • Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    Returns ParamSpec[]

  • Creates a new instance of a #GObject subtype and sets its properties.

    Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.

    Parameters

    • object_type: GType<unknown>

      the type id of the #GObject subtype to instantiate

    • parameters: GObject.Parameter[]

      an array of #GParameter

    Returns GObject.Object

  • register(plugin: Gst.Plugin, name: string, rank: number, type: GType<unknown>): boolean
  • Create a new elementfactory capable of instantiating objects of the type and add the factory to plugin.

    Parameters

    • plugin: Gst.Plugin

      #GstPlugin 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<unknown>

      GType of element to register

    Returns boolean

  • Atomically modifies a pointer to point to a new object. The reference count of oldobj is decreased and the reference count of newobj is increased.

    Either newobj and the value pointed to by oldobj may be %NULL.

    Parameters

    • oldobj: Gst.Object

      pointer to a place of a #GstObject to replace

    • newobj: Gst.Object

      a new #GstObject

    Returns [boolean, Gst.Object]

  • state_get_name(state: Gst.State): string
  • type_set_skip_documentation(type: GType<unknown>): 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

    • type: GType<unknown>

      a #GType of element

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method