1/*
2 * GStreamer
3 * Copyright (C) 2012 Matthew Waters <ystree00@gmail.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_COLOR_CONVERT_H__
22#define __GST_GL_COLOR_CONVERT_H__
23
24#include <gst/video/video.h>
25#include <gst/gstmemory.h>
26
27#include <gst/gl/gstgl_fwd.h>
28
29G_BEGIN_DECLS
30
31GST_GL_API
32GType 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))
39
40/**
41 * GstGLColorConvert
42 *
43 * Opaque #GstGLColorConvert object
44 */
45struct _GstGLColorConvert
46{
47 /*< private >*/
48 GstObject parent;
49
50 GstGLContext *context;
51
52 /* input data */
53 GstVideoInfo in_info;
54 GstVideoInfo out_info;
55
56 gboolean initted;
57 gboolean passthrough;
58
59 GstBuffer * inbuf;
60 GstBuffer * outbuf;
61
62 /* used for the conversion */
63 GstGLFramebuffer *fbo;
64 GstGLShader *shader;
65
66 /*< private >*/
67 GstGLColorConvertPrivate *priv;
68
69 gpointer _reserved[GST_PADDING];
70};
71
72/**
73 * GstGLColorConvertClass:
74 *
75 * The #GstGLColorConvertClass struct only contains private data
76 */
77struct _GstGLColorConvertClass
78{
79 /*< private >*/
80 GstObjectClass object_class;
81
82 gpointer _padding[GST_PADDING];
83};
84
85/**
86 * GST_GL_COLOR_CONVERT_EXT_FORMATS: (skip)
87 *
88 */
89#if G_BYTE_ORDER == G_LITTLE_ENDIAN
90#define GST_GL_COLOR_CONVERT_EXT_FORMATS \
91 ", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE, Y412_LE"
92#else
93#define GST_GL_COLOR_CONVERT_EXT_FORMATS \
94 ", P010_10BE, P012_BE, P016_BE, Y212_BE, Y412_BE"
95#endif
96
97/**
98 * GST_GL_COLOR_CONVERT_FORMATS:
99 *
100 * The currently supported formats that can be converted
101 */
102#define GST_GL_COLOR_CONVERT_FORMATS "{ RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, " \
103 "xBGR, ARGB, ABGR, GBRA, GBR, RGBP, BGRP, Y444, I420, YV12, Y42B, " \
104 "Y41B, NV12, NV21, NV16, NV61, YUY2, UYVY, Y210, AYUV, " \
105 "VUYA, Y410, GRAY8, GRAY16_LE, GRAY16_BE, " \
106 "RGB16, BGR16, ARGB64, A420, AV12" \
107 GST_GL_COLOR_CONVERT_EXT_FORMATS "}"
108
109/**
110 * GST_GL_COLOR_CONVERT_VIDEO_CAPS:
111 *
112 * The currently supported #GstCaps that can be converted
113 */
114#define GST_GL_COLOR_CONVERT_VIDEO_CAPS \
115 "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), " \
116 "format = (string) " GST_GL_COLOR_CONVERT_FORMATS ", " \
117 "width = " GST_VIDEO_SIZE_RANGE ", " \
118 "height = " GST_VIDEO_SIZE_RANGE ", " \
119 "framerate = " GST_VIDEO_FPS_RANGE ", " \
120 "texture-target = (string) { 2D, rectangle, external-oes } " \
121 " ; " \
122 "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "," \
123 GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION "), " \
124 "format = (string) " GST_GL_COLOR_CONVERT_FORMATS ", " \
125 "width = " GST_VIDEO_SIZE_RANGE ", " \
126 "height = " GST_VIDEO_SIZE_RANGE ", " \
127 "framerate = " GST_VIDEO_FPS_RANGE ", " \
128 "texture-target = (string) { 2D, rectangle, external-oes }"
129
130GST_GL_API
131GstGLColorConvert * gst_gl_color_convert_new (GstGLContext * context);
132
133GST_GL_API
134GstCaps * gst_gl_color_convert_transform_caps (GstGLContext * context,
135 GstPadDirection direction,
136 GstCaps * caps,
137 GstCaps * filter);
138GST_GL_API
139GstCaps * gst_gl_color_convert_fixate_caps (GstGLContext * context,
140 GstPadDirection direction,
141 GstCaps * caps,
142 GstCaps * other);
143GST_GL_API
144gboolean gst_gl_color_convert_set_caps (GstGLColorConvert * convert,
145 GstCaps * in_caps,
146 GstCaps * out_caps);
147GST_GL_API
148gboolean gst_gl_color_convert_decide_allocation (GstGLColorConvert * convert,
149 GstQuery * query);
150
151GST_GL_API
152GstBuffer * gst_gl_color_convert_perform (GstGLColorConvert * convert, GstBuffer * inbuf);
153
154G_END_DECLS
155
156#endif /* __GST_GL_COLOR_CONVERT_H__ */
157

source code of include/gstreamer-1.0/gst/gl/gstglcolorconvert.h