Gstreamer Objects hierachy.

os posted @ 2013年9月14日 09:51 in GStreamer , 1504 阅读

Gstreamer学习list.

如何查看GType节点,以及父子关系。

 

`GObject
  |
  +GstObject
  | |
  | +GstPad
  | |
  | +GstPadTemplate
  | |
  | +GstPluginFeature
  | | |
  | | +GstElementFactory
  | | |
  | | +GstTypeFindFactory
  | | |
  | | `GstIndexFactory
  | |
  | +GstElement
  | | |
  | | `GstBin
  | |   |
  | |   `GstPipeline
  | |
  | +GstBus
  | |
  | +GstTask
  | |
  | +GstTaskPool
  | |
  | +GstClock
  | |
  | +GstPlugin
  | |
  | `GstRegistry
  |
  `GstSignalObject
|
`GstMiniObject
  |
  +GstQuery
  |
  +GstMessage
  |
  +GstBuffer
  |
  +GstEvent
  |
  `GstBufferList

 

 

 GstObject:

/**
 * GstObject:
 * @refcount: unused
 * @lock: object LOCK
 * @name: The name of the object
 * @name_prefix: unused
 * @parent: this object's parent, weak ref
 * @flags: use GST_OBJECT_IS_XXX macros to access the flags
 *
 * GStreamer base object class.
 */
struct _GstObject {
  GObject 	 object;

  /*< public >*/
  gint           refcount;    /* unused (FIXME 0.11: remove) */

  /*< public >*/ /* with LOCK */
  GMutex        *lock;        /* object LOCK */
  gchar         *name;        /* object name */
  gchar         *name_prefix; /* (un)used for debugging (FIXME 0.11: remove) */
  GstObject     *parent;      /* this object's parent, weak ref */
  guint32        flags;

  /*< private >*/
  gpointer _gst_reserved;
};

/**
 * GstObjectClass:
 * @parent_class: parent
 * @path_string_separator: separator used by gst_object_get_path_string()
 * @signal_object: is used to signal to the whole class
 * @lock: class lock to be used with GST_CLASS_GET_LOCK(), GST_CLASS_LOCK(), GST_CLASS_UNLOCK() and others.
 * @parent_set: default signal handler
 * @parent_unset: default signal handler
 * @object_saved: default signal handler
 * @deep_notify: default signal handler
 * @save_thyself: xml serialisation
 * @restore_thyself: xml de-serialisation
 *
 * GStreamer base object class.
 */
struct _GstObjectClass {
  GObjectClass	parent_class;

  const gchar	*path_string_separator;
  GObject	*signal_object;

  /* FIXME-0.11: remove this, plus the above GST_CLASS_*_LOCK macros */
  GStaticRecMutex *lock;

  /* signals */
  /* FIXME-0.11: remove, and pass NULL in g_signal_new(), we never used them */
  void          (*parent_set)       (GstObject * object, GstObject * parent);
  void          (*parent_unset)     (GstObject * object, GstObject * parent);
  /* FIXME 0.11: Remove this, it's deprecated */
  void          (*object_saved)     (GstObject * object, GstXmlNodePtr parent);
  void          (*deep_notify)      (GstObject * object, GstObject * orig, GParamSpec * pspec);

  /*< public >*/
  /* virtual methods for subclasses */
  /* FIXME 0.11: Remove this, it's deprecated */
  GstXmlNodePtr (*save_thyself)     (GstObject * object, GstXmlNodePtr parent);
  void          (*restore_thyself)  (GstObject * object, GstXmlNodePtr self);

  /*< private >*/
  gpointer _gst_reserved[GST_PADDING];
};

 

   GObject GstObject
成员函数   class->constructor = g_object_constructor;
  class->constructed = g_object_constructed;
  class->set_property = g_object_do_set_property;
  class->get_property = g_object_do_get_property;
  class->dispose = g_object_real_dispose;
  class->finalize = g_object_finalize;
  class->dispatch_properties_changed = g_object_dispatch_properties_changed;
  class->notify = NULL;

