diff --git a/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m b/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m index b3ba59e9c2..a93baa335b 100644 --- a/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m +++ b/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m @@ -36,22 +36,19 @@ static GstGLAPI gst_gl_context_cocoa_get_gl_api (GstGLContext * context); static GstGLPlatform gst_gl_context_cocoa_get_gl_platform (GstGLContext * context); static void gst_gl_context_cocoa_swap_buffers (GstGLContext * context); -#define GST_GL_CONTEXT_COCOA_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT_COCOA, GstGLContextCocoaPrivate)) - GST_DEBUG_CATEGORY_STATIC (gst_gl_context_cocoa_debug); #define GST_CAT_DEFAULT gst_gl_context_cocoa_debug G_DEFINE_TYPE_WITH_CODE (GstGLContextCocoa, gst_gl_context_cocoa, - GST_TYPE_GL_CONTEXT, GST_DEBUG_CATEGORY_INIT (gst_gl_context_cocoa_debug, "glcontext_cocoa", 0, "Cocoa GL Context"); ); + GST_TYPE_GL_CONTEXT, + G_ADD_PRIVATE (GstGLContextCocoa) + GST_DEBUG_CATEGORY_INIT (gst_gl_context_cocoa_debug, "glcontext_cocoa", 0, "Cocoa GL Context"); ); static void gst_gl_context_cocoa_class_init (GstGLContextCocoaClass * klass) { GstGLContextClass *context_class = (GstGLContextClass *) klass; - g_type_class_add_private (klass, sizeof (GstGLContextCocoaPrivate)); - context_class->swap_buffers = GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_swap_buffers); context_class->destroy_context = @@ -70,7 +67,7 @@ gst_gl_context_cocoa_class_init (GstGLContextCocoaClass * klass) static void gst_gl_context_cocoa_init (GstGLContextCocoa * context) { - context->priv = GST_GL_CONTEXT_COCOA_GET_PRIVATE (context); + context->priv = gst_gl_context_cocoa_get_instance_private (context); } /* Must be called in the gl thread */ diff --git a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m index 1aecf09c16..91c1187ef3 100644 --- a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m +++ b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m @@ -62,16 +62,9 @@ /* */ /* =============================================================*/ -#define GST_GL_WINDOW_COCOA_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_WINDOW_COCOA, GstGLWindowCocoaPrivate)) - #define GST_CAT_DEFAULT gst_gl_window_cocoa_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); -#define DEBUG_INIT \ - GST_DEBUG_CATEGORY_GET (GST_CAT_DEFAULT, "glwindow"); -#define gst_gl_window_cocoa_parent_class parent_class -G_DEFINE_TYPE_WITH_CODE (GstGLWindowCocoa, gst_gl_window_cocoa, GST_TYPE_GL_WINDOW, DEBUG_INIT); static void gst_gl_window_cocoa_finalize (GObject * object); static gboolean gst_gl_window_cocoa_open (GstGLWindow *window, GError **err); @@ -103,14 +96,20 @@ struct _GstGLWindowCocoaPrivate gpointer gl_queue; }; +#define DEBUG_INIT \ + GST_DEBUG_CATEGORY_GET (GST_CAT_DEFAULT, "glwindow"); + +#define gst_gl_window_cocoa_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstGLWindowCocoa, gst_gl_window_cocoa, GST_TYPE_GL_WINDOW, + G_ADD_PRIVATE (GstGLWindowCocoa) + DEBUG_INIT); + static void gst_gl_window_cocoa_class_init (GstGLWindowCocoaClass * klass) { GstGLWindowClass *window_class = (GstGLWindowClass *) klass; GObjectClass *gobject_class = (GObjectClass *) klass; - g_type_class_add_private (klass, sizeof (GstGLWindowCocoaPrivate)); - window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_open); window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_close); window_class->get_window_handle = @@ -133,7 +132,7 @@ gst_gl_window_cocoa_class_init (GstGLWindowCocoaClass * klass) static void gst_gl_window_cocoa_init (GstGLWindowCocoa * window) { - window->priv = GST_GL_WINDOW_COCOA_GET_PRIVATE (window); + window->priv = gst_gl_window_cocoa_get_instance_private (window); window->priv->preferred_width = 320; window->priv->preferred_height = 240; diff --git a/gst-libs/gst/gl/eagl/gstglcontext_eagl.m b/gst-libs/gst/gl/eagl/gstglcontext_eagl.m index 392eeee497..409c1dac73 100644 --- a/gst-libs/gst/gl/eagl/gstglcontext_eagl.m +++ b/gst-libs/gst/gl/eagl/gstglcontext_eagl.m @@ -56,10 +56,8 @@ struct _GstGLContextEaglPrivate GLuint depth_renderbuffer; }; -#define GST_GL_CONTEXT_EAGL_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT_EAGL, GstGLContextEaglPrivate)) - -G_DEFINE_TYPE (GstGLContextEagl, gst_gl_context_eagl, GST_TYPE_GL_CONTEXT); +G_DEFINE_TYPE_WITH_PRIVATE (GstGLContextEagl, gst_gl_context_eagl, + GST_TYPE_GL_CONTEXT); static void gst_gl_context_eagl_class_init (GstGLContextEaglClass * klass) @@ -68,8 +66,6 @@ gst_gl_context_eagl_class_init (GstGLContextEaglClass * klass) context_class = (GstGLContextClass *) klass; - g_type_class_add_private (klass, sizeof (GstGLContextEaglPrivate)); - context_class->destroy_context = GST_DEBUG_FUNCPTR (gst_gl_context_eagl_destroy_context); context_class->create_context = @@ -90,7 +86,7 @@ gst_gl_context_eagl_class_init (GstGLContextEaglClass * klass) static void gst_gl_context_eagl_init (GstGLContextEagl * context) { - context->priv = GST_GL_CONTEXT_EAGL_GET_PRIVATE (context); + context->priv = gst_gl_context_eagl_get_instance_private (context); } /* Must be called in the gl thread */ diff --git a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m index 088a47c225..672c6a5782 100644 --- a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m +++ b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m @@ -29,9 +29,6 @@ #include "gstglwindow_eagl.h" #include "gstglcontext_eagl.h" -#define GST_GL_WINDOW_EAGL_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_WINDOW_EAGL, GstGLWindowEaglPrivate)) - #define GST_CAT_DEFAULT gst_gl_window_eagl_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); @@ -39,7 +36,8 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); GST_DEBUG_CATEGORY_GET (GST_CAT_DEFAULT, "glwindow"); #define gst_gl_window_eagl_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstGLWindowEagl, gst_gl_window_eagl, - GST_TYPE_GL_WINDOW, DEBUG_INIT); + GST_TYPE_GL_WINDOW, G_ADD_PRIVATE (GstGLWindowEagl) DEBUG_INIT); + static void gst_gl_window_eagl_finalize (GObject * object); static guintptr gst_gl_window_eagl_get_display (GstGLWindow * window); @@ -66,8 +64,6 @@ gst_gl_window_eagl_class_init (GstGLWindowEaglClass * klass) GObjectClass *gobject_class = (GObjectClass *) klass; GstGLWindowClass *window_class = (GstGLWindowClass *) klass; - g_type_class_add_private (klass, sizeof (GstGLWindowEaglPrivate)); - gobject_class->finalize = gst_gl_window_eagl_finalize; window_class->get_display = @@ -86,7 +82,7 @@ gst_gl_window_eagl_class_init (GstGLWindowEaglClass * klass) static void gst_gl_window_eagl_init (GstGLWindowEagl * window) { - window->priv = GST_GL_WINDOW_EAGL_GET_PRIVATE (window); + window->priv = gst_gl_window_eagl_get_instance_private (window); window->priv->gl_queue = (__bridge_retained gpointer)dispatch_queue_create ("org.freedesktop.gstreamer.glwindow", NULL); } diff --git a/gst-libs/gst/gl/gstglbasefilter.c b/gst-libs/gst/gl/gstglbasefilter.c index 61514cecd5..01622984ba 100644 --- a/gst-libs/gst/gl/gstglbasefilter.c +++ b/gst-libs/gst/gl/gstglbasefilter.c @@ -42,9 +42,6 @@ #define GST_CAT_DEFAULT gst_gl_base_filter_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); -#define GST_GL_BASE_FILTER_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_BASE_FILTER, GstGLBaseFilterPrivate)) - struct _GstGLBaseFilterPrivate { GstGLContext *other_context; @@ -62,7 +59,8 @@ enum #define gst_gl_base_filter_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstGLBaseFilter, gst_gl_base_filter, - GST_TYPE_BASE_TRANSFORM, GST_DEBUG_CATEGORY_INIT (gst_gl_base_filter_debug, + GST_TYPE_BASE_TRANSFORM, G_ADD_PRIVATE (GstGLBaseFilter) + GST_DEBUG_CATEGORY_INIT (gst_gl_base_filter_debug, "glbasefilter", 0, "glbasefilter element"); ); @@ -99,8 +97,6 @@ gst_gl_base_filter_class_init (GstGLBaseFilterClass * klass) GObjectClass *gobject_class; GstElementClass *element_class; - g_type_class_add_private (klass, sizeof (GstGLBaseFilterPrivate)); - gobject_class = (GObjectClass *) klass; element_class = GST_ELEMENT_CLASS (klass); @@ -134,7 +130,7 @@ gst_gl_base_filter_init (GstGLBaseFilter * filter) { gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM (filter), TRUE); - filter->priv = GST_GL_BASE_FILTER_GET_PRIVATE (filter); + filter->priv = gst_gl_base_filter_get_instance_private (filter); } static void diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c index 309bc367b6..e8327defb5 100644 --- a/gst-libs/gst/gl/gstglbufferpool.c +++ b/gst-libs/gst/gl/gstglbufferpool.c @@ -59,13 +59,14 @@ static void gst_gl_buffer_pool_finalize (GObject * object); GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_BUFFER_POOL); #define GST_CAT_DEFAULT GST_CAT_GL_BUFFER_POOL -#define GST_GL_BUFFER_POOL_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_GL_BUFFER_POOL, GstGLBufferPoolPrivate)) +#define _init \ + GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_BUFFER_POOL, "glbufferpool", 0, \ + "GL Buffer Pool"); #define gst_gl_buffer_pool_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstGLBufferPool, gst_gl_buffer_pool, - GST_TYPE_BUFFER_POOL, GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_BUFFER_POOL, - "glbufferpool", 0, "GL Buffer Pool")); + GST_TYPE_BUFFER_POOL, G_ADD_PRIVATE (GstGLBufferPool) + _init); static const gchar ** gst_gl_buffer_pool_get_options (GstBufferPool * pool) @@ -327,8 +328,6 @@ gst_gl_buffer_pool_class_init (GstGLBufferPoolClass * klass) GObjectClass *gobject_class = (GObjectClass *) klass; GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass; - g_type_class_add_private (klass, sizeof (GstGLBufferPoolPrivate)); - gobject_class->finalize = gst_gl_buffer_pool_finalize; gstbufferpool_class->get_options = gst_gl_buffer_pool_get_options; @@ -342,7 +341,7 @@ gst_gl_buffer_pool_init (GstGLBufferPool * pool) { GstGLBufferPoolPrivate *priv = NULL; - pool->priv = GST_GL_BUFFER_POOL_GET_PRIVATE (pool); + pool->priv = gst_gl_buffer_pool_get_instance_private (pool); priv = pool->priv; priv->allocator = NULL; diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c index d8c24f73c1..ccad1d6805 100644 --- a/gst-libs/gst/gl/gstglcolorconvert.c +++ b/gst-libs/gst/gl/gstglcolorconvert.c @@ -462,7 +462,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_color_convert_debug); GST_DEBUG_CATEGORY_INIT (gst_gl_color_convert_debug, "glconvert", 0, "convert"); G_DEFINE_TYPE_WITH_CODE (GstGLColorConvert, gst_gl_color_convert, - GST_TYPE_OBJECT, DEBUG_INIT); + GST_TYPE_OBJECT, G_ADD_PRIVATE (GstGLColorConvert) DEBUG_INIT); + static void gst_gl_color_convert_finalize (GObject * object); static void gst_gl_color_convert_reset (GstGLColorConvert * convert); @@ -472,15 +473,13 @@ static void gst_gl_color_convert_reset (GstGLColorConvert * convert); static void gst_gl_color_convert_class_init (GstGLColorConvertClass * klass) { - g_type_class_add_private (klass, sizeof (GstGLColorConvertPrivate)); - G_OBJECT_CLASS (klass)->finalize = gst_gl_color_convert_finalize; } static void gst_gl_color_convert_init (GstGLColorConvert * convert) { - convert->priv = GST_GL_COLOR_CONVERT_GET_PRIVATE (convert); + convert->priv = gst_gl_color_convert_get_instance_private (convert); gst_gl_color_convert_reset (convert); } diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c index 20bed4e87a..a764594811 100644 --- a/gst-libs/gst/gl/gstglcontext.c +++ b/gst-libs/gst/gl/gstglcontext.c @@ -187,12 +187,6 @@ _context_share_group_is_shared (struct ContextShareGroup *share) GST_DEBUG_CATEGORY (GST_CAT_DEFAULT); GST_DEBUG_CATEGORY_STATIC (gst_gl_debug); -#define gst_gl_context_parent_class parent_class -G_DEFINE_ABSTRACT_TYPE (GstGLContext, gst_gl_context, GST_TYPE_OBJECT); - -#define GST_GL_CONTEXT_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT, GstGLContextPrivate)) - static void _init_debug (void); static gpointer gst_gl_context_create_thread (GstGLContext * context); @@ -237,6 +231,10 @@ typedef struct GstGLContextClass parent; } GstGLWrappedContextClass; +#define gst_gl_context_parent_class parent_class +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GstGLContext, gst_gl_context, + GST_TYPE_OBJECT); + #define GST_TYPE_GL_WRAPPED_CONTEXT (gst_gl_wrapped_context_get_type()) static GType gst_gl_wrapped_context_get_type (void); G_DEFINE_TYPE (GstGLWrappedContext, gst_gl_wrapped_context, @@ -272,7 +270,7 @@ _ensure_window (GstGLContext * context) static void gst_gl_context_init (GstGLContext * context) { - context->priv = GST_GL_CONTEXT_GET_PRIVATE (context); + context->priv = gst_gl_context_get_instance_private (context); context->window = NULL; context->gl_vtable = g_slice_alloc0 (sizeof (GstGLFuncs)); @@ -289,8 +287,6 @@ gst_gl_context_init (GstGLContext * context) static void gst_gl_context_class_init (GstGLContextClass * klass) { - g_type_class_add_private (klass, sizeof (GstGLContextPrivate)); - klass->get_proc_address = GST_DEBUG_FUNCPTR (gst_gl_context_default_get_proc_address); klass->get_gl_platform_version = diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c index e108073040..3b72a566d1 100644 --- a/gst-libs/gst/gl/gstgldisplay.c +++ b/gst-libs/gst/gl/gstgldisplay.c @@ -81,16 +81,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_context); GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug); #define GST_CAT_DEFAULT gst_gl_display_debug -#define DEBUG_INIT \ - GST_DEBUG_CATEGORY_INIT (gst_gl_display_debug, "gldisplay", 0, "opengl display"); \ - GST_DEBUG_CATEGORY_GET (gst_context, "GST_CONTEXT"); - -G_DEFINE_TYPE_WITH_CODE (GstGLDisplay, gst_gl_display, GST_TYPE_OBJECT, - DEBUG_INIT); - -#define GST_GL_DISPLAY_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_DISPLAY, GstGLDisplayPrivate)) - enum { SIGNAL_0, @@ -119,6 +109,14 @@ struct _GstGLDisplayPrivate GCond thread_cond; }; +#define DEBUG_INIT \ + GST_DEBUG_CATEGORY_INIT (gst_gl_display_debug, "gldisplay", 0, "opengl display"); \ + GST_DEBUG_CATEGORY_GET (gst_context, "GST_CONTEXT"); + +G_DEFINE_TYPE_WITH_CODE (GstGLDisplay, gst_gl_display, GST_TYPE_OBJECT, + G_ADD_PRIVATE (GstGLDisplay) + DEBUG_INIT); + static gboolean _unlock_main_thread (GstGLDisplay * display) { @@ -158,8 +156,6 @@ _event_thread_main (GstGLDisplay * display) static void gst_gl_display_class_init (GstGLDisplayClass * klass) { - g_type_class_add_private (klass, sizeof (GstGLDisplayPrivate)); - /** * GstGLDisplay::create-context: * @object: the #GstGLDisplay @@ -186,7 +182,7 @@ gst_gl_display_class_init (GstGLDisplayClass * klass) static void gst_gl_display_init (GstGLDisplay * display) { - display->priv = GST_GL_DISPLAY_GET_PRIVATE (display); + display->priv = gst_gl_display_get_instance_private (display); display->type = GST_GL_DISPLAY_TYPE_ANY; display->priv->gl_api = GST_GL_API_ANY; diff --git a/gst-libs/gst/gl/gstglframebuffer.c b/gst-libs/gst/gl/gstglframebuffer.c index b1d64b288c..98eee348f4 100644 --- a/gst-libs/gst/gl/gstglframebuffer.c +++ b/gst-libs/gst/gl/gstglframebuffer.c @@ -79,15 +79,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_framebuffer_debug); #define GST_CAT_DEFAULT gst_gl_framebuffer_debug -#define DEBUG_INIT \ - GST_DEBUG_CATEGORY_INIT (gst_gl_framebuffer_debug, "glframebuffer", 0, "GL Framebuffer"); - -G_DEFINE_TYPE_WITH_CODE (GstGLFramebuffer, gst_gl_framebuffer, GST_TYPE_OBJECT, - DEBUG_INIT); - -#define GST_GL_FRAMEBUFFER_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_FRAMEBUFFER, GstGLFramebufferPrivate)) - static void gst_gl_framebuffer_finalize (GObject * object); struct _GstGLFramebufferPrivate @@ -96,6 +87,12 @@ struct _GstGLFramebufferPrivate guint effective_height; }; +#define DEBUG_INIT \ + GST_DEBUG_CATEGORY_INIT (gst_gl_framebuffer_debug, "glframebuffer", 0, "GL Framebuffer"); + +G_DEFINE_TYPE_WITH_CODE (GstGLFramebuffer, gst_gl_framebuffer, GST_TYPE_OBJECT, + G_ADD_PRIVATE (GstGLFramebuffer) DEBUG_INIT); + struct fbo_attachment { guint attachment_point; @@ -124,15 +121,13 @@ _fbo_attachment_unset (struct fbo_attachment *attach) static void gst_gl_framebuffer_class_init (GstGLFramebufferClass * klass) { - g_type_class_add_private (klass, sizeof (GstGLFramebufferPrivate)); - G_OBJECT_CLASS (klass)->finalize = gst_gl_framebuffer_finalize; } static void gst_gl_framebuffer_init (GstGLFramebuffer * fb) { - fb->priv = GST_GL_FRAMEBUFFER_GET_PRIVATE (fb); + fb->priv = gst_gl_framebuffer_get_instance_private (fb); fb->attachments = g_array_new (FALSE, FALSE, (sizeof (struct fbo_attachment))); diff --git a/gst-libs/gst/gl/gstglshader.c b/gst-libs/gst/gl/gstglshader.c index 6d14159c4f..0f02ace8a0 100644 --- a/gst-libs/gst/gl/gstglshader.c +++ b/gst-libs/gst/gl/gstglshader.c @@ -38,9 +38,6 @@ #define GLhandleARB GLuint #endif -#define GST_GL_SHADER_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_SHADER, GstGLShaderPrivate)) - #define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0)) #define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1)) #define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0)) @@ -91,7 +88,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_shader_debug); #define DEBUG_INIT \ GST_DEBUG_CATEGORY_INIT (gst_gl_shader_debug, "glshader", 0, "shader"); G_DEFINE_TYPE_WITH_CODE (GstGLShader, gst_gl_shader, GST_TYPE_OBJECT, - DEBUG_INIT); + G_ADD_PRIVATE (GstGLShader) DEBUG_INIT); static void _cleanup_shader (GstGLContext * context, GstGLShader * shader) @@ -174,8 +171,6 @@ gst_gl_shader_class_init (GstGLShaderClass * klass) /* bind class methods .. */ GObjectClass *obj_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GstGLShaderPrivate)); - obj_class->finalize = gst_gl_shader_finalize; obj_class->set_property = gst_gl_shader_set_property; obj_class->get_property = gst_gl_shader_get_property; @@ -195,7 +190,7 @@ gst_gl_shader_init (GstGLShader * self) /* initialize sources and create program object */ GstGLShaderPrivate *priv; - priv = self->priv = GST_GL_SHADER_GET_PRIVATE (self); + priv = self->priv = gst_gl_shader_get_instance_private (self); priv->linked = FALSE; priv->uniform_locations = diff --git a/gst-libs/gst/gl/gstglslstage.c b/gst-libs/gst/gl/gstglslstage.c index 4e7374c302..b95c3fedd2 100644 --- a/gst-libs/gst/gl/gstglslstage.c +++ b/gst-libs/gst/gl/gstglslstage.c @@ -55,14 +55,6 @@ static const gchar *es2_version_header = "#version 100\n"; GST_DEBUG_CATEGORY_STATIC (gst_glsl_stage_debug); #define GST_CAT_DEFAULT gst_glsl_stage_debug -G_DEFINE_TYPE_WITH_CODE (GstGLSLStage, gst_glsl_stage, GST_TYPE_OBJECT, - GST_DEBUG_CATEGORY_INIT (gst_glsl_stage_debug, "glslstage", 0, - "GLSL Stage"); - ); - -#define GST_GLSL_STAGE_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GLSL_STAGE, GstGLSLStagePrivate)) - struct _GstGLSLStagePrivate { GstGLSLFuncs vtable; @@ -77,6 +69,12 @@ struct _GstGLSLStagePrivate gboolean compiled; }; +G_DEFINE_TYPE_WITH_CODE (GstGLSLStage, gst_glsl_stage, GST_TYPE_OBJECT, + G_ADD_PRIVATE (GstGLSLStage) + GST_DEBUG_CATEGORY_INIT (gst_glsl_stage_debug, "glslstage", 0, + "GLSL Stage"); + ); + static void gst_glsl_stage_finalize (GObject * object) { @@ -125,8 +123,6 @@ gst_glsl_stage_class_init (GstGLSLStageClass * klass) { GObjectClass *obj_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GstGLSLStagePrivate)); - obj_class->finalize = gst_glsl_stage_finalize; obj_class->set_property = gst_glsl_stage_set_property; obj_class->get_property = gst_glsl_stage_get_property; @@ -135,7 +131,7 @@ gst_glsl_stage_class_init (GstGLSLStageClass * klass) static void gst_glsl_stage_init (GstGLSLStage * stage) { - stage->priv = GST_GLSL_STAGE_GET_PRIVATE (stage); + stage->priv = gst_glsl_stage_get_instance_private (stage); } static gboolean diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c index fa4884a322..745cde0aab 100644 --- a/gst-libs/gst/gl/gstglupload.c +++ b/gst-libs/gst/gl/gstglupload.c @@ -63,16 +63,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug); #define GST_CAT_DEFAULT gst_gl_upload_debug -#define DEBUG_INIT \ - GST_DEBUG_CATEGORY_INIT (gst_gl_upload_debug, "glupload", 0, "upload"); - -G_DEFINE_TYPE_WITH_CODE (GstGLUpload, gst_gl_upload, GST_TYPE_OBJECT, - DEBUG_INIT); static void gst_gl_upload_finalize (GObject * object); -#define GST_GL_UPLOAD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - GST_TYPE_GL_UPLOAD, GstGLUploadPrivate)) - static GstGLTextureTarget _caps_get_texture_target (GstCaps * caps, GstGLTextureTarget default_target) { @@ -113,6 +105,12 @@ struct _GstGLUploadPrivate int method_i; }; +#define DEBUG_INIT \ + GST_DEBUG_CATEGORY_INIT (gst_gl_upload_debug, "glupload", 0, "upload"); + +G_DEFINE_TYPE_WITH_CODE (GstGLUpload, gst_gl_upload, GST_TYPE_OBJECT, + G_ADD_PRIVATE (GstGLUpload) DEBUG_INIT); + static GstCaps * _set_caps_features_with_passthrough (const GstCaps * caps, const gchar * feature_name, GstCapsFeatures * passthrough) @@ -1559,15 +1557,13 @@ gst_gl_upload_get_input_template_caps (void) static void gst_gl_upload_class_init (GstGLUploadClass * klass) { - g_type_class_add_private (klass, sizeof (GstGLUploadPrivate)); - G_OBJECT_CLASS (klass)->finalize = gst_gl_upload_finalize; } static void gst_gl_upload_init (GstGLUpload * upload) { - upload->priv = GST_GL_UPLOAD_GET_PRIVATE (upload); + upload->priv = gst_gl_upload_get_instance_private (upload); } /** diff --git a/gst-libs/gst/gl/gstglviewconvert.c b/gst-libs/gst/gl/gstglviewconvert.c index c19b7790c1..d032c21053 100644 --- a/gst-libs/gst/gl/gstglviewconvert.c +++ b/gst-libs/gst/gl/gstglviewconvert.c @@ -102,14 +102,11 @@ struct _GstGLViewConvertPrivate GLuint attr_texture; }; -#define GST_GL_VIEW_CONVERT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - GST_TYPE_GL_VIEW_CONVERT, GstGLViewConvertPrivate)) - #define DEBUG_INIT \ GST_DEBUG_CATEGORY_INIT (gst_gl_view_convert_debug, "glviewconvert", 0, "glviewconvert object"); G_DEFINE_TYPE_WITH_CODE (GstGLViewConvert, gst_gl_view_convert, - GST_TYPE_OBJECT, DEBUG_INIT); + GST_TYPE_OBJECT, G_ADD_PRIVATE (GstGLViewConvert) DEBUG_INIT); static void gst_gl_view_convert_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -261,8 +258,6 @@ gst_gl_view_convert_class_init (GstGLViewConvertClass * klass) { GObjectClass *gobject_class = (GObjectClass *) klass; - g_type_class_add_private (klass, sizeof (GstGLViewConvertPrivate)); - gobject_class->set_property = gst_gl_view_convert_set_property; gobject_class->get_property = gst_gl_view_convert_get_property; gobject_class->finalize = gst_gl_view_convert_finalize; @@ -302,7 +297,7 @@ gst_gl_view_convert_class_init (GstGLViewConvertClass * klass) static void gst_gl_view_convert_init (GstGLViewConvert * convert) { - convert->priv = GST_GL_VIEW_CONVERT_GET_PRIVATE (convert); + convert->priv = gst_gl_view_convert_get_instance_private (convert); convert->shader = NULL; convert->downmix_mode = DEFAULT_DOWNMIX; diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c index f7237a4976..17ad5edcce 100644 --- a/gst-libs/gst/gl/gstglwindow.c +++ b/gst-libs/gst/gl/gstglwindow.c @@ -78,12 +78,6 @@ #define GST_CAT_DEFAULT gst_gl_window_debug GST_DEBUG_CATEGORY (GST_CAT_DEFAULT); -#define gst_gl_window_parent_class parent_class -G_DEFINE_ABSTRACT_TYPE (GstGLWindow, gst_gl_window, GST_TYPE_OBJECT); - -#define GST_GL_WINDOW_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_WINDOW, GstGLWindowPrivate)) - static void gst_gl_window_default_draw (GstGLWindow * window); static void gst_gl_window_default_run (GstGLWindow * window); static void gst_gl_window_default_quit (GstGLWindow * window); @@ -105,6 +99,10 @@ struct _GstGLWindowPrivate GCond sync_message_cond; }; +#define gst_gl_window_parent_class parent_class +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GstGLWindow, gst_gl_window, + GST_TYPE_OBJECT); + static void gst_gl_window_finalize (GObject * object); typedef struct _GstGLDummyWindow @@ -163,7 +161,7 @@ _init_debug (void) static void gst_gl_window_init (GstGLWindow * window) { - GstGLWindowPrivate *priv = GST_GL_WINDOW_GET_PRIVATE (window); + GstGLWindowPrivate *priv = gst_gl_window_get_instance_private (window); window->priv = priv; g_mutex_init (&window->lock); @@ -181,8 +179,6 @@ gst_gl_window_init (GstGLWindow * window) static void gst_gl_window_class_init (GstGLWindowClass * klass) { - g_type_class_add_private (klass, sizeof (GstGLWindowPrivate)); - klass->open = GST_DEBUG_FUNCPTR (gst_gl_window_default_open); klass->close = GST_DEBUG_FUNCPTR (gst_gl_window_default_close); klass->run = GST_DEBUG_FUNCPTR (gst_gl_window_default_run); diff --git a/gst-libs/gst/gl/win32/gstglcontext_wgl.c b/gst-libs/gst/gl/win32/gstglcontext_wgl.c index 47b576c0b7..ec4a8ebaba 100644 --- a/gst-libs/gst/gl/win32/gstglcontext_wgl.c +++ b/gst-libs/gst/gl/win32/gstglcontext_wgl.c @@ -44,9 +44,8 @@ struct _GstGLContextWGLPrivate #define GST_CAT_DEFAULT gst_gl_context_debug #define gst_gl_context_wgl_parent_class parent_class -G_DEFINE_TYPE (GstGLContextWGL, gst_gl_context_wgl, GST_TYPE_GL_CONTEXT); -#define GST_GL_CONTEXT_WGL_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT_WGL, GstGLContextWGLPrivate)) +G_DEFINE_TYPE_PRIVATE (GstGLContextWGL, gst_gl_context_wgl, + GST_TYPE_GL_CONTEXT); static guintptr gst_gl_context_wgl_get_gl_context (GstGLContext * context); static void gst_gl_context_wgl_swap_buffers (GstGLContext * context); @@ -66,8 +65,6 @@ gst_gl_context_wgl_class_init (GstGLContextWGLClass * klass) { GstGLContextClass *context_class = (GstGLContextClass *) klass; - g_type_class_add_private (klass, sizeof (GstGLContextWGLPrivate)); - context_class->get_gl_context = GST_DEBUG_FUNCPTR (gst_gl_context_wgl_get_gl_context); context_class->choose_format = @@ -90,7 +87,7 @@ gst_gl_context_wgl_class_init (GstGLContextWGLClass * klass) static void gst_gl_context_wgl_init (GstGLContextWGL * context_wgl) { - context_wgl->priv = GST_GL_CONTEXT_WGL_GET_PRIVATE (context_wgl); + context_wgl->priv = gst_gl_context_wgl_get_instance_private (context_wgl); context_wgl->priv->context_api = GST_GL_API_OPENGL | GST_GL_API_OPENGL3; } diff --git a/gst-libs/gst/gl/win32/gstglwindow_win32.c b/gst-libs/gst/gl/win32/gstglwindow_win32.c index 324954e587..bbaa7b0830 100644 --- a/gst-libs/gst/gl/win32/gstglwindow_win32.c +++ b/gst-libs/gst/gl/win32/gstglwindow_win32.c @@ -31,9 +31,6 @@ LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LRESULT FAR PASCAL sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -#define GST_GL_WINDOW_WIN32_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_WINDOW_WIN32, GstGLWindowWin32Private)) - enum { PROP_0 @@ -52,7 +49,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); GST_DEBUG_CATEGORY_GET (GST_CAT_DEFAULT, "glwindow"); #define gst_gl_window_win32_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstGLWindowWin32, gst_gl_window_win32, - GST_TYPE_GL_WINDOW, DEBUG_INIT); + GST_TYPE_GL_WINDOW, G_ADD_PRIVATE (GstGLWindowWin32) DEBUG_INIT); static void gst_gl_window_win32_set_window_handle (GstGLWindow * window, guintptr handle); @@ -70,8 +67,6 @@ gst_gl_window_win32_class_init (GstGLWindowWin32Class * klass) { GstGLWindowClass *window_class = (GstGLWindowClass *) klass; - g_type_class_add_private (klass, sizeof (GstGLWindowWin32Private)); - window_class->set_window_handle = GST_DEBUG_FUNCPTR (gst_gl_window_win32_set_window_handle); window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_win32_draw); @@ -87,7 +82,7 @@ gst_gl_window_win32_class_init (GstGLWindowWin32Class * klass) static void gst_gl_window_win32_init (GstGLWindowWin32 * window) { - window->priv = GST_GL_WINDOW_WIN32_GET_PRIVATE (window); + window->priv = gst_gl_window_win32_get_instance_private (window); } GstGLWindowWin32 * diff --git a/gst-libs/gst/gl/x11/gstglcontext_glx.c b/gst-libs/gst/gl/x11/gstglcontext_glx.c index 877e5c6d8c..3da3467842 100644 --- a/gst-libs/gst/gl/x11/gstglcontext_glx.c +++ b/gst-libs/gst/gl/x11/gstglcontext_glx.c @@ -41,12 +41,6 @@ #define GST_CAT_DEFAULT gst_gl_context_debug -#define gst_gl_context_glx_parent_class parent_class -G_DEFINE_TYPE (GstGLContextGLX, gst_gl_context_glx, GST_TYPE_GL_CONTEXT); - -#define GST_GL_CONTEXT_GLX_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT_GLX, GstGLContextGLXPrivate)) - static guintptr gst_gl_context_glx_get_gl_context (GstGLContext * context); static void gst_gl_context_glx_swap_buffers (GstGLContext * context); static gboolean gst_gl_context_glx_activate (GstGLContext * context, @@ -74,13 +68,15 @@ struct _GstGLContextGLXPrivate GLXContext, Bool, const int *); }; +#define gst_gl_context_glx_parent_class parent_class +G_DEFINE_TYPE_WITH_PRIVATE (GstGLContextGLX, gst_gl_context_glx, + GST_TYPE_GL_CONTEXT); + static void gst_gl_context_glx_class_init (GstGLContextGLXClass * klass) { GstGLContextClass *context_class = (GstGLContextClass *) klass; - g_type_class_add_private (klass, sizeof (GstGLContextGLXPrivate)); - context_class->get_gl_context = GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_gl_context); context_class->activate = GST_DEBUG_FUNCPTR (gst_gl_context_glx_activate); @@ -107,7 +103,7 @@ gst_gl_context_glx_class_init (GstGLContextGLXClass * klass) static void gst_gl_context_glx_init (GstGLContextGLX * context) { - context->priv = GST_GL_CONTEXT_GLX_GET_PRIVATE (context); + context->priv = gst_gl_context_glx_get_instance_private (context); } GstGLContextGLX * diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c index 9898e0be71..29e5084c58 100644 --- a/gst-libs/gst/gl/x11/gstglwindow_x11.c +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c @@ -36,14 +36,8 @@ /* for XkbKeycodeToKeysym */ #include -#define GST_GL_WINDOW_X11_GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_WINDOW_X11, GstGLWindowX11Private)) - #define GST_CAT_DEFAULT gst_gl_window_debug -#define gst_gl_window_x11_parent_class parent_class -G_DEFINE_TYPE (GstGLWindowX11, gst_gl_window_x11, GST_TYPE_GL_WINDOW); - G_GNUC_INTERNAL gboolean gst_gl_window_x11_handle_event (GstGLWindowX11 * window_x11, xcb_generic_event_t * event); @@ -71,6 +65,10 @@ struct _GstGLWindowX11Private GstVideoRectangle render_rect; }; +#define gst_gl_window_x11_parent_class parent_class +G_DEFINE_TYPE_WITH_PRIVATE (GstGLWindowX11, gst_gl_window_x11, + GST_TYPE_GL_WINDOW); + static guintptr gst_gl_window_x11_get_display (GstGLWindow * window); guintptr gst_gl_window_x11_get_gl_context (GstGLWindow * window); gboolean gst_gl_window_x11_activate (GstGLWindow * window, gboolean activate); @@ -102,8 +100,6 @@ gst_gl_window_x11_class_init (GstGLWindowX11Class * klass) GObjectClass *obj_class = G_OBJECT_CLASS (klass); GstGLWindowClass *window_class = (GstGLWindowClass *) klass; - g_type_class_add_private (klass, sizeof (GstGLWindowX11Private)); - obj_class->finalize = gst_gl_window_x11_finalize; window_class->get_display = GST_DEBUG_FUNCPTR (gst_gl_window_x11_get_display); @@ -126,7 +122,7 @@ gst_gl_window_x11_class_init (GstGLWindowX11Class * klass) static void gst_gl_window_x11_init (GstGLWindowX11 * window) { - window->priv = GST_GL_WINDOW_X11_GET_PRIVATE (window); + window->priv = gst_gl_window_x11_get_instance_private (window); } /* Must be called in the gl thread */