![]() |
![]() |
![]() |
GStreamer 0.10 Core Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <gst/gst.h> struct GstMiniObject; enum GstMiniObjectFlags; GstMiniObject * (*GstMiniObjectCopyFunction) (const GstMiniObject *obj
); void (*GstMiniObjectFinalizeFunction) (GstMiniObject *obj
); void (*GstMiniObjectWeakNotify) (gpointer data
,GstMiniObject *where_the_mini_object_was
); #define GST_MINI_OBJECT_FLAGS (obj) #define GST_MINI_OBJECT_FLAG_IS_SET (obj, flag) #define GST_MINI_OBJECT_FLAG_SET (obj, flag) #define GST_MINI_OBJECT_FLAG_UNSET (obj, flag) #define GST_MINI_OBJECT_REFCOUNT (obj) #define GST_MINI_OBJECT_REFCOUNT_VALUE (obj) GstMiniObject * gst_mini_object_new (GType type
); GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object
); gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object
); GstMiniObject * gst_mini_object_make_writable (GstMiniObject *mini_object
); GstMiniObject * gst_mini_object_ref (GstMiniObject *mini_object
); void gst_mini_object_unref (GstMiniObject *mini_object
); void gst_mini_object_replace (GstMiniObject **olddata
,GstMiniObject *newdata
); void gst_mini_object_weak_ref (GstMiniObject *object
,GstMiniObjectWeakNotify notify
,gpointer data
); void gst_mini_object_weak_unref (GstMiniObject *object
,GstMiniObjectWeakNotify notify
,gpointer data
); struct GstParamSpecMiniObject; GParamSpec * gst_param_spec_mini_object (const char *name
,const char *nick
,const char *blurb
,GType object_type
,GParamFlags flags
); void gst_value_set_mini_object (GValue *value
,GstMiniObject *mini_object
); void gst_value_take_mini_object (GValue *value
,GstMiniObject *mini_object
); GstMiniObject * gst_value_get_mini_object (const GValue *value
); GstMiniObject * gst_value_dup_mini_object (const GValue *value
);
GstMiniObject is a baseclass like GObject, but has been stripped down of features to be fast and small. It offers sub-classing and ref-counting in the same way as GObject does. It has no properties and no signal-support though.
Last reviewed on 2005-11-23 (0.9.5)
struct GstMiniObject { GTypeInstance instance; gint refcount; guint flags; };
Base class for refcounted lightweight objects. Ref Func: gst_mini_object_ref Unref Func: gst_mini_object_unref Set Value Func: gst_value_set_mini_object Get Value Func: gst_value_get_mini_object
GTypeInstance |
type instance |
gint |
atomic refcount |
guint |
extra flags. |
typedef enum { GST_MINI_OBJECT_FLAG_READONLY = (1<<0), GST_MINI_OBJECT_FLAG_RESERVED1 = (1<<1), /* padding */ GST_MINI_OBJECT_FLAG_LAST = (1<<4) } GstMiniObjectFlags;
Flags for the mini object
GstMiniObject * (*GstMiniObjectCopyFunction) (const GstMiniObject *obj
);
Virtual function prototype for methods to create copies of instances.
|
MiniObject to copy |
Returns : |
reference to cloned instance. |
void (*GstMiniObjectFinalizeFunction) (GstMiniObject *obj
);
Virtual function prototype for methods to free ressources used by
mini-objects. Subclasses of the mini object are allowed to revive the
passed object by doing a gst_mini_object_ref()
. If the object is not
revived after the finalize function, the memory associated with the
object is freed.
|
MiniObject to finalize |
void (*GstMiniObjectWeakNotify) (gpointer data
,GstMiniObject *where_the_mini_object_was
);
A GstMiniObjectWeakNotify function can be added to a mini object as a callback that gets triggered when the mini object is finalized. Since the mini object is already being finalized when the GstMiniObjectWeakNotify is called, there's not much you could do with the object, apart from e.g. using its adress as hash-index or the like.
|
data that was provided when the weak reference was established |
|
the mini object being finalized |
Since 0.10.35
#define GST_MINI_OBJECT_FLAGS(obj) (GST_MINI_OBJECT_CAST(obj)->flags)
This macro returns the entire set of flags for the mini-object.
|
MiniObject to return flags for. |
#define GST_MINI_OBJECT_FLAG_IS_SET(obj,flag) !!(GST_MINI_OBJECT_FLAGS (obj) & (flag))
This macro checks to see if the given flag is set.
|
MiniObject to check for flags. |
|
Flag to check for |
#define GST_MINI_OBJECT_FLAG_SET(obj,flag) (GST_MINI_OBJECT_FLAGS (obj) |= (flag))
This macro sets the given bits.
|
MiniObject to set flag in. |
|
Flag to set, can by any number of bits in guint32. |
#define GST_MINI_OBJECT_FLAG_UNSET(obj,flag) (GST_MINI_OBJECT_FLAGS (obj) &= ~(flag))
This macro usets the given bits.
|
MiniObject to unset flag in. |
|
Flag to set, must be a single bit in guint32. |
#define GST_MINI_OBJECT_REFCOUNT(obj) ((GST_MINI_OBJECT_CAST(obj))->refcount)
Get access to the reference count field of the mini-object.
|
a GstMiniObject |
#define GST_MINI_OBJECT_REFCOUNT_VALUE(obj) (g_atomic_int_get (&(GST_MINI_OBJECT_CAST(obj))->refcount))
Get the reference count value of the mini-object.
|
a GstMiniObject |
GstMiniObject * gst_mini_object_new (GType type
);
Creates a new mini-object of the desired type.
MT safe
|
the GType of the mini-object to create |
Returns : |
the new mini-object. [transfer full] |
GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object
);
Creates a copy of the mini-object.
MT safe
|
the mini-object to copy |
Returns : |
the new mini-object. [transfer full] |
gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object
);
Checks if a mini-object is writable. A mini-object is writable if the reference count is one and the GST_MINI_OBJECT_FLAG_READONLY flag is not set. Modification of a mini-object should only be done after verifying that it is writable.
MT safe
|
the mini-object to check |
Returns : |
TRUE if the object is writable. |
GstMiniObject * gst_mini_object_make_writable (GstMiniObject *mini_object
);
Checks if a mini-object is writable. If not, a writable copy is made and returned. This gives away the reference to the original mini object, and returns a reference to the new object.
MT safe
|
the mini-object to make writable. [transfer full] |
Returns : |
a mini-object (possibly the same pointer) that is writable. [transfer full] |
GstMiniObject * gst_mini_object_ref (GstMiniObject *mini_object
);
Increase the reference count of the mini-object.
Note that the refcount affects the writeability
of mini
-object, see gst_mini_object_is_writable()
. It is
important to note that keeping additional references to
GstMiniObject instances can potentially increase the number
of memcpy operations in a pipeline, especially if the miniobject
is a GstBuffer.
|
the mini-object |
Returns : |
the mini-object. [transfer full] |
void gst_mini_object_unref (GstMiniObject *mini_object
);
Decreases the reference count of the mini-object, possibly freeing the mini-object.
|
the mini-object |
void gst_mini_object_replace (GstMiniObject **olddata
,GstMiniObject *newdata
);
Modifies a pointer to point to a new mini-object. The modification
is done atomically, and the reference counts are updated correctly.
Either newdata
and the value pointed to by olddata
may be NULL.
|
pointer to a pointer to a mini-object to be replaced. [inout][transfer full] |
|
pointer to new mini-object |
void gst_mini_object_weak_ref (GstMiniObject *object
,GstMiniObjectWeakNotify notify
,gpointer data
);
Adds a weak reference callback to a mini object. Weak references are
used for notification when a mini object is finalized. They are called
"weak references" because they allow you to safely hold a pointer
to the mini object without calling gst_mini_object_ref()
(gst_mini_object_ref()
adds a strong reference, that is, forces the object
to stay alive).
|
GstMiniObject to reference weakly |
|
callback to invoke before the mini object is freed |
|
extra data to pass to notify |
Since 0.10.36
void gst_mini_object_weak_unref (GstMiniObject *object
,GstMiniObjectWeakNotify notify
,gpointer data
);
Removes a weak reference callback to a mini object.
|
GstMiniObject to remove a weak reference from |
|
callback to search for |
|
data to search for |
Since 0.10.36
struct GstParamSpecMiniObject { GParamSpec parent_instance; };
A GParamSpec
derived structure that contains the meta data
for GstMiniObject
properties.
GParamSpec |
private GParamSpec portion |
GParamSpec * gst_param_spec_mini_object (const char *name
,const char *nick
,const char *blurb
,GType object_type
,GParamFlags flags
);
Creates a new GParamSpec instance that hold GstMiniObject references.
|
the canonical name of the property |
|
the nickname of the property |
|
a short description of the property |
|
the GstMiniObject GType for the property |
|
a combination of GParamFlags |
Returns : |
a newly allocated GParamSpec instance. [transfer full] |
void gst_value_set_mini_object (GValue *value
,GstMiniObject *mini_object
);
Set the contents of a GST_TYPE_MINI_OBJECT
derived GValue to
mini_object
.
The caller retains ownership of the reference.
|
a valid GValue of GST_TYPE_MINI_OBJECT derived type |
|
mini object value to set. [transfer none] |
void gst_value_take_mini_object (GValue *value
,GstMiniObject *mini_object
);
Set the contents of a GST_TYPE_MINI_OBJECT
derived GValue to
mini_object
.
Takes over the ownership of the caller's reference to mini_object
;
the caller doesn't have to unref it any more.
|
a valid GValue of GST_TYPE_MINI_OBJECT derived type |
|
mini object value to take. [transfer full] |
GstMiniObject * gst_value_get_mini_object (const GValue *value
);
Get the contents of a GST_TYPE_MINI_OBJECT
derived GValue.
Does not increase the refcount of the returned object.
|
a valid GValue of GST_TYPE_MINI_OBJECT derived type |
Returns : |
mini object contents of value . [transfer none]
|
GstMiniObject * gst_value_dup_mini_object (const GValue *value
);
Get the contents of a GST_TYPE_MINI_OBJECT
derived GValue,
increasing its reference count. If the contents of the GValue
are NULL
, NULL
will be returned.
|
a valid GValue of GST_TYPE_MINI_OBJECT derived type |
Returns : |
mini object contents of value . [transfer full]
|
Since 0.10.20