override Gobject的一些:

  gobject_class->set_property = gst_object_set_property;
  gobject_class->get_property = gst_object_get_property;

  gobject_class->dispatch_properties_changed
      = GST_DEBUG_FUNCPTR (gst_object_dispatch_properties_changed);

  gobject_class->dispose = gst_object_dispose;
  gobject_class->finalize = gst_object_finalize;

 

Property - "name"
Signals "notify" ; default handler: class->notify = NULL;

"parent-set",it's default handler is NULL?

"parent-unset",it's default handler is NULL?

"object-saved",it's default handler is NULL?

"deep-notify",it's default handler is NULL?

User register signal handler  user可以自己注册"notify"的回调: user handler user可以自己注册上面几个信号的回调: user handler
何时emit signal?

user 调用GObject的APIs:

g_object_set()

g_object_notify()

g_object_notify_by_pspec()

user 调用GstObject的APIs:

gst_object_set_parent()

gst_object_unparent()

gst_object_save_thyself()

Quark data

"GObject-closure-array"

"GObject-weak-references"

"GObject-toggle-references"

"GObject-notify-queue"

以及用户自定义的

 

 

GstPad:

/**
 * GstPad:
 * @element_private: private data owned by the parent element
 * @padtemplate: padtemplate for this pad
 * @direction: the direction of the pad, cannot change after creating
 *             the pad.
 * @stream_rec_lock: recursive stream lock of the pad, used to protect
 *                   the data used in streaming.
 * @task: task for this pad if the pad is actively driving dataflow.
 * @preroll_lock: lock used when prerolling
 * @preroll_cond: conf to signal preroll
 * @block_cond: conditional to signal pad block
 * @block_callback: callback for the pad block if any
 * @block_data: user data for @block_callback
 * @caps: the current caps of the pad
 * @getcapsfunc: function to get caps of the pad
 * @setcapsfunc: function to set caps on the pad
 * @acceptcapsfunc: function to check if pad can accept caps
 * @fixatecapsfunc: function to fixate caps
 * @activatefunc: pad activation function
 * @activatepushfunc: function to activate/deactivate pad in push mode
 * @activatepullfunc: function to activate/deactivate pad in pull mode
 * @linkfunc: function called when pad is linked
 * @unlinkfunc: function called when pad is unlinked
 * @peer: the pad this pad is linked to
 * @sched_private: private storage for the scheduler
 * @chainfunc: function to chain buffer to pad
 * @checkgetrangefunc: function to check if pad can operate in pull mode
 * @getrangefunc: function to get a range of data from a pad
 * @eventfunc: function to send an event to a pad
 * @mode: current activation mode of the pad
 * @querytypefunc: get list of supported queries
 * @queryfunc: perform a query on the pad
 * @intlinkfunc: get the internal links of this pad
 * @bufferallocfunc: function to allocate a buffer for this pad
 * @do_buffer_signals: counter counting installed buffer signals
 * @do_event_signals: counter counting installed event signals
 * @iterintlinkfunc: get the internal links iterator of this pad
 * @block_destroy_data: notify function for gst_pad_set_blocked_async_full()
 *
 * The #GstPad structure. Use the functions to update the variables.
 */
struct _GstPad {
  GstObject			object;

  /*< public >*/
  gpointer			element_private;

  GstPadTemplate		*padtemplate;

  GstPadDirection		 direction;

  /*< public >*/ /* with STREAM_LOCK */
  /* streaming rec_lock */
  GStaticRecMutex		*stream_rec_lock;
  GstTask			*task;
  /*< public >*/ /* with PREROLL_LOCK */
  GMutex			*preroll_lock;
  GCond				*preroll_cond;

  /*< public >*/ /* with LOCK */
  /* block cond, mutex is from the object */
  GCond				*block_cond;
  GstPadBlockCallback		 block_callback;
  gpointer			 block_data;

  /* the pad capabilities */
  GstCaps			*caps;
  GstPadGetCapsFunction		getcapsfunc;
  GstPadSetCapsFunction		setcapsfunc;
  GstPadAcceptCapsFunction	 acceptcapsfunc;
  GstPadFixateCapsFunction	 fixatecapsfunc;

