gstreamer/gst-libs/gst/gl/egl/gsteglimagememory.h
Lubosz Sarnecki 0468dc6663 eglimagememory: Methods to create GstGLMemory from dmabufs
Maps GstVideoFormats to suitable DRM fourccs which work with
glcolorconvert, using gst_gl_memory_alloc(). We require mostly
only 4 formats to be supported by the driver. We require DRM
equivalent to RGB16, RGBA, R8 and RG88. This way it's compatible with
DesktopGL, since GL_TEXTURE_2D is used and limit driver requirements.
With this we can virtually support all formats the glcolorconvert
supports.

https://bugzilla.gnome.org/show_bug.cgi?id=743345
2017-12-09 19:32:13 +00:00

74 lines
2.3 KiB
C

/*
* GStreamer
* Copyright (C) 2012 Collabora Ltd.
* @author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
* Copyright (C) 2014 Julien Isorce <julien.isorce@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _GST_EGL_IMAGE_MEMORY_H_
#define _GST_EGL_IMAGE_MEMORY_H_
#include <gst/gst.h>
#include <gst/gstallocator.h>
#include <gst/gstmemory.h>
#include <gst/video/video.h>
#include <gst/gl/gl.h>
#include "gstglcontext_egl.h"
G_BEGIN_DECLS
typedef void (*GstEGLImageDestroyNotify) (GstGLContextEGL * context,
gpointer data);
typedef struct _GstEGLImageMemory GstEGLImageMemory;
#define GST_EGL_IMAGE_MEMORY_TYPE "EGLImage"
#define GST_CAPS_FEATURE_MEMORY_EGL_IMAGE "memory:EGLImage"
struct _GstEGLImageMemory
{
GstMemory parent;
GstGLContextEGL *context;
EGLImageKHR image;
GstVideoGLTextureType type;
GstVideoGLTextureOrientation orientation;
gpointer user_data;
GstEGLImageDestroyNotify user_data_destroy;
};
void gst_egl_image_memory_init (void);
gboolean gst_egl_image_memory_setup_buffer (GstGLContext * context, GstVideoInfo * info, GstBuffer * buffer);
gboolean gst_is_egl_image_memory (GstMemory * mem);
EGLImageKHR gst_egl_image_memory_get_image (GstMemory * mem);
EGLDisplay gst_egl_image_memory_get_display (GstMemory * mem);
GstVideoGLTextureOrientation gst_egl_image_memory_get_orientation (GstMemory * mem);
void gst_egl_image_memory_set_orientation (GstMemory * mem,
GstVideoGLTextureOrientation orientation);
#if GST_GL_HAVE_DMABUF
GstMemory * gst_egl_image_memory_from_dmabuf (GstGLContext * context,
gint dmabuf, GstVideoInfo * in_info, gint plane, gsize offset);
#endif
G_END_DECLS
#endif /* _GST_GL_MEMORY_H_ */