gstreamer GST_BOILERPLATE_FULL 分析

来源:互联网 发布:天地传说之宝莲灯源码 编辑:程序博客网 时间:2024/06/11 23:43

..../gstutils.h 定义了GST_BOILERPLATE_FULL,针对v4l2src的分析,展开如下:

#define GST_BOILERPLATE_FULL(GstV4l2Src, gst_v4l2src, GstPushSrc, GST_TYPE_PUSH_SRC, gst_v4l2src_init_interfaces) 

---------------->
static void gst_v4l2src_base_init     (gpointer      g_class); 
static void gst_v4l2src_class_init    (GstV4l2SrcClass *g_class);
static void gst_v4l2src_init        (GstV4l2Src   *object, GstV4l2SrcClass *g_class);
static GstPushSrcClass *parent_class = NULL;  


static void        
GstV4l2Src_class_init_trampoline (gpointer g_class,  gpointer data)  
{         
       parent_class = (GstPushSrcClass *)    
      g_type_class_peek_parent (g_class);    
      gst_v4l2src_class_init ((GstV4l2SrcClass *)g_class);  
}  
         
GType gst_v4l2src_get_type (void);  
         
GType         
gst_v4l2src_get_type (void) 
{         
  /* The typedef for GType may be gulong or gsize, depending on the 
   * system and whether the compiler is c++ or not. The g_once_init_* 
   * functions always take a gsize * though ... */   
  static volatile gsize gonce_data = 0;     \


  if (g_once_init_enter (&gonce_data)) { 
    GType _type;  
    _type = gst_type_register_static_full (GST_TYPE_PUSH_SRC, g_intern_static_string (GstV4l2Src), 

        sizeof (GstV4l2Src,Class),  
        gst_v4l2src_base_init,     
        NULL,    /* base_finalize */    
       gst_v4l2src_class_init_trampoline,   
        NULL,    /* class_finalize */    
        NULL,               /* class_data */    
        sizeof (type),       
        0,                  /* n_preallocs */    
        (GInstanceInitFunc) gst_v4l2src_init,                  
        NULL,                                                           
        (GTypeFlags) 0);                    
    gst_v4l2src_init_interfaces(_type);            
    g_once_init_leave (&gonce_data, (gsize) _type);   
  }         
  return (GType) gonce_data;      
}

通过g_type_register_static 注册。