Gjsify LogoGjsify Logo

The ringbuffer base class structure.

Hierarchy

Index

Constructors

Properties

_gst_reserved: object
acquired: boolean
cb_data: object
cond: Cond
data: Gst.Buffer
empty_seg: number
flags: number
g_type_instance: TypeInstance
lock: GLib.Mutex
name: string
name_prefix: string
object: Gst.Object
open: boolean
parent: Gst.Object
refcount: number
samples_per_seg: number
segbase: number
segdone: number
state: number
waiting: number
$gtype: GType<RingBuffer>
name: string

Methods

  • Allocate the resources for the ringbuffer. This function fills in the data pointer of the ring buffer with a valid #GstBuffer to which samples can be written. MT safe.

    Parameters

    Returns boolean

  • activate(active: boolean): boolean
  • Activate buf to start or stop pulling data. MT safe. FALSE on error.

    Parameters

    • active: boolean

      the new mode

    Returns boolean

  • advance(advance: number): void
  • Subclasses should call this function to notify the fact that MT safe.

    Parameters

    • advance: number

      the number of segments written

    Returns void

  • 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

  • clear(segment: number): void
  • Clear the given segment of the buffer with silence samples. This function is used by subclasses. MT safe.

    Parameters

    • segment: number

      the segment to clear

    Returns void

  • clear_all(): void
  • Fill the ringbuffer with silence. MT safe.

    Returns void

  • close_device(): boolean
  • Close the audio device associated with the ring buffer. The ring buffer should already have been released via gst_ring_buffer_release(). MT safe.

    Returns boolean

  • commit(sample: number, data: number, len: number): number
  • Same as gst_ring_buffer_commit_full() but with a in_samples and out_samples equal to len, ignoring accum. error. MT safe.

    Parameters

    • sample: number

      the sample position of the data

    • data: number

      the data to commit

    • len: number

      the number of samples in the data to commit

    Returns number

  • commit_full(sample: number, data: number, in_samples: number, out_samples: number, accum: number): number
  • Commit in_samples samples pointed to by data to the ringbuffer buf. samples in data. For negative rates, out_samples must be negative and When out_samples is positive, the first sample will be written at position sample in the ringbuffer. When out_samples is negative, the last sample will be written to although it is recommended for optimal performance. set to 0 when this function is first called. In case the commit operation is interrupted, one can resume the processing by passing the previously returned MT safe. number of samples written can be less than out_samples when buf was interrupted with a flush or stop.

    Parameters

    • sample: number

      the sample position of the data

    • data: number

      the data to commit

    • in_samples: number

      the number of samples in the data to commit

    • out_samples: number

      the number of samples to write to the ringbuffer

    • accum: number

      accumulator for rate conversion.

    Returns number

  • connect(sigName: string, callback: ((...args: any[]) => void)): number
  • Parameters

    • sigName: string
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns number

  • connect_after(sigName: string, callback: ((...args: any[]) => void)): number
  • Parameters

    • sigName: string
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns number

  • convert(src_fmt: Gst.Format, src_val: number, dest_fmt: Gst.Format, dest_val: number): boolean
  • Convert src_val in src_fmt to the equivalent value in dest_fmt. The result will be put in dest_val.

    Parameters

    • src_fmt: Gst.Format

      the source format

    • src_val: number

      the source value

    • dest_fmt: Gst.Format

      the destination format

    • dest_val: number

      a location to store the converted value

    Returns boolean

  • default_error(error: GLib.Error, debug: string): void
  • delay(): number
  • Get the number of samples queued in the audio device. This is usually less than the segment size but can be bigger when the implementation uses another internal buffer between the audio device. For playback ringbuffers this is the amount of samples transfered from the ringbuffer to the device but still not played. For capture ringbuffers this is the amount of samples in the device that are not yet transfered to the ringbuffer. MT safe.

    Returns number

  • device_is_open(): boolean
  • Checks the status of the device associated with the ring buffer. MT safe.

    Returns boolean

  • disconnect(id: number): void
  • Parameters

    • id: number

    Returns void

  • emit(sigName: string, ...args: any[]): void
  • Parameters

    • sigName: string
    • Rest ...args: any[]

    Returns 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

  • 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_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_name(): string
  • get_name_prefix(): 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_qdata(quark: number): object
  • 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

  • is_acquired(): boolean
  • Check if the ringbuffer is acquired and ready to use. MT safe.

    Returns boolean

  • is_active(): boolean
  • Check if buf is activated. MT safe.

    Returns boolean

  • is_floating(): boolean
  • may_start(allowed: boolean): void
  • Tell the ringbuffer that it is allowed to start playback when the ringbuffer is filled with samples. MT safe.

    Parameters

    • allowed: boolean

      the new value

    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

  • open_device(): boolean
  • Open the audio device associated with the ring buffer. Does not perform any setup on the device. You must open the device before acquiring the ring buffer. MT safe.

    Returns boolean

  • pause(): boolean
  • Pause processing samples from the ringbuffer. MT safe.

    Returns boolean

  • prepare_read(segment: number, readptr: number, len: number): boolean
  • Returns a pointer to memory where the data from segment segment can be found. This function is mostly used by subclasses. MT safe.

    Parameters

    • segment: number

      the segment to read

    • readptr: number

      the pointer to the memory where samples can be read

    • len: number

      the number of bytes to read

    Returns boolean

  • read(sample: number, data: number, len: number): number
  • Read len samples from the ringbuffer into the memory pointed to by data. The first sample should be read from position sample in the ringbuffer. although it is recommended. error. MT safe.

    Parameters

    • sample: number

      the sample position of the data

    • data: number

      where the data should be read

    • len: number

      the number of samples in data to read

    Returns number

  • 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

  • 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(): boolean
  • Free the resources of the ringbuffer. MT safe.

    Returns boolean

  • restore_thyself(self: NodePtr): void
  • run_dispose(): void
  • Releases all references to other objects. This can be used to break reference cycles.

    This function should only be called from object system implementations.

    Returns void

  • samples_done(): number
  • Get the number of samples that were processed by the ringbuffer since it was last started. This does not include the number of samples not yet processed (see gst_ring_buffer_delay()). MT safe.

    Returns number

  • 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_flushing(flushing: boolean): void
  • Set the ringbuffer to flushing mode or normal mode. MT safe.

    Parameters

    • flushing: boolean

      the new mode

    Returns void

  • set_name(name: string): boolean
  • set_name_prefix(name_prefix: string): void
  • set_property(property_name: string, value?: any): void
  • set_sample(sample: number): void
  • Make sure that the next sample written to the device is accounted for as being the sample sample written to the device. This value will be used in reporting the current sample position of the ringbuffer. This function will also clear the buffer with silence. MT safe.

    Parameters

    • sample: number

      the sample number to set

    Returns void

  • start(): boolean
  • Start processing samples from the ringbuffer. MT safe.

    Returns boolean

  • 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

  • stop(): boolean
  • Stop processing samples from the ringbuffer. MT safe.

    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

  • unparent(): void
  • unref(): 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 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 instance. Use g_clear_object() for this.

    Returns void

  • Allocate the resources for the ringbuffer. This function fills in the data pointer of the ring buffer with a valid #GstBuffer to which samples can be written. MT safe.

    virtual

    Parameters

    Returns boolean

  • vfunc_activate(active: boolean): boolean
  • Activate buf to start or stop pulling data. MT safe. FALSE on error.

    virtual

    Parameters

    • active: boolean

      the new mode

    Returns boolean

  • vfunc_clear_all(): void
  • Fill the ringbuffer with silence. MT safe.

    virtual

    Returns void

  • vfunc_close_device(): boolean
  • Close the audio device associated with the ring buffer. The ring buffer should already have been released via gst_ring_buffer_release(). MT safe.

    virtual

    Returns boolean

  • vfunc_commit(sample: number, data: number, in_samples: number, out_samples: number, accum: number): number
  • Parameters

    • sample: number
    • data: number
    • in_samples: number
    • out_samples: number
    • accum: number

    Returns number

  • vfunc_constructed(): void
  • vfunc_delay(): number
  • Get the number of samples queued in the audio device. This is usually less than the segment size but can be bigger when the implementation uses another internal buffer between the audio device. For playback ringbuffers this is the amount of samples transfered from the ringbuffer to the device but still not played. For capture ringbuffers this is the amount of samples in the device that are not yet transfered to the ringbuffer. MT safe.

    virtual

    Returns number

  • vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: ParamSpec): void
  • vfunc_dispose(): void
  • vfunc_finalize(): void
  • vfunc_get_property(property_id: number, value?: any, pspec?: ParamSpec): 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_open_device(): boolean
  • Open the audio device associated with the ring buffer. Does not perform any setup on the device. You must open the device before acquiring the ring buffer. MT safe.

    virtual

    Returns boolean

  • vfunc_pause(): boolean
  • Pause processing samples from the ringbuffer. MT safe.

    virtual

    Returns boolean

  • vfunc_release(): boolean
  • Free the resources of the ringbuffer. MT safe.

    virtual

    Returns boolean

  • vfunc_restore_thyself(self: NodePtr): void
  • vfunc_resume(): boolean
  • Returns boolean

  • vfunc_set_property(property_id: number, value?: any, pspec?: ParamSpec): void
  • vfunc_start(): boolean
  • Start processing samples from the ringbuffer. MT safe.

    virtual

    Returns boolean

  • vfunc_stop(): boolean
  • Stop processing samples from the ringbuffer. MT safe.

    virtual

    Returns boolean

  • 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

  • compat_control(what: number, data: object): number
  • Print debug info about the buffer sized in spec to the debug log.

    Parameters

    Returns void

  • Print debug info about the parsed caps in spec to the debug log.

    Parameters

    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

  • Parse caps into spec.

    Parameters

    Returns boolean

  • ref(object: object): object
  • ref_sink(object: object): void
  • sink(object: object): void
  • unref(object: object): 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