gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent

https://bugzilla.gnome.org/show_bug.cgi?id=743062
This commit is contained in:
Sebastian Dröge 2017-05-15 20:31:31 +03:00 committed by Tim-Philipp Müller
parent e004cfd6fe
commit a9a05c01a9
34 changed files with 134 additions and 28 deletions

View file

@ -69,13 +69,18 @@ gst_gl_window_android_egl_init (GstGLWindowAndroidEGL * window)
GstGLWindowAndroidEGL * GstGLWindowAndroidEGL *
gst_gl_window_android_egl_new (GstGLDisplay * display) gst_gl_window_android_egl_new (GstGLDisplay * display)
{ {
GstGLWindowAndroidEGL *window;
if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_EGL) == 0) if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_EGL) == 0)
/* we require an egl display to create android windows */ /* we require an egl display to create android windows */
return NULL; return NULL;
GST_DEBUG ("creating Android EGL window"); GST_DEBUG ("creating Android EGL window");
return g_object_new (GST_TYPE_GL_WINDOW_ANDROID_EGL, NULL); window = g_object_new (GST_TYPE_GL_WINDOW_ANDROID_EGL, NULL);
gst_object_ref_sink (window);
return window;
} }
static void static void

View file

@ -77,11 +77,16 @@ gst_gl_context_cocoa_init (GstGLContextCocoa * context)
GstGLContextCocoa * GstGLContextCocoa *
gst_gl_context_cocoa_new (GstGLDisplay * display) gst_gl_context_cocoa_new (GstGLDisplay * display)
{ {
GstGLContextCocoa *context;
if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_COCOA) == 0) if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_COCOA) == 0)
/* we require an cocoa display to create CGL contexts */ /* we require an cocoa display to create CGL contexts */
return NULL; return NULL;
return g_object_new (GST_TYPE_GL_CONTEXT_COCOA, NULL); context = g_object_new (GST_TYPE_GL_CONTEXT_COCOA, NULL);
gst_object_ref_sink (context);
return context;
} }
struct pixel_attr struct pixel_attr

View file

@ -115,6 +115,7 @@ gst_gl_display_cocoa_setup_nsapp (gpointer data)
if (NSApp != nil && !singleton) { if (NSApp != nil && !singleton) {
GstGLDisplayCocoa *ret = g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL); GstGLDisplayCocoa *ret = g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL);
gst_object_ref_sink (ret);
g_mutex_unlock (&nsapp_lock); g_mutex_unlock (&nsapp_lock);
return ret; return ret;
} }
@ -167,6 +168,7 @@ gst_gl_display_cocoa_setup_nsapp (gpointer data)
} else { } else {
GST_DEBUG ("Create display"); GST_DEBUG ("Create display");
singleton = g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL); singleton = g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL);
gst_object_ref_sink (singletone);
} }
g_mutex_unlock (&nsapp_lock); g_mutex_unlock (&nsapp_lock);
@ -223,13 +225,18 @@ gst_gl_display_cocoa_finalize (GObject * object)
GstGLDisplayCocoa * GstGLDisplayCocoa *
gst_gl_display_cocoa_new (void) gst_gl_display_cocoa_new (void)
{ {
GstGLDisplayCocoa *display;
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
#ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION #ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION
return gst_gl_display_cocoa_setup_nsapp (NULL); display = gst_gl_display_cocoa_setup_nsapp (NULL);
#else #else
return g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL); display = g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL);
gst_object_ref_sink (display);
#endif #endif
return display;
} }
static guintptr static guintptr

View file

@ -143,11 +143,16 @@ gst_gl_window_cocoa_finalize (GObject * object)
GstGLWindowCocoa * GstGLWindowCocoa *
gst_gl_window_cocoa_new (GstGLDisplay * display) gst_gl_window_cocoa_new (GstGLDisplay * display)
{ {
GstGLWindowCocoa *window;
if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_COCOA) == 0) if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_COCOA) == 0)
/* we require an cocoa display to create CGL windows */ /* we require an cocoa display to create CGL windows */
return NULL; return NULL;
return g_object_new (GST_TYPE_GL_WINDOW_COCOA, NULL); window = g_object_new (GST_TYPE_GL_WINDOW_COCOA, NULL);
gst_object_ref_sink (window);
return window;
} }
/* Must be called from the main thread */ /* Must be called from the main thread */