  GstPadActivateFunction	 activatefunc;
  GstPadActivateModeFunction	 activatepushfunc;
  GstPadActivateModeFunction	 activatepullfunc;

  /* pad link */
  GstPadLinkFunction		 linkfunc;
  GstPadUnlinkFunction		 unlinkfunc;
  GstPad			*peer;

  gpointer			 sched_private;

  /* data transport functions */
  GstPadChainFunction		 chainfunc;
  GstPadCheckGetRangeFunction	 checkgetrangefunc;
  GstPadGetRangeFunction	 getrangefunc;
  GstPadEventFunction		 eventfunc;

  GstActivateMode		 mode;

  /* generic query method */
  GstPadQueryTypeFunction	 querytypefunc;
  GstPadQueryFunction		 queryfunc;

  /* internal links */
#ifndef GST_DISABLE_DEPRECATED
  GstPadIntLinkFunction		 intlinkfunc;
#else
#ifndef __GTK_DOC_IGNORE__
  gpointer intlinkfunc;
#endif
#endif

  GstPadBufferAllocFunction      bufferallocfunc;

  /* whether to emit signals for have-data. counts number
   * of handlers attached. */
  gint				 do_buffer_signals;
  gint				 do_event_signals;

  /* ABI added */
  /* iterate internal links */
  GstPadIterIntLinkFunction     iterintlinkfunc;

  /* free block_data */
  GDestroyNotify block_destroy_data;

  /*< private >*/
  union {
    struct {
      gboolean                      block_callback_called;
      GstPadPrivate                *priv;
    } ABI;
    gpointer _gst_reserved[GST_PADDING - 2];
  } abidata;
};

struct _GstPadClass {
  GstObjectClass	parent_class;

  /* signal callbacks */
  void		(*linked)		(GstPad *pad, GstPad *peer);
  void		(*unlinked)		(GstPad *pad, GstPad *peer);
  void		(*request_link)		(GstPad *pad);
  gboolean	(*have_data)		(GstPad *pad, GstMiniObject *data);

  /*< private >*/
  gpointer _gst_reserved[GST_PADDING];
};

 

  GObject GstObject GstPad
成员函数  

override Gobject的一些:

gobject_class->set_property = gst_object_set_property;
gobject_class->get_property = gst_object_get_property;

gobject_class->dispatch_properties_changed
= GST_DEBUG_FUNCPTR (gst_object_dispatch_properties_changed);

gobject_class->dispose = gst_object_dispose;
gobject_class->finalize = gst_object_finalize;

 

  gobject_class->dispose = gst_pad_dispose;
  gobject_class->finalize = gst_pad_finalize;
  gobject_class->set_property = gst_pad_set_property;
  gobject_class->get_property = gst_pad_get_property;
Property - "name"

"caps"

"direction"

"template"

enum
{
  PAD_PROP_0,
  PAD_PROP_CAPS,
  PAD_PROP_DIRECTION,
  PAD_PROP_TEMPLATE,
  /* FILL ME */
};

Signals  

"parent-set",it's default handler is NULL?

"parent-unset",it's default handler is NULL?

"object-saved",it's default handler is NULL?

"deep-notify",it's default handler is NULL?

"linked"

"unlinked"

"request-link"

"have-data"

enum
{
  PAD_LINKED,
  PAD_UNLINKED,
  PAD_REQUEST_LINK,
  PAD_HAVE_DATA,
  /* FILL ME */
  LAST_SIGNAL
};
 

User register signal handler   user可以自己注册上面几个信号的回调: user handler  
何时emit signal?

 

user 调用GstObject的APIs:

gst_object_set_parent()

gst_object_unparent()

gst_object_save_thyself()

gst_pad_signals[PAD_LINKED]:

1. gst_pad_link_full()

2. gst_pad_link()

gst_pad_signals[PAD_UNLINKED]:

1. gst_pad_unlink()

gst_pad_signals[PAD_HAVE_DATA]:

1. gst_pad_pull_range()

2. gst_pad_push_event()

3. gst_pad_send_event()

 

 

Quark data

 

  /* quarks for probe signals */
