3 * Copyright (C) 2012 Matthew Waters <ystree00@gmail.com>
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.
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.
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.
21 #ifndef __GST_GL_COLOR_CONVERT_H__
22 #define __GST_GL_COLOR_CONVERT_H__
24 #include <gst/video/video.h>
25 #include <gst/gstmemory.h>
27 #include <gst/gl/gstgl_fwd.h>
32 GType gst_gl_color_convert_get_type (void);
33 #define GST_TYPE_GL_COLOR_CONVERT (gst_gl_color_convert_get_type())
34 #define GST_GL_COLOR_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_COLOR_CONVERT,GstGLColorConvert))
35 #define GST_GL_COLOR_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_DISPLAY,GstGLColorConvertClass))
36 #define GST_IS_GL_COLOR_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_COLOR_CONVERT))
37 #define GST_IS_GL_COLOR_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_COLOR_CONVERT))
38 #define GST_GL_COLOR_CONVERT_CAST(obj) ((GstGLColorConvert*)(obj))
43 * Opaque #GstGLColorConvert object
45 struct _GstGLColorConvert
50 GstGLContext *context;
54 GstVideoInfo out_info;
62 /* used for the conversion */
63 GstGLFramebuffer *fbo;
67 GstGLColorConvertPrivate *priv;
69 gpointer _reserved[GST_PADDING];
73 * GstGLColorConvertClass:
75 * The #GstGLColorConvertClass struct only contains private data
77 struct _GstGLColorConvertClass
80 GstObjectClass object_class;
82 gpointer _padding[GST_PADDING];
86 * GST_GL_COLOR_CONVERT_FORMATS:
88 * The currently supported formats that can be converted
90 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
91 #define COLOR_CONVERT_EXT_FORMATS ", BGR10A2_LE, RGB10A2_LE, P010_10LE, P016_LE"
93 #define COLOR_CONVERT_EXT_FORMATS ", P010_10BE, P016_BE"
96 #define GST_GL_COLOR_CONVERT_FORMATS "{ RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, " \
97 "xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, " \
98 "Y41B, NV12, NV21, YUY2, UYVY, AYUV, VUYA, Y410, " \
99 "GRAY8, GRAY16_LE, GRAY16_BE, RGB16, BGR16, ARGB64 " \
100 COLOR_CONVERT_EXT_FORMATS "}"
103 * GST_GL_COLOR_CONVERT_VIDEO_CAPS:
105 * The currently supported #GstCaps that can be converted
107 #define GST_GL_COLOR_CONVERT_VIDEO_CAPS \
108 "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), " \
109 "format = (string) " GST_GL_COLOR_CONVERT_FORMATS ", " \
110 "width = " GST_VIDEO_SIZE_RANGE ", " \
111 "height = " GST_VIDEO_SIZE_RANGE ", " \
112 "framerate = " GST_VIDEO_FPS_RANGE ", " \
113 "texture-target = (string) { 2D, rectangle, external-oes } " \
115 "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "," \
116 GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION "), " \
117 "format = (string) " GST_GL_COLOR_CONVERT_FORMATS ", " \
118 "width = " GST_VIDEO_SIZE_RANGE ", " \
119 "height = " GST_VIDEO_SIZE_RANGE ", " \
120 "framerate = " GST_VIDEO_FPS_RANGE ", " \
121 "texture-target = (string) { 2D, rectangle, external-oes }"
124 GstGLColorConvert * gst_gl_color_convert_new (GstGLContext * context);
127 GstCaps * gst_gl_color_convert_transform_caps (GstGLContext * context,
128 GstPadDirection direction,
132 GstCaps * gst_gl_color_convert_fixate_caps (GstGLContext * context,
133 GstPadDirection direction,
137 gboolean gst_gl_color_convert_set_caps (GstGLColorConvert * convert,
141 gboolean gst_gl_color_convert_decide_allocation (GstGLColorConvert * convert,
145 GstBuffer * gst_gl_color_convert_perform (GstGLColorConvert * convert, GstBuffer * inbuf);
149 #endif /* __GST_GL_COLOR_CONVERT_H__ */