egl: Update for new GstContext API

This commit is contained in:
Sebastian Dröge 2013-09-18 22:24:07 +02:00
parent b92791d102
commit 14f2c30686
2 changed files with 14 additions and 8 deletions

View file

@ -37,6 +37,7 @@
#define EGL_EGLEXT_PROTOTYPES #define EGL_EGLEXT_PROTOTYPES
#include <gst/egl/egl.h> #include <gst/egl/egl.h>
#include <string.h>
#if defined (USE_EGL_RPI) && defined(__GNUC__) #if defined (USE_EGL_RPI) && defined(__GNUC__)
#pragma GCC reset_options #pragma GCC reset_options
@ -304,14 +305,17 @@ gst_egl_image_allocator_wrap (GstAllocator * allocator,
return GST_MEMORY_CAST (mem); return GST_MEMORY_CAST (mem);
} }
void GstContext *
gst_context_set_egl_display (GstContext * context, GstEGLDisplay * display) gst_context_new_egl_display (GstEGLDisplay * display, gboolean persistent)
{ {
GstContext *context;
GstStructure *s; GstStructure *s;
context = gst_context_new (GST_EGL_DISPLAY_CONTEXT_TYPE, persistent);
s = gst_context_writable_structure (context); s = gst_context_writable_structure (context);
gst_structure_set (s, GST_EGL_DISPLAY_CONTEXT_TYPE, GST_TYPE_EGL_DISPLAY, gst_structure_set (s, "display", GST_TYPE_EGL_DISPLAY, display, NULL);
display, NULL);
return context;
} }
gboolean gboolean
@ -319,9 +323,12 @@ gst_context_get_egl_display (GstContext * context, GstEGLDisplay ** display)
{ {
const GstStructure *s; 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); s = gst_context_get_structure (context);
return gst_structure_get (s, GST_EGL_DISPLAY_CONTEXT_TYPE, return gst_structure_get (s, "display", GST_TYPE_EGL_DISPLAY, display, NULL);
GST_TYPE_EGL_DISPLAY, display, NULL);
} }
struct _GstEGLDisplay struct _GstEGLDisplay

View file

@ -56,8 +56,7 @@ GstMemory *gst_egl_image_allocator_wrap (GstAllocator * allocator,
GDestroyNotify user_data_destroy); GDestroyNotify user_data_destroy);
#define GST_EGL_DISPLAY_CONTEXT_TYPE "gst.egl.EGLDisplay" #define GST_EGL_DISPLAY_CONTEXT_TYPE "gst.egl.EGLDisplay"
void gst_context_set_egl_display (GstContext * context, GstContext * gst_context_new_egl_display (GstEGLDisplay * display, gboolean persistent);
GstEGLDisplay * display);
gboolean gst_context_get_egl_display (GstContext * context, gboolean gst_context_get_egl_display (GstContext * context,
GstEGLDisplay ** display); GstEGLDisplay ** display);