View file

@ -108,13 +108,18 @@ gst_gl_window_dispmanx_egl_init (GstGLWindowDispmanxEGL * window_egl)
GstGLWindowDispmanxEGL * GstGLWindowDispmanxEGL *
gst_gl_window_dispmanx_egl_new (GstGLDisplay * display) gst_gl_window_dispmanx_egl_new (GstGLDisplay * display)
{ {
GstGLWindowDispmanxEGL *window;
if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_EGL) == 0) if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_EGL) == 0)
/* we require an egl display to create dispmanx windows */ /* we require an egl display to create dispmanx windows */
return NULL; return NULL;
GST_DEBUG ("creating Dispmanx EGL window"); GST_DEBUG ("creating Dispmanx EGL window");
return g_object_new (GST_TYPE_GL_WINDOW_DISPMANX_EGL, NULL); window = g_object_new (GST_TYPE_GL_WINDOW_DISPMANX_EGL, NULL);
gst_object_ref_sink (window);
return window;
} }
static void static void

View file

@ -96,8 +96,13 @@ gst_gl_context_eagl_init (GstGLContextEagl * context)
GstGLContextEagl * GstGLContextEagl *
gst_gl_context_eagl_new (GstGLDisplay * display) gst_gl_context_eagl_new (GstGLDisplay * display)
{ {
GstGLContextEagl *context;
/* there isn't actually a display type for eagl yet? */ /* there isn't actually a display type for eagl yet? */
return g_object_new (GST_TYPE_GL_CONTEXT_EAGL, NULL); context = g_object_new (GST_TYPE_GL_CONTEXT_EAGL, NULL);
gst_object_ref_sink (context);
return context;
} }
void void

View file

@ -103,8 +103,13 @@ gst_gl_window_eagl_finalize (GObject * object)
GstGLWindowEagl * GstGLWindowEagl *
gst_gl_window_eagl_new (GstGLDisplay * display) gst_gl_window_eagl_new (GstGLDisplay * display)
{ {
GstGLWindowEagl *window;
/* there isn't an eagl display type */ /* there isn't an eagl display type */
return g_object_new (GST_TYPE_GL_WINDOW_EAGL, NULL); window = g_object_new (GST_TYPE_GL_WINDOW_EAGL, NULL);
gst_object_ref_sink (window);
return window;
} }
static guintptr static guintptr

View file

@ -108,9 +108,14 @@ gst_gl_context_egl_init (GstGLContextEGL * context)
GstGLContextEGL * GstGLContextEGL *
gst_gl_context_egl_new (GstGLDisplay * display) gst_gl_context_egl_new (GstGLDisplay * display)
{ {
GstGLContextEGL *context;
/* XXX: display type could theoretically be anything, as long as /* XXX: display type could theoretically be anything, as long as
* eglGetDisplay supports it. */ * eglGetDisplay supports it. */
return g_object_new (GST_TYPE_GL_CONTEXT_EGL, NULL); context = g_object_new (GST_TYPE_GL_CONTEXT_EGL, NULL);
gst_object_ref_sink (context);
return context;
} }
static gboolean static gboolean

View file

@ -176,6 +176,7 @@ gst_gl_display_egl_new (void)
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL); ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL);
gst_object_ref_sink (ret);
ret->display = ret->display =
gst_gl_display_egl_get_from_native (GST_GL_DISPLAY_TYPE_ANY, 0); gst_gl_display_egl_get_from_native (GST_GL_DISPLAY_TYPE_ANY, 0);
@ -206,6 +207,7 @@ gst_gl_display_egl_new_with_egl_display (EGLDisplay display)
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL); ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL);
gst_object_ref_sink (ret);
ret->display = display; ret->display = display;
ret->foreign_display = TRUE; ret->foreign_display = TRUE;
@ -270,6 +272,7 @@ gst_gl_display_egl_from_gl_display (GstGLDisplay * display)
g_return_val_if_fail (display_type != GST_GL_DISPLAY_TYPE_NONE, NULL); g_return_val_if_fail (display_type != GST_GL_DISPLAY_TYPE_NONE, NULL);
ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL); ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL);
gst_object_ref_sink (ret);
ret->display = ret->display =
gst_gl_display_egl_get_from_native (display_type, native_display); gst_gl_display_egl_get_from_native (display_type, native_display);

View file

