1 /* 2 * GStreamer 3 * Copyright (C) 2015 Matthew Waters <matthew@centricular.com> 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 21 #ifndef _GST_GL_FORMAT_H_ 22 #define _GST_GL_FORMAT_H_ 23 24 #include <gst/gst.h> 25 26 #include <gst/gl/gstgl_fwd.h> 27 #include <gst/video/video.h> 28 29 /** 30 * GST_GL_TEXTURE_TARGET_2D_STR: 31 * 32 * String used for %GST_GL_TEXTURE_TARGET_2D in things like caps values 33 */ 34 #define GST_GL_TEXTURE_TARGET_2D_STR "2D" 35 36 /** 37 * GST_GL_TEXTURE_TARGET_RECTANGLE_STR: 38 * 39 * String used for %GST_GL_TEXTURE_TARGET_RECTANGLE in things like caps values 40 */ 41 #define GST_GL_TEXTURE_TARGET_RECTANGLE_STR "rectangle" 42 43 /** 44 * GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR: 45 * 46 * String used for %GST_GL_TEXTURE_TARGET_EXTERNAL_OES in things like caps values 47 */ 48 #define GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR "external-oes" 49 50 /** 51 * GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D: 52 * 53 * String used for %GST_GL_TEXTURE_TARGET_2D as a #GstBufferPool pool option 54 */ 55 #define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D "GstBufferPoolOptionGLTextureTarget2D" 56 57 /** 58 * GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE: 59 * 60 * String used for %GST_GL_TEXTURE_TARGET_RECTANGLE as a #GstBufferPool pool option 61 */ 62 #define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE "GstBufferPoolOptionGLTextureTargetRectangle" 63 64 /** 65 * GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES: 66 * 67 * String used for %GST_GL_TEXTURE_TARGET_EXTERNAL_OES as a #GstBufferPool pool option 68 */ 69 #define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES "GstBufferPoolOptionGLTextureTargetExternalOES" 70 71 G_BEGIN_DECLS 72 73 /** 74 * GstGLFormat: 75 * @GST_GL_LUMINANCE: Single component replicated across R, G, and B textures 76 * components 77 * @GST_GL_ALPHA: Single component stored in the A texture component 78 * @GST_GL_LUMINANCE_ALPHA: Combination of #GST_GL_LUMINANCE and #GST_GL_ALPHA 79 * @GST_GL_RED: Single component stored in the R texture component 80 * @GST_GL_R8: Single 8-bit component stored in the R texture component 81 * @GST_GL_RG: Two components stored in the R and G texture components 82 * @GST_GL_RG8: Two 8-bit components stored in the R and G texture components 83 * @GST_GL_RGB: Three components stored in the R, G, and B texture components 84 * @GST_GL_RGB8: Three 8-bit components stored in the R, G, and B 85 * texture components 86 * @GST_GL_RGB565: Three components of bit depth 5, 6 and 5 stored in the R, G, 87 * and B texture components respectively. 88 * @GST_GL_RGB16: Three 16-bit components stored in the R, G, and B 89 * texture components 90 * @GST_GL_RGBA: Four components stored in the R, G, B, and A texture 91 * components respectively. 92 * @GST_GL_RGBA8: Four 8-bit components stored in the R, G, B, and A texture 93 * components respectively. 94 * @GST_GL_RGBA16: Four 16-bit components stored in the R, G, B, and A texture 95 * components respectively. 96 * @GST_GL_DEPTH_COMPONENT16: A single 16-bit component for depth information. 97 * @GST_GL_DEPTH24_STENCIL8: A 24-bit component for depth information and 98 * a 8-bit component for stencil informat. 99 */ 100 typedef enum 101 { 102 /* values taken from the GL headers */ 103 GST_GL_LUMINANCE = 0x1909, 104 105 GST_GL_ALPHA = 0x1906, 106 107 GST_GL_LUMINANCE_ALPHA = 0x190A, 108 109 GST_GL_RED = 0x1903, 110 GST_GL_R8 = 0x8229, 111 112 GST_GL_RG = 0x8227, 113 GST_GL_RG8 = 0x822B, 114 115 GST_GL_RGB = 0x1907, 116 GST_GL_RGB8 = 0x8051, 117 GST_GL_RGB565 = 0x8D62, 118 GST_GL_RGB16 = 0x8054, 119 120 GST_GL_RGBA = 0x1908, 121 GST_GL_RGBA8 = 0x8058, 122 GST_GL_RGBA16 = 0x805B, 123 124 GST_GL_DEPTH_COMPONENT16 = 0x81A5, 125 126 GST_GL_DEPTH24_STENCIL8 = 0x88F0, 127 } GstGLFormat; 128 129 GST_GL_API 130 guint gst_gl_format_type_n_bytes (guint format, 131 guint type); 132 GST_GL_API 133 GstGLFormat gst_gl_format_from_video_info (GstGLContext * context, 134 GstVideoInfo * vinfo, 135 guint plane); 136 GST_GL_API 137 guint gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context, 138 guint format, 139 guint type); 140 GST_GL_API 141 void gst_gl_format_type_from_sized_gl_format (GstGLFormat format, 142 GstGLFormat * unsized_format, 143 guint * gl_type); 144 145 GST_GL_API 146 gboolean gst_gl_format_is_supported (GstGLContext * context, 147 GstGLFormat format); 148 149 GST_GL_API 150 GstGLTextureTarget gst_gl_texture_target_from_string (const gchar * str); 151 GST_GL_API 152 const gchar * gst_gl_texture_target_to_string (GstGLTextureTarget target); 153 GST_GL_API 154 guint gst_gl_texture_target_to_gl (GstGLTextureTarget target); 155 GST_GL_API 156 GstGLTextureTarget gst_gl_texture_target_from_gl (guint target); 157 GST_GL_API 158 const gchar * gst_gl_texture_target_to_buffer_pool_option (GstGLTextureTarget target); 159 160 G_END_DECLS 161 162 #endif /* _GST_GL_FORMAT_H_ */ 163