static GQuark buffer_quark;
static GQuark event_quark;

 

GstPadTemplate:

/**
 * GstPadTemplate:
 *
 * The padtemplate object.
 */
struct _GstPadTemplate {
  GstObject	   object;

  gchar           *name_template;
  GstPadDirection  direction;
  GstPadPresence   presence;
  GstCaps	  *caps;

  gpointer _gst_reserved[GST_PADDING];
};

struct _GstPadTemplateClass {
  GstObjectClass   parent_class;

  /* signal callbacks */
  void (*pad_created)	(GstPadTemplate *templ, GstPad *pad);

  gpointer _gst_reserved[GST_PADDING];
};

 

  GObject GstObject GstPadTemplate
成员函数  

override Gobject的一些:

gobject_class->set_property = gst_object_set_property;
gobject_class->get_property = gst_object_get_property;

gobject_class->dispatch_properties_changed
= GST_DEBUG_FUNCPTR (gst_object_dispatch_properties_changed);

gobject_class->dispose = gst_object_dispose;
gobject_class->finalize = gst_object_finalize;

 

  gobject_class->dispose = gst_pad_template_dispose;

  gobject_class->get_property = gst_pad_template_get_property;
  gobject_class->set_property = gst_pad_template_set_property;

Property - "name"

enum
{
  PROP_NAME_TEMPLATE = 1,
  PROP_DIRECTION,
  PROP_PRESENCE,
  PROP_CAPS
};
 

Signals  

"parent-set",it's default handler is NULL?

"parent-unset",it's default handler is NULL?

"object-saved",it's default handler is NULL?

"deep-notify",it's default handler is NULL?

"pad-created"

enum
{
  TEMPL_PAD_CREATED,
  /* FILL ME */
  LAST_SIGNAL
};
 

User register signal handler   user可以自己注册上面几个信号的回调: user handler  
何时emit signal?

 

user 调用GstObject的APIs:

gst_object_set_parent()

gst_object_unparent()

gst_object_save_thyself()

gst_pad_template_signals[TEMPL_PAD_CREATED]:

gst_pad_template_pad_created

 

 

Quark data

 

  /* quarks for probe signals */
static GQuark buffer_quark;
static GQuark event_quark;

 

GstPluginFeature:

/**
 * GstPluginFeature:
 *
 * Opaque #GstPluginFeature structure.
 */
struct _GstPluginFeature {
  GstObject      object;

  /*< private >*/
  gboolean       loaded;
  gchar         *name; /* FIXME-0.11: remove variable, we use GstObject:name */
  guint          rank;

  const gchar   *plugin_name;
  GstPlugin     *plugin;      /* weak ref */

  /*< private >*/
  gpointer _gst_reserved[GST_PADDING - 1];
};

struct _GstPluginFeatureClass {
  GstObjectClass        parent_class;

  /*< private >*/
  gpointer _gst_reserved[GST_PADDING];
};

 

  GObject GstObject GstPluginFeature
成员函数  

override Gobject的一些:

gobject_class->set_property = gst_object_set_property;
gobject_class->get_property = gst_object_get_property;

gobject_class->dispatch_properties_changed
= GST_DEBUG_FUNCPTR (gst_object_dispatch_properties_changed);

gobject_class->dispose = gst_object_dispose;
gobject_class->finalize = gst_object_finalize;

 

G_OBJECT_CLASS (klass)->finalize = gst_plugin_feature_finalize;

Property - "name"

 

Signals  

"parent-set",it's default handler is NULL?

"parent-unset",it's default handler is NULL?

"object-saved",it's default handler is NULL?

"deep-notify",it's default handler is NULL?

 

User register signal handler   user可以自己注册上面几个信号的回调: user handler  
何时emit signal?

 

user 调用GstObject的APIs:

gst_object_set_parent()

gst_object_unparent()

gst_object_save_thyself()

 

 

 

Quark data

 

   

 

GstElementFactory:

/**
 * GstElementFactory:
 *
 * The opaque #GstElementFactory data structure.
 */
struct _GstElementFactory {
  GstPluginFeature      parent;

  GType                 type;                   /* unique GType of element or 0 if not loaded */