@ -252,6 +252,7 @@ gst_gl_memory_egl_init_once (void)
_gl_memory_egl_allocator = _gl_memory_egl_allocator =
g_object_new (GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, NULL); g_object_new (GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, NULL);
gst_object_ref_sink (_gl_memory_egl_allocator);
/* The allocator is never unreffed */ /* The allocator is never unreffed */
GST_OBJECT_FLAG_SET (_gl_memory_egl_allocator, GST_OBJECT_FLAG_SET (_gl_memory_egl_allocator,

View file

@ -461,6 +461,7 @@ gst_gl_buffer_init_once (void)
_gl_buffer_allocator = _gl_buffer_allocator =
g_object_new (gst_gl_buffer_allocator_get_type (), NULL); g_object_new (gst_gl_buffer_allocator_get_type (), NULL);
gst_object_ref_sink (_gl_buffer_allocator);
/* The allocator is never unreffed */ /* The allocator is never unreffed */
GST_OBJECT_FLAG_SET (_gl_buffer_allocator, GST_OBJECT_FLAG_MAY_BE_LEAKED); GST_OBJECT_FLAG_SET (_gl_buffer_allocator, GST_OBJECT_FLAG_MAY_BE_LEAKED);

View file

@ -310,6 +310,7 @@ gst_gl_buffer_pool_new (GstGLContext * context)
GstGLBufferPool *pool; GstGLBufferPool *pool;
pool = g_object_new (GST_TYPE_GL_BUFFER_POOL, NULL); pool = g_object_new (GST_TYPE_GL_BUFFER_POOL, NULL);
gst_object_ref_sink (pool);
pool->context = gst_object_ref (context); pool->context = gst_object_ref (context);
GST_LOG_OBJECT (pool, "new GL buffer pool for context %" GST_PTR_FORMAT, GST_LOG_OBJECT (pool, "new GL buffer pool for context %" GST_PTR_FORMAT,

View file

@ -469,7 +469,7 @@ gst_gl_color_convert_init (GstGLColorConvert * convert)
* gst_gl_color_convert_new: * gst_gl_color_convert_new:
* @context: a #GstGLContext * @context: a #GstGLContext
* *
* Returns: a new #GstGLColorConvert object * Returns: (transfer full): a new #GstGLColorConvert object
* *
* Since: 1.4 * Since: 1.4
*/ */
@ -479,6 +479,7 @@ gst_gl_color_convert_new (GstGLContext * context)
GstGLColorConvert *convert; GstGLColorConvert *convert;
convert = g_object_new (GST_TYPE_GL_COLOR_CONVERT, NULL); convert = g_object_new (GST_TYPE_GL_COLOR_CONVERT, NULL);
gst_object_ref_sink (convert);
convert->context = gst_object_ref (context); convert->context = gst_object_ref (context);

View file

@ -382,7 +382,7 @@ gst_gl_context_new (GstGLDisplay * display)
* represented by @handle stays alive while the returned #GstGLContext is * represented by @handle stays alive while the returned #GstGLContext is
* active. * active.
* *
* Returns: a #GstGLContext wrapping @handle * Returns: (transfer full): a #GstGLContext wrapping @handle
* *
* Since: 1.4 * Since: 1.4
*/ */
@ -402,6 +402,7 @@ gst_gl_context_new_wrapped (GstGLDisplay * display, guintptr handle,
NULL); NULL);
context_wrap = g_object_new (GST_TYPE_GL_WRAPPED_CONTEXT, NULL); context_wrap = g_object_new (GST_TYPE_GL_WRAPPED_CONTEXT, NULL);
gst_object_ref_sink (context_wrap);
if (!context_wrap) { if (!context_wrap) {
/* subclass returned a NULL context */ /* subclass returned a NULL context */

View file

@ -323,7 +323,8 @@ gst_gl_display_new (void)
"(platform: %s), creating dummy", "(platform: %s), creating dummy",
GST_STR_NULL (user_choice), GST_STR_NULL (platform_choice)); GST_STR_NULL (user_choice), GST_STR_NULL (platform_choice));
return g_object_new (GST_TYPE_GL_DISPLAY, NULL); display = g_object_new (GST_TYPE_GL_DISPLAY, NULL);
gst_object_ref_sink (display);
} }
return display; return display;

View file

@ -166,7 +166,7 @@ gst_gl_framebuffer_finalize (GObject * object)
* *
* Returns: a new #GstGLFramebuffer * Returns: a new #GstGLFramebuffer
* *
* Since: 1.10 * Since: (transfer full): 1.10
*/ */
GstGLFramebuffer * GstGLFramebuffer *
gst_gl_framebuffer_new (GstGLContext * context) gst_gl_framebuffer_new (GstGLContext * context)
@ -187,6 +187,7 @@ gst_gl_framebuffer_new (GstGLContext * context)
fb = g_object_new (GST_TYPE_GL_FRAMEBUFFER, NULL); fb = g_object_new (GST_TYPE_GL_FRAMEBUFFER, NULL);
fb->context = gst_object_ref (context); fb->context = gst_object_ref (context);
gl->GenFramebuffers (1, &fb->fbo_id); gl->GenFramebuffers (1, &fb->fbo_id);
gst_object_ref_sink (fb);
return fb; return fb;
} }

View file

@ -1096,6 +1096,7 @@ gst_gl_memory_init_once (void)
"OpenGL Base Texture Memory"); "OpenGL Base Texture Memory");
_gl_memory_allocator = g_object_new (GST_TYPE_GL_MEMORY_ALLOCATOR, NULL); _gl_memory_allocator = g_object_new (GST_TYPE_GL_MEMORY_ALLOCATOR, NULL);
gst_object_ref_sink (_gl_memory_allocator);
gst_allocator_register (GST_GL_MEMORY_ALLOCATOR_NAME, _gl_memory_allocator); gst_allocator_register (GST_GL_MEMORY_ALLOCATOR_NAME, _gl_memory_allocator);

View file

@ -835,6 +835,7 @@ gst_gl_memory_pbo_init_once (void)
GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_MEMORY, "glmemory", 0, "OpenGL Memory"); GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_MEMORY, "glmemory", 0, "OpenGL Memory");
_gl_allocator = g_object_new (GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, NULL); _gl_allocator = g_object_new (GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, NULL);
gst_object_ref_sink (_gl_allocator);
/* The allocator is never unreffed */ /* The allocator is never unreffed */
GST_OBJECT_FLAG_SET (_gl_allocator, GST_OBJECT_FLAG_MAY_BE_LEAKED); GST_OBJECT_FLAG_SET (_gl_allocator, GST_OBJECT_FLAG_MAY_BE_LEAKED);

View file

@ -474,6 +474,8 @@ gst_gl_overlay_compositor_new (GstGLContext * context)
GstGLOverlayCompositor *compositor = GstGLOverlayCompositor *compositor =
g_object_new (GST_TYPE_GL_OVERLAY_COMPOSITOR, NULL); g_object_new (GST_TYPE_GL_OVERLAY_COMPOSITOR, NULL);
gst_object_ref_sink (compositor);
compositor->context = gst_object_ref (context); compositor->context = gst_object_ref (context);
gst_gl_context_thread_add (compositor->context, gst_gl_context_thread_add (compositor->context,
@ -575,6 +577,7 @@ gst_gl_overlay_compositor_upload_overlays (GstGLOverlayCompositor * compositor,
GstGLCompositionOverlay *overlay = GstGLCompositionOverlay *overlay =
gst_gl_composition_overlay_new (compositor->context, rectangle, gst_gl_composition_overlay_new (compositor->context, rectangle,
compositor->position_attrib, compositor->texcoord_attrib); compositor->position_attrib, compositor->texcoord_attrib);
gst_object_ref_sink (overlay);
gst_gl_composition_overlay_upload (overlay, buf); gst_gl_composition_overlay_upload (overlay, buf);

View file

@ -317,6 +317,7 @@ gst_gl_renderbuffer_init_once (void)
_gl_renderbuffer_allocator = _gl_renderbuffer_allocator =
g_object_new (GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, NULL); g_object_new (GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, NULL);
gst_object_ref_sink (_gl_renderbuffer_allocator);
GST_OBJECT_FLAG_SET (_gl_renderbuffer_allocator, GST_OBJECT_FLAG_SET (_gl_renderbuffer_allocator,
GST_OBJECT_FLAG_MAY_BE_LEAKED); GST_OBJECT_FLAG_MAY_BE_LEAKED);

View file

@ -235,6 +235,7 @@ _new_with_stages_va_list (GstGLContext * context, GError ** error,
g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL); g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
shader = g_object_new (GST_TYPE_GL_SHADER, NULL); shader = g_object_new (GST_TYPE_GL_SHADER, NULL);
gst_object_ref_sink (shader);
shader->context = gst_object_ref (context); shader->context = gst_object_ref (context);
while ((stage = va_arg (varargs, GstGLSLStage *))) { while ((stage = va_arg (varargs, GstGLSLStage *))) {

View file

@ -196,7 +196,7 @@ _ensure_shader (GstGLSLStage * stage)
* @n_strings: the number of strings in @str * @n_strings: the number of strings in @str
* @str: an array of strings concatted together to produce a shader * @str: an array of strings concatted together to produce a shader
* *
* Returns: (transfer full): a new #GstGLSLStage of the specified @type * Returns: (transfer floating): a new #GstGLSLStage of the specified @type
* *
* Since: 1.8 * Since: 1.8
*/ */
@ -235,7 +235,7 @@ gst_glsl_stage_new_with_strings (GstGLContext * context, guint type,
* @profile: the #GstGLSLProfile * @profile: the #GstGLSLProfile
* @str: a shader string * @str: a shader string
* *
* Returns: (transfer full): a new #GstGLSLStage of the specified @type * Returns: (transfer floating): a new #GstGLSLStage of the specified @type
* *
* Since: 1.8 * Since: 1.8
*/ */
@ -252,7 +252,7 @@ gst_glsl_stage_new_with_string (GstGLContext * context, guint type,
* @context: a #GstGLContext * @context: a #GstGLContext
* @type: the GL enum shader stage type * @type: the GL enum shader stage type
* *
* Returns: (transfer full): a new #GstGLSLStage of the specified @type * Returns: (transfer floating): a new #GstGLSLStage of the specified @type
* *
* Since: 1.8 * Since: 1.8
*/ */
@ -267,7 +267,7 @@ gst_glsl_stage_new (GstGLContext * context, guint type)
* gst_glsl_stage_new_with_default_vertex: * gst_glsl_stage_new_with_default_vertex:
* @context: a #GstGLContext * @context: a #GstGLContext
* *
* Returns: (transfer full): a new #GstGLSLStage with the default vertex shader * Returns: (transfer floating): a new #GstGLSLStage with the default vertex shader
* *
* Since: 1.8 * Since: 1.8
*/ */
@ -284,7 +284,7 @@ gst_glsl_stage_new_default_vertex (GstGLContext * context)
* gst_glsl_stage_new_with_default_fragment: * gst_glsl_stage_new_with_default_fragment:
* @context: a #GstGLContext * @context: a #GstGLContext
* *
* Returns: (transfer full): a new #GstGLSLStage with the default fragment shader * Returns: (transfer floating): a new #GstGLSLStage with the default fragment shader
* *
* Since: 1.8 * Since: 1.8
*/ */

View file

@ -1561,7 +1561,7 @@ gst_gl_upload_init (GstGLUpload * upload)
* gst_gl_upload_new: * gst_gl_upload_new:
* @context: a #GstGLContext * @context: a #GstGLContext
* *
* Returns: a new #GstGLUpload object * Returns: (transfer full): a new #GstGLUpload object
*/ */
GstGLUpload * GstGLUpload *
gst_gl_upload_new (GstGLContext * context) gst_gl_upload_new (GstGLContext * context)
@ -1569,6 +1569,8 @@ gst_gl_upload_new (GstGLContext * context)
GstGLUpload *upload = g_object_new (GST_TYPE_GL_UPLOAD, NULL); GstGLUpload *upload = g_object_new (GST_TYPE_GL_UPLOAD, NULL);
gint i, n; gint i, n;
gst_object_ref_sink (upload);
if (context) if (context)
gst_gl_upload_set_context (upload, context); gst_gl_upload_set_context (upload, context);
else else

View file

@ -336,14 +336,19 @@ gst_gl_view_convert_finalize (GObject * object)
/** /**
* gst_gl_view_convert_new: * gst_gl_view_convert_new:
* *
* Returns: a new #GstGLViewConvert * Returns: (transfer full): a new #GstGLViewConvert
* *
* Since: 1.6 * Since: 1.6
*/ */
GstGLViewConvert * GstGLViewConvert *
gst_gl_view_convert_new (void) gst_gl_view_convert_new (void)
{ {
return g_object_new (GST_TYPE_GL_VIEW_CONVERT, NULL); GstGLViewConvert *convert;
convert = g_object_new (GST_TYPE_GL_VIEW_CONVERT, NULL);
gst_object_ref_sink (convert);
return convert;
} }
/** /**

View file

@ -1014,5 +1014,10 @@ gst_gl_dummy_window_init (GstGLDummyWindow * dummy)
GstGLDummyWindow * GstGLDummyWindow *
gst_gl_dummy_window_new (void) gst_gl_dummy_window_new (void)
{ {
return g_object_new (gst_gl_dummy_window_get_type (), NULL); GstGLDummyWindow *window;
window = g_object_new (gst_gl_dummy_window_get_type (), NULL);
gst_object_ref_sink (window);
return window;
} }

View file

@ -83,6 +83,7 @@ gst_gl_display_viv_fb_new (gint disp_idx)
GST_DEBUG ("creating Vivante FB EGL display %d", disp_idx); GST_DEBUG ("creating Vivante FB EGL display %d", disp_idx);
display = g_object_new (GST_TYPE_GL_DISPLAY_VIV_FB, NULL); display = g_object_new (GST_TYPE_GL_DISPLAY_VIV_FB, NULL);
gst_object_ref_sink (display);
display->disp_idx = disp_idx; display->disp_idx = disp_idx;
display->display = fbGetDisplayByIndex (display->disp_idx); display->display = fbGetDisplayByIndex (display->disp_idx);
if (!display->display) { if (!display->display) {

View file

@ -72,12 +72,17 @@ gst_gl_window_viv_fb_egl_init (GstGLWindowVivFBEGL * window)
GstGLWindowVivFBEGL * GstGLWindowVivFBEGL *
gst_gl_window_viv_fb_egl_new (GstGLDisplay * display) gst_gl_window_viv_fb_egl_new (GstGLDisplay * display)
{ {
GstGLWindowVivFBEGL *window;
if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_VIV_FB) == if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_VIV_FB) ==
0) 0)
/* we require a Vivante FB display to create windows */ /* we require a Vivante FB display to create windows */
return NULL; return NULL;
return g_object_new (GST_TYPE_GL_WINDOW_VIV_FB_EGL, NULL); window = g_object_new (GST_TYPE_GL_WINDOW_VIV_FB_EGL, NULL);
gst_object_ref_sink (window);
return window;
} }
static void static void

View file

@ -116,6 +116,7 @@ gst_gl_display_wayland_new (const gchar * name)
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
ret = g_object_new (GST_TYPE_GL_DISPLAY_WAYLAND, NULL); ret = g_object_new (GST_TYPE_GL_DISPLAY_WAYLAND, NULL);
gst_object_ref_sink (ret);
ret->display = wl_display_connect (name); ret->display = wl_display_connect (name);
if (!ret->display) { if (!ret->display) {
@ -151,6 +152,7 @@ gst_gl_display_wayland_new_with_display (struct wl_display * display)
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
ret = g_object_new (GST_TYPE_GL_DISPLAY_WAYLAND, NULL); ret = g_object_new (GST_TYPE_GL_DISPLAY_WAYLAND, NULL);
gst_object_ref_sink (ret);
ret->display = display; ret->display = display;
ret->foreign_display = TRUE; ret->foreign_display = TRUE;

View file

@ -353,6 +353,8 @@ gst_gl_window_wayland_egl_init (GstGLWindowWaylandEGL * window)
GstGLWindowWaylandEGL * GstGLWindowWaylandEGL *
gst_gl_window_wayland_egl_new (GstGLDisplay * display) gst_gl_window_wayland_egl_new (GstGLDisplay * display)
{ {
GstGLWindowWaylandEGL *window;
if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WAYLAND) if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WAYLAND)
== 0) == 0)
/* we require a wayland display to create wayland surfaces */ /* we require a wayland display to create wayland surfaces */
@ -360,7 +362,10 @@ gst_gl_window_wayland_egl_new (GstGLDisplay * display)
GST_DEBUG ("creating Wayland EGL window"); GST_DEBUG ("creating Wayland EGL window");
return g_object_new (GST_TYPE_GL_WINDOW_WAYLAND_EGL, NULL); window = g_object_new (GST_TYPE_GL_WINDOW_WAYLAND_EGL, NULL);
gst_object_ref_sink (window);
return window;
} }
static void static void

View file

@ -98,12 +98,17 @@ gst_gl_context_wgl_init (GstGLContextWGL * context_wgl)
GstGLContextWGL * GstGLContextWGL *
gst_gl_context_wgl_new (GstGLDisplay * display) gst_gl_context_wgl_new (GstGLDisplay * display)
{ {
GstGLContextWGL *context;
if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WIN32) == if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WIN32) ==
0) 0)
/* we require an win32 display handle to create WGL contexts */ /* we require an win32 display handle to create WGL contexts */
return NULL; return NULL;
return g_object_new (GST_TYPE_GL_CONTEXT_WGL, NULL); context = g_object_new (GST_TYPE_GL_CONTEXT_WGL, NULL);
gst_object_ref_sink (context);
return context;
} }
static HGLRC static HGLRC

View file

@ -93,12 +93,17 @@ gst_gl_window_win32_init (GstGLWindowWin32 * window)
GstGLWindowWin32 * GstGLWindowWin32 *
gst_gl_window_win32_new (GstGLDisplay * display) gst_gl_window_win32_new (GstGLDisplay * display)
{ {
GstGLWindowWin32 *window;
if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WIN32) == if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WIN32) ==
0) 0)
/* we require an win32 display to create win32 windows */ /* we require an win32 display to create win32 windows */
return NULL; return NULL;
return g_object_new (GST_TYPE_GL_WINDOW_WIN32, NULL); window = g_object_new (GST_TYPE_GL_WINDOW_WIN32, NULL);
gst_object_ref_sink (window);
return window;
} }
static void static void

View file

@ -112,11 +112,16 @@ gst_gl_context_glx_init (GstGLContextGLX * context)
GstGLContextGLX * GstGLContextGLX *
gst_gl_context_glx_new (GstGLDisplay * display) gst_gl_context_glx_new (GstGLDisplay * display)
{ {
GstGLContextGLX *context;
if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_X11) == 0) if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_X11) == 0)
/* we require an x11 display handle to create GLX contexts */ /* we require an x11 display handle to create GLX contexts */
return NULL; return NULL;
return g_object_new (GST_TYPE_GL_CONTEXT_GLX, NULL); context = g_object_new (GST_TYPE_GL_CONTEXT_GLX, NULL);
gst_object_ref_sink (context);
return context;
} }
static inline void static inline void

View file

@ -88,6 +88,7 @@ gst_gl_display_x11_new (const gchar * name)
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
ret = g_object_new (GST_TYPE_GL_DISPLAY_X11, NULL); ret = g_object_new (GST_TYPE_GL_DISPLAY_X11, NULL);
gst_object_ref_sink (ret);
ret->name = g_strdup (name); ret->name = g_strdup (name);
ret->display = XOpenDisplay (ret->name); ret->display = XOpenDisplay (ret->name);
@ -131,6 +132,7 @@ gst_gl_display_x11_new_with_display (Display * display)
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
ret = g_object_new (GST_TYPE_GL_DISPLAY_X11, NULL); ret = g_object_new (GST_TYPE_GL_DISPLAY_X11, NULL);
gst_object_ref_sink (ret);
ret->name = g_strdup (DisplayString (display)); ret->name = g_strdup (DisplayString (display));
ret->display = display; ret->display = display;

View file

@ -123,6 +123,8 @@ gst_gl_window_x11_init (GstGLWindowX11 * window)
GstGLWindowX11 * GstGLWindowX11 *
gst_gl_window_x11_new (GstGLDisplay * display) gst_gl_window_x11_new (GstGLDisplay * display)
{ {
GstGLWindowX11 *window;
if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_X11) if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_X11)
== GST_GL_DISPLAY_TYPE_NONE) { == GST_GL_DISPLAY_TYPE_NONE) {
GST_INFO ("Wrong display type %u for this window type %u", display->type, GST_INFO ("Wrong display type %u for this window type %u", display->type,
@ -130,7 +132,10 @@ gst_gl_window_x11_new (GstGLDisplay * display)
return NULL; return NULL;
} }
return g_object_new (GST_TYPE_GL_WINDOW_X11, NULL); window = g_object_new (GST_TYPE_GL_WINDOW_X11, NULL);
gst_object_ref_sink (window);
return window;
} }
gboolean gboolean