GST_ERROR_OBJECT (ctx->element, "Could not get EGL display connection");
goto HANDLE_ERROR; /* No EGL error is set by eglGetDisplay() */
}
- ctx->display = gst_egl_display_new (display);
+ ctx->display = gst_egl_display_new (display, (GDestroyNotify) eglTerminate);
context = gst_context_new ();
gst_context_set_egl_display (context, ctx->display);
{
EGLDisplay display;
volatile gint refcount;
+ GDestroyNotify destroy_notify;
};
GstEGLDisplay *
-gst_egl_display_new (EGLDisplay display)
+gst_egl_display_new (EGLDisplay display, GDestroyNotify destroy_notify)
{
GstEGLDisplay *gdisplay;
gdisplay = g_slice_new (GstEGLDisplay);
gdisplay->display = display;
gdisplay->refcount = 1;
+ gdisplay->destroy_notify = destroy_notify;
return gdisplay;
}
g_return_if_fail (display != NULL);
if (g_atomic_int_dec_and_test (&display->refcount)) {
- if (display->display != EGL_NO_DISPLAY)
- eglTerminate (display->display);
+ if (display->destroy_notify)
+ display->destroy_notify (display->display);
g_slice_free (GstEGLDisplay, display);
}
}
#define GST_TYPE_EGL_DISPLAY (gst_egl_display_get_type())
GType gst_egl_display_get_type (void);
-GstEGLDisplay *gst_egl_display_new (EGLDisplay display);
+GstEGLDisplay *gst_egl_display_new (EGLDisplay display, GDestroyNotify destroy_notify);
GstEGLDisplay *gst_egl_display_ref (GstEGLDisplay * display);
void gst_egl_display_unref (GstEGLDisplay * display);
EGLDisplay gst_egl_display_get (GstEGLDisplay * display);