  /* FIXME-0.11: deprecate this in favour of meta_data */
  GstElementDetails     details;

  GList *               staticpadtemplates;     /* GstStaticPadTemplate list */
  guint                 numpadtemplates;

  /* URI interface stuff */
  guint                 uri_type;
  gchar **              uri_protocols;

  GList *               interfaces;             /* interface type names this element implements */

  /*< private >*/
  /* FIXME-0.11: move up and replace details */
  gpointer		meta_data;
  gpointer _gst_reserved[GST_PADDING - 1];
};

struct _GstElementFactoryClass {
  GstPluginFeatureClass parent_class;

  gpointer _gst_reserved[GST_PADDING];
};

 

  GObject GstObject GstPluginFeature GstElementFactory
成员函数  

 

 

G_OBJECT_CLASS (klass)->finalize = gst_plugin_feature_finalize;

gobject_class->finalize = gst_element_factory_finalize;
Property    

 

 
Signals  

 

 

 
User register signal handler        
何时emit signal?

 

 

 

 

 

 
Quark data

 

     

 

GstTypeFindFactory:

/**
 * GstTypeFindFactory:
 *
 * Object that stores information about a typefind function.
 */
struct _GstTypeFindFactory {
  GstPluginFeature		feature;
  /* <private> */

  GstTypeFindFunction		function;
  gchar **			extensions;
  GstCaps *			caps; /* FIXME: not yet saved in registry */

  gpointer			user_data;
  GDestroyNotify		user_data_notify;

  gpointer _gst_reserved[GST_PADDING];
};

struct _GstTypeFindFactoryClass {
  GstPluginFeatureClass		parent;
  /* <private> */

  gpointer _gst_reserved[GST_PADDING];
};

 

  GObject GstObject GstPluginFeature GstTypeFindFactory
成员函数  

 

 

G_OBJECT_CLASS (klass)->finalize = gst_plugin_feature_finalize;

object_class->dispose = gst_type_find_factory_dispose;
Property    

 

 
Signals  

 

 

 
User register signal handler        
何时emit signal?

 

 

 

 

 

 
Quark data

 

     

 

GstIndexFactory:

/**
 * GstIndexFactory:
 *
 * The GstIndexFactory object
 */
struct _GstIndexFactory {
  GstPluginFeature feature;

  gchar *longdesc;            /* long description of the index (well, don't overdo it..) */
  GType type;                 /* unique GType of the index */

  gpointer _gst_reserved[GST_PADDING];
};

struct _GstIndexFactoryClass {
  GstPluginFeatureClass parent;

  gpointer _gst_reserved[GST_PADDING];
};

 

  GObject GstObject GstPluginFeature GstIndexFactory
成员函数  

 

 

G_OBJECT_CLASS (klass)->finalize = gst_plugin_feature_finalize;

gobject_class->finalize = gst_index_factory_finalize;

Property    

 

 
Signals  

 

 

 
User register signal handler        
何时emit signal?

 

 

 

 

 

 
Quark data

 

     

 

GstElement:

/**
 * GstElement:
 * @state_lock: Used to serialize execution of gst_element_set_state()
 * @state_cond: Used to signal completion of a state change
 * @state_cookie: Used to detect concurrent execution of
 * gst_element_set_state() and gst_element_get_state()
 * @current_state: the current state of an element
 * @next_state: the next state of an element, can be #GST_STATE_VOID_PENDING if
 * the element is in the correct state.
 * @pending_state: the final state the element should go to, can be
 * #GST_STATE_VOID_PENDING if the element is in the correct state
 * @last_return: the last return value of an element state change
 * @bus: the bus of the element. This bus is provided to the element by the
 * parent element or the application. A #GstPipeline has a bus of its own.
 * @clock: the clock of the element. This clock is usually provided to the
 * element by the toplevel #GstPipeline.
 * @base_time: the time of the clock right before the element is set to
 * PLAYING. Subtracting @base_time from the current clock time in the PLAYING
 * state will yield the running_time against the clock.
 * @numpads: number of pads of the element, includes both source and sink pads.
 * @pads: list of pads
 * @numsrcpads: number of source pads of the element.
 * @srcpads: list of source pads
 * @numsinkpads: number of sink pads of the element.
 * @sinkpads: list of sink pads
 * @pads_cookie: updated whenever the a pad is added or removed
 *
 * GStreamer element abstract base class.
 */
