egl: Use new types from libgstvideo instead of defining our own

This commit is contained in:
Sebastian Dröge 2013-04-17 10:40:48 +02:00
parent ece3d1c2f6
commit a6e50140b7
3 changed files with 21 additions and 44 deletions

View file

@ -9,10 +9,13 @@ libgstegl_@GST_API_VERSION@include_HEADERS = egl.h
libgstegl_@GST_API_VERSION@_la_CFLAGS = \ libgstegl_@GST_API_VERSION@_la_CFLAGS = \
$(GST_PLUGINS_BAD_CFLAGS) \ $(GST_PLUGINS_BAD_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_CFLAGS) \ $(GST_CFLAGS) \
$(EGL_CFLAGS) $(EGL_CFLAGS)
libgstegl_@GST_API_VERSION@_la_LIBADD = \ libgstegl_@GST_API_VERSION@_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) \
-lgstvideo-@GST_API_VERSION@ \
$(GST_LIBS) \ $(GST_LIBS) \
$(EGL_LIBS) $(EGL_LIBS)
@ -41,11 +44,12 @@ GstEGL-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstegl-@GST_API_VERSIO
-I$(top_srcdir)/gst-libs \ -I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \ -I$(top_builddir)/gst-libs \
--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \ --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \ --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-video-@GST_API_VERSION@` \
--library=libgstegl-@GST_API_VERSION@.la \ --library=libgstegl-@GST_API_VERSION@.la \
--include=Gst-@GST_API_VERSION@ \ --include=Gst-@GST_API_VERSION@ \
--libtool="$(top_builddir)/libtool" \ --libtool="$(top_builddir)/libtool" \
--pkg gstreamer-@GST_API_VERSION@ \ --pkg gstreamer-@GST_API_VERSION@ \
--pkg gstreamer-video-@GST_API_VERSION@ \
--pkg-export gstreamer-egl-@GST_API_VERSION@ \ --pkg-export gstreamer-egl-@GST_API_VERSION@ \
--add-init-section="gst_init(NULL,NULL);" \ --add-init-section="gst_init(NULL,NULL);" \
-DGST_USE_UNSTABLE_API \ -DGST_USE_UNSTABLE_API \

View file

@ -33,8 +33,8 @@ typedef struct
GstEGLDisplay *display; GstEGLDisplay *display;
EGLImageKHR image; EGLImageKHR image;
GstEGLImageType type; GstVideoGLTextureType type;
GstEGLImageOrientation orientation; GstVideoGLTextureOrientation orientation;
gpointer user_data; gpointer user_data;
GDestroyNotify user_data_destroy; GDestroyNotify user_data_destroy;
@ -79,11 +79,10 @@ gst_egl_image_memory_get_display (GstMemory * mem)
return gst_egl_display_ref (GST_EGL_IMAGE_MEMORY (mem)->display); return gst_egl_display_ref (GST_EGL_IMAGE_MEMORY (mem)->display);
} }
GstEGLImageType GstVideoGLTextureType
gst_egl_image_memory_get_type (GstMemory * mem) gst_egl_image_memory_get_type (GstMemory * mem)
{ {
g_return_val_if_fail (gst_is_egl_image_memory (mem), g_return_val_if_fail (gst_is_egl_image_memory (mem), -1);
GST_EGL_IMAGE_MEMORY_TYPE_INVALID);
if (mem->parent) if (mem->parent)
mem = mem->parent; mem = mem->parent;
@ -91,11 +90,11 @@ gst_egl_image_memory_get_type (GstMemory * mem)
return GST_EGL_IMAGE_MEMORY (mem)->type; return GST_EGL_IMAGE_MEMORY (mem)->type;
} }
GstEGLImageOrientation GstVideoGLTextureOrientation
gst_egl_image_memory_get_orientation (GstMemory * mem) gst_egl_image_memory_get_orientation (GstMemory * mem)
{ {
g_return_val_if_fail (gst_is_egl_image_memory (mem), g_return_val_if_fail (gst_is_egl_image_memory (mem),
GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_NORMAL); GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL);
if (mem->parent) if (mem->parent)
mem = mem->parent; mem = mem->parent;
@ -105,7 +104,7 @@ gst_egl_image_memory_get_orientation (GstMemory * mem)
void void
gst_egl_image_memory_set_orientation (GstMemory * mem, gst_egl_image_memory_set_orientation (GstMemory * mem,
GstEGLImageOrientation orientation) GstVideoGLTextureOrientation orientation)
{ {
g_return_if_fail (gst_is_egl_image_memory (mem)); g_return_if_fail (gst_is_egl_image_memory (mem));
@ -253,7 +252,7 @@ gst_egl_image_allocator_obtain (void)
GstMemory * GstMemory *
gst_egl_image_allocator_alloc (GstAllocator * allocator, gst_egl_image_allocator_alloc (GstAllocator * allocator,
GstEGLDisplay * display, GstEGLImageType type, gint width, gint height, GstEGLDisplay * display, GstVideoGLTextureType type, gint width, gint height,
gsize * size) gsize * size)
{ {
return NULL; return NULL;
@ -261,7 +260,7 @@ gst_egl_image_allocator_alloc (GstAllocator * allocator,
GstMemory * GstMemory *
gst_egl_image_allocator_wrap (GstAllocator * allocator, gst_egl_image_allocator_wrap (GstAllocator * allocator,
GstEGLDisplay * display, EGLImageKHR image, GstEGLImageType type, GstEGLDisplay * display, EGLImageKHR image, GstVideoGLTextureType type,
GstMemoryFlags flags, gsize size, gpointer user_data, GstMemoryFlags flags, gsize size, gpointer user_data,
GDestroyNotify user_data_destroy) GDestroyNotify user_data_destroy)
{ {
@ -269,7 +268,6 @@ gst_egl_image_allocator_wrap (GstAllocator * allocator,
g_return_val_if_fail (display != NULL, NULL); g_return_val_if_fail (display != NULL, NULL);
g_return_val_if_fail (image != EGL_NO_IMAGE_KHR, NULL); g_return_val_if_fail (image != EGL_NO_IMAGE_KHR, NULL);
g_return_val_if_fail (type != GST_EGL_IMAGE_MEMORY_TYPE_INVALID, NULL);
if (!allocator) { if (!allocator) {
allocator = gst_egl_image_allocator_obtain (); allocator = gst_egl_image_allocator_obtain ();
@ -282,7 +280,7 @@ gst_egl_image_allocator_wrap (GstAllocator * allocator,
mem->display = gst_egl_display_ref (display); mem->display = gst_egl_display_ref (display);
mem->image = image; mem->image = image;
mem->type = type; mem->type = type;
mem->orientation = GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_NORMAL; mem->orientation = GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL;
mem->user_data = user_data; mem->user_data = user_data;
mem->user_data_destroy = user_data_destroy; mem->user_data_destroy = user_data_destroy;

View file

@ -23,6 +23,7 @@
#define __GST_EGL_H__ #define __GST_EGL_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h>
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
@ -30,32 +31,6 @@
#define GST_CAPS_FEATURE_MEMORY_EGL_IMAGE "memory:EGLImage" #define GST_CAPS_FEATURE_MEMORY_EGL_IMAGE "memory:EGLImage"
typedef enum
{
GST_EGL_IMAGE_MEMORY_TYPE_INVALID = -1,
/* GL formats */
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE = 0x0000,
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE_ALPHA,
GST_EGL_IMAGE_MEMORY_TYPE_RGB16,
GST_EGL_IMAGE_MEMORY_TYPE_RGB,
GST_EGL_IMAGE_MEMORY_TYPE_RGBA,
/* YUV formats */
/* GST_EGL_IMAGE_MEMORY_TYPE_YUV420P = 0x1000, */
/* Other */
GST_EGL_IMAGE_MEMORY_TYPE_OTHER = 0xffff
} GstEGLImageType;
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 */
GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_FLIP,
/* Just for the sake of completeness, nothing uses this probably */
GST_EGL_IMAGE_ORIENTATION_X_FLIP_Y_NORMAL,
GST_EGL_IMAGE_ORIENTATION_X_FLIP_Y_FLIP
} GstEGLImageOrientation;
typedef struct _GstEGLDisplay GstEGLDisplay; typedef struct _GstEGLDisplay GstEGLDisplay;
/* EGLImage GstMemory handling */ /* EGLImage GstMemory handling */
@ -63,18 +38,18 @@ gboolean gst_egl_image_memory_is_mappable (void);
gboolean gst_is_egl_image_memory (GstMemory * mem); gboolean gst_is_egl_image_memory (GstMemory * mem);
EGLImageKHR gst_egl_image_memory_get_image (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); GstVideoGLTextureType gst_egl_image_memory_get_type (GstMemory * mem);
GstEGLImageOrientation gst_egl_image_memory_get_orientation (GstMemory * mem); GstVideoGLTextureOrientation gst_egl_image_memory_get_orientation (GstMemory * mem);
void gst_egl_image_memory_set_orientation (GstMemory * mem, void gst_egl_image_memory_set_orientation (GstMemory * mem,
GstEGLImageOrientation orientation); GstVideoGLTextureOrientation orientation);
/* Generic EGLImage allocator that doesn't support mapping, copying or anything */ /* Generic EGLImage allocator that doesn't support mapping, copying or anything */
GstAllocator *gst_egl_image_allocator_obtain (void); GstAllocator *gst_egl_image_allocator_obtain (void);
GstMemory *gst_egl_image_allocator_alloc (GstAllocator * allocator, GstMemory *gst_egl_image_allocator_alloc (GstAllocator * allocator,
GstEGLDisplay * display, GstEGLImageType type, gint width, gint height, GstEGLDisplay * display, GstVideoGLTextureType type, gint width, gint height,
gsize * size); gsize * size);
GstMemory *gst_egl_image_allocator_wrap (GstAllocator * allocator, GstMemory *gst_egl_image_allocator_wrap (GstAllocator * allocator,
GstEGLDisplay * display, EGLImageKHR image, GstEGLImageType type, GstEGLDisplay * display, EGLImageKHR image, GstVideoGLTextureType type,
GstMemoryFlags flags, gsize size, gpointer user_data, GstMemoryFlags flags, gsize size, gpointer user_data,
GDestroyNotify user_data_destroy); GDestroyNotify user_data_destroy);