summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2013-03-28 17:48:04 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2013-03-29 16:38:34 +0100
commitce9b6e5afb52eb04802aa690a8868cac4eb475ab (patch)
treebb962b26d82b22a473a0d74bb300459bec722e84 /gst-libs
parent9e2af116f6b974dcf32b6e3e8494391355deaa01 (diff)
downloadgstreamer-plugins-bad-ce9b6e5afb52eb04802aa690a8868cac4eb475ab.tar.gz
eglglessink: Implement GstContext handling
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/egl/egl.c20
-rw-r--r--gst-libs/gst/egl/egl.h36
2 files changed, 45 insertions, 11 deletions
diff --git a/gst-libs/gst/egl/egl.c b/gst-libs/gst/egl/egl.c
index 73b9c5e91..374a6ffdd 100644
--- a/gst-libs/gst/egl/egl.c
+++ b/gst-libs/gst/egl/egl.c
@@ -290,6 +290,26 @@ gst_egl_image_allocator_wrap (GstAllocator * allocator,
return GST_MEMORY_CAST (mem);
}
+void
+gst_context_set_egl_display (GstContext * context, GstEGLDisplay * display)
+{
+ GstStructure *s;
+
+ s = (GstStructure *) gst_context_get_structure (context);
+ gst_structure_set (s, GST_EGL_DISPLAY_CONTEXT_TYPE, GST_TYPE_EGL_DISPLAY,
+ display, NULL);
+}
+
+gboolean
+gst_context_get_egl_display (GstContext * context, GstEGLDisplay ** display)
+{
+ GstStructure *s;
+
+ s = (GstStructure *) gst_context_get_structure (context);
+ return gst_structure_get (s, GST_EGL_DISPLAY_CONTEXT_TYPE,
+ GST_TYPE_EGL_DISPLAY, display, NULL);
+}
+
struct _GstEGLDisplay
{
EGLDisplay display;
diff --git a/gst-libs/gst/egl/egl.h b/gst-libs/gst/egl/egl.h
index 099c900d2..542446288 100644
--- a/gst-libs/gst/egl/egl.h
+++ b/gst-libs/gst/egl/egl.h
@@ -28,7 +28,8 @@
#define GST_EGL_IMAGE_MEMORY_TYPE "EGLImage"
-typedef enum {
+typedef enum
+{
GST_EGL_IMAGE_MEMORY_TYPE_INVALID = -1,
/* GL formats */
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE = 0x0000,
@@ -42,7 +43,8 @@ typedef enum {
GST_EGL_IMAGE_MEMORY_TYPE_OTHER = 0xffff
} GstEGLImageType;
-typedef enum {
+typedef enum
+{
/* GStreamer orientation, top line first in memory, left row first */
GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_NORMAL,
/* OpenGL orientation, bottom line first in memory, left row first */
@@ -58,22 +60,34 @@ typedef struct _GstEGLDisplay GstEGLDisplay;
gboolean gst_egl_image_memory_is_mappable (void);
gboolean gst_is_egl_image_memory (GstMemory * mem);
EGLImageKHR gst_egl_image_memory_get_image (GstMemory * mem);
-GstEGLDisplay * gst_egl_image_memory_get_display (GstMemory * mem);
+GstEGLDisplay *gst_egl_image_memory_get_display (GstMemory * mem);
GstEGLImageType gst_egl_image_memory_get_type (GstMemory * mem);
-GstEGLImageOrientation gst_egl_image_memory_get_orientation (GstMemory *mem);
-void gst_egl_image_memory_set_orientation (GstMemory *mem, GstEGLImageOrientation orientation);
+GstEGLImageOrientation gst_egl_image_memory_get_orientation (GstMemory * mem);
+void gst_egl_image_memory_set_orientation (GstMemory * mem,
+ GstEGLImageOrientation orientation);
/* Generic EGLImage allocator that doesn't support mapping, copying or anything */
-GstAllocator * gst_egl_image_allocator_obtain (void);
-GstMemory * gst_egl_image_allocator_alloc (GstAllocator * allocator, GstEGLDisplay * display, GstEGLImageType type, gint width, gint height, gsize * size);
-GstMemory * gst_egl_image_allocator_wrap (GstAllocator * allocator, GstEGLDisplay * display, EGLImageKHR image, GstEGLImageType type, GstMemoryFlags flags, gsize size, gpointer user_data, GDestroyNotify user_data_destroy);
+GstAllocator *gst_egl_image_allocator_obtain (void);
+GstMemory *gst_egl_image_allocator_alloc (GstAllocator * allocator,
+ GstEGLDisplay * display, GstEGLImageType type, gint width, gint height,
+ gsize * size);
+GstMemory *gst_egl_image_allocator_wrap (GstAllocator * allocator,
+ GstEGLDisplay * display, EGLImageKHR image, GstEGLImageType type,
+ GstMemoryFlags flags, gsize size, gpointer user_data,
+ GDestroyNotify user_data_destroy);
+
+#define GST_EGL_DISPLAY_CONTEXT_TYPE "gst.egl.EGLDisplay"
+void gst_context_set_egl_display (GstContext * context,
+ GstEGLDisplay * display);
+gboolean gst_context_get_egl_display (GstContext * context,
+ GstEGLDisplay ** display);
/* EGLDisplay wrapper with refcount, connection is closed after last ref is gone */
#define GST_TYPE_EGL_DISPLAY (gst_egl_display_get_type())
-GType gst_egl_display_get_type(void);
+GType gst_egl_display_get_type (void);
-GstEGLDisplay * gst_egl_display_new (EGLDisplay display);
-GstEGLDisplay * gst_egl_display_ref (GstEGLDisplay * display);
+GstEGLDisplay *gst_egl_display_new (EGLDisplay display);
+GstEGLDisplay *gst_egl_display_ref (GstEGLDisplay * display);
void gst_egl_display_unref (GstEGLDisplay * display);
EGLDisplay gst_egl_display_get (GstEGLDisplay * display);