From 14f2c30686b21ad4effc0466c1936f9f125778fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 18 Sep 2013 22:24:07 +0200 Subject: [PATCH] egl: Update for new GstContext API --- gst-libs/gst/egl/egl.c | 19 +++++++++++++------ gst-libs/gst/egl/egl.h | 3 +-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/gst-libs/gst/egl/egl.c b/gst-libs/gst/egl/egl.c index 0b0ebcc247..2f283ada11 100644 --- a/gst-libs/gst/egl/egl.c +++ b/gst-libs/gst/egl/egl.c @@ -37,6 +37,7 @@ #define EGL_EGLEXT_PROTOTYPES #include +#include #if defined (USE_EGL_RPI) && defined(__GNUC__) #pragma GCC reset_options @@ -304,14 +305,17 @@ gst_egl_image_allocator_wrap (GstAllocator * allocator, return GST_MEMORY_CAST (mem); } -void -gst_context_set_egl_display (GstContext * context, GstEGLDisplay * display) +GstContext * +gst_context_new_egl_display (GstEGLDisplay * display, gboolean persistent) { + GstContext *context; GstStructure *s; + context = gst_context_new (GST_EGL_DISPLAY_CONTEXT_TYPE, persistent); s = gst_context_writable_structure (context); - gst_structure_set (s, GST_EGL_DISPLAY_CONTEXT_TYPE, GST_TYPE_EGL_DISPLAY, - display, NULL); + gst_structure_set (s, "display", GST_TYPE_EGL_DISPLAY, display, NULL); + + return context; } gboolean @@ -319,9 +323,12 @@ gst_context_get_egl_display (GstContext * context, GstEGLDisplay ** display) { const GstStructure *s; + g_return_val_if_fail (GST_IS_CONTEXT (context), FALSE); + g_return_val_if_fail (strcmp (gst_context_get_context_type (context), + GST_EGL_DISPLAY_CONTEXT_TYPE) == 0, FALSE); + s = gst_context_get_structure (context); - return gst_structure_get (s, GST_EGL_DISPLAY_CONTEXT_TYPE, - GST_TYPE_EGL_DISPLAY, display, NULL); + return gst_structure_get (s, "display", GST_TYPE_EGL_DISPLAY, display, NULL); } struct _GstEGLDisplay diff --git a/gst-libs/gst/egl/egl.h b/gst-libs/gst/egl/egl.h index ebc623322b..7187716170 100644 --- a/gst-libs/gst/egl/egl.h +++ b/gst-libs/gst/egl/egl.h @@ -56,8 +56,7 @@ GstMemory *gst_egl_image_allocator_wrap (GstAllocator * allocator, GDestroyNotify user_data_destroy); #define GST_EGL_DISPLAY_CONTEXT_TYPE "gst.egl.EGLDisplay" -void gst_context_set_egl_display (GstContext * context, - GstEGLDisplay * display); +GstContext * gst_context_new_egl_display (GstEGLDisplay * display, gboolean persistent); gboolean gst_context_get_egl_display (GstContext * context, GstEGLDisplay ** display);