mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
egl: Add support for different orientations of the EGLImage
The content of the EGLImages can be at least in GStreamer orientation, meaning top line first in memory, or OpenGL orientation, meaning bottom line first in memory.
This commit is contained in:
parent
d5f15cf3a2
commit
a373e75949
2 changed files with 37 additions and 0 deletions
|
@ -34,6 +34,7 @@ typedef struct
|
|||
GstEGLDisplay *display;
|
||||
EGLImageKHR image;
|
||||
GstEGLImageType type;
|
||||
GstEGLImageOrientation orientation;
|
||||
|
||||
gpointer user_data;
|
||||
GDestroyNotify user_data_destroy;
|
||||
|
@ -90,6 +91,29 @@ gst_egl_image_memory_get_type (GstMemory * mem)
|
|||
return GST_EGL_IMAGE_MEMORY (mem)->type;
|
||||
}
|
||||
|
||||
GstEGLImageOrientation
|
||||
gst_egl_image_memory_get_orientation (GstMemory *mem)
|
||||
{
|
||||
g_return_val_if_fail (gst_is_egl_image_memory (mem),
|
||||
GST_EGL_IMAGE_MEMORY_TYPE_INVALID);
|
||||
|
||||
if (mem->parent)
|
||||
mem = mem->parent;
|
||||
|
||||
return GST_EGL_IMAGE_MEMORY (mem)->orientation;
|
||||
}
|
||||
|
||||
void
|
||||
gst_egl_image_memory_set_orientation (GstMemory *mem, GstEGLImageOrientation orientation)
|
||||
{
|
||||
g_return_if_fail (gst_is_egl_image_memory (mem));
|
||||
|
||||
if (mem->parent)
|
||||
mem = mem->parent;
|
||||
|
||||
GST_EGL_IMAGE_MEMORY (mem)->orientation = orientation;
|
||||
}
|
||||
|
||||
static GstMemory *
|
||||
gst_egl_image_allocator_alloc_vfunc (GstAllocator * allocator, gsize size,
|
||||
GstAllocationParams * params)
|
||||
|
@ -257,6 +281,7 @@ gst_egl_image_allocator_wrap (GstAllocator * allocator,
|
|||
mem->display = gst_egl_display_ref (display);
|
||||
mem->image = image;
|
||||
mem->type = type;
|
||||
mem->orientation = GST_EGL_IMAGE_ORIENTATION_X_NORMAL_Y_NORMAL;
|
||||
|
||||
mem->user_data = user_data;
|
||||
mem->user_data_destroy = user_data_destroy;
|
||||
|
|
|
@ -42,6 +42,16 @@ typedef enum {
|
|||
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;
|
||||
|
||||
/* EGLImage GstMemory handling */
|
||||
|
@ -50,6 +60,8 @@ 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);
|
||||
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);
|
||||
|
||||
/* Generic EGLImage allocator that doesn't support mapping, copying or anything */
|
||||
GstAllocator * gst_egl_image_allocator_obtain (void);
|
||||
|
|
Loading…
Reference in a new issue