MiniObject
Object Hierarchy:
Description:
[ CCode ( get_value_function = "g_value_get_boxed" , ref_function = "gst_mini_object_ref" , set_value_function = "g_value_set_boxed" , take_value_function = "g_value_take_boxed" , type_id = "G_TYPE_BOXED" , unref_function = "gst_mini_object_unref" ) ]
[ Compact ]
public abstract class MiniObject
MiniObject is a simple structure that can be used to implement refcounted types.
Subclasses will include MiniObject as the first member in their structure and then call
gst_mini_object_init to initialize the MiniObject fields.
@ref and 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 copy.
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. 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 MiniObject with
set_qdata and get_qdata
. The data is meant to be specific to the particular object and is not automatically copied with
copy or similar methods.
A weak reference can be added and remove with weak_ref and
weak_unref respectively.
Content:
Static methods:
- public static bool replace (ref MiniObject? olddata, MiniObject? newdata)
- public static bool take (ref MiniObject olddata, MiniObject newdata)
Methods:
- public bool @lock (LockFlags flags)
Lock the mini-object with the specified access mode in flags
.
- public unowned MiniObject @ref ()
Increase the reference count of the mini-object.
- public void @unlock (LockFlags flags)
Unlock the mini-object with the specified access mode in flags
.
- public void add_parent (MiniObject parent)
This adds parent as a parent for
this.
- public MiniObject? copy ()
Creates a copy of the mini-object.
- public T get_qdata<T> (Quark quark)
This function gets back user data pointers stored via
set_qdata.
- public bool is_writable ()
If this 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.
- public MiniObject make_writable ()
Checks if a mini-object is writable.
- public void remove_parent (MiniObject parent)
This removes parent as a parent for
this.
- public void set_qdata<T> (Quark quark, owned T data)
This sets an opaque, named pointer on a miniobject.
- public void* steal_qdata (Quark quark)
This function gets back user data pointers stored via
set_qdata and removes the data from this
without invoking its `destroy()` function (if any was set).
- public void unref ()
Decreases the reference count of the mini-object, possibly freeing the
mini-object.
- public void weak_ref (MiniObjectNotify notify)
Adds a weak reference callback to a mini object.
- public void weak_unref (MiniObjectNotify notify)
Removes a weak reference callback from a mini object.
Fields: