static void setup (void) { display = gst_gl_display_new (); context = gst_gl_context_new (display); gst_gl_context_create (context, 0, NULL); gst_gl_memory_init_once (); }
/** * gst_gl_memory_pbo_init: * * Initializes the GL Memory allocator. It is safe to call this function * multiple times. This must be called before any other GstGLMemoryPBO operation. */ void gst_gl_memory_pbo_init_once (void) { static volatile gsize _init = 0; if (g_once_init_enter (&_init)) { gst_gl_memory_init_once (); GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_MEMORY, "glmemory", 0, "OpenGL Memory"); _gl_allocator = g_object_new (GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, NULL); gst_allocator_register (GST_GL_MEMORY_PBO_ALLOCATOR_NAME, gst_object_ref (_gl_allocator)); g_once_init_leave (&_init, 1); } }
/** * gst_gl_memory_egl_init_once: * * Initializes the GL Memory allocator. It is safe to call this function * multiple times. This must be called before any other GstGLMemoryEGL operation. * * Since: 1.10 */ void gst_gl_memory_egl_init_once (void) { static volatile gsize _init = 0; if (g_once_init_enter (&_init)) { gst_gl_memory_init_once (); GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_MEMORY, "glmemory", 0, "OpenGL Texture with EGLImage memory"); _gl_memory_egl_allocator = g_object_new (GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, NULL); /* The allocator is never unreffed */ GST_OBJECT_FLAG_SET (_gl_memory_egl_allocator, GST_OBJECT_FLAG_MAY_BE_LEAKED); gst_allocator_register (GST_GL_MEMORY_EGL_ALLOCATOR_NAME, gst_object_ref (_gl_memory_egl_allocator)); g_once_init_leave (&_init, 1); } }