gstglutils.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * GStreamer
  3. * Copyright (C) 2013 Matthew Waters <[email protected]>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public
  16. * License along with this library; if not, write to the
  17. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef __GST_GL_UTILS_H__
  21. #define __GST_GL_UTILS_H__
  22. #include <gst/video/video.h>
  23. #include <gst/gl/gstgl_fwd.h>
  24. G_BEGIN_DECLS
  25. /**
  26. * GstGLContextProjection:
  27. *
  28. * %GST_GL_DISPLAY_PROJECTION_ORTHO2D: Orthogonal projection
  29. * %GST_GL_DISPLAY_CONVERSION_MATRIX: Perspective projection
  30. */
  31. typedef enum
  32. {
  33. GST_GL_DISPLAY_PROJECTION_ORTHO2D,
  34. GST_GL_DISPLAY_PROJECTION_PERSPECTIVE
  35. } GstGLDisplayProjection;
  36. /**
  37. * CDCB:
  38. * @texture: texture to draw
  39. * @width: new width
  40. * @height: new height:
  41. * @data: user data
  42. *
  43. * client draw callback
  44. */
  45. typedef gboolean (*CDCB) (GLuint texture, GLuint width, GLuint height, gpointer data);
  46. /**
  47. * GLCB:
  48. * @width: the width
  49. * @height: the height
  50. * @texture: texture
  51. * @stuff: user data
  52. *
  53. * callback definition for operating on textures
  54. */
  55. typedef void (*GLCB) (gint, gint, guint, gpointer stuff);
  56. /**
  57. * GLCB_V2:
  58. * @stuff: user data
  59. *
  60. * callback definition for operating through a Framebuffer object
  61. */
  62. typedef void (*GLCB_V2) (gpointer stuff);
  63. void gst_gl_context_gen_texture (GstGLContext * context, GLuint * pTexture,
  64. GstVideoFormat v_format, GLint width, GLint height);
  65. void gst_gl_context_del_texture (GstGLContext * context, GLuint * pTexture);
  66. void gst_gl_generate_texture_full (GstGLContext * context, const GstVideoInfo * info,
  67. const guint comp, gint stride[], gsize offset[], gsize size[], GLuint * pTexture);
  68. gboolean gst_gl_context_gen_fbo (GstGLContext * context, gint width, gint height,
  69. GLuint * fbo, GLuint * depthbuffer);
  70. gboolean gst_gl_context_use_fbo (GstGLContext * context, gint texture_fbo_width,
  71. gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
  72. GLuint texture_fbo, GLCB cb, gint input_texture_width,
  73. gint input_texture_height, GLuint input_texture, gdouble proj_param1,
  74. gdouble proj_param2, gdouble proj_param3, gdouble proj_param4,
  75. GstGLDisplayProjection projection, gpointer stuff);
  76. gboolean gst_gl_context_use_fbo_v2 (GstGLContext * context, gint texture_fbo_width,
  77. gint texture_fbo_height, GLuint fbo, GLuint depth_buffer,
  78. GLuint texture_fbo, GLCB_V2 cb, gpointer stuff);
  79. void gst_gl_context_del_fbo (GstGLContext * context, GLuint fbo,
  80. GLuint depth_buffer);
  81. gboolean gst_gl_context_gen_shader (GstGLContext * context,
  82. const gchar * shader_vertex_source,
  83. const gchar * shader_fragment_source, GstGLShader ** shader);
  84. void gst_gl_context_del_shader (GstGLContext * context, GstGLShader * shader);
  85. gboolean gst_gl_context_check_framebuffer_status (GstGLContext * context);
  86. void gst_gl_context_set_error (GstGLContext * context, const char * format, ...);
  87. gchar *gst_gl_context_get_error (void);
  88. gboolean gst_gl_ensure_display (gpointer element, GstGLDisplay **display_ptr);
  89. gboolean gst_gl_handle_set_context (GstElement * element, GstContext * context,
  90. GstGLDisplay ** display);
  91. gboolean gst_gl_handle_context_query (GstElement * element, GstQuery * query,
  92. GstGLDisplay ** display);
  93. G_END_DECLS
  94. #endif /* __GST_GL_UTILS_H__ */