Blame gst-libs/gst/gl/egl/gsteglimage.h

Packit 971217
/*
Packit 971217
 * GStreamer
Packit 971217
 * Copyright (C) 2012 Collabora Ltd.
Packit 971217
 *   @author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Packit 971217
 * Copyright (C) 2014 Julien Isorce <julien.isorce@gmail.com>
Packit 971217
 *
Packit 971217
 * This library is free software; you can redistribute it and/or
Packit 971217
 * modify it under the terms of the GNU Library General Public
Packit 971217
 * License as published by the Free Software Foundation; either
Packit 971217
 * version 2 of the License, or (at your option) any later version.
Packit 971217
 *
Packit 971217
 * This library is distributed in the hope that it will be useful,
Packit 971217
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 971217
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 971217
 * Library General Public License for more details.
Packit 971217
 *
Packit 971217
 * You should have received a copy of the GNU Library General Public
Packit 971217
 * License along with this library; if not, write to the
Packit 971217
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 971217
 * Boston, MA 02110-1301, USA.
Packit 971217
 */
Packit 971217
Packit 971217
#ifndef _GST_EGL_IMAGE_H_
Packit 971217
#define _GST_EGL_IMAGE_H_
Packit 971217
Packit 971217
#include <gst/gl/gstgl_fwd.h>
Packit 971217
#include <gst/gl/gstglformat.h>
Packit 971217
Packit 971217
G_BEGIN_DECLS
Packit 971217
Packit 971217
GST_GL_API GType gst_egl_image_get_type (void);
Packit 971217
Packit 971217
#define GST_TYPE_EGL_IMAGE                         (gst_egl_image_get_type())
Packit 971217
#define GST_IS_EGL_IMAGE(obj)                      (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_EGL_IMAGE))
Packit 971217
#define GST_EGL_IMAGE_CAST(obj)                    ((GstEGLImage *)(obj))
Packit 971217
#define GST_EGL_IMAGE(obj)                         (GST_EGL_IMAGE_CAST(obj))
Packit 971217
Packit 971217
typedef struct _GstEGLImage GstEGLImage;
Packit 971217
Packit 971217
/**
Packit 971217
 * GstEGLImageDestroyNotify:
Packit 971217
 * @image: a #GstEGLImage
Packit 971217
 * @data: user data passed to gst_egl_image_new_wrapped()
Packit 971217
 *
Packit 971217
 * Function to be called when the GstEGLImage is destroyed. It should free
Packit 971217
 * the associated #EGLImage if necessary
Packit 971217
 */
Packit 971217
typedef void (*GstEGLImageDestroyNotify) (GstEGLImage * image,
Packit 971217
    gpointer data);
Packit 971217
Packit 971217
/**
Packit 971217
 * GstEGLImage:
Packit 971217
 *
Packit 971217
 * Opaque #GstEGLImage struct.
Packit 971217
 */
Packit 971217
struct _GstEGLImage
Packit 971217
{
Packit 971217
  GstMiniObject parent;
Packit 971217
Packit 971217
  GstGLContext *context;
Packit 971217
  gpointer image;
Packit 971217
  GstGLFormat format;
Packit 971217
Packit 971217
  /* <private> */
Packit 971217
  gpointer destroy_data;
Packit 971217
  GstEGLImageDestroyNotify destroy_notify;
Packit 971217
Packit 971217
  gpointer _padding[GST_PADDING];
Packit 971217
};
Packit 971217
Packit 971217
GST_GL_API
Packit 971217
GstEGLImage *             gst_egl_image_new_wrapped             (GstGLContext * context,
Packit 971217
                                                                 gpointer image,
Packit 971217
                                                                 GstGLFormat format,
Packit 971217
                                                                 gpointer user_data,
Packit 971217
                                                                 GstEGLImageDestroyNotify user_data_destroy);
Packit 971217
GST_GL_API
Packit 971217
gpointer                gst_egl_image_get_image                 (GstEGLImage * image);
Packit 971217
Packit 971217
GST_GL_API
Packit 971217
GstEGLImage *           gst_egl_image_from_texture              (GstGLContext * context,
Packit 971217
                                                                 GstGLMemory * gl_mem,
Packit 971217
                                                                 guintptr * attribs);
Packit 971217
#if GST_GL_HAVE_DMABUF
Packit 971217
GST_GL_API
Packit 971217
GstEGLImage *           gst_egl_image_from_dmabuf               (GstGLContext * context,
Packit 971217
                                                                 gint dmabuf,
Packit 971217
                                                                 GstVideoInfo * in_info,
Packit 971217
                                                                 gint plane,
Packit 971217
                                                                 gsize offset);
Packit 971217
GST_GL_API
Packit 971217
gboolean                gst_egl_image_export_dmabuf             (GstEGLImage *image, int *fd, gint *stride, gsize *offset);
Packit 971217
#endif
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_egl_image_ref:
Packit 971217
 * @image: a #GstEGLImage.
Packit 971217
 *
Packit 971217
 * Increases the refcount of the given image by one.
Packit 971217
 *
Packit 971217
 * Returns: (transfer full): @image
Packit 971217
 */
Packit 971217
static inline GstEGLImage *
Packit 971217
gst_egl_image_ref (GstEGLImage * image)
Packit 971217
{
Packit 971217
  return (GstEGLImage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (image));
Packit 971217
}
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_egl_image_unref:
Packit 971217
 * @image: (transfer full): a #GstEGLImage.
Packit 971217
 *
Packit 971217
 * Decreases the refcount of the image. If the refcount reaches 0, the image
Packit 971217
 * with the associated metadata and memory will be freed.
Packit 971217
 */
Packit 971217
static inline void
Packit 971217
gst_egl_image_unref (GstEGLImage * image)
Packit 971217
{
Packit 971217
  gst_mini_object_unref (GST_MINI_OBJECT_CAST (image));
Packit 971217
}
Packit 971217
Packit 971217
G_END_DECLS
Packit 971217
Packit 971217
#endif /* _GST_EGL_IMAGE_H_ */