struct _GstElement
{
  GstObject             object;

  /*< public >*/ /* with LOCK */
  GStaticRecMutex      *state_lock;

  /* element state */
  GCond                *state_cond;
  guint32               state_cookie;
  GstState              current_state;
  GstState              next_state;
  GstState              pending_state;
  GstStateChangeReturn  last_return;

  GstBus               *bus;

  /* allocated clock */
  GstClock             *clock;
  GstClockTimeDiff      base_time; /* NULL/READY: 0 - PAUSED: current time - PLAYING: difference to clock */

  /* element pads, these lists can only be iterated while holding
   * the LOCK or checking the cookie after each LOCK. */
  guint16               numpads;
  GList                *pads;
  guint16               numsrcpads;
  GList                *srcpads;
  guint16               numsinkpads;
  GList                *sinkpads;
  guint32               pads_cookie;

  /*< private >*/
  union {
    struct {
      /* state set by application */
      GstState              target_state;
      /* running time of the last PAUSED state */
      GstClockTime          start_time;
    } ABI;
    /* adding + 0 to mark ABI change to be undone later */
    gpointer _gst_reserved[GST_PADDING + 0];
  } abidata;
};

/**
 * GstElementClass:
 * @parent_class: the parent class structure
 * @details: #GstElementDetails for elements of this class
 * @elementfactory: the #GstElementFactory that creates these elements
 * @padtemplates: a #GList of #GstPadTemplate
 * @numpadtemplates: the number of padtemplates
 * @pad_templ_cookie: changed whenever the padtemplates change
 * @request_new_pad: called when a new pad is requested
 * @release_pad: called when a request pad is to be released
 * @get_state: get the state of the element
 * @set_state: set a new state on the element
 * @change_state: called by @set_state to perform an incremental state change
 * @set_bus: set a #GstBus on the element
 * @provide_clock: gets the #GstClock provided by the element
 * @set_clock: set the #GstClock on the element
 * @get_index: set a #GstIndex on the element
 * @set_index: get the #GstIndex of an element
 * @send_event: send a #GstEvent to the element
 * @get_query_types: get the supported #GstQueryType of this element
 * @query: perform a #GstQuery on the element
 * @request_new_pad_full: called when a new pad is requested. Since: 0.10.32.
 * @state_changed: called immediately after a new state was set. Since: 0.10.36.
 *
 * GStreamer element class. Override the vmethods to implement the element
 * functionality.
 */
struct _GstElementClass
{
  GstObjectClass         parent_class;

  /*< public >*/
  /* the element details */
  /* FIXME-0.11: deprecate this in favour of meta_data */
  GstElementDetails      details;

  /* factory that the element was created from */
  GstElementFactory     *elementfactory;

  /* templates for our pads */
  GList                 *padtemplates;
  gint                   numpadtemplates;
  guint32                pad_templ_cookie;

  /*< private >*/
  /* signal callbacks */
  void (*pad_added)     (GstElement *element, GstPad *pad);
  void (*pad_removed)   (GstElement *element, GstPad *pad);
  void (*no_more_pads)  (GstElement *element);

  /*< public >*/
  /* virtual methods for subclasses */

  /* request/release pads */
  GstPad*               (*request_new_pad)      (GstElement *element, GstPadTemplate *templ, const gchar* name);
  void                  (*release_pad)          (GstElement *element, GstPad *pad);

  /* state changes */
  GstStateChangeReturn (*get_state)             (GstElement * element, GstState * state,
                                                 GstState * pending, GstClockTime timeout);
  GstStateChangeReturn (*set_state)             (GstElement *element, GstState state);
  GstStateChangeReturn (*change_state)          (GstElement *element, GstStateChange transition);

  /* bus */
  void                  (*set_bus)              (GstElement * element, GstBus * bus);

