3 * Copyright (C) 2012 Collabora Ltd.
4 * @author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
5 * Copyright (C) 2014 Julien Isorce <julien.isorce@gmail.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
23 #ifndef _GST_EGL_IMAGE_H_
24 #define _GST_EGL_IMAGE_H_
26 #include <gst/gl/gstgl_fwd.h>
27 #include <gst/gl/gstglformat.h>
31 GST_GL_API GType gst_egl_image_get_type (void);
33 #define GST_TYPE_EGL_IMAGE (gst_egl_image_get_type())
34 #define GST_IS_EGL_IMAGE(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_EGL_IMAGE))
35 #define GST_EGL_IMAGE_CAST(obj) ((GstEGLImage *)(obj))
36 #define GST_EGL_IMAGE(obj) (GST_EGL_IMAGE_CAST(obj))
38 typedef struct _GstEGLImage GstEGLImage;
41 * GstEGLImageDestroyNotify:
42 * @image: a #GstEGLImage
43 * @data: user data passed to gst_egl_image_new_wrapped()
45 * Function to be called when the GstEGLImage is destroyed. It should free
46 * the associated #EGLImage if necessary
48 typedef void (*GstEGLImageDestroyNotify) (GstEGLImage * image,
54 * Opaque #GstEGLImage struct.
61 GstGLContext *context;
65 gpointer destroy_data;
66 GstEGLImageDestroyNotify destroy_notify;
68 gpointer _padding[GST_PADDING];
72 GstEGLImage * gst_egl_image_new_wrapped (GstGLContext * context,
76 GstEGLImageDestroyNotify user_data_destroy);
78 gpointer gst_egl_image_get_image (GstEGLImage * image);
81 GstEGLImage * gst_egl_image_from_texture (GstGLContext * context,
84 #if GST_GL_HAVE_DMABUF
86 GstEGLImage * gst_egl_image_from_dmabuf (GstGLContext * context,
88 GstVideoInfo * in_info,
92 GstEGLImage * gst_egl_image_from_dmabuf_direct (GstGLContext * context,
95 GstVideoInfo * in_info);
98 gboolean gst_egl_image_export_dmabuf (GstEGLImage *image, int *fd, gint *stride, gsize *offset);
103 * @image: a #GstEGLImage.
105 * Increases the refcount of the given image by one.
107 * Returns: (transfer full): @image
109 static inline GstEGLImage *
110 gst_egl_image_ref (GstEGLImage * image)
112 return (GstEGLImage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (image));
116 * gst_egl_image_unref:
117 * @image: (transfer full): a #GstEGLImage.
119 * Decreases the refcount of the image. If the refcount reaches 0, the image
120 * with the associated metadata and memory will be freed.
123 gst_egl_image_unref (GstEGLImage * image)
125 gst_mini_object_unref (GST_MINI_OBJECT_CAST (image));
130 #endif /* _GST_EGL_IMAGE_H_ */