2016-05-04 02:17:59 +00:00
|
|
|
/*
|
|
|
|
* 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_H_
|
|
|
|
#define _GST_EGL_IMAGE_H_
|
|
|
|
|
2017-07-07 15:15:12 +00:00
|
|
|
#include <gst/gl/gstgl_fwd.h>
|
|
|
|
#include <gst/gl/gstglformat.h>
|
2016-05-04 02:17:59 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API GType gst_egl_image_get_type (void);
|
2017-08-10 08:09:22 +00:00
|
|
|
|
2016-05-04 02:17:59 +00:00
|
|
|
#define GST_TYPE_EGL_IMAGE (gst_egl_image_get_type())
|
|
|
|
#define GST_IS_EGL_IMAGE(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_EGL_IMAGE))
|
|
|
|
#define GST_EGL_IMAGE_CAST(obj) ((GstEGLImage *)(obj))
|
|
|
|
#define GST_EGL_IMAGE(obj) (GST_EGL_IMAGE_CAST(obj))
|
|
|
|
|
|
|
|
typedef struct _GstEGLImage GstEGLImage;
|
|
|
|
|
2017-07-28 10:00:12 +00:00
|
|
|
/**
|
|
|
|
* GstEGLImageDestroyNotify:
|
|
|
|
* @image: a #GstEGLImage
|
|
|
|
* @data: user data passed to gst_egl_image_new_wrapped()
|
|
|
|
*
|
|
|
|
* Function to be called when the GstEGLImage is destroyed. It should free
|
2019-05-20 01:14:27 +00:00
|
|
|
* the associated `EGLImage` if necessary
|
2017-07-28 10:00:12 +00:00
|
|
|
*/
|
2016-05-04 02:17:59 +00:00
|
|
|
typedef void (*GstEGLImageDestroyNotify) (GstEGLImage * image,
|
|
|
|
gpointer data);
|
|
|
|
|
2016-11-02 10:21:33 +00:00
|
|
|
/**
|
|
|
|
* GstEGLImage:
|
|
|
|
*
|
|
|
|
* Opaque #GstEGLImage struct.
|
|
|
|
*/
|
2016-05-04 02:17:59 +00:00
|
|
|
struct _GstEGLImage
|
|
|
|
{
|
2018-04-02 06:34:58 +00:00
|
|
|
/*< private >*/
|
2016-05-04 02:17:59 +00:00
|
|
|
GstMiniObject parent;
|
|
|
|
|
2016-11-16 15:41:14 +00:00
|
|
|
GstGLContext *context;
|
2017-07-07 15:15:12 +00:00
|
|
|
gpointer image;
|
2017-03-13 03:28:47 +00:00
|
|
|
GstGLFormat format;
|
2016-05-04 02:17:59 +00:00
|
|
|
|
|
|
|
gpointer destroy_data;
|
|
|
|
GstEGLImageDestroyNotify destroy_notify;
|
2016-11-07 15:50:41 +00:00
|
|
|
|
|
|
|
gpointer _padding[GST_PADDING];
|
2016-05-04 02:17:59 +00:00
|
|
|
};
|
|
|
|
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2016-05-04 02:17:59 +00:00
|
|
|
GstEGLImage * gst_egl_image_new_wrapped (GstGLContext * context,
|
2017-07-07 15:15:12 +00:00
|
|
|
gpointer image,
|
2017-03-13 03:28:47 +00:00
|
|
|
GstGLFormat format,
|
2016-05-04 02:17:59 +00:00
|
|
|
gpointer user_data,
|
|
|
|
GstEGLImageDestroyNotify user_data_destroy);
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2017-07-07 15:15:12 +00:00
|
|
|
gpointer gst_egl_image_get_image (GstEGLImage * image);
|
2016-05-04 02:17:59 +00:00
|
|
|
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2016-11-16 15:41:14 +00:00
|
|
|
GstEGLImage * gst_egl_image_from_texture (GstGLContext * context,
|
|
|
|
GstGLMemory * gl_mem,
|
|
|
|
guintptr * attribs);
|
2016-05-04 02:17:59 +00:00
|
|
|
#if GST_GL_HAVE_DMABUF
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2016-05-04 02:17:59 +00:00
|
|
|
GstEGLImage * gst_egl_image_from_dmabuf (GstGLContext * context,
|
|
|
|
gint dmabuf,
|
2021-01-04 22:25:10 +00:00
|
|
|
const GstVideoInfo * in_info,
|
2016-05-04 02:17:59 +00:00
|
|
|
gint plane,
|
|
|
|
gsize offset);
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2018-10-30 11:25:02 +00:00
|
|
|
GstEGLImage * gst_egl_image_from_dmabuf_direct (GstGLContext * context,
|
|
|
|
gint *fd,
|
2021-01-04 22:25:10 +00:00
|
|
|
const gsize *offset,
|
|
|
|
const GstVideoInfo * in_info);
|
2020-02-13 09:28:40 +00:00
|
|
|
GST_GL_API
|
|
|
|
GstEGLImage * gst_egl_image_from_dmabuf_direct_target (GstGLContext * context,
|
|
|
|
gint *fd,
|
2021-01-04 22:25:10 +00:00
|
|
|
const gsize *offset,
|
|
|
|
const GstVideoInfo * in_info,
|
2020-02-13 09:28:40 +00:00
|
|
|
GstGLTextureTarget target);
|
2018-10-30 11:25:02 +00:00
|
|
|
|
|
|
|
GST_GL_API
|
2017-01-11 01:23:58 +00:00
|
|
|
gboolean gst_egl_image_export_dmabuf (GstEGLImage *image, int *fd, gint *stride, gsize *offset);
|
2016-05-04 02:17:59 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_egl_image_ref:
|
|
|
|
* @image: a #GstEGLImage.
|
|
|
|
*
|
|
|
|
* Increases the refcount of the given image by one.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): @image
|
|
|
|
*/
|
|
|
|
static inline GstEGLImage *
|
|
|
|
gst_egl_image_ref (GstEGLImage * image)
|
|
|
|
{
|
|
|
|
return (GstEGLImage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (image));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-11-02 10:21:33 +00:00
|
|
|
* gst_egl_image_unref:
|
|
|
|
* @image: (transfer full): a #GstEGLImage.
|
2016-05-04 02:17:59 +00:00
|
|
|
*
|
|
|
|
* Decreases the refcount of the image. If the refcount reaches 0, the image
|
|
|
|
* with the associated metadata and memory will be freed.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
gst_egl_image_unref (GstEGLImage * image)
|
|
|
|
{
|
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (image));
|
|
|
|
}
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* _GST_EGL_IMAGE_H_ */
|