Gjsify LogoGjsify Logo

#GstMiniObject is a simple structure that can be used to implement refcounted types.

Subclasses will include #GstMiniObject as the first member in their structure and then call gst_mini_object_init() to initialize the #GstMiniObject fields.

gst_mini_object_ref() and gst_mini_object_unref() increment and decrement the refcount respectively. When the refcount of a mini-object reaches 0, the dispose function is called first and when this returns %TRUE, the free function of the miniobject is called.

A copy can be made with gst_mini_object_copy().

gst_mini_object_is_writable() will return %TRUE when the refcount of the object is exactly 1 and there is no parent or a single parent exists and is writable itself, meaning the current caller has the only reference to the object. gst_mini_object_make_writable() will return a writable version of the object, which might be a new copy when the refcount was not 1.

Opaque data can be associated with a #GstMiniObject with gst_mini_object_set_qdata() and gst_mini_object_get_qdata(). The data is meant to be specific to the particular object and is not automatically copied with gst_mini_object_copy() or similar methods.

A weak reference can be added and remove with gst_mini_object_weak_ref() and gst_mini_object_weak_unref() respectively.

record

Hierarchy

  • MiniObject

Index

Constructors

Properties

a copy function

field

a dispose function

field
flags: number

extra flags.

field

the free function

field
lockstate: number

atomic state of the locks

field
refcount: number

atomic refcount

field
type: GType<unknown>

the GType of the object

field
name: string

Methods

  • This adds parent as a parent for object. Having one ore more parents affects the writability of object: if a parent is not writable, object is also not writable, regardless of its refcount. object is only writable if all the parents are writable and its own refcount is exactly 1.

    Note: This function does not take ownership of parent and also does not take an additional reference. It is the responsibility of the caller to remove the parent again at a later time.

    Parameters

    Returns void

  • getQdata(quark: number): object
  • This function gets back user data pointers stored via gst_mini_object_set_qdata().

    Parameters

    • quark: number

      A #GQuark, naming the user data pointer

    Returns object

  • isWritable(): boolean
  • If mini_object has the LOCKABLE flag set, check if the current EXCLUSIVE lock on object is the only one, this means that changes to the object will not be visible to any other object.

    If the LOCKABLE flag is not set, check if the refcount of mini_object is exactly 1, meaning that no other reference exists to the object and that the object is therefore writable.

    Modification of a mini-object should only be done after verifying that it is writable.

    Returns boolean

  • Lock the mini-object with the specified access mode in flags.

    Parameters

    Returns boolean

  • This removes parent as a parent for object. See gst_mini_object_add_parent().

    Parameters

    Returns void

  • This sets an opaque, named pointer on a miniobject. The name is specified through a #GQuark (retrieved e.g. via g_quark_from_static_string()), and the pointer can be gotten back from the object with gst_mini_object_get_qdata() until the object is disposed. Setting a previously set user data pointer, overrides (frees) the old pointer set, using %NULL as pointer essentially removes the data stored.

    destroy may be specified which is called with data as argument when the object is disposed, or the data is being overwritten by a call to gst_mini_object_set_qdata() with the same quark.

    Parameters

    • quark: number

      A #GQuark, naming the user data pointer

    • data: object

      An opaque user data pointer

    • destroy: GLib.DestroyNotify

      Function to invoke with data as argument, when data needs to be freed

    Returns void

  • stealQdata(quark: number): object
  • This function gets back user data pointers stored via gst_mini_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set).

    Parameters

    • quark: number

      A #GQuark, naming the user data pointer

    Returns object

  • Unlock the mini-object with the specified access mode in flags.

    Parameters

    Returns void

  • Atomically modifies a pointer to point to a new mini-object. The reference count of olddata is decreased and the reference count of newdata is increased.

    Either newdata and the value pointed to by olddata may be %NULL.

    Parameters

    Returns [boolean, Gst.MiniObject]

  • Modifies a pointer to point to a new mini-object. The modification is done atomically. This version is similar to gst_mini_object_replace() except that it does not increase the refcount of newdata and thus takes ownership of newdata.

    Either newdata and the value pointed to by olddata may be %NULL.

    Parameters

    Returns [boolean, Gst.MiniObject]

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