mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 03:45:39 +00:00
eglglessink: Port to new EGL library
This commit is contained in:
parent
f9eccfe015
commit
e852f18e93
4 changed files with 455 additions and 703 deletions
File diff suppressed because it is too large
Load diff
|
@ -50,6 +50,7 @@
|
|||
#include <gst/video/video.h>
|
||||
#include <gst/video/gstvideosink.h>
|
||||
#include <gst/base/gstdataqueue.h>
|
||||
#include <gst/egl/egl.h>
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
@ -122,7 +123,7 @@ struct _GstEglGlesRenderContext
|
|||
{
|
||||
EGLConfig config;
|
||||
EGLContext eglcontext;
|
||||
EGLDisplay display;
|
||||
GstEGLDisplay *display;
|
||||
EGLNativeWindowType window, used_window;
|
||||
EGLSurface surface;
|
||||
gboolean buffer_preserved;
|
||||
|
@ -144,12 +145,6 @@ struct _GstEglGlesRenderContext
|
|||
coord5 position_array[12]; /* 4 x Frame, 4 x Border1, 4 x Border2 */
|
||||
unsigned short index_array[4];
|
||||
unsigned int position_buffer, index_buffer;
|
||||
|
||||
gboolean can_map_eglimage;
|
||||
GstMemoryMapFunction eglimage_map;
|
||||
GstMemoryUnmapFunction eglimage_unmap;
|
||||
PlatformMapVideo eglimage_video_map;
|
||||
PlatformUnmapVideo eglimage_video_unmap;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -235,7 +230,7 @@ struct _GstEglGlesSink
|
|||
GstFlowReturn last_flow;
|
||||
GstMiniObject *dequeued_object;
|
||||
|
||||
GstMemory *last_memory;
|
||||
GstBuffer *last_buffer;
|
||||
|
||||
/* Properties */
|
||||
gboolean create_window;
|
||||
|
|
|
@ -61,9 +61,6 @@
|
|||
GST_DEBUG_CATEGORY_STATIC (eglgles_platform_wrapper);
|
||||
#define GST_CAT_DEFAULT eglgles_platform_wrapper
|
||||
|
||||
PlatformMapVideo default_map_video;
|
||||
PlatformUnmapVideo default_unmap_video;
|
||||
|
||||
/* XXX: Likely to be removed */
|
||||
gboolean
|
||||
platform_wrapper_init (void)
|
||||
|
@ -76,7 +73,6 @@ platform_wrapper_init (void)
|
|||
|
||||
#ifdef USE_EGL_X11
|
||||
#include <X11/Xlib.h>
|
||||
#include <gst/video/gstvideopool.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -125,45 +121,10 @@ platform_destroy_native_window (EGLNativeDisplayType display,
|
|||
*window_data = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
platform_can_map_eglimage (GstMemoryMapFunction * map,
|
||||
GstMemoryUnmapFunction * unmap, PlatformMapVideo * video_map,
|
||||
PlatformUnmapVideo * video_unmap)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
platform_has_custom_eglimage_alloc (void)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
platform_alloc_eglimage (EGLDisplay display, EGLContext context, GLint format,
|
||||
GLint type, gint width, gint height, GLuint tex_id, EGLImageKHR * image,
|
||||
gpointer * image_platform_data)
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
platform_free_eglimage (EGLDisplay display, EGLContext context, GLuint tex_id,
|
||||
EGLImageKHR * image, gpointer * image_platform_data)
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_EGL_MALI_FB
|
||||
#include <EGL/fbdev_window.h>
|
||||
#include <mali_egl_image.h>
|
||||
#include <ump/ump.h>
|
||||
#include <ump/ump_ref_drv.h>
|
||||
|
||||
#include <gst/video/video.h>
|
||||
|
||||
EGLNativeWindowType
|
||||
platform_create_native_window (gint width, gint height, gpointer * window_data)
|
||||
|
@ -185,6 +146,12 @@ platform_destroy_native_window (EGLNativeDisplayType display,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* FIXME: Move to gst-libs/gst/egl */
|
||||
#if 0
|
||||
#include <mali_egl_image.h>
|
||||
#include <ump/ump.h>
|
||||
#include <ump/ump_ref_drv.h>
|
||||
#include <gst/video/video.h>
|
||||
static gpointer
|
||||
eglimage_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags)
|
||||
{
|
||||
|
@ -613,62 +580,11 @@ platform_free_eglimage (EGLDisplay display, EGLContext context, GLuint tex_id,
|
|||
ump_close ();
|
||||
g_slice_free (fbdev_pixmap, *image_platform_data);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(USE_EGL_X11) && !defined(USE_EGL_MALI_FB) && !defined(USE_EGL_RPI)
|
||||
#include <gst/video/gstvideopool.h>
|
||||
|
||||
/* Dummy functions for creating a native Window */
|
||||
EGLNativeWindowType
|
||||
platform_create_native_window (gint width, gint height, gpointer * window_data)
|
||||
{
|
||||
GST_ERROR ("Can't create native window");
|
||||
return (EGLNativeWindowType) 0;
|
||||
}
|
||||
|
||||
gboolean
|
||||
platform_destroy_native_window (EGLNativeDisplayType display,
|
||||
EGLNativeWindowType window, gpointer * window_data)
|
||||
{
|
||||
GST_ERROR ("Can't destroy native window");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
platform_can_map_eglimage (GstMemoryMapFunction * map,
|
||||
GstMemoryUnmapFunction * unmap, PlatformMapVideo * video_map,
|
||||
PlatformUnmapVideo * video_unmap)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
platform_has_custom_eglimage_alloc (void)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
platform_alloc_eglimage (EGLDisplay display, EGLContext context, GLint format,
|
||||
GLint type, gint width, gint height, GLuint tex_id, EGLImageKHR * image,
|
||||
gpointer * image_platform_data)
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
platform_free_eglimage (EGLDisplay display, EGLContext context, GLuint tex_id,
|
||||
EGLImageKHR * image, gpointer * image_platform_data)
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_EGL_RPI
|
||||
#include <bcm_host.h>
|
||||
#include <gst/video/gstvideopool.h>
|
||||
#include <gst/video/gstvideosink.h>
|
||||
|
||||
typedef struct
|
||||
|
@ -754,34 +670,23 @@ platform_destroy_native_window (EGLNativeDisplayType display,
|
|||
*window_data = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
platform_can_map_eglimage (GstMemoryMapFunction * map,
|
||||
GstMemoryUnmapFunction * unmap, PlatformMapVideo * video_map,
|
||||
PlatformUnmapVideo * video_unmap)
|
||||
#if !defined(USE_EGL_X11) && !defined(USE_EGL_MALI_FB) && !defined(USE_EGL_RPI)
|
||||
/* Dummy functions for creating a native Window */
|
||||
EGLNativeWindowType
|
||||
platform_create_native_window (gint width, gint height, gpointer * window_data)
|
||||
{
|
||||
return FALSE;
|
||||
GST_ERROR ("Can't create native window");
|
||||
return (EGLNativeWindowType) 0;
|
||||
}
|
||||
|
||||
gboolean
|
||||
platform_has_custom_eglimage_alloc (void)
|
||||
platform_destroy_native_window (EGLNativeDisplayType display,
|
||||
EGLNativeWindowType window, gpointer * window_data)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
platform_alloc_eglimage (EGLDisplay display, EGLContext context, GLint format,
|
||||
GLint type, gint width, gint height, GLuint tex_id, EGLImageKHR * image,
|
||||
gpointer * image_platform_data)
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
platform_free_eglimage (EGLDisplay display, EGLContext context, GLuint tex_id,
|
||||
EGLImageKHR * image, gpointer * image_platform_data)
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
GST_ERROR ("Can't destroy native window");
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -47,12 +47,10 @@
|
|||
* tweaking and isolation from the main routines
|
||||
*/
|
||||
|
||||
#ifndef __GST_ANDROID_VIDEO_PLATFORM_WRAPPER__
|
||||
#define __GST_ANDROID_VIDEO_PLATFORM_WRAPPER__
|
||||
#ifndef __GST_VIDEO_PLATFORM_WRAPPER__
|
||||
#define __GST_VIDEO_PLATFORM_WRAPPER__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/video/gstvideometa.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
gboolean platform_wrapper_init (void);
|
||||
|
@ -60,47 +58,4 @@ EGLNativeWindowType platform_create_native_window (gint width, gint height, gpoi
|
|||
gboolean platform_destroy_native_window (EGLNativeDisplayType display,
|
||||
EGLNativeWindowType w, gpointer * window_data);
|
||||
|
||||
GstBufferPool *platform_create_buffer_pool (EGLDisplay display);
|
||||
|
||||
#define GST_EGL_IMAGE_MEMORY_NAME "GstEGLImage"
|
||||
typedef struct
|
||||
{
|
||||
GstMemory parent;
|
||||
|
||||
GstVideoFormat format;
|
||||
gint width, height;
|
||||
|
||||
GMutex lock;
|
||||
|
||||
/* Always in order RGB/Y, UV/U, V */
|
||||
EGLImageKHR image[3];
|
||||
gpointer image_platform_data[3];
|
||||
GLuint texture[3];
|
||||
gint stride[3];
|
||||
gsize offset[3];
|
||||
guint n_textures;
|
||||
|
||||
gpointer memory[3];
|
||||
gpointer memory_platform_data[3];
|
||||
gint memory_refcount[3];
|
||||
GstMapFlags memory_flags[3];
|
||||
|
||||
gpointer mapped_memory;
|
||||
gint mapped_memory_refcount;
|
||||
GstMapFlags mapped_memory_flags;
|
||||
} GstEGLImageMemory;
|
||||
|
||||
#define GST_EGL_IMAGE_MEMORY(m) ((GstEGLImageMemory*)(m))
|
||||
|
||||
typedef gboolean (*PlatformMapVideo) (GstVideoMeta *meta, guint plane, GstMapInfo *info, gpointer *data, gint * stride, GstMapFlags flags);
|
||||
typedef gboolean (*PlatformUnmapVideo) (GstVideoMeta *meta, guint plane, GstMapInfo *info);
|
||||
|
||||
extern PlatformMapVideo default_map_video;
|
||||
extern PlatformUnmapVideo default_unmap_video;
|
||||
|
||||
gboolean platform_can_map_eglimage (GstMemoryMapFunction *map, GstMemoryUnmapFunction *unmap, PlatformMapVideo *video_map, PlatformUnmapVideo *video_unmap);
|
||||
gboolean platform_has_custom_eglimage_alloc (void);
|
||||
gboolean platform_alloc_eglimage (EGLDisplay display, EGLContext context, GLint format, GLint type, gint width, gint height, GLuint tex_id, EGLImageKHR *image, gpointer *image_platform_data);
|
||||
void platform_free_eglimage (EGLDisplay display, EGLContext context, GLuint tex_id, EGLImageKHR *image, gpointer *image_platform_data);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue