GstObject

Name

GstObject -- Basis for the GST object hierarchy.

Synopsis


#include <gst/gst.h>


enum        GstObjectFlags;
struct      GstObject;
#define     GST_FLAGS                       (obj)
#define     GST_FLAG_IS_SET                 (obj,flag)
#define     GST_FLAG_SET                    (obj,flag)
#define     GST_FLAG_UNSET                  (obj,flag)
#define     GST_LOCK                        (obj)
#define     GST_TRYLOCK                     (obj)
#define     GST_UNLOCK                      (obj)
#define     GST_GET_LOCK                    (obj)
#define     GST_OBJECT_PARENT               (obj)
#define     GST_OBJECT_NAME                 (obj)
#define     GST_OBJECT_FLOATING             (obj)
#define     GST_OBJECT_DESTROYED            (obj)
gboolean    gst_object_check_uniqueness     (GList *list,
                                             const gchar *name);
void        gst_object_set_parent           (GstObject *object,
                                             GstObject *parent);
GstObject*  gst_object_get_parent           (GstObject *object);
void        gst_object_set_name             (GstObject *object,
                                             const gchar *name);
const gchar* gst_object_get_name            (GstObject *object);
void        gst_object_unparent             (GstObject *object);
GstObject*  gst_object_ref                  (GstObject *object);
void        gst_object_unref                (GstObject *object);
void        gst_object_sink                 (GstObject *object);
void        gst_object_destroy              (GstObject *object);
xmlNodePtr  gst_object_save_thyself         (GstObject *object,
                                             xmlNodePtr parent);
void        gst_object_restore_thyself      (GstObject *object,
                                             xmlNodePtr self);
gchar*      gst_object_get_path_string      (GstObject *object);
void        gst_class_signal_emit_by_name   (GstObject *object,
                                             const gchar *name,
                                             xmlNodePtr self);
guint       gst_class_signal_connect        (GstObjectClass *klass,
                                             const gchar *name,
                                             gpointer func,
                                             gpointer func_data);

Object Hierarchy


  GObject
   +----GstObject

Properties


  "name"                 gchararray           : Read / Write

Signal Prototypes


"object-saved"
            void        user_function      (GstObject *gstobject,
                                            gpointer arg1,
                                            gpointer user_data);
"parent-set"
            void        user_function      (GstObject *gstobject,
                                            GObject *arg1,
                                            gpointer user_data);

Description

GstObject provides a root for the object hierarchy tree filed in by the GST library. It is currently a thin wrapper on top of GObject but it can be compiled against GTK+ with a shim provided by the GStreamer library. It is an abstract class that is not very usable on its own.

GstObject gives us basic refcounting, parenting functionality and locking.

gst_object_set_name() and gst_object_get_name() are used to set/get the name of the object.

Details

enum GstObjectFlags

typedef enum
{
  GST_DESTROYED   = 0,
  GST_FLOATING,

  GST_OBJECT_FLAG_LAST   = 4
} GstObjectFlags;


struct GstObject

struct GstObject;


GST_FLAGS()

#define GST_FLAGS(obj)			(GST_OBJECT_CAST (obj)->flags)

This macro returns the entire set of flags for the object.


GST_FLAG_IS_SET()

#define GST_FLAG_IS_SET(obj,flag)	(GST_FLAGS (obj) & (1<<(flag)))

This macro checks to see if the given flag is set.


GST_FLAG_SET()

#define GST_FLAG_SET(obj,flag)		G_STMT_START{ (GST_FLAGS (obj) |= (1<<(flag))); }G_STMT_END

This macro sets the given bits.


GST_FLAG_UNSET()

#define GST_FLAG_UNSET(obj,flag)	G_STMT_START{ (GST_FLAGS (obj) &= ~(1<<(flag))); }G_STMT_END

This macro usets the given bits.


GST_LOCK()

#define GST_LOCK(obj)		(g_mutex_lock(GST_OBJECT_CAST(obj)->lock))

This macro will obtain a lock on the object, making serialization possible.


GST_TRYLOCK()

#define GST_TRYLOCK(obj)	(g_mutex_trylock(GST_OBJECT_CAST(obj)->lock))

This macro will try to obtain a lock on the object, but will return with FALSE if it can't get it immediately.


GST_UNLOCK()

#define GST_UNLOCK(obj)		(g_mutex_unlock(GST_OBJECT_CAST(obj)->lock))

This macro releases a lock on the object.


GST_GET_LOCK()

#define GST_GET_LOCK(obj)	(GST_OBJECT_CAST(obj)->lock)

Acquire a reference to the mutex of this object.


GST_OBJECT_PARENT()

#define GST_OBJECT_PARENT(obj)		(((GstObject *)(obj))->parent)

Get the parent of this object


GST_OBJECT_NAME()

#define GST_OBJECT_NAME(obj)		(const gchar*)(((GstObject *)(obj))->name)

Get the name of this object


GST_OBJECT_FLOATING()

#define GST_OBJECT_FLOATING(obj)	(GST_FLAG_IS_SET (obj, GST_FLOATING))

Check if the object is floating.


GST_OBJECT_DESTROYED()

#define GST_OBJECT_DESTROYED(obj)	(GST_FLAG_IS_SET (obj, GST_DESTROYED))

Check if the object has been destroyed.


gst_object_check_uniqueness ()

gboolean    gst_object_check_uniqueness     (GList *list,
                                             const gchar *name);

This function checks through the list of objects to see if the name given appears in the list as the name of an object. It returns TRUE if the name does not exist in the list.


gst_object_set_parent ()

void        gst_object_set_parent           (GstObject *object,
                                             GstObject *parent);

Set the parent of the object. The object's reference count is incremented. signals the parent-set signal


gst_object_get_parent ()

GstObject*  gst_object_get_parent           (GstObject *object);

Return the parent of the object.


gst_object_set_name ()

void        gst_object_set_name             (GstObject *object,
                                             const gchar *name);

Set the name of the object.


gst_object_get_name ()

const gchar* gst_object_get_name            (GstObject *object);

Get the name of the object.


gst_object_unparent ()

void        gst_object_unparent             (GstObject *object);

Clear the parent of the object, removing the associated reference.


gst_object_ref ()

GstObject*  gst_object_ref                  (GstObject *object);

Increments the refence count on the object.


gst_object_unref ()

void        gst_object_unref                (GstObject *object);

Decrements the refence count on the object. If reference count hits zero, destroy the object.


gst_object_sink ()

void        gst_object_sink                 (GstObject *object);

Removes floating reference on an object. Any newly created object has a refcount of 1 and is FLOATING. This function should be used when creating a new object to symbolically 'take ownership of' the object. Use gst_object_set_parent to have this done for you.


gst_object_destroy ()

void        gst_object_destroy              (GstObject *object);

Destroy the object.


gst_object_save_thyself ()

xmlNodePtr  gst_object_save_thyself         (GstObject *object,
                                             xmlNodePtr parent);

Saves the given object into the parent XML node.


gst_object_restore_thyself ()

void        gst_object_restore_thyself      (GstObject *object,
                                             xmlNodePtr self);

Restores the given object with the data from the parent XML node.


gst_object_get_path_string ()

gchar*      gst_object_get_path_string      (GstObject *object);

Generates a string describing the path of the object in the object hierarchy. Only useful (or used) for debugging


gst_class_signal_emit_by_name ()

void        gst_class_signal_emit_by_name   (GstObject *object,
                                             const gchar *name,
                                             xmlNodePtr self);

emits the named class signal.


gst_class_signal_connect ()

guint       gst_class_signal_connect        (GstObjectClass *klass,
                                             const gchar *name,
                                             gpointer func,
                                             gpointer func_data);

Connect to a class signal.

Properties

"name" (gchararray : Read / Write)

Signals

The "object-saved" signal

void        user_function                  (GstObject *gstobject,
                                            gpointer arg1,
                                            gpointer user_data);

Is trigered whenever a new object is saved to XML. You can connect to this signal to insert custom XML tags into the core XML.


The "parent-set" signal

void        user_function                  (GstObject *gstobject,
                                            GObject *arg1,
                                            gpointer user_data);