3 * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
4 * Copyright (C) 2005,2006,2007 David A. Schleef <ds@schleef.org>
5 * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
6 * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
25 * SECTION:plugin-opengl
28 * Cross-platform OpenGL plugin.
34 * gst-launch-1.0 --gst-debug=gldisplay:3 videotestsrc ! glimagesink
35 * ]| A debugging pipeline.
37 * GST_DEBUG=gl*:6 gst-launch-1.0 videotestsrc ! glimagesink
38 * ]| A debugging pipelines related to shaders.
46 #undef HAVE_VIDEO_AGGREGATOR_IN_BASE
48 #include "gstglimagesink.h"
49 #include "gstgluploadelement.h"
50 #include "gstgldownloadelement.h"
51 #include "gstglcolorconvertelement.h"
52 #include "gstglcolorbalance.h"
53 #include "gstglfilterbin.h"
54 #include "gstglsinkbin.h"
55 #include "gstglsrcbin.h"
57 #include "gstglfiltercube.h"
58 #include "gstgleffects.h"
59 #include "gstglcolorscale.h"
61 #ifdef HAVE_VIDEO_AGGREGATOR_IN_BASE
62 #include "gstglmixerbin.h"
63 #include "gstglvideomixer.h"
64 #include "gstglstereomix.h"
67 #include "gstglfiltershader.h"
68 #include "gstglfilterapp.h"
69 #include "gstglstereosplit.h"
70 #include "gstglviewconvert.h"
71 #include "gstgltestsrc.h"
72 #include "gstgldeinterlace.h"
73 #include "gstglalpha.h"
74 #include "gstgloverlaycompositorelement.h"
77 #include "gstgltransformation.h"
78 #include "gstglvideoflip.h"
80 #if defined(HAVE_JPEG) && defined(HAVE_PNG)
81 #include "gstgloverlay.h"
84 #if GST_GL_HAVE_OPENGL
85 #include "gstglfilterglass.h"
86 /* #include "gstglfilterreflectedscreen.h" */
87 #ifdef HAVE_VIDEO_AGGREGATOR_IN_BASE
88 #include "gstglmosaic.h"
91 #include "gstgldifferencematte.h"
92 /* #include "gstglbumper.h" */
94 #endif /* GST_GL_HAVE_OPENGL */
96 #if GST_GL_HAVE_WINDOW_COCOA
97 /* avoid including Cocoa/CoreFoundation from a C file... */
98 extern GType gst_ca_opengl_layer_sink_bin_get_type (void);
101 #if GST_GL_HAVE_WINDOW_DISPMANX
102 extern void bcm_host_init (void);
105 #if GST_GL_HAVE_WINDOW_X11
106 #include <X11/Xlib.h>
109 #define GST_CAT_DEFAULT gst_gl_gstgl_debug
110 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
112 /* Register filters that make up the gstgl plugin */
114 plugin_init (GstPlugin * plugin)
116 GST_DEBUG_CATEGORY_INIT (gst_gl_gstgl_debug, "gstopengl", 0, "gstopengl");
118 #if GST_GL_HAVE_WINDOW_DISPMANX
119 GST_DEBUG ("Initialize BCM host");
123 #if GST_GL_HAVE_WINDOW_X11
124 if (g_getenv ("GST_GL_XINITTHREADS"))
128 if (!gst_element_register (plugin, "glimagesink",
129 GST_RANK_SECONDARY, gst_gl_image_sink_bin_get_type ())) {
133 if (!gst_element_register (plugin, "glimagesinkelement",
134 GST_RANK_NONE, gst_glimage_sink_get_type ())) {
138 if (!gst_element_register (plugin, "glupload",
139 GST_RANK_NONE, GST_TYPE_GL_UPLOAD_ELEMENT)) {
143 if (!gst_element_register (plugin, "gldownload",
144 GST_RANK_NONE, GST_TYPE_GL_DOWNLOAD_ELEMENT)) {
148 if (!gst_element_register (plugin, "glcolorconvert",
149 GST_RANK_NONE, GST_TYPE_GL_COLOR_CONVERT_ELEMENT)) {
153 if (!gst_element_register (plugin, "glcolorbalance",
154 GST_RANK_NONE, GST_TYPE_GL_COLOR_BALANCE)) {
158 if (!gst_element_register (plugin, "glfilterbin",
159 GST_RANK_NONE, GST_TYPE_GL_FILTER_BIN)) {
163 if (!gst_element_register (plugin, "glsinkbin",
164 GST_RANK_NONE, GST_TYPE_GL_SINK_BIN)) {
168 if (!gst_element_register (plugin, "glsrcbin",
169 GST_RANK_NONE, GST_TYPE_GL_SRC_BIN)) {
172 #ifdef HAVE_VIDEO_AGGREGATOR_IN_BASE
173 if (!gst_element_register (plugin, "glmixerbin",
174 GST_RANK_NONE, GST_TYPE_GL_MIXER_BIN)) {
179 if (!gst_element_register (plugin, "glfiltercube",
180 GST_RANK_NONE, GST_TYPE_GL_FILTER_CUBE)) {
184 if (!gst_element_register (plugin, "gltransformation",
185 GST_RANK_NONE, GST_TYPE_GL_TRANSFORMATION)) {
189 if (!gst_element_register (plugin, "glvideoflip",
190 GST_RANK_NONE, GST_TYPE_GL_VIDEO_FLIP)) {
195 if (!gst_gl_effects_register_filters (plugin, GST_RANK_NONE)) {
199 if (!gst_element_register (plugin, "glcolorscale",
200 GST_RANK_NONE, GST_TYPE_GL_COLORSCALE)) {
203 #ifdef HAVE_VIDEO_AGGREGATOR_IN_BASE
204 if (!gst_element_register (plugin, "glvideomixer",
205 GST_RANK_NONE, gst_gl_video_mixer_bin_get_type ())) {
209 if (!gst_element_register (plugin, "glvideomixerelement",
210 GST_RANK_NONE, gst_gl_video_mixer_get_type ())) {
215 if (!gst_element_register (plugin, "glshader",
216 GST_RANK_NONE, gst_gl_filtershader_get_type ())) {
220 if (!gst_element_register (plugin, "glfilterapp",
221 GST_RANK_NONE, GST_TYPE_GL_FILTER_APP)) {
225 if (!gst_element_register (plugin, "glviewconvert",
226 GST_RANK_NONE, GST_TYPE_GL_VIEW_CONVERT_ELEMENT)) {
230 if (!gst_element_register (plugin, "glstereosplit",
231 GST_RANK_NONE, GST_TYPE_GL_STEREOSPLIT)) {
234 #ifdef HAVE_VIDEO_AGGREGATOR_IN_BASE
235 if (!gst_element_register (plugin, "glstereomix",
236 GST_RANK_NONE, GST_TYPE_GL_STEREO_MIX)) {
241 if (!gst_element_register (plugin, "gltestsrc",
242 GST_RANK_NONE, GST_TYPE_GL_TEST_SRC)) {
246 if (!gst_element_register (plugin, "gldeinterlace",
247 GST_RANK_NONE, GST_TYPE_GL_DEINTERLACE)) {
251 if (!gst_element_register (plugin, "glalpha",
252 GST_RANK_NONE, GST_TYPE_GL_ALPHA)) {
256 if (!gst_element_register (plugin, "gloverlaycompositor",
257 GST_RANK_NONE, GST_TYPE_GL_OVERLAY_COMPOSITOR_ELEMENT)) {
260 #if defined(HAVE_JPEG) && defined(HAVE_PNG)
261 if (!gst_element_register (plugin, "gloverlay",
262 GST_RANK_NONE, gst_gl_overlay_get_type ())) {
266 #if GST_GL_HAVE_OPENGL
267 if (!gst_element_register (plugin, "glfilterglass",
268 GST_RANK_NONE, GST_TYPE_GL_FILTER_GLASS)) {
272 if (!gst_element_register (plugin, "glfilterreflectedscreen",
273 GST_RANK_NONE, GST_TYPE_GL_FILTER_REFLECTED_SCREEN)) {
277 #ifdef HAVE_VIDEO_AGGREGATOR_IN_BASE
278 if (!gst_element_register (plugin, "glmosaic",
279 GST_RANK_NONE, GST_TYPE_GL_MOSAIC)) {
284 if (!gst_element_register (plugin, "gldifferencematte",
285 GST_RANK_NONE, gst_gl_differencematte_get_type ())) {
289 if (!gst_element_register (plugin, "glbumper",
290 GST_RANK_NONE, gst_gl_bumper_get_type ())) {
294 #endif /* HAVE_PNG */
295 #endif /* GST_GL_HAVE_OPENGL */
296 #if GST_GL_HAVE_WINDOW_COCOA
297 if (!gst_element_register (plugin, "caopengllayersink",
298 GST_RANK_NONE, gst_ca_opengl_layer_sink_bin_get_type ())) {
306 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
310 plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)