GstObject

Name

GstObject -- Basis for the GST object hierarchy.

Synopsis


#include <gst/gst.h>


#define     GST_OBJECT_FLAG_LAST
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)
GstObject*  gst_object_new                  (void);
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);
#define     gst_object_ref                  (object)
#define     gst_object_unref                (object)
#define     gst_object_sink                 (object)
#define     gst_object_destroy              (object)
xmlNodePtr  gst_object_save_thyself         (GstObject *object,
                                             xmlNodePtr parent);
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,
                                             GtkSignalFunc func,
                                             gpointer func_data);

Object Hierarchy


  GtkObject
   +----GstObject

Signal Prototypes


"parent-set"
            void        user_function      (GstObject *gstobject,
                                            GstObject *arg1,
                                            gpointer user_data);
"object-saved"
            void        user_function      (GstObject *gstobject,
                                            gpointer 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 GtkObject, but eventually will be replaced by a stripped down version of it. This will remove all the X dependencies from the GST library, making it much more portably and generally useful.

GstObject gives us basic refcounting and parenting functionality, though it is possible that we could use GtkObject's equivalent functions. I'll probably use what I have now until I strip down GtkObject to re-parent the hierarchy.

Details

GST_OBJECT_FLAG_LAST

#define GST_OBJECT_FLAG_LAST 4

subclasses can use this value to start the enumeration of their flags


struct GstObject

struct GstObject;


GST_FLAGS()

#define GST_FLAGS(obj)			GTK_OBJECT_FLAGS(obj)

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

obj :Object to return flags for.


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.

obj :GstSrc to check for flag in.
flag :Flag to check for, must be a single bit in guint32.


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.

obj :Object to set flag in.
flag :Flag to set, can by any number of bits in guint32.


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.

obj :Object to unset flag in.
flag :Flag to set, must be a single bit in guint32.


GST_LOCK()

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

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

obj :Object to lock.


GST_TRYLOCK()

#define GST_TRYLOCK(obj)	(g_mutex_trylock(GST_OBJECT(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.

obj :Object to try to get a lock on.


GST_UNLOCK()

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

This macro releases a lock on the object.

obj :Object to unlock.


GST_GET_LOCK()

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

Acquire a reference to the mutex of this object.

obj :Object to get the mutex of.


GST_OBJECT_PARENT()

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

Get the parent of this object

obj :Object to get the parent of.


GST_OBJECT_NAME()

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

Get the name of this object

obj :Object to get the name of.


gst_object_new ()

GstObject*  gst_object_new                  (void);

Create a new, empty object. Not very useful, should never be used.

Returns : new object


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

object : GstObject to set parent of
parent : new parent of object


gst_object_get_parent ()

GstObject*  gst_object_get_parent           (GstObject *object);

Return the parent of the object.

object : GstObject to get parent of
Returns : parent of the object


gst_object_set_name ()

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

Set the name of the object.

object : GstObject to set the name of
name : new name of object


gst_object_get_name ()

const gchar* gst_object_get_name            (GstObject *object);

Get the name of the object.

object : GstObject to get the name of
Returns : name of the object


gst_object_unparent ()

void        gst_object_unparent             (GstObject *object);

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

object : GstObject to unparent


gst_object_ref()

#define		gst_object_ref(object)		gtk_object_ref(GTK_OBJECT(object));

Increments the refence count on the object.

object : GstObject to reference


gst_object_unref()

#define		gst_object_unref(object)	gtk_object_unref(GTK_OBJECT(object));

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

object : GstObject to unreference


gst_object_sink()

#define		gst_object_sink(object)		gtk_object_sink(GTK_OBJECT(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.

object : GstObject to sink


gst_object_destroy()

#define		gst_object_destroy(object)	gtk_object_destroy(GTK_OBJECT(object))

object :the object


gst_object_save_thyself ()

xmlNodePtr  gst_object_save_thyself         (GstObject *object,
                                             xmlNodePtr parent);

object : 
parent : 
Returns : 


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. Usefull for debugging

object : GstObject to get the path from
Returns : a string describing the path of the object


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.

object : the object that sends the signal
name : the name of the signal to emit
self : data for the signal


gst_class_signal_connect ()

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

Connect to a class signal.

klass : the GstObjectClass to attach the signal to
name : the name of the signal to attach to
func : the signal function
func_data : a pointer to user data
Returns : the signal id.

Signals

The "parent-set" signal

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

gstobject :the object which received the signal.
arg1 :the new parent
user_data :user data set when the signal handler was connected.


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.

gstobject :the object which received the signal.
arg1 :the xmlNodePtr of the parent node
user_data :user data set when the signal handler was connected.