  /* set/get clocks */
  GstClock*             (*provide_clock)        (GstElement *element);
  gboolean              (*set_clock)            (GstElement *element, GstClock *clock);

  /* index */
  GstIndex*             (*get_index)            (GstElement *element);
  void                  (*set_index)            (GstElement *element, GstIndex *index);

  /* query functions */
  gboolean              (*send_event)           (GstElement *element, GstEvent *event);

  const GstQueryType*   (*get_query_types)      (GstElement *element);
  gboolean              (*query)                (GstElement *element, GstQuery *query);

  /*< private >*/
  /* FIXME-0.11: move up and replace details */
  gpointer		meta_data;

  /*< public >*/
  /* Virtual method for subclasses (additions) */
  /* FIXME-0.11 Make this the default behaviour */
  GstPad*		(*request_new_pad_full) (GstElement *element, GstPadTemplate *templ,
						 const gchar* name, const GstCaps *caps);

  void                  (*state_changed)        (GstElement *element, GstState oldstate,
                                                 GstState newstate, GstState pending);

  /*< private >*/
  gpointer _gst_reserved[GST_PADDING-3];
};

 

  GObject GstObject GstElement
成员函数  

override Gobject的一些:

gobject_class->set_property = gst_object_set_property;
gobject_class->get_property = gst_object_get_property;

gobject_class->dispatch_properties_changed
= GST_DEBUG_FUNCPTR (gst_object_dispatch_properties_changed);

gobject_class->dispose = gst_object_dispose;
gobject_class->finalize = gst_object_finalize;

 

  gobject_class->dispose = gst_element_dispose;
  gobject_class->finalize = gst_element_finalize;
Property - "name"

 

Signals  

"parent-set",it's default handler is NULL?

"parent-unset",it's default handler is NULL?

"object-saved",it's default handler is NULL?

"deep-notify",it's default handler is NULL?

enum
{
PAD_ADDED,
PAD_REMOVED,
NO_MORE_PADS,
/* add more above */
LAST_SIGNAL
};

User register signal handler   user可以自己注册上面几个信号的回调: user handler  
何时emit signal?

 

user 调用GstObject的APIs:

gst_object_set_parent()

gst_object_unparent()

gst_object_save_thyself()

gst_element_add_pad ()
gst_element_remove_pad()

gst_element_no_more_pads()

 

 

Quark data

 

  _gst_elementclass_factory

 

GstBin:

/**
 * GstBin:
 * @numchildren: the number of children in this bin
 * @children: the list of children in this bin
 * @children_cookie: updated whenever @children changes
 * @child_bus: internal bus for handling child messages
 * @messages: queued and cached messages
 * @polling: the bin is currently calculating its state
 * @state_dirty: the bin needs to recalculate its state (deprecated)
 * @clock_dirty: the bin needs to select a new clock
 * @provided_clock: the last clock selected
 * @clock_provider: the element that provided @provided_clock
 *
 * The GstBin base class. Subclasses can access these fields provided
 * the LOCK is taken.
 */
struct _GstBin {
  GstElement	 element;

  /*< public >*/ /* with LOCK */
  /* our children, subclass are supposed to update these
   * fields to reflect their state with _iterate_*() */
  gint		 numchildren;
  GList		*children;
  guint32	 children_cookie;

  GstBus        *child_bus;
  GList         *messages;

  gboolean	 polling;
  gboolean       state_dirty;

  gboolean       clock_dirty;
  GstClock	*provided_clock;
  GstElement    *clock_provider;

  /*< private >*/
  GstBinPrivate *priv;

  gpointer _gst_reserved[GST_PADDING - 1];
};

/**
 * GstBinClass:
 * @parent_class: bin parent class
 * @add_element: method to add an element to a bin
 * @remove_element: method to remove an element from a bin
 * @handle_message: method to handle a message from the children
 *
 * Subclasses can override the @add_element and @remove_element to
 * update the list of children in the bin.
 *
 * The @handle_message method can be overridden to implement custom
 * message handling.  @handle_message takes ownership of the message, just like
 * #gst_element_post_message.
 */
struct _GstBinClass {
  GstElementClass parent_class;

