[503/906] Rename GST_BOILERPLATE_* to G_DEFINE_TYPE_* and move _base_init into _class_init

This commit is contained in:
Matthew Waters 2012-05-30 13:46:21 +10:00 committed by Tim-Philipp Müller
parent 1a034ba18d
commit f7bc5dcf83
3 changed files with 34 additions and 47 deletions

View file

@ -49,10 +49,10 @@
GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
#define GST_CAT_DEFAULT gst_gl_display_debug
#define DEBUG_INIT(bla) \
#define DEBUG_INIT \
GST_DEBUG_CATEGORY_INIT (gst_gl_display_debug, "gldisplay", 0, "opengl display");
GST_BOILERPLATE_FULL (GstGLDisplay, gst_gl_display, GObject, G_TYPE_OBJECT,
G_DEFINE_TYPE_WITH_CODE (GstGLDisplay, gst_gl_display, G_TYPE_OBJECT,
DEBUG_INIT);
static void gst_gl_display_finalize (GObject * object);
@ -102,12 +102,6 @@ void gst_gl_display_thread_do_download_draw_yuv (GstGLDisplay * display);
//------------------------------------------------------------
//---------------------- For klass GstGLDisplay ---------------
//------------------------------------------------------------
static void
gst_gl_display_base_init (gpointer g_class)
{
}
static void
gst_gl_display_class_init (GstGLDisplayClass * klass)
{
@ -118,7 +112,7 @@ gst_gl_display_class_init (GstGLDisplayClass * klass)
static void
gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
gst_gl_display_init (GstGLDisplay * display)
{
//thread safe
display->mutex = g_mutex_new ();

View file

@ -51,11 +51,11 @@ enum
PROP_EXTERNAL_OPENGL_CONTEXT
};
#define DEBUG_INIT(bla) \
#define DEBUG_INIT \
GST_DEBUG_CATEGORY_INIT (gst_gl_filter_debug, "glfilter", 0, "glfilter element");
GST_BOILERPLATE_FULL (GstGLFilter, gst_gl_filter, GstBaseTransform,
GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
G_DEFINE_TYPE_WITH_CODE (GstGLFilter, gst_gl_filter, GST_TYPE_BASE_TRANSFORM,
DEBUG_INIT);
static void gst_gl_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -83,25 +83,16 @@ static gboolean gst_gl_filter_do_transform (GstGLFilter * filter,
static void gst_gl_filter_start_gl (GstGLDisplay * display, gpointer data);
static void gst_gl_filter_stop_gl (GstGLDisplay * display, gpointer data);
static void
gst_gl_filter_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_gl_filter_src_pad_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_gl_filter_sink_pad_template));
}
static void
gst_gl_filter_class_init (GstGLFilterClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
gobject_class = (GObjectClass *) klass;
gobject_class->set_property = gst_gl_filter_set_property;
element_class = GST_ELEMENT_CLASS (klass)
gobject_class->set_property = gst_gl_filter_set_property;
gobject_class->get_property = gst_gl_filter_get_property;
GST_BASE_TRANSFORM_CLASS (klass)->transform_caps =
@ -120,6 +111,11 @@ gst_gl_filter_class_init (GstGLFilterClass * klass)
"Give an external OpenGL context with which to share textures",
0, G_MAXULONG, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_gl_filter_src_pad_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_gl_filter_sink_pad_template));
klass->set_caps = NULL;
klass->filter = NULL;
klass->display_init_cb = NULL;
@ -131,7 +127,7 @@ gst_gl_filter_class_init (GstGLFilterClass * klass)
}
static void
gst_gl_filter_init (GstGLFilter * filter, GstGLFilterClass * klass)
gst_gl_filter_init (GstGLFilter * filter)
{
GstBaseTransform *base_trans = GST_BASE_TRANSFORM (filter);

View file

@ -25,7 +25,7 @@
#include <gst/gst.h>
#include <gst/base/gstcollectpads.h>
#include <gst/controller/gstcontroller.h>
//#include <gst/controller/gstcontroller.h>
#include <gst/video/video.h>
#ifdef HAVE_STDLIB_H
@ -227,8 +227,9 @@ static void gst_gl_mixer_child_proxy_init (gpointer g_iface,
gpointer iface_data);
static void _do_init (GType object_type);
GST_BOILERPLATE_FULL (GstGLMixer, gst_gl_mixer, GstElement,
GST_TYPE_ELEMENT, _do_init);
#define gst_gl_mixer_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstGLMixer, gst_gl_mixer, GST_TYPE_ELEMENT, _do_init);
static void gst_gl_mixer_finalize (GObject * object);
static void
_do_init (GType object_type)
@ -282,33 +283,29 @@ gst_gl_mixer_child_proxy_init (gpointer g_iface, gpointer iface_data)
iface->get_children_count = gst_gl_mixer_child_proxy_get_children_count;
}
static void
gst_gl_mixer_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
}
static void
gst_gl_mixer_class_init (GstGLMixerClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GObjectClass *gobject_class;
GstElementClass *element_class;
gobject_class = (GObjectClass *) klass;
element_class = GST_ELEMENT_CLASS (klass);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_gl_mixer_finalize);
gobject_class->get_property = gst_gl_mixer_get_property;
gobject_class->set_property = gst_gl_mixer_set_property;
gstelement_class->request_new_pad =
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
element_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_gl_mixer_request_new_pad);
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_gl_mixer_release_pad);
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_gl_mixer_change_state);
element_class->release_pad = GST_DEBUG_FUNCPTR (gst_gl_mixer_release_pad);
element_class->change_state = GST_DEBUG_FUNCPTR (gst_gl_mixer_change_state);
/* Register the pad class */
(void) (GST_TYPE_GL_MIXER_PAD);
@ -354,7 +351,7 @@ gst_gl_mixer_reset (GstGLMixer * mix)
}
static void
gst_gl_mixer_init (GstGLMixer * mix, GstGLMixerClass * g_class)
gst_gl_mixer_init (GstGLMixer * mix)
{
GstElementClass *klass = GST_ELEMENT_GET_CLASS (mix);