gstglcolorconvert.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * GStreamer
  3. * Copyright (C) 2012 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_COLOR_CONVERT_H__
  21. #define __GST_GL_COLOR_CONVERT_H__
  22. #include <gst/video/video.h>
  23. #include <gst/gstmemory.h>
  24. #include <gst/gl/gstgl_fwd.h>
  25. G_BEGIN_DECLS
  26. GType gst_gl_color_convert_get_type (void);
  27. #define GST_TYPE_GL_COLOR_CONVERT (gst_gl_color_convert_get_type())
  28. #define GST_GL_COLOR_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_COLOR_CONVERT,GstGLColorConvert))
  29. #define GST_GL_COLOR_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_DISPLAY,GstGLColorConvertClass))
  30. #define GST_IS_GL_COLOR_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_COLOR_CONVERT))
  31. #define GST_IS_GL_COLOR_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_COLOR_CONVERT))
  32. #define GST_GL_COLOR_CONVERT_CAST(obj) ((GstGLColorConvert*)(obj))
  33. /**
  34. * GstGLColorConvert
  35. *
  36. * Opaque #GstGLColorConvert object
  37. */
  38. struct _GstGLColorConvert
  39. {
  40. /* <private> */
  41. GstObject parent;
  42. GstGLContext *context;
  43. /* input data */
  44. GstVideoInfo in_info;
  45. GstVideoInfo out_info;
  46. gboolean initted;
  47. GstBuffer * inbuf;
  48. GstBuffer * outbuf;
  49. /* used for the conversion */
  50. GLuint fbo;
  51. GLuint depth_buffer;
  52. GstGLShader *shader;
  53. GLint shader_attr_position_loc;
  54. GLint shader_attr_texture_loc;
  55. /* <private> */
  56. GstGLColorConvertPrivate *priv;
  57. gpointer _reserved[GST_PADDING];
  58. };
  59. /**
  60. * GstGLColorConvertClass:
  61. *
  62. * The #GstGLColorConvertClass struct only contains private data
  63. */
  64. struct _GstGLColorConvertClass
  65. {
  66. GstObjectClass object_class;
  67. };
  68. /**
  69. * GST_GL_COLOR_CONVERT_FORMATS:
  70. *
  71. * The currently supported formats that can be converted
  72. */
  73. #define GST_GL_COLOR_CONVERT_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, " \
  74. "xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, " \
  75. "Y41B, NV12, NV21, YUY2, UYVY, AYUV, " \
  76. "GRAY8, GRAY16_LE, GRAY16_BE }"
  77. /**
  78. * GST_GL_COLOR_CONVERT_VIDEO_CAPS:
  79. *
  80. * The currently supported #GstCaps that can be converted
  81. */
  82. #define GST_GL_COLOR_CONVERT_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_GL_COLOR_CONVERT_FORMATS)
  83. GstGLColorConvert * gst_gl_color_convert_new (GstGLContext * context);
  84. void gst_gl_color_convert_set_format (GstGLColorConvert * convert,
  85. GstVideoInfo * in_info,
  86. GstVideoInfo * out_info);
  87. GstBuffer * gst_gl_color_convert_perform (GstGLColorConvert * convert, GstBuffer * inbuf);
  88. G_END_DECLS
  89. #endif /* __GST_GL_COLOR_CONVERT_H__ */