2013-06-11 15:04:55 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2013 Matthew Waters <ystreet00@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_GL_UTILS_H__
|
|
|
|
#define __GST_GL_UTILS_H__
|
|
|
|
|
2013-06-13 07:57:35 +00:00
|
|
|
#include <gst/video/video.h>
|
2013-06-11 15:04:55 +00:00
|
|
|
|
2013-07-11 09:03:31 +00:00
|
|
|
#include <gst/gl/gstgl_fwd.h>
|
2013-06-11 15:04:55 +00:00
|
|
|
|
2014-04-29 18:24:08 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2013-06-11 15:04:55 +00:00
|
|
|
/**
|
2013-09-15 04:23:43 +00:00
|
|
|
* GstGLContextProjection:
|
2013-06-11 15:04:55 +00:00
|
|
|
*
|
|
|
|
* %GST_GL_DISPLAY_PROJECTION_ORTHO2D: Orthogonal projection
|
|
|
|
* %GST_GL_DISPLAY_CONVERSION_MATRIX: Perspective projection
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_GL_DISPLAY_PROJECTION_ORTHO2D,
|
|
|
|
GST_GL_DISPLAY_PROJECTION_PERSPECTIVE
|
|
|
|
} GstGLDisplayProjection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CDCB:
|
|
|
|
* @texture: texture to draw
|
|
|
|
* @width: new width
|
|
|
|
* @height: new height:
|
|
|
|
* @data: user data
|
|
|
|
*
|
|
|
|
* client draw callback
|
|
|
|
*/
|
|
|
|
typedef gboolean (*CDCB) (GLuint texture, GLuint width, GLuint height, gpointer data);
|
|
|
|
/**
|
|
|
|
* GLCB:
|
|
|
|
* @width: the width
|
|
|
|
* @height: the height
|
|
|
|
* @texture: texture
|
|
|
|
* @stuff: user data
|
|
|
|
*
|
|
|
|
* callback definition for operating on textures
|
|
|
|
*/
|
|
|
|
typedef void (*GLCB) (gint, gint, guint, gpointer stuff);
|
|
|
|
/**
|
|
|
|
* GLCB_V2:
|
|
|
|
* @stuff: user data
|
|
|
|
*
|
|
|
|
* callback definition for operating through a Framebuffer object
|
|
|
|
*/
|
|
|
|
typedef void (*GLCB_V2) (gpointer stuff);
|
|
|
|
|
2015-06-02 06:32:03 +00:00
|
|
|
/* deprecated. replaced by GstGLMemory */
|
2013-09-15 04:23:43 +00:00
|
|
|
void gst_gl_context_gen_texture (GstGLContext * context, GLuint * pTexture,
|
2013-06-11 15:04:55 +00:00
|
|
|
GstVideoFormat v_format, GLint width, GLint height);
|
2015-06-02 06:32:03 +00:00
|
|
|
/* deprecated. replaced by GstGLMemory */
|
2013-09-15 04:23:43 +00:00
|
|
|
void gst_gl_context_del_texture (GstGLContext * context, GLuint * pTexture);
|
2013-06-11 15:04:55 +00:00
|
|
|
|
2015-06-02 06:32:03 +00:00
|
|
|
/* deprecated. replaced by GstGLMemory */
|
2014-03-22 22:01:49 +00:00
|
|
|
void gst_gl_generate_texture_full (GstGLContext * context, const GstVideoInfo * info,
|
|
|
|
const guint comp, gint stride[], gsize offset[], gsize size[], GLuint * pTexture);
|
|
|
|
|
2013-09-15 04:23:43 +00:00
|
|
|
gboolean gst_gl_context_gen_fbo (GstGLContext * context, gint width, gint height,
|
2013-06-11 15:04:55 +00:00
|
|
|
GLuint * fbo, GLuint * depthbuffer);
|
2013-09-15 04:23:43 +00:00
|
|
|
gboolean gst_gl_context_use_fbo_v2 (GstGLContext * context, gint texture_fbo_width,
|
2013-06-11 15:04:55 +00:00
|
|
|
gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
|
2013-06-16 10:44:47 +00:00
|
|
|
GLuint texture_fbo, GLCB_V2 cb, gpointer stuff);
|
2013-09-15 04:23:43 +00:00
|
|
|
void gst_gl_context_del_fbo (GstGLContext * context, GLuint fbo,
|
2013-06-11 15:04:55 +00:00
|
|
|
GLuint depth_buffer);
|
|
|
|
|
2013-09-15 04:23:43 +00:00
|
|
|
gboolean gst_gl_context_gen_shader (GstGLContext * context,
|
2013-06-11 15:04:55 +00:00
|
|
|
const gchar * shader_vertex_source,
|
|
|
|
const gchar * shader_fragment_source, GstGLShader ** shader);
|
2013-09-15 04:23:43 +00:00
|
|
|
void gst_gl_context_del_shader (GstGLContext * context, GstGLShader * shader);
|
2013-06-11 15:04:55 +00:00
|
|
|
|
2013-09-15 04:23:43 +00:00
|
|
|
gboolean gst_gl_context_check_framebuffer_status (GstGLContext * context);
|
2013-06-12 13:17:30 +00:00
|
|
|
|
2013-09-15 04:23:43 +00:00
|
|
|
void gst_gl_context_set_error (GstGLContext * context, const char * format, ...);
|
|
|
|
gchar *gst_gl_context_get_error (void);
|
2013-06-13 06:55:37 +00:00
|
|
|
|
2014-08-14 13:29:00 +00:00
|
|
|
gboolean gst_gl_ensure_element_data (gpointer element,
|
|
|
|
GstGLDisplay **display_ptr, GstGLContext ** other_context_ptr);
|
2013-11-12 23:43:16 +00:00
|
|
|
gboolean gst_gl_handle_set_context (GstElement * element, GstContext * context,
|
2014-08-14 13:29:00 +00:00
|
|
|
GstGLDisplay ** display, GstGLContext ** other_context);
|
2013-11-12 23:43:16 +00:00
|
|
|
gboolean gst_gl_handle_context_query (GstElement * element, GstQuery * query,
|
2014-08-14 13:29:00 +00:00
|
|
|
GstGLDisplay ** display, GstGLContext ** other_context);
|
2013-11-12 23:43:16 +00:00
|
|
|
|
2015-02-10 14:27:28 +00:00
|
|
|
gboolean gst_gl_run_query (GstElement * element,
|
|
|
|
GstQuery * query, GstPadDirection direction);
|
2014-12-19 17:11:08 +00:00
|
|
|
gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
|
|
|
|
guint plane);
|
2015-05-06 13:46:49 +00:00
|
|
|
GstCaps * gst_gl_caps_replace_all_caps_features (const GstCaps * caps,
|
2015-02-02 13:11:06 +00:00
|
|
|
const gchar * feature_name);
|
2014-12-19 17:11:08 +00:00
|
|
|
|
2015-08-31 09:18:23 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
void gst_gl_insert_debug_marker (GstGLContext * context,
|
|
|
|
const gchar * format, ...) G_GNUC_PRINTF (2, 3);
|
|
|
|
#else /* GST_DISABLE_GST_DEBUG */
|
|
|
|
#if G_HAVE_ISO_VARARGS
|
|
|
|
#define gst_gl_insert_debug_marker(...) G_STMT_START{ }G_STMT_END
|
|
|
|
#else /* G_HAVE_ISO_VARARGS */
|
|
|
|
#if G_HAVE_GNUC_VARARGS
|
|
|
|
#define gst_gl_insert_debug_marker(args...) G_STMT_START{ }G_STMT_END
|
|
|
|
#else /* G_HAVE_GNUC_VARARGS */
|
|
|
|
static inline void
|
|
|
|
gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif /* G_HAVE_GNUC_VARARGS */
|
|
|
|
#endif /* G_HAVE_ISO_VARARGS */
|
|
|
|
#endif /* GST_DISABLE_GST_DEBUG */
|
|
|
|
|
2014-04-29 18:24:08 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2013-06-11 15:04:55 +00:00
|
|
|
#endif /* __GST_GL_UTILS_H__ */
|