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 | * @GST_GL_RGBA10_A2: Four components of bit depth 10, 10, 10 and 2 stored in the |
100 | * R, G, B and A texture components respectively. |
101 | * @GST_GL_R16: Single 16-bit component stored in the R texture component |
102 | * @GST_GL_RG16: Two 16-bit components stored in the R and G texture components |
103 | */ |
104 | typedef enum |
105 | { |
106 | /* values taken from the GL headers */ |
107 | GST_GL_LUMINANCE = 0x1909, |
108 | |
109 | GST_GL_ALPHA = 0x1906, |
110 | |
111 | GST_GL_LUMINANCE_ALPHA = 0x190A, |
112 | |
113 | GST_GL_RED = 0x1903, |
114 | GST_GL_R8 = 0x8229, |
115 | |
116 | GST_GL_RG = 0x8227, |
117 | GST_GL_RG8 = 0x822B, |
118 | |
119 | GST_GL_RGB = 0x1907, |
120 | GST_GL_RGB8 = 0x8051, |
121 | GST_GL_RGB565 = 0x8D62, |
122 | GST_GL_RGB16 = 0x8054, |
123 | |
124 | GST_GL_RGBA = 0x1908, |
125 | GST_GL_RGBA8 = 0x8058, |
126 | GST_GL_RGBA16 = 0x805B, |
127 | |
128 | GST_GL_DEPTH_COMPONENT16 = 0x81A5, |
129 | |
130 | GST_GL_DEPTH24_STENCIL8 = 0x88F0, |
131 | |
132 | GST_GL_RGB10_A2 = 0x8059, |
133 | |
134 | GST_GL_R16 = 0x822A, |
135 | GST_GL_RG16 = 0x822C, |
136 | } GstGLFormat; |
137 | |
138 | GST_GL_API |
139 | guint gst_gl_format_type_n_bytes (guint format, |
140 | guint type); |
141 | GST_GL_API |
142 | GstGLFormat gst_gl_format_from_video_info (GstGLContext * context, |
143 | const GstVideoInfo * vinfo, |
144 | guint plane); |
145 | GST_GL_API |
146 | guint gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context, |
147 | guint format, |
148 | guint type); |
149 | GST_GL_API |
150 | void gst_gl_format_type_from_sized_gl_format (GstGLFormat format, |
151 | GstGLFormat * unsized_format, |
152 | guint * gl_type); |
153 | |
154 | GST_GL_API |
155 | gboolean gst_gl_format_is_supported (GstGLContext * context, |
156 | GstGLFormat format); |
157 | |
158 | GST_GL_API |
159 | GstGLTextureTarget gst_gl_texture_target_from_string (const gchar * str); |
160 | GST_GL_API |
161 | const gchar * gst_gl_texture_target_to_string (GstGLTextureTarget target); |
162 | GST_GL_API |
163 | guint gst_gl_texture_target_to_gl (GstGLTextureTarget target); |
164 | GST_GL_API |
165 | GstGLTextureTarget gst_gl_texture_target_from_gl (guint target); |
166 | GST_GL_API |
167 | const gchar * gst_gl_texture_target_to_buffer_pool_option (GstGLTextureTarget target); |
168 | |
169 | G_END_DECLS |
170 | |
171 | #endif /* _GST_GL_FORMAT_H_ */ |
172 | |