2015-12-14 02:43:59 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2015 Matthew Waters <matthew@centricular.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_FORMAT_H_
|
|
|
|
#define _GST_GL_FORMAT_H_
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
#include <gst/gl/gstgl_fwd.h>
|
|
|
|
#include <gst/video/video.h>
|
|
|
|
|
2016-03-06 08:32:21 +00:00
|
|
|
/**
|
|
|
|
* GST_GL_TEXTURE_TARGET_2D_STR:
|
|
|
|
*
|
|
|
|
* String used for %GST_GL_TEXTURE_TARGET_2D in things like caps values
|
|
|
|
*/
|
2015-12-14 02:43:59 +00:00
|
|
|
#define GST_GL_TEXTURE_TARGET_2D_STR "2D"
|
2016-03-06 08:32:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_GL_TEXTURE_TARGET_RECTANGLE_STR:
|
|
|
|
*
|
|
|
|
* String used for %GST_GL_TEXTURE_TARGET_RECTANGLE in things like caps values
|
|
|
|
*/
|
2015-12-14 02:43:59 +00:00
|
|
|
#define GST_GL_TEXTURE_TARGET_RECTANGLE_STR "rectangle"
|
2016-03-06 08:32:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR:
|
|
|
|
*
|
|
|
|
* String used for %GST_GL_TEXTURE_TARGET_EXTERNAL_OES in things like caps values
|
|
|
|
*/
|
2015-12-14 02:43:59 +00:00
|
|
|
#define GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR "external-oes"
|
|
|
|
|
2016-03-06 08:32:21 +00:00
|
|
|
/**
|
|
|
|
* GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D:
|
|
|
|
*
|
|
|
|
* String used for %GST_GL_TEXTURE_TARGET_2D as a #GstBufferPool pool option
|
|
|
|
*/
|
2015-12-14 02:43:59 +00:00
|
|
|
#define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D "GstBufferPoolOptionGLTextureTarget2D"
|
2016-03-06 08:32:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE:
|
|
|
|
*
|
|
|
|
* String used for %GST_GL_TEXTURE_TARGET_RECTANGLE as a #GstBufferPool pool option
|
|
|
|
*/
|
2015-12-14 02:43:59 +00:00
|
|
|
#define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE "GstBufferPoolOptionGLTextureTargetRectangle"
|
2016-03-06 08:32:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES:
|
|
|
|
*
|
2017-01-11 05:09:03 +00:00
|
|
|
* String used for %GST_GL_TEXTURE_TARGET_EXTERNAL_OES as a #GstBufferPool pool option
|
2016-03-06 08:32:21 +00:00
|
|
|
*/
|
2015-12-14 02:43:59 +00:00
|
|
|
#define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES "GstBufferPoolOptionGLTextureTargetExternalOES"
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2017-07-26 09:03:15 +00:00
|
|
|
/**
|
|
|
|
* GstGLFormat:
|
|
|
|
* @GST_GL_LUMINANCE: Single component replicated across R, G, and B textures
|
|
|
|
* components
|
|
|
|
* @GST_GL_ALPHA: Single component stored in the A texture component
|
|
|
|
* @GST_GL_LUMINANCE_ALPHA: Combination of #GST_GL_LUMINANCE and #GST_GL_ALPHA
|
|
|
|
* @GST_GL_RED: Single component stored in the R texture component
|
|
|
|
* @GST_GL_R8: Single 8-bit component stored in the R texture component
|
|
|
|
* @GST_GL_RG: Two components stored in the R and G texture components
|
|
|
|
* @GST_GL_RG8: Two 8-bit components stored in the R and G texture components
|
|
|
|
* @GST_GL_RGB: Three components stored in the R, G, and B texture components
|
|
|
|
* @GST_GL_RGB8: Three 8-bit components stored in the R, G, and B
|
|
|
|
* texture components
|
|
|
|
* @GST_GL_RGB565: Three components of bit depth 5, 6 and 5 stored in the R, G,
|
|
|
|
* and B texture components respectively.
|
2018-05-05 11:21:13 +00:00
|
|
|
* @GST_GL_RGB16: Three 16-bit components stored in the R, G, and B
|
|
|
|
* texture components
|
2017-07-26 09:03:15 +00:00
|
|
|
* @GST_GL_RGBA: Four components stored in the R, G, B, and A texture
|
|
|
|
* components respectively.
|
|
|
|
* @GST_GL_RGBA8: Four 8-bit components stored in the R, G, B, and A texture
|
|
|
|
* components respectively.
|
2018-05-05 11:21:13 +00:00
|
|
|
* @GST_GL_RGBA16: Four 16-bit components stored in the R, G, B, and A texture
|
|
|
|
* components respectively.
|
2017-07-26 09:03:15 +00:00
|
|
|
* @GST_GL_DEPTH_COMPONENT16: A single 16-bit component for depth information.
|
|
|
|
* @GST_GL_DEPTH24_STENCIL8: A 24-bit component for depth information and
|
|
|
|
* a 8-bit component for stencil informat.
|
2019-06-05 01:26:08 +00:00
|
|
|
* @GST_GL_RGBA10_A2: Four components of bit depth 10, 10, 10 and 2 stored in the
|
|
|
|
* R, G, B and A texture components respectively.
|
2019-06-13 05:07:06 +00:00
|
|
|
* @GST_GL_R16: Single 16-bit component stored in the R texture component
|
|
|
|
* @GST_GL_RG16: Two 16-bit components stored in the R and G texture components
|
2017-07-26 09:03:15 +00:00
|
|
|
*/
|
2016-07-11 12:28:42 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/* values taken from the GL headers */
|
|
|
|
GST_GL_LUMINANCE = 0x1909,
|
|
|
|
|
|
|
|
GST_GL_ALPHA = 0x1906,
|
|
|
|
|
|
|
|
GST_GL_LUMINANCE_ALPHA = 0x190A,
|
|
|
|
|
|
|
|
GST_GL_RED = 0x1903,
|
|
|
|
GST_GL_R8 = 0x8229,
|
|
|
|
|
|
|
|
GST_GL_RG = 0x8227,
|
|
|
|
GST_GL_RG8 = 0x822B,
|
|
|
|
|
|
|
|
GST_GL_RGB = 0x1907,
|
|
|
|
GST_GL_RGB8 = 0x8051,
|
|
|
|
GST_GL_RGB565 = 0x8D62,
|
2018-05-05 11:21:13 +00:00
|
|
|
GST_GL_RGB16 = 0x8054,
|
2016-07-11 12:28:42 +00:00
|
|
|
|
|
|
|
GST_GL_RGBA = 0x1908,
|
|
|
|
GST_GL_RGBA8 = 0x8058,
|
2018-05-05 11:21:13 +00:00
|
|
|
GST_GL_RGBA16 = 0x805B,
|
2016-07-11 12:28:42 +00:00
|
|
|
|
|
|
|
GST_GL_DEPTH_COMPONENT16 = 0x81A5,
|
|
|
|
|
|
|
|
GST_GL_DEPTH24_STENCIL8 = 0x88F0,
|
2019-06-05 01:26:08 +00:00
|
|
|
|
|
|
|
GST_GL_RGB10_A2 = 0x8059,
|
2019-06-13 05:07:06 +00:00
|
|
|
|
|
|
|
GST_GL_R16 = 0x822A,
|
|
|
|
GST_GL_RG16 = 0x822C,
|
2016-07-11 12:28:42 +00:00
|
|
|
} GstGLFormat;
|
|
|
|
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2015-12-14 02:43:59 +00:00
|
|
|
guint gst_gl_format_type_n_bytes (guint format,
|
|
|
|
guint type);
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2017-03-13 03:28:47 +00:00
|
|
|
GstGLFormat gst_gl_format_from_video_info (GstGLContext * context,
|
2021-01-04 22:25:10 +00:00
|
|
|
const GstVideoInfo * vinfo,
|
2015-12-14 02:43:59 +00:00
|
|
|
guint plane);
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2015-12-14 02:43:59 +00:00
|
|
|
guint gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context,
|
|
|
|
guint format,
|
|
|
|
guint type);
|
gl/memory: store the internal format as the texture format
Instead of having special cases at each GL texture creation, upload,
readback or copy for all non-8-bits-per-components.
Simply store the more specific format and retrieve the generic
component/type tuple from that.
Introduce a helper function for retrieving the generic GL format (RGBA,
RGB, RG, R, L, A) and type (BYTE, SHORT, SHORT_5_6_5) from a sized
GL format enum (RGBA8, RGB565, RG8, etc).
2018-03-14 07:12:21 +00:00
|
|
|
GST_GL_API
|
|
|
|
void gst_gl_format_type_from_sized_gl_format (GstGLFormat format,
|
|
|
|
GstGLFormat * unsized_format,
|
|
|
|
guint * gl_type);
|
2015-12-14 02:43:59 +00:00
|
|
|
|
2023-07-20 10:54:06 +00:00
|
|
|
GST_GL_API
|
|
|
|
gboolean gst_gl_video_format_swizzle (GstVideoFormat video_format,
|
|
|
|
int * swizzle);
|
|
|
|
|
2018-05-05 11:03:25 +00:00
|
|
|
GST_GL_API
|
|
|
|
gboolean gst_gl_format_is_supported (GstGLContext * context,
|
|
|
|
GstGLFormat format);
|
2023-07-20 10:50:26 +00:00
|
|
|
GST_GL_API
|
|
|
|
guint gst_gl_format_n_components (GstGLFormat gl_format);
|
2023-07-20 10:54:06 +00:00
|
|
|
GST_GL_API
|
|
|
|
void gst_gl_swizzle_invert (gint * swizzle,
|
|
|
|
gint * inversion);
|
2018-05-05 11:03:25 +00:00
|
|
|
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2015-12-14 02:43:59 +00:00
|
|
|
GstGLTextureTarget gst_gl_texture_target_from_string (const gchar * str);
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2015-12-14 02:43:59 +00:00
|
|
|
const gchar * gst_gl_texture_target_to_string (GstGLTextureTarget target);
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2015-12-14 02:43:59 +00:00
|
|
|
guint gst_gl_texture_target_to_gl (GstGLTextureTarget target);
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2015-12-14 02:43:59 +00:00
|
|
|
GstGLTextureTarget gst_gl_texture_target_from_gl (guint target);
|
2018-03-13 10:57:15 +00:00
|
|
|
GST_GL_API
|
2015-12-14 02:43:59 +00:00
|
|
|
const gchar * gst_gl_texture_target_to_buffer_pool_option (GstGLTextureTarget target);
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* _GST_GL_FORMAT_H_ */
|