  /*< private >*/
  GThreadPool  *pool;

  /* signals */
  void		(*element_added)	(GstBin *bin, GstElement *child);
  void		(*element_removed)	(GstBin *bin, GstElement *child);

  /*< public >*/
  /* virtual methods for subclasses */
  gboolean	(*add_element)		(GstBin *bin, GstElement *element);
  gboolean	(*remove_element)	(GstBin *bin, GstElement *element);

  void		(*handle_message)	(GstBin *bin, GstMessage *message);

  /*< private >*/
  /* signal added 0.10.22 */
  gboolean	(*do_latency)           (GstBin *bin);

  /*< private >*/
  gpointer _gst_reserved[GST_PADDING-1];
};

 

  GObject GstObject GstElement GstBin
成员函数  

 

 

gobject_class->dispose = gst_element_dispose;
gobject_class->finalize = gst_element_finalize;
  gobject_class->set_property = gst_bin_set_property;
  gobject_class->get_property = gst_bin_get_property;
Property -  

 

enum
{
  PROP_0,
  PROP_ASYNC_HANDLING,
  PROP_MESSAGE_FORWARD,
  PROP_LAST
};
 
Signals  

 

enum
{
PAD_ADDED,
PAD_REMOVED,
NO_MORE_PADS,
/* add more above */
LAST_SIGNAL
};

enum
{
  ELEMENT_ADDED,
  ELEMENT_REMOVED,
  DO_LATENCY,
  LAST_SIGNAL
};
User register signal handler        
何时emit signal?

 

 

gst_element_add_pad ()
gst_element_remove_pad()

gst_element_no_more_pads()

 

 

  klass->add_element = GST_DEBUG_FUNCPTR (gst_bin_add_func);
  klass->remove_element = GST_DEBUG_FUNCPTR (gst_bin_remove_func);
  klass->handle_message = GST_DEBUG_FUNCPTR (gst_bin_handle_message_func);
Quark data

 

  _gst_elementclass_factory  

 

GstPipeline:

struct _GstPipeline {
  GstBin 	 bin;

  /*< public >*/ /* with LOCK */
  GstClock      *fixed_clock;

  GstClockTime   stream_time;	
  GstClockTime   delay;

  /*< private >*/
  GstPipelinePrivate *priv;

  gpointer _gst_reserved[GST_PADDING-1];
};

struct _GstPipelineClass {
  GstBinClass parent_class;

  /*< private >*/
  gpointer _gst_reserved[GST_PADDING];
};

 

  GObject GstObject GstElement GstBin GstPipeline
成员函数  

 

 

  gobject_class->set_property = gst_bin_set_property;
gobject_class->get_property = gst_bin_get_property;

 override老祖宗:

gobject_class->set_property = gst_pipeline_set_property;
  gobject_class->get_property = gst_pipeline_get_property;

gobject_class->dispose = gst_pipeline_dispose;

 

override父类:

  gstelement_class->change_state =
      GST_DEBUG_FUNCPTR (gst_pipeline_change_state);
  gstelement_class->provide_clock =
      GST_DEBUG_FUNCPTR (gst_pipeline_provide_clock_func);
  gstbin_class->handle_message =
      GST_DEBUG_FUNCPTR (gst_pipeline_handle_message);

Property -  

 

enum
{
PROP_0,
PROP_ASYNC_HANDLING,
PROP_MESSAGE_FORWARD,
PROP_LAST
};
enum
{
  PROP_0,
  PROP_DELAY,
  PROP_AUTO_FLUSH_BUS
};
Signals  

 

 

enum
{
ELEMENT_ADDED,
ELEMENT_REMOVED,
DO_LATENCY,
LAST_SIGNAL
};
 
User register signal handler          
何时emit signal?

 

 

 

 

 

klass->add_element = GST_DEBUG_FUNCPTR (gst_bin_add_func);
klass->remove_element = GST_DEBUG_FUNCPTR (gst_bin_remove_func);
klass->handle_message = GST_DEBUG_FUNCPTR (gst_bin_handle_message_func);
 
Quark data

 

       

 

 


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter