summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-12-11 12:59:09 +0000
committerTim-Philipp Müller <tim@centricular.com>2017-12-19 12:02:31 +0000
commit769a21d0bb310906b880c07da0e1e2376e11c187 (patch)
tree02b93bbe659389c940abd69b3a214cfa05f6c501
parent43631c63ea76c524f96488dbdf4f4e20fa764626 (diff)
gl: remove GStreamer OpenGL integration library and move to -base
https://bugzilla.gnome.org/show_bug.cgi?id=754094
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac1091
-rw-r--r--docs/libs/Makefile.am5
-rw-r--r--docs/libs/gst-plugins-bad-libs-docs.sgml58
-rw-r--r--docs/libs/gst-plugins-bad-libs-sections.txt1084
-rw-r--r--docs/libs/gst-plugins-bad-libs.types24
-rw-r--r--docs/plugins/Makefile.am2
-rw-r--r--docs/plugins/gst-plugins-bad-plugins-docs.sgml43
-rw-r--r--docs/plugins/gst-plugins-bad-plugins-sections.txt655
-rw-r--r--docs/plugins/gst-plugins-bad-plugins.args269
-rw-r--r--docs/plugins/gst-plugins-bad-plugins.hierarchy49
-rw-r--r--ext/Makefile.am3
-rw-r--r--ext/meson.build2
-rw-r--r--gst-libs/gst/Makefile.am17
-rw-r--r--gst-libs/gst/gl/.gitignore2
-rw-r--r--gst-libs/gst/gl/Makefile.am215
-rw-r--r--gst-libs/gst/gl/android/Makefile.am21
-rw-r--r--gst-libs/gst/gl/android/gstglwindow_android_egl.c146
-rw-r--r--gst-libs/gst/gl/android/gstglwindow_android_egl.h65
-rw-r--r--gst-libs/gst/gl/cocoa/Makefile.am42
-rw-r--r--gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h67
-rw-r--r--gst-libs/gst/gl/cocoa/gstglcaopengllayer.h59
-rw-r--r--gst-libs/gst/gl/cocoa/gstglcaopengllayer.m252
-rw-r--r--gst-libs/gst/gl/cocoa/gstglcontext_cocoa.h75
-rw-r--r--gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m339
-rw-r--r--gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.h62
-rw-r--r--gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.m250
-rw-r--r--gst-libs/gst/gl/cocoa/gstglwindow_cocoa.h67
-rw-r--r--gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m604
-rw-r--r--gst-libs/gst/gl/dispmanx/Makefile.am21
-rw-r--r--gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c325
-rw-r--r--gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h93
-rw-r--r--gst-libs/gst/gl/eagl/Makefile.am35
-rw-r--r--gst-libs/gst/gl/eagl/gstglcontext_eagl.h75
-rw-r--r--gst-libs/gst/gl/eagl/gstglcontext_eagl.m397
-rw-r--r--gst-libs/gst/gl/eagl/gstglwindow_eagl.h69
-rw-r--r--gst-libs/gst/gl/eagl/gstglwindow_eagl.m223
-rw-r--r--gst-libs/gst/gl/egl/Makefile.am32
-rw-r--r--gst-libs/gst/gl/egl/gstegl.c64
-rw-r--r--gst-libs/gst/gl/egl/gstegl.h57
-rw-r--r--gst-libs/gst/gl/egl/gsteglimage.c531
-rw-r--r--gst-libs/gst/gl/egl/gsteglimage.h124
-rw-r--r--gst-libs/gst/gl/egl/gstglcontext_egl.c798
-rw-r--r--gst-libs/gst/gl/egl/gstglcontext_egl.h95
-rw-r--r--gst-libs/gst/gl/egl/gstgldisplay_egl.c299
-rw-r--r--gst-libs/gst/gl/egl/gstgldisplay_egl.h82
-rw-r--r--gst-libs/gst/gl/egl/gstglmemoryegl.c275
-rw-r--r--gst-libs/gst/gl/egl/gstglmemoryegl.h105
-rw-r--r--gst-libs/gst/gl/gl.h58
-rw-r--r--gst-libs/gst/gl/glprototypes/Makefile.am20
-rw-r--r--gst-libs/gst/gl/glprototypes/README54
-rw-r--r--gst-libs/gst/gl/glprototypes/all_functions.h33
-rw-r--r--gst-libs/gst/gl/glprototypes/base.h328
-rw-r--r--gst-libs/gst/gl/glprototypes/blending.h99
-rw-r--r--gst-libs/gst/gl/glprototypes/buffers.h48
-rw-r--r--gst-libs/gst/gl/glprototypes/debug.h117
-rw-r--r--gst-libs/gst/gl/glprototypes/eglimage.h53
-rw-r--r--gst-libs/gst/gl/glprototypes/fbo.h157
-rw-r--r--gst-libs/gst/gl/glprototypes/fixedfunction.h144
-rw-r--r--gst-libs/gst/gl/glprototypes/gles.h102
-rw-r--r--gst-libs/gst/gl/glprototypes/gstgl_compat.h67
-rw-r--r--gst-libs/gst/gl/glprototypes/gstgl_gles2compat.h57
-rw-r--r--gst-libs/gst/gl/glprototypes/opengl.h72
-rw-r--r--gst-libs/gst/gl/glprototypes/query.h63
-rw-r--r--gst-libs/gst/gl/glprototypes/shaders.h374
-rw-r--r--gst-libs/gst/gl/glprototypes/sync.h46
-rw-r--r--gst-libs/gst/gl/glprototypes/vao.h37
-rw-r--r--gst-libs/gst/gl/gstgl_enums.h41
-rw-r--r--gst-libs/gst/gl/gstgl_fwd.h177
-rw-r--r--gst-libs/gst/gl/gstglapi.c214
-rw-r--r--gst-libs/gst/gl/gstglapi.h113
-rw-r--r--gst-libs/gst/gl/gstglbasefilter.c465
-rw-r--r--gst-libs/gst/gl/gstglbasefilter.h88
-rw-r--r--gst-libs/gst/gl/gstglbasememory.c759
-rw-r--r--gst-libs/gst/gl/gstglbasememory.h421
-rw-r--r--gst-libs/gst/gl/gstglbuffer.c492
-rw-r--r--gst-libs/gst/gl/gstglbuffer.h141
-rw-r--r--gst-libs/gst/gl/gstglbufferpool.c417
-rw-r--r--gst-libs/gst/gl/gstglbufferpool.h80
-rw-r--r--gst-libs/gst/gl/gstglcolorconvert.c2524
-rw-r--r--gst-libs/gst/gl/gstglcolorconvert.h142
-rw-r--r--gst-libs/gst/gl/gstglconfig.h.meson48
-rw-r--r--gst-libs/gst/gl/gstglcontext.c1857
-rw-r--r--gst-libs/gst/gl/gstglcontext.h221
-rw-r--r--gst-libs/gst/gl/gstglcontext_private.h31
-rw-r--r--gst-libs/gst/gl/gstgldebug.c521
-rw-r--r--gst-libs/gst/gl/gstgldebug.h184
-rw-r--r--gst-libs/gst/gl/gstgldisplay.c792
-rw-r--r--gst-libs/gst/gl/gstgldisplay.h149
-rw-r--r--gst-libs/gst/gl/gstglfeature.c285
-rw-r--r--gst-libs/gst/gl/gstglfeature.h62
-rw-r--r--gst-libs/gst/gl/gstglfeature_private.h108
-rw-r--r--gst-libs/gst/gl/gstglfilter.c1223
-rw-r--r--gst-libs/gst/gl/gstglfilter.h145
-rw-r--r--gst-libs/gst/gl/gstglformat.c387
-rw-r--r--gst-libs/gst/gl/gstglformat.h148
-rw-r--r--gst-libs/gst/gl/gstglframebuffer.c579
-rw-r--r--gst-libs/gst/gl/gstglframebuffer.h121
-rw-r--r--gst-libs/gst/gl/gstglfuncs.h108
-rw-r--r--gst-libs/gst/gl/gstglmemory.c1526
-rw-r--r--gst-libs/gst/gl/gstglmemory.h306
-rw-r--r--gst-libs/gst/gl/gstglmemorypbo.c867
-rw-r--r--gst-libs/gst/gl/gstglmemorypbo.h110
-rw-r--r--gst-libs/gst/gl/gstgloverlaycompositor.c649
-rw-r--r--gst-libs/gst/gl/gstgloverlaycompositor.h92
-rw-r--r--gst-libs/gst/gl/gstglpixelformat.c23
-rw-r--r--gst-libs/gst/gl/gstglquery.c354
-rw-r--r--gst-libs/gst/gl/gstglquery.h163
-rw-r--r--gst-libs/gst/gl/gstglrenderbuffer.c476
-rw-r--r--gst-libs/gst/gl/gstglrenderbuffer.h154
-rw-r--r--gst-libs/gst/gl/gstglshader.c1589
-rw-r--r--gst-libs/gst/gl/gstglshader.h160
-rw-r--r--gst-libs/gst/gl/gstglshaderstrings.c82
-rw-r--r--gst-libs/gst/gl/gstglshaderstrings.h42
-rw-r--r--gst-libs/gst/gl/gstglsl.c931
-rw-r--r--gst-libs/gst/gl/gstglsl.h157
-rw-r--r--gst-libs/gst/gl/gstglsl_private.h68
-rw-r--r--gst-libs/gst/gl/gstglslstage.c549
-rw-r--r--gst-libs/gst/gl/gstglslstage.h108
-rw-r--r--gst-libs/gst/gl/gstglsyncmeta.c388
-rw-r--r--gst-libs/gst/gl/gstglsyncmeta.h95
-rw-r--r--gst-libs/gst/gl/gstglupload.c1856
-rw-r--r--gst-libs/gst/gl/gstglupload.h123
-rw-r--r--gst-libs/gst/gl/gstglutils.c874
-rw-r--r--gst-libs/gst/gl/gstglutils.h64
-rw-r--r--gst-libs/gst/gl/gstglutils_private.h34
-rw-r--r--gst-libs/gst/gl/gstglviewconvert.c2381
-rw-r--r--gst-libs/gst/gl/gstglviewconvert.h137
-rw-r--r--gst-libs/gst/gl/gstglwindow.c1022
-rw-r--r--gst-libs/gst/gl/gstglwindow.h269
-rw-r--r--gst-libs/gst/gl/gstglwindow_private.h31
-rw-r--r--gst-libs/gst/gl/meson.build702
-rw-r--r--gst-libs/gst/gl/utils/gles_versions.h38
-rw-r--r--gst-libs/gst/gl/utils/opengl_versions.h54
-rw-r--r--gst-libs/gst/gl/viv-fb/Makefile.am25
-rw-r--r--gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.c103
-rw-r--r--gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.h67
-rw-r--r--gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c264
-rw-r--r--gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.h66
-rw-r--r--gst-libs/gst/gl/wayland/Makefile.am29
-rw-r--r--gst-libs/gst/gl/wayland/gstgldisplay_wayland.c173
-rw-r--r--gst-libs/gst/gl/wayland/gstgldisplay_wayland.h82
-rw-r--r--gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c583
-rw-r--r--gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h109
-rw-r--r--gst-libs/gst/gl/wayland/wayland_event_source.c204
-rw-r--r--gst-libs/gst/gl/wayland/wayland_event_source.h42
-rw-r--r--gst-libs/gst/gl/win32/Makefile.am29
-rw-r--r--gst-libs/gst/gl/win32/gstglcontext_wgl.c417
-rw-r--r--gst-libs/gst/gl/win32/gstglcontext_wgl.h67
-rw-r--r--gst-libs/gst/gl/win32/gstglwindow_win32.c496
-rw-r--r--gst-libs/gst/gl/win32/gstglwindow_win32.h86
-rw-r--r--gst-libs/gst/gl/win32/win32_message_source.c83
-rw-r--r--gst-libs/gst/gl/win32/win32_message_source.h34
-rw-r--r--gst-libs/gst/gl/x11/Makefile.am33
-rw-r--r--gst-libs/gst/gl/x11/gstglcontext_glx.c522
-rw-r--r--gst-libs/gst/gl/x11/gstglcontext_glx.h77
-rw-r--r--gst-libs/gst/gl/x11/gstgldisplay_x11.c240
-rw-r--r--gst-libs/gst/gl/x11/gstgldisplay_x11.h79
-rw-r--r--gst-libs/gst/gl/x11/gstglwindow_x11.c670
-rw-r--r--gst-libs/gst/gl/x11/gstglwindow_x11.h114
-rw-r--r--gst-libs/gst/gl/x11/xcb_event_source.c105
-rw-r--r--gst-libs/gst/gl/x11/xcb_event_source.h29
-rw-r--r--gst-libs/gst/meson.build1
-rw-r--r--meson_options.txt6
-rw-r--r--pkgconfig/Makefile.am6
-rw-r--r--pkgconfig/gstreamer-plugins-bad-uninstalled.pc.in2
-rw-r--r--pkgconfig/meson.build9
-rw-r--r--po/POTFILES.in1
-rw-r--r--tests/check/Makefile.am131
-rw-r--r--tests/check/elements/glimagesink.c283
-rw-r--r--tests/check/libs/gstglcolorconvert.c265
-rw-r--r--tests/check/libs/gstglcontext.c662
-rw-r--r--tests/check/libs/gstglheaders.c173
-rw-r--r--tests/check/libs/gstglmatrix.c262
-rw-r--r--tests/check/libs/gstglmemory.c349
-rw-r--r--tests/check/libs/gstglquery.c347
-rw-r--r--tests/check/libs/gstglshader.c225
-rw-r--r--tests/check/libs/gstglsl.c374
-rw-r--r--tests/check/libs/gstglslstage.c101
-rw-r--r--tests/check/libs/gstglupload.c432
-rw-r--r--tests/check/meson.build8
-rw-r--r--tests/check/pipelines/simple-launch-lines.c361
-rw-r--r--tests/examples/Makefile.am10
-rw-r--r--tests/examples/gl/Makefile.am28
-rw-r--r--tests/examples/gl/clutter/.gitignore3
-rw-r--r--tests/examples/gl/clutter/Makefile.am48
-rw-r--r--tests/examples/gl/clutter/clutteractor.c179
-rw-r--r--tests/examples/gl/clutter/clutteractortee.c232
-rw-r--r--tests/examples/gl/clutter/cluttershare.c383
-rw-r--r--tests/examples/gl/clutter/cluttershare.cbp76
-rw-r--r--tests/examples/gl/cocoa/.gitignore1
-rwxr-xr-xtests/examples/gl/cocoa/Makefile.am16
-rwxr-xr-xtests/examples/gl/cocoa/cocoa-videooverlay.m233
-rw-r--r--tests/examples/gl/generic/Makefile.am2
-rw-r--r--tests/examples/gl/generic/README21
-rw-r--r--tests/examples/gl/generic/cube/.gitignore1
-rw-r--r--tests/examples/gl/generic/cube/Makefile.am9
-rw-r--r--tests/examples/gl/generic/cube/main.cpp267
-rw-r--r--tests/examples/gl/generic/cubeyuv/.gitignore1
-rw-r--r--tests/examples/gl/generic/cubeyuv/Makefile.am8
-rw-r--r--tests/examples/gl/generic/cubeyuv/main.cpp323
-rw-r--r--tests/examples/gl/generic/doublecube/.gitignore1
-rw-r--r--tests/examples/gl/generic/doublecube/Makefile.am9
-rw-r--r--tests/examples/gl/generic/doublecube/main.cpp370
-rw-r--r--tests/examples/gl/generic/generic.sln38
-rw-r--r--tests/examples/gl/generic/recordgraphic/.gitignore1
-rw-r--r--tests/examples/gl/generic/recordgraphic/Makefile.am9
-rw-r--r--tests/examples/gl/generic/recordgraphic/main.cpp263
-rw-r--r--tests/examples/gl/gtk/3dvideo/.gitignore1
-rw-r--r--tests/examples/gl/gtk/3dvideo/Makefile.am16
-rw-r--r--tests/examples/gl/gtk/3dvideo/main.cpp444
-rw-r--r--tests/examples/gl/gtk/3dvideo/mviewwidget.c324
-rw-r--r--tests/examples/gl/gtk/3dvideo/mviewwidget.h78
-rw-r--r--tests/examples/gl/gtk/Makefile.am13
-rw-r--r--tests/examples/gl/gtk/README27
-rw-r--r--tests/examples/gl/gtk/filternovideooverlay/.gitignore1
-rw-r--r--tests/examples/gl/gtk/filternovideooverlay/Makefile.am18
-rw-r--r--tests/examples/gl/gtk/filternovideooverlay/main.cpp180
-rw-r--r--tests/examples/gl/gtk/filtervideooverlay/.gitignore1
-rw-r--r--tests/examples/gl/gtk/filtervideooverlay/Makefile.am11
-rw-r--r--tests/examples/gl/gtk/filtervideooverlay/main.cpp296
-rw-r--r--tests/examples/gl/gtk/fxtest/.gitignore2
-rw-r--r--tests/examples/gl/gtk/fxtest/Makefile.am20
-rw-r--r--tests/examples/gl/gtk/fxtest/fxtest.c367
-rw-r--r--tests/examples/gl/gtk/fxtest/pixbufdrop.c330
-rw-r--r--tests/examples/gl/gtk/gstgtk.c127
-rw-r--r--tests/examples/gl/gtk/gstgtk.h35
-rw-r--r--tests/examples/gl/gtk/gtk.sln50
-rw-r--r--tests/examples/gl/gtk/switchvideooverlay/.gitignore1
-rw-r--r--tests/examples/gl/gtk/switchvideooverlay/Makefile.am11
-rw-r--r--tests/examples/gl/gtk/switchvideooverlay/main.cpp294
-rw-r--r--tests/examples/gl/meson.build7
-rw-r--r--tests/examples/gl/qt/.gitignore2
-rw-r--r--tests/examples/gl/qt/Makefile.am2
-rw-r--r--tests/examples/gl/qt/README24
-rw-r--r--tests/examples/gl/qt/mousevideooverlay/gstthread.cpp67
-rw-r--r--tests/examples/gl/qt/mousevideooverlay/gstthread.h56
-rw-r--r--tests/examples/gl/qt/mousevideooverlay/main.cpp43
-rw-r--r--tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pri10
-rw-r--r--tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pro44
-rw-r--r--tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.sln26
-rw-r--r--tests/examples/gl/qt/mousevideooverlay/pipeline.cpp358
-rw-r--r--tests/examples/gl/qt/mousevideooverlay/pipeline.h73
-rw-r--r--tests/examples/gl/qt/mousevideooverlay/qrenderer.cpp58
-rw-r--r--tests/examples/gl/qt/mousevideooverlay/qrenderer.h48
-rw-r--r--tests/examples/gl/qt/qglwidgetvideooverlay/gstthread.cpp62
-rw-r--r--tests/examples/gl/qt/qglwidgetvideooverlay/gstthread.h55
-rw-r--r--tests/examples/gl/qt/qglwidgetvideooverlay/main.cpp43
-rw-r--r--tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp341
-rw-r--r--tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h69
-rw-r--r--tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.cpp52
-rw-r--r--tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.h45
-rw-r--r--tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pri10
-rw-r--r--tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pro47
-rw-r--r--tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.sln26
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/.gitignore2
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/AsyncQueue.h77
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/README32
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/cocoa_utils.mm26
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/gstthread.cpp66
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/gstthread.h58
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/main.cpp41
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/pipeline.cpp230
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/pipeline.h71
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp285
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/qglrenderer.h60
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro80
-rw-r--r--tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_gstthread.cpp143
-rw-r--r--tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_pipeline.cpp143
-rw-r--r--tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_qrenderer.cpp150
-rw-r--r--tests/examples/gl/qt/videooverlay/videooverlay.cpp80
-rw-r--r--tests/examples/gl/qt/videooverlay/videooverlay.pri4
-rw-r--r--tests/examples/gl/qt/videooverlay/videooverlay.pro42
-rw-r--r--tests/examples/gl/qt/videooverlay/videooverlay.sln26
-rw-r--r--tests/examples/gl/sdl/.gitignore2
-rw-r--r--tests/examples/gl/sdl/Makefile.am34
-rw-r--r--tests/examples/gl/sdl/meson.build16
-rw-r--r--tests/examples/gl/sdl/sdl.sln20
-rw-r--r--tests/examples/gl/sdl/sdlshare.c420
-rw-r--r--tests/examples/gl/sdl/sdlshare2.c411
-rw-r--r--tests/examples/meson.build1
281 files changed, 280 insertions, 58532 deletions
diff --git a/Makefile.am b/Makefile.am
index 365cbdc07..732dc4b85 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,7 +17,7 @@ EXTRA_DIST = \
gst-libs/gst/interfaces/build_mkenum.py \
gst-libs/gst/mpegts/mpegts_enum.py \
ext/srtp/srtp_mkenum.py \
- ext/vulkan/vkconfig.h.meson gst-libs/gst/gl/gstglconfig.h.meson
+ ext/vulkan/vkconfig.h.meson
DISTCLEANFILES = _stdint.h
@@ -122,8 +122,9 @@ CRUFT_DIRS = \
$(top_srcdir)/gst-libs/gst/baseparse \
$(top_srcdir)/gst-libs/gst/base \
$(top_srcdir)/gst-libs/gst/egl \
+ $(top_srcdir)/gst-libs/gst/gl \
$(top_srcdir)/gst-libs/gst/signalprocessor \
- $(top_srcdir)/tests/examples/gl/gtk/gtkvideooverlay \
+ $(top_srcdir)/tests/examples/gl \
$(top_srcdir)/tests/examples/scaletempo \
$(top_srcdir)/tests/examples/shapewipe \
$(top_srcdir)/tests/examples/switch \
diff --git a/configure.ac b/configure.ac
index 9a401e801..0f3e02f7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -272,67 +272,6 @@ AC_SUBST(GTK3_CFLAGS)
AC_SUBST(HAVE_GTK3)
AM_CONDITIONAL(HAVE_GTK3, test "x$HAVE_GTK3" = "xyes")
-dnl clutter is optional and used in examples
-HAVE_CLUTTER=no
-HAVE_CLUTTER_X11=no
-HAVE_CLUTTER_GLX=no
-if test "x$BUILD_EXAMPLES" = "xyes"; then
- PKG_CHECK_MODULES(CLUTTER, clutter-1.0 >= 1.8, HAVE_CLUTTER=yes, HAVE_CLUTTER=no)
- AC_SUBST(CLUTTER_LIBS)
- AC_SUBST(CLUTTER_CFLAGS)
- AC_SUBST(HAVE_CLUTTER)
-
- PKG_CHECK_MODULES(CLUTTER_GLX, clutter-glx-1.0 >= 1.8, HAVE_CLUTTER_GLX=yes, HAVE_CLUTTER_GLX=no)
- AC_SUBST(CLUTTER_GLX_LIBS)
- AC_SUBST(CLUTTER_GLX_CFLAGS)
- AC_SUBST(HAVE_CLUTTER_GLX)
-
- PKG_CHECK_MODULES(CLUTTER_X11, clutter-x11-1.0 >= 1.8, HAVE_CLUTTER_X11=yes, HAVE_CLUTTER_X11=no)
- AC_SUBST(CLUTTER_X11_LIBS)
- AC_SUBST(CLUTTER_X11_CFLAGS)
- AC_SUBST(HAVE_CLUTTER_X11)
-fi
-AM_CONDITIONAL(HAVE_CLUTTER, test "x$HAVE_CLUTTER" = "xyes")
-AM_CONDITIONAL(HAVE_CLUTTER_GLX, test "x$HAVE_CLUTTER_GLX" = "xyes")
-AM_CONDITIONAL(HAVE_CLUTTER_X11, test "x$HAVE_CLUTTER_X11" = "xyes")
-
-dnl used in the gl/clutteractor example
-if test "x$BUILD_EXAMPLES" = "xyes"; then
- PKG_CHECK_MODULES(XCOMPOSITE, xcomposite, HAVE_XCOMPOSITE=yes, HAVE_XCOMPOSITE=no)
- AC_SUBST(XCOMPOSITE_CFLAGS)
- AC_SUBST(XCOMPOSITE_LIBS)
-fi
-AM_CONDITIONAL(HAVE_XCOMPOSITE, test "x$HAVE_XCOMPOSITE" = "xyes")
-
-dnl graphene-1.0 is optional and used in gltransformation
-HAVE_GRAPHENE=NO
-PKG_CHECK_MODULES(GRAPHENE, graphene-1.0 >= 1.4.0, HAVE_GRAPHENE=yes, HAVE_GRAPHENE=no)
-if test "x$HAVE_GRAPHENE" = "xyes"; then
- AC_DEFINE(HAVE_GRAPHENE, [1] , [Use graphene])
-fi
-AC_SUBST(HAVE_GRAPHENE)
-AC_SUBST(GRAPHENE_LIBS)
-AC_SUBST(GRAPHENE_CFLAGS)
-AM_CONDITIONAL(HAVE_GRAPHENE, test "x$HAVE_GRAPHENE" = "xyes")
-
-
-dnl sdl is optional and used in examples
-HAVE_SDL=NO
-if test "x$BUILD_EXAMPLES" = "xyes"; then
- PKG_CHECK_MODULES(SDL, sdl >= 1.2.0, HAVE_SDL=yes, HAVE_SDL=no)
- AC_SUBST(SDL_LIBS)
- AC_SUBST(SDL_CFLAGS)
- AC_SUBST(SDL_CLUTTER)
-fi
-AM_CONDITIONAL(HAVE_SDL, test "x$HAVE_SDL" = "xyes")
-
-
-dnl Needed for GtkBuilder to autoconnect signals
-PKG_CHECK_MODULES(GMODULE_EXPORT, gmodule-export-2.0, HAVE_GMODULE_EXPORT=yes, HAVE_GMODULE_EXPORT=no)
-
-dnl Needed by plugins that use g_module_*() API
-PKG_CHECK_MODULES(GMODULE_NO_EXPORT, gmodule-no-export-2.0)
-
dnl x11 is optional for librfb
HAVE_X11=NO
PKG_CHECK_MODULES(X11, x11, HAVE_X11=yes, HAVE_X11=no)
@@ -543,998 +482,6 @@ if test "x$HAVE_WINSOCK2_H" = "xyes"; then
AC_SUBST(WINSOCK2_LIBS)
fi
-dnl *** opengl ***
-AC_ARG_ENABLE([opengl],
- [ --enable-opengl Enable Desktop OpenGL support @<:@default=auto@:>@],
- [case "${enableval}" in
- yes) NEED_GL=yes ;;
- no) NEED_GL=no ;;
- auto) NEED_GL=auto ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-opengl]) ;;
- esac],[NEED_GL=auto])
-
-AC_ARG_WITH([opengl-module-name],
- AS_HELP_STRING([--with-opengl-module-name],[library module name for OpenGL (default: libGL)]))
-if test x$with_opengl_module_name != x; then
- AC_DEFINE_UNQUOTED(GST_GL_LIBGL_MODULE_NAME, "$with_opengl_module_name", [OpenGL module name])
-fi
-
-AC_ARG_ENABLE([gles2],
- [ --enable-gles2 Enable OpenGL|ES 2.0 support @<:@default=auto@:>@],
- [case "${enableval}" in
- yes) NEED_GLES2=yes ;;
- no) NEED_GLES2=no ;;
- auto) NEED_GLES2=auto ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-gles2]) ;;
- esac],[NEED_GLES2=auto])
-
-AC_ARG_WITH([gles2-module-name],
- AS_HELP_STRING([--with-gles2-module-name],[library module name for GLES2 (default: libGLESv2)]))
-if test x$with_gles2_module_name != x; then
- AC_DEFINE_UNQUOTED(GST_GL_LIBGLESV2_MODULE_NAME, "$with_gles2_module_name", [GLES2 module name])
-fi
-
-AC_ARG_ENABLE([egl],
- [ --enable-egl Enable EGL support @<:@default=auto@:>@],
- [case "${enableval}" in
- yes) NEED_EGL=yes ;;
- no) NEED_EGL=no ;;
- auto) NEED_EGL=auto ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-egl]) ;;
- esac],[NEED_EGL=auto])
-
-AC_ARG_WITH([egl-module-name],
- AS_HELP_STRING([--with-egl-module-name],[library module name for EGL (default: libEGL)]))
-if test x$with_egl_module_name != x; then
- AC_DEFINE_UNQUOTED(GST_GL_LIBEGL_MODULE_NAME, "$with_egl_module_name", [EGL module name])
-fi
-
-AC_ARG_ENABLE([wgl],
- [ --enable-wgl Enable WGL support @<:@default=auto@:>@],
- [case "${enableval}" in
- yes) NEED_WGL=yes ;;
- no) NEED_WGL=no ;;
- auto) NEED_WGL=auto ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-wgl]) ;;
- esac],[NEED_WGL=auto])
-
-AC_ARG_ENABLE([glx],
- [ --enable-glx Enable GLX support @<:@default=auto@:>@],
- [case "${enableval}" in
- yes) NEED_GLX=yes ;;
- no) NEED_GLX=no ;;
- auto) NEED_GLX=auto ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-glx]) ;;
- esac],[NEED_GLX=auto])
-
-AC_ARG_ENABLE([cocoa],
- [ --enable-cocoa Enable Cocoa support @<:@default=auto@:>@],
- [case "${enableval}" in
- yes) NEED_COCOA=yes ;;
- no) NEED_COCOA=no ;;
- auto) NEED_COCOA=auto ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-cocoa]) ;;
- esac],[NEED_COCOA=auto])
-
-AC_ARG_ENABLE([x11],
- [ --enable-x11 Enable x11 support @<:@default=auto@:>@],
- [case "${enableval}" in
- yes) NEED_X11=yes ;;
- no) NEED_X11=no ;;
- auto) NEED_X11=auto ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-x11]) ;;
- esac],[NEED_X11=auto])
-
-AC_ARG_ENABLE([wayland],
- [ --enable-wayland Enable Wayland support (requires EGL) @<:@default=auto@:>@],
- [case "${enableval}" in
- yes) NEED_WAYLAND_EGL=yes ;;
- no) NEED_WAYLAND_EGL=no ;;
- auto) NEED_WAYLAND_EGL=auto ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-wayland]) ;;
- esac],[NEED_WAYLAND_EGL=auto])
-
-AC_ARG_ENABLE([dispmanx],
- [ --enable-dispmanx Enable Dispmanx support (requires EGL) @<:@default=auto@:>@],
- [case "${enableval}" in
- yes) NEED_DISPMANX=yes ;;
- no) NEED_DISPMANX=no ;;
- auto) NEED_DISPMANX=auto ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-dispmanx]) ;;
- esac],[NEED_DISPMANX=auto])
-
-AG_GST_PKG_CHECK_MODULES(X11_XCB, x11-xcb)
-save_CPPFLAGS="$CPPFLAGS"
-save_LIBS="$LIBS"
-
-HAVE_GL=no
-HAVE_GLES2=no
-HAVE_GLES3_H=no
-HAVE_WAYLAND_EGL=no
-HAVE_VIV_FB_EGL=no
-HAVE_EGL_RPI=no
-
-case $host in
- *-mingw32* )
- LIBS="$LIBS -lgdi32"
- AG_GST_CHECK_LIBHEADER(GL, opengl32, glTexImage2D,, GL/gl.h)
- AC_CHECK_HEADER(GL/wglext.h, HAVE_WGLEXT="yes", HAVE_WGLEXT="no", [#include <GL/gl.h>])
- if test "x$HAVE_WGLEXT" = "xyes"; then
- HAVE_WGL=yes
- HAVE_GL=yes
- fi
- ;;
- *)
- if test "x$NEED_GL" != "xno"; then
- AG_GST_PKG_CHECK_MODULES(GL, gl)
- if test "x$HAVE_GL" != "xyes"; then
- AG_GST_CHECK_LIBHEADER(GL, GL, glTexImage2D,, GL/gl.h)
- fi
- fi
- if test "x$NEED_GLES2" != "xno"; then
- AG_GST_PKG_CHECK_MODULES(GLES2, glesv2)
- if test "x$HAVE_GLES2" != "xyes"; then
- AG_GST_CHECK_LIBHEADER(GLES2, GLESv2, glTexImage2D,, GLES2/gl2.h)
- fi
- AC_CHECK_HEADER([GLES3/gl3.h], [HAVE_GLES3_H=yes])
- AS_IF([test "x$HAVE_GLES3_H" == "xyes"],
- [
- AC_CHECK_HEADER([GLES3/gl3ext.h], [HAVE_GLES3EXT3_H=yes], [HAVE_GLES3EXT3_H=no], [#include <GLES3/gl3.h>])
- ])
- fi
- if test "x$NEED_EGL" != "xno"; then
- AG_GST_PKG_CHECK_MODULES(EGL, egl)
- if test "x$HAVE_EGL" != "xyes"; then
- AG_GST_CHECK_LIBHEADER(EGL, EGL, eglGetError,, EGL/egl.h)
- fi
- fi
-
- old_LIBS=$LIBS
- old_CFLAGS=$CFLAGS
-
- dnl imx6 / Vivante specifics
- if test "x$HAVE_EGL" = "xyes"; then
- AC_CHECK_LIB([EGL], [fbGetDisplay], [HAVE_VIV_FB_EGL=yes])
- fi
-
- dnl FIXME: Mali EGL depends on GLESv1 or GLESv2
- AC_CHECK_HEADER([EGL/fbdev_window.h],
- [
- LIBS="$LIBS -lUMP"
- AC_CHECK_LIB([Mali], [mali_image_create],
- [
- LIBS="$LIBS -lMali"
- AC_CHECK_LIB([GLESv2], [glEnable],
- [
- AC_CHECK_HEADER([GLES2/gl2.h],
- [
- AC_CHECK_LIB([EGL], [eglGetProcAddress],
- [
- AC_CHECK_HEADER([EGL/egl.h],
- [
- HAVE_EGL=yes
- HAVE_GLES2=yes
- EGL_LIBS="-lMali -lUMP"
- EGL_CFLAGS=""
- AC_DEFINE(USE_EGL_MALI_FB, [1], [Use Mali FB EGL platform])
- ])
- ])
- ])
- ])
- ])
- ])
-
- dnl FIXME: EGL of RPi depends on GLESv1 or GLESv2
- dnl FIXME: GLESv2 of RPi depends on EGL... WTF!
- LIBS="$LIBS -lvcos -lvchiq_arm"
- AC_CHECK_LIB([bcm_host], [bcm_host_init],
- [
- LIBS="$LIBS -lbcm_host"
- AC_CHECK_HEADER(bcm_host.h,
- [
- LIBS="$LIBS -lGLESv2"
- AC_CHECK_LIB([EGL], [eglGetProcAddress],
- [
- LIBS="$LIBS -lEGL"
- AC_CHECK_HEADER([EGL/egl.h],
- [
- AC_CHECK_LIB([GLESv2], [glEnable],
- [
- AC_CHECK_HEADER([GLES2/gl2.h],
- [
- HAVE_EGL=yes
- HAVE_GLES2=yes
- HAVE_EGL_RPI=yes
- EGL_LIBS="-lbcm_host -lvcos -lvchiq_arm"
- EGL_CFLAGS=""
- AC_DEFINE(USE_EGL_RPI, [1], [Use RPi platform])
- ])
- ])
- ])
- ])
- ])
- ])
-
- LIBS=$old_LIBS
- CFLAGS=$old_CFLAGS
-
- PKG_CHECK_MODULES(WAYLAND_EGL, wayland-client >= 1.0 wayland-cursor >= 1.0 wayland-egl >= 9.0, HAVE_WAYLAND_EGL=yes, HAVE_WAYLAND_EGL=no)
-
- # OS X and iOS always have GL available
- case $host in
- *-darwin*)
- if test "x$HAVE_IOS" = "xyes"; then
- HAVE_GLES2=yes
- else
- HAVE_GL=yes
- fi
- ;;
- esac
- ;;
-esac
-
-CPPFLAGS="$save_CPPFLAGS"
-LIBS="$save_LIBS"
-
-USE_OPENGL=no
-USE_GLES2=no
-USE_GLX=no
-USE_COCOA=no
-USE_WGL=no
-USE_X11=no
-USE_EAGL=no
-GL_LIBS=
-GL_CFLAGS=
-GL_OBJCFLAGS=
-
-dnl Check for what the user asked for and what we could find
-if test "x$HAVE_EGL" = "xno"; then
- if test "x$NEED_EGL" = "xyes"; then
- AC_MSG_ERROR([Could not find the required EGL libraries])
- fi
-fi
-
-if test "x$HAVE_GL" = "xno"; then
- if test "x$NEED_GL" = "xyes"; then
- AC_MSG_ERROR([Could not find the required OpenGL libraries])
- fi
-fi
-
-if test "x$HAVE_GLES2" = "xno"; then
- if test "x$NEED_GLES2" = "xyes"; then
- AC_MSG_ERROR([Could not find the required OpenGL|ES 2.0 libraries])
- fi
-fi
-
-dnl X, GLX and OpenGL
-if test "x$HAVE_X11_XCB" = "xno"; then
- if test "x$NEED_GLX" = "xyes"; then
- AC_MSG_ERROR([Building the GLX backend without X11 is unsupported])
- fi
- if test "x$NEED_X11" = "xyes"; then
- AC_MSG_ERROR([Could not find X11 development libraries])
- fi
-else
- if test "x$NEED_GL" != "xno"; then
- if test "x$HAVE_GL" = "xno"; then
- if test "x$NEED_GLX" = "xyes"; then
- AC_MSG_ERROR([Building the GLX backend without the OpenGL backend is unsupported])
- fi
- else dnl HAVE_GL=yes
- USE_OPENGL=yes
- if test "x$NEED_GLX" != "xno"; then
- USE_GLX=yes
- fi
- fi
- fi
-fi
-
-dnl check for DMABUF support
-HAVE_DRM_FOURCC_HEADER=no
-AC_CHECK_HEADER(libdrm/drm_fourcc.h,
- HAVE_DRM_FOURCC_HEADER=yes, )
-
-HAVE_GST_ALLOCATORS=no
-PKG_CHECK_MODULES(GST_ALLOCATORS, gstreamer-allocators-1.0,
- HAVE_GST_ALLOCATORS=yes, )
-
-GST_GL_HAVE_DMABUF=0
-if test "x$HAVE_DRM_FOURCC_HEADER" = "xyes" -a \
- "x$HAVE_GST_ALLOCATORS" = "xyes" -a \
- "x$HAVE_EGL" = "xyes"; then
- GST_GL_HAVE_DMABUF=1
-fi
-
-dnl check for Vivante DirectVIV support
-AC_CHECK_LIB(GLESv2, glTexDirectVIV, [HAVE_VIV_DIRECTVIV=yes], [HAVE_VIV_DIRECTVIV=no])
-
-GST_GL_HAVE_VIV_DIRECTVIV=0
-if test "x$HAVE_VIV_DIRECTVIV" = "xyes"; then
- GST_GL_HAVE_VIV_DIRECTVIV=1
-fi
-
-dnl check if we can include both GL and GLES2 at the same time
-if test "x$HAVE_GL" = "xyes" -a "x$HAVE_GLES2" = "xyes"; then
- GLES3_H_DEFINE=0
- GLES3EXT3_H_DEFINE=0
- if test "x$HAVE_GLES3_H" == "xyes"; then
- GLES3_H_DEFINE=1
- fi
- if test "x$HAVE_GLES3EXT3_H" == "xyes"; then
- GLES3EXT3_H_DEFINE=1
- fi
- GL_INCLUDES="
-#ifdef __GNUC__
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored \"-Wredundant-decls\"
-#endif
-#ifndef GL_GLEXT_PROTOTYPES
-#define GL_GLEXT_PROTOTYPES 1
-#endif
-# ifdef HAVE_IOS
-# include <OpenGLES/ES2/gl.h>
-# include <OpenGLES/ES2/glext.h>
-# else
-# if $GLES3_H_DEFINE
-# include <GLES3/gl3.h>
-# if $GLES3EXT3_H_DEFINE
-# include <GLES3/gl3ext.h>
-# endif
-# include <GLES2/gl2ext.h>
-# else
-# include <GLES2/gl2.h>
-# include <GLES2/gl2ext.h>
-# endif
-# endif
-# ifdef __APPLE__
-# include <OpenGL/OpenGL.h>
-# include <OpenGL/gl.h>
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
-# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
-# include <OpenGL/gl3.h>
-# endif
-# else
-# include <GL/gl.h>
-# if __WIN32__ || _WIN32
-# include <GL/glext.h>
-# endif
-# endif
-int main (int argc, char **argv) { return 0; }
-"
- AC_MSG_CHECKING([whether it is possible to include both GL and GLES2 headers])
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $GL_CFLAGS $GLES2_CFLAGS $WARNING_CFLAGS $ERROR_CFLAGS"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[$GL_INCLUDES]], [[
- #if !defined(GL_FALSE)
- #error Failed to include GL headers
- #endif
- ]])],[ AC_MSG_RESULT(yes)
- ],[AC_MSG_RESULT(no)
- if test "x$NEED_GLES2" = "xyes"; then
- if test "x$NEED_GL" = "xyes"; then
- AC_MSG_ERROR([Cannot seem to include both GL and GLES2 headers. Try disabling one API])
- fi
- AC_MSG_WARN([Disabling Desktop GL support])
- HAVE_GL=no
- USE_OPENGL=no
- else
- AC_MSG_WARN([Disabling GL|ES 2.0 support])
- HAVE_GLES2=no
- HAVE_GLES3_H=no
- fi
- ])
- CFLAGS="$save_CFLAGS"
-fi
-
-#dnl Check for OpenGL
-echo host is $host
-case $host in
- *-android*)
- if test "x$NEED_WGL" = "xyes"; then
- AC_MSG_ERROR([WGL is not available on Android])
- fi
- if test "x$NEED_GLX" = "xyes"; then
- AC_MSG_ERROR([GLX is not available on Android])
- fi
- if test "x$NEED_GL" = "xyes"; then
- AC_MSG_ERROR([GL is not available on Android])
- fi
- if test "x$NEED_X11" = "xyes"; then
- AC_MSG_ERROR([X11 is not available on Android])
- fi
- if test "x$NEED_COCOA" = "xyes"; then
- AC_MSG_ERROR([Cocoa is not available on Android])
- fi
-
- dnl OpenGL|ES 2.0
- if test "x$HAVE_GLES2" = "xyes"; then
- if test "x$NEED_GLES2" != "xno"; then
- GL_LIBS="$GL_LIBS -lGLESv2"
- USE_GLES2=yes
- fi
- fi
-
- dnl EGL
- if test "x$HAVE_EGL" = "xyes"; then
- if test "x$NEED_EGL" != "xno"; then
- GL_LIBS="$GL_LIBS -lEGL"
- USE_EGL=yes
- fi
- fi
-
- if test "x$USE_EGL" != "xyes"; then
- AC_MSG_ERROR([Need EGL on Android])
- fi
-
- if test "x$USE_GLES2" != "xyes"; then
- AC_MSG_ERROR([Need OpenGL|ES 2.0 on Android])
- fi
-
- HAVE_WINDOW_ANDROID=yes
- ;;
- *-linux* | *-cygwin* | *-solaris* | *-netbsd* | *-freebsd* | *-openbsd* | *-kfreebsd* | *-dragonflybsd* | *-gnu* )
- if test "x$NEED_WGL" = "xyes"; then
- AC_MSG_ERROR([WGL is not available on unix])
- fi
-
- if test "x$HAVE_X11_XCB" = "xno"; then
- if test "x$HAVE_WAYLAND_EGL" = "xno"; then
- AC_MSG_WARN([X or Wayland is required for OpenGL support])
- fi
- fi
-
- dnl check Desktop OpenGL
- if test "x$HAVE_GL" = "xyes"; then
- if test "x$NEED_GL" != "xno"; then
- GL_LIBS="$GL_LIBS -lGL"
- fi
- fi
-
- dnl OpenGL|ES 2.0
- if test "x$HAVE_GLES2" = "xyes"; then
- if test "x$NEED_GLES2" != "xno"; then
- GL_LIBS="$GL_LIBS -lGLESv2"
- USE_GLES2=yes
- fi
- fi
-
- if test "x$HAVE_X11_XCB" = "xyes" -a "x$HAVE_EGL_RPI" = "xno"; then
- if test "x$NEED_X11" != "xno"; then
- GL_LIBS="$GL_LIBS $X11_XCB_LIBS"
- GL_CFLAGS="$GL_CFLAGS $X11_XCB_CFLAGS"
- HAVE_WINDOW_X11=yes
- fi
- fi
-
- if test "x$HAVE_WAYLAND_EGL" = "xyes"; then
- if test "x$NEED_EGL" = "xno" -o "x$HAVE_EGL" = "xno"; then
- AC_MSG_WARN([EGL is required by the Wayland backend for OpenGL support])
- else
- if test "x$NEED_WAYLAND_EGL" != "xno"; then
- HAVE_WINDOW_WAYLAND=yes
- GL_LIBS="$GL_LIBS $WAYLAND_EGL_LIBS"
- GL_CFLAGS="$GL_CFLAGS $WAYLAND_EGL_CFLAGS"
- fi
- fi
- fi
-
- if test "x$HAVE_VIV_FB_EGL" = "xyes"; then
- if test "x$NEED_EGL" = "xno" -o "x$HAVE_EGL" = "xno"; then
- AC_MSG_WARN([EGL is required by the Vivante EGL FB backend])
- else
- HAVE_WINDOW_VIV_FB=yes
- GL_LIBS="$GL_LIBS"
- GL_CFLAGS="$GL_CFLAGS"
- fi
- fi
-
- if test "x$HAVE_EGL_RPI" = "xyes"; then
- if test "x$NEED_DISPMANX" != "xno"; then
- HAVE_WINDOW_DISPMANX=yes
- USE_EGL=yes
- fi
- fi
-
- dnl EGL
- if test "x$HAVE_EGL" = "xno"; then
- if test "x$HAVE_GL" = "xno"; then
- AC_MSG_WARN([Building requires either EGL or GLX for OpenGL support])
- fi
- else
- if test "x$NEED_EGL" != "xno"; then
- if test "x$HAVE_WINDOW_WAYLAND" = "xyes" -o "x$HAVE_WINDOW_X11" = "xyes" -o "x$HAVE_WINDOW_DISPMANX" = "xyes" -o "x$HAVE_WINDOW_VIV_FB" = "xyes"; then
- GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
- GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
- USE_EGL=yes
- fi
- fi
- fi
- ;;
- *-darwin*)
- if test "x$HAVE_IOS" = "xyes"; then
- if test "x$NEED_WGL" = "xyes"; then
- AC_MSG_ERROR([WGL is not available on iOS])
- fi
- if test "x$NEED_GLX" = "xyes"; then
- AC_MSG_ERROR([GLX is not available on iOS])
- fi
- if test "x$NEED_GL" = "xyes"; then
- AC_MSG_ERROR([GL is not available on iOS])
- fi
- if test "x$NEED_X11" = "xyes"; then
- AC_MSG_ERROR([X11 is not available on iOS])
- fi
- if test "x$NEED_COCOA" = "xyes"; then
- AC_MSG_ERROR([Cocoa is not available on iOS])
- fi
- if test "x$NEED_EGL" = "xyes"; then
- AC_MSG_ERROR([EGL is not available on iOS])
- fi
-
- GL_LIBS="$LIBS -framework OpenGLES -framework QuartzCore -framework UIKit -framework CoreGraphics -framework CoreFoundation -framework Foundation"
- GL_CFLAGS="$GL_CFLAGS"
- USE_GLES2=yes
- USE_EAGL=yes
- HAVE_WINDOW_EAGL=yes
-
- ac_cv_type_GLsizeiptr=yes
- ac_cv_type_GLintptr=yes
- ac_cv_type_GLchar=yes
- else
- dnl Only osx supports cocoa.
- if test "x$NEED_WGL" = "xyes"; then
- AC_MSG_ERROR([WGL is not available on Mac OS X])
- fi
-
- if test "x$NEED_COCOA" != "xno"; then
- GL_LIBS="$LIBS -framework OpenGL -framework Cocoa -framework QuartzCore -framework CoreFoundation"
- GL_CFLAGS="$GL_CFLAGS"
- USE_COCOA=yes
- HAVE_WINDOW_COCOA=yes
- USE_OPENGL=yes
- fi
-
- if test "x$USE_GLX" = "xyes"; then
- if test "x$HAVE_X11_XCB" = "xyes"; then
- if test "x$NEED_X11" != "xno"; then
- GL_LIBS="$GL_LIBS $X11_XCB_LIBS"
- GL_CFLAGS="$GL_CFLAGS $X11_XCB_CFLAGS"
- HAVE_WINDOW_X11=yes
- fi
- fi
-
- if test "x$HAVE_GL" = "xyes"; then
- if test "x$NEED_GL" != "xno"; then
- GL_LIBS="$GL_LIBS -lGL"
- fi
- USE_OPENGL=yes
- fi
- fi
-
- if test "x$HAVE_EGL" = "xyes"; then
- if test "x$NEED_EGL" != "xno"; then
- if test "x$HAVE_WINDOW_X11" = "xyes"; then
- GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
- GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
- USE_EGL=yes
- fi
- fi
- fi
-
- dnl OpenGL|ES 2.0
- if test "x$HAVE_GLES2" = "xyes"; then
- if test "x$NEED_GLES2" != "xno"; then
- GL_LIBS="$GL_LIBS -lGLESv2"
- USE_GLES2=yes
- fi
- fi
- fi
- ;;
- *-mingw32*)
- if test "x$NEED_GLX" = "xyes"; then
- AC_MSG_ERROR([GLX is not available on Windows])
- fi
- if test "x$NEED_GLES2" = "xyes"; then
- AC_MSG_ERROR([OpenGL|ES 2.0 is not supported on your platform yet])
- fi
-
- if test "x$HAVE_GL" = "xyes"; then
- if test "x$NEED_GL" != "xno"; then
- if test "x$HAVE_WGL" = "xyes"; then
- if test "$NEED_WGL" != "xno"; then
- GL_LIBS="$GL_LIBS -lgdi32 -lopengl32"
- HAVE_WINDOW_WIN32=yes
- USE_OPENGL=yes
- USE_WGL=yes
- fi
- fi
- fi
- fi
- ;;
- *)
- AC_MSG_WARN([Don't know how to check for OpenGL on your platform.])
- ;;
-esac
-
-GL_PLATFORMS=
-GL_WINDOWS=
-GL_APIS=
-GL_CONFIG_DEFINES=
-
-dnl APIs
-
-GST_GL_HAVE_OPENGL=0
-GST_GL_HAVE_GLES2=0
-GST_GL_HAVE_GLES3=0
-GST_GL_HAVE_GLES3EXT3_H=0
-
-if test "x$USE_OPENGL" = "xyes"; then
- GL_APIS="gl $GL_APIS"
- GST_GL_HAVE_OPENGL=1
-fi
-if test "x$USE_GLES2" = "xyes"; then
- GL_APIS="gles2 $GL_APIS"
- GST_GL_HAVE_GLES2=1
- if test "x$HAVE_GLES3_H" = "xyes"; then
- GST_GL_HAVE_GLES3=1
- if test "x$HAVE_GLES3EXT3_H" = "xyes"; then
- GST_GL_HAVE_GLES3EXT3_H=1
- fi
- fi
-fi
-
-GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
-#define GST_GL_HAVE_OPENGL $GST_GL_HAVE_OPENGL
-#define GST_GL_HAVE_GLES2 $GST_GL_HAVE_GLES2
-#define GST_GL_HAVE_GLES3 $GST_GL_HAVE_GLES3
-#define GST_GL_HAVE_GLES3EXT3_H $GST_GL_HAVE_GLES3EXT3_H
-"
-
-dnl WINDOW's
-
-GST_GL_HAVE_WINDOW_X11=0
-GST_GL_HAVE_WINDOW_COCOA=0
-GST_GL_HAVE_WINDOW_WIN32=0
-GST_GL_HAVE_WINDOW_WAYLAND=0
-GST_GL_HAVE_WINDOW_ANDROID=0
-GST_GL_HAVE_WINDOW_DISPMANX=0
-GST_GL_HAVE_WINDOW_EAGL=0
-GST_GL_HAVE_WINDOW_VIV_FB=0
-
-if test "x$HAVE_WINDOW_X11" = "xyes"; then
- GL_WINDOWS="x11 $GL_WINDOWS"
- GST_GL_HAVE_WINDOW_X11=1
-fi
-if test "x$HAVE_WINDOW_COCOA" = "xyes"; then
- GL_WINDOWS="cocoa $GL_WINDOWS"
- GST_GL_HAVE_WINDOW_COCOA=1
-fi
-if test "x$HAVE_WINDOW_WIN32" = "xyes"; then
- GL_WINDOWS="win32 $GL_WINDOWS"
- GST_GL_HAVE_WINDOW_WIN32=1
-fi
-if test "x$HAVE_WINDOW_WAYLAND" = "xyes"; then
- GL_WINDOWS="wayland $GL_WINDOWS"
- GST_GL_HAVE_WINDOW_WAYLAND=1
-fi
-if test "x$HAVE_WINDOW_ANDROID" = "xyes"; then
- GL_WINDOWS="android $GL_WINDOWS"
- GST_GL_HAVE_WINDOW_ANDROID=1
-fi
-if test "x$HAVE_WINDOW_DISPMANX" = "xyes"; then
- GL_WINDOWS="dispmanx $GL_WINDOWS"
- GST_GL_HAVE_WINDOW_DISPMANX=1
-fi
-if test "x$HAVE_WINDOW_EAGL" = "xyes"; then
- GL_WINDOWS="eagl $GL_WINDOWS"
- GST_GL_HAVE_WINDOW_EAGL=1
-fi
-if test "x$HAVE_WINDOW_VIV_FB" = "xyes"; then
- GL_WINDOWS="viv-fb $GL_WINDOWS"
- GST_GL_HAVE_WINDOW_VIV_FB=1
-fi
-
-GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
-#define GST_GL_HAVE_WINDOW_X11 $GST_GL_HAVE_WINDOW_X11
-#define GST_GL_HAVE_WINDOW_COCOA $GST_GL_HAVE_WINDOW_COCOA
-#define GST_GL_HAVE_WINDOW_WIN32 $GST_GL_HAVE_WINDOW_WIN32
-#define GST_GL_HAVE_WINDOW_WAYLAND $GST_GL_HAVE_WINDOW_WAYLAND
-#define GST_GL_HAVE_WINDOW_ANDROID $GST_GL_HAVE_WINDOW_ANDROID
-#define GST_GL_HAVE_WINDOW_DISPMANX $GST_GL_HAVE_WINDOW_DISPMANX
-#define GST_GL_HAVE_WINDOW_EAGL $GST_GL_HAVE_WINDOW_EAGL
-#define GST_GL_HAVE_WINDOW_VIV_FB $GST_GL_HAVE_WINDOW_VIV_FB
-"
-
-dnl PLATFORM's
-
-GST_GL_HAVE_PLATFORM_EGL=0
-GST_GL_HAVE_PLATFORM_GLX=0
-GST_GL_HAVE_PLATFORM_WGL=0
-GST_GL_HAVE_PLATFORM_CGL=0
-GST_GL_HAVE_PLATFORM_EAGL=0
-
-if test "x$USE_EGL" = "xyes"; then
- GL_PLATFORMS="egl $GL_PLATFORMS"
- GST_GL_HAVE_PLATFORM_EGL=1
-fi
-if test "x$USE_GLX" = "xyes"; then
- GL_PLATFORMS="glx $GL_PLATFORMS"
- GST_GL_HAVE_PLATFORM_GLX=1
-fi
-if test "x$USE_WGL" = "xyes"; then
- GL_PLATFORMS="wgl $GL_PLATFORMS"
- GST_GL_HAVE_PLATFORM_WGL=1
-fi
-if test "x$USE_COCOA" = "xyes"; then
- GL_PLATFORMS="cgl $GL_PLATFORMS"
- GST_GL_HAVE_PLATFORM_CGL=1
-fi
-if test "x$USE_EAGL" = "xyes"; then
- GL_PLATFORMS="eagl $GL_PLATFORMS"
- GST_GL_HAVE_PLATFORM_EAGL=1
-fi
-
-GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
-#define GST_GL_HAVE_PLATFORM_EGL $GST_GL_HAVE_PLATFORM_EGL
-#define GST_GL_HAVE_PLATFORM_GLX $GST_GL_HAVE_PLATFORM_GLX
-#define GST_GL_HAVE_PLATFORM_WGL $GST_GL_HAVE_PLATFORM_WGL
-#define GST_GL_HAVE_PLATFORM_CGL $GST_GL_HAVE_PLATFORM_CGL
-#define GST_GL_HAVE_PLATFORM_EAGL $GST_GL_HAVE_PLATFORM_EAGL
-"
-
-GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
-#define GST_GL_HAVE_DMABUF $GST_GL_HAVE_DMABUF
-#define GST_GL_HAVE_VIV_DIRECTVIV $GST_GL_HAVE_VIV_DIRECTVIV
-"
-
-dnl Check for no platforms/window systems
-if test "x$GL_APIS" = "x"; then
- AC_MSG_WARN([Either OpenGL or OpenGL|ES is required for OpenGL support])
-fi
-if test "x$GL_PLATFORMS" = "x"; then
- AC_MSG_WARN([Could not find any OpenGL platforms to use such as CGL, WGL or GLX])
-fi
-if test "x$GL_WINDOWS" = "x"; then
- AC_MSG_WARN([Could not find any window systems to use such as Cocoa, Win32API or X11])
-fi
-
-if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; then
- GL_LIBS=
- GL_CFLAGS=
- GL_OBJCFLAGS=
- USE_OPENGL=no
- USE_GLES2=no
- USE_GLX=no
- USE_EGL=no
- USE_WGL=no
- USE_COCOA=no
- USE_EGL_MALI=no
- USE_EGL_RPI=no
- USE_EAGL=no
-
- HAVE_WINDOW_X11=no
- HAVE_WINDOW_WIN32=no
- HAVE_WINDOW_DISPMANX=no
- HAVE_WINDOW_WAYLAND=no
- HAVE_WINDOW_ANDROID=no
- HAVE_WINDOW_COCOA=no
- HAVE_WINDOW_EAGL=no
- HAVE_WINDOW_VIV_FB=no
-fi
-
-AC_SUBST(GL_APIS)
-AC_SUBST(GL_PLATFORMS)
-AC_SUBST(GL_WINDOWS)
-AC_SUBST(GL_LIBS)
-AC_SUBST(GL_CFLAGS)
-AC_SUBST(GL_OBJCFLAGS)
-AC_SUBST(USE_OPENGL)
-AC_SUBST(USE_GLES2)
-
-AM_CONDITIONAL(HAVE_WINDOW_X11, test "x$HAVE_WINDOW_X11" = "xyes")
-AM_CONDITIONAL(HAVE_WINDOW_COCOA, test "x$HAVE_WINDOW_COCOA" = "xyes")
-AM_CONDITIONAL(HAVE_WINDOW_WIN32, test "x$HAVE_WINDOW_WIN32" = "xyes")
-AM_CONDITIONAL(HAVE_WINDOW_DISPMANX, test "x$HAVE_WINDOW_DISPMANX" = "xyes")
-AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes")
-AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes")
-AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes")
-AM_CONDITIONAL(HAVE_WINDOW_VIV_FB, test "x$HAVE_WINDOW_VIV_FB" = "xyes")
-
-AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
-AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
-AM_CONDITIONAL(USE_GLX, test "x$USE_GLX" = "xyes")
-AM_CONDITIONAL(USE_EGL, test "x$USE_EGL" = "xyes")
-AM_CONDITIONAL(USE_WGL, test "x$USE_WGL" = "xyes")
-AM_CONDITIONAL(USE_COCOA, test "x$USE_COCOA" = "xyes")
-AM_CONDITIONAL(USE_EGL_MALI, test "x$USE_EGL_MALI" = "xyes")
-AM_CONDITIONAL(USE_EGL_RPI, test "x$USE_EGL_RPI" = "xyes")
-AM_CONDITIONAL(USE_EAGL, test "x$USE_EAGL" = "xyes")
-
-AM_CONDITIONAL(HAVE_GST_GL, test "x$USE_OPENGL" = "xyes" -o "x$USE_GLES2" = "xyes")
-
-dnl Check for some types that are not always present
-GL_INCLUDES=""
-if test "x$USE_GLES2" = "xyes"; then
- GL_INCLUDES="$GL_INCLUDES
-#ifndef GL_GLEXT_PROTOTYPES
-#define GL_GLEXT_PROTOTYPES 1
-#endif
-# ifdef HAVE_IOS
-# include <OpenGLES/ES2/gl.h>
-# include <OpenGLES/ES2/glext.h>
-# else
-# if $GST_GL_HAVE_GLES3
-# include <GLES3/gl3.h>
-# if $GST_GL_HAVE_GLES3EXT3_H
-# include <GLES3/gl3ext.h>
-# endif
-# include <GLES2/gl2ext.h>
-# else
-# include <GLES2/gl2.h>
-# include <GLES2/gl2ext.h>
-# endif
-# endif
-"
-fi
-
-if test "x$USE_OPENGL" = "xyes"; then
- GL_INCLUDES="$GL_INCLUDES
-# ifdef __APPLE__
-# include <OpenGL/OpenGL.h>
-# include <OpenGL/gl.h>
-# else
-# include <GL/gl.h>
-# if __WIN32__ || _WIN32
-# include <GL/glext.h>
-# endif
-# endif
-"
-fi
-
-GST_GL_HAVE_GLEGLIMAGEOES=0
-GST_GL_HAVE_GLCHAR=0
-GST_GL_HAVE_GLSIZEIPTR=0
-GST_GL_HAVE_GLINTPTR=0
-GST_GL_HAVE_GLSYNC=0
-GST_GL_HAVE_GLUINT64=0
-GST_GL_HAVE_GLINT64=0
-GST_GL_HAVE_EGLATTRIB=0
-
-old_CFLAGS=$CFLAGS
-CFLAGS="$GL_CFLAGS $CFLAGS"
-
-AC_CHECK_TYPES(GLeglImageOES, [], [], [[$GL_INCLUDES]])
-if test "x$ac_cv_type_GLeglImageOES" = "xyes"; then
- GST_GL_HAVE_GLEGLIMAGEOES=1
-fi
-
-AC_CHECK_TYPES(GLchar, [], [], [[$GL_INCLUDES]])
-if test "x$ac_cv_type_GLchar" = "xyes"; then
- GST_GL_HAVE_GLCHAR=1
-fi
-
-AC_CHECK_TYPES(GLsizeiptr, [], [], [[$GL_INCLUDES]])
-if test "x$ac_cv_type_GLsizeiptr" = "xyes"; then
- GST_GL_HAVE_GLSIZEIPTR=1
-fi
-
-AC_CHECK_TYPES(GLintptr, [], [], [[$GL_INCLUDES]])
-if test "x$ac_cv_type_GLintptr" = "xyes"; then
- GST_GL_HAVE_GLINTPTR=1
-fi
-
-AC_CHECK_TYPES(GLsync, [], [], [[$GL_INCLUDES]])
-if test "x$ac_cv_type_GLsync" = "xyes"; then
- GST_GL_HAVE_GLSYNC=1
-fi
-
-AC_CHECK_TYPES(GLuint64, [], [], [[$GL_INCLUDES]])
-if test "x$ac_cv_type_GLuint64" = "xyes"; then
- GST_GL_HAVE_GLUINT64=1
-fi
-
-AC_CHECK_TYPES(GLint64, [], [], [[$GL_INCLUDES]])
-if test "x$ac_cv_type_GLint64" = "xyes"; then
- GST_GL_HAVE_GLINT64=1
-fi
-
-if test "x$USE_EGL" = "xyes"; then
- EGL_INCLUDES="$GL_INCLUDES
- #include <EGL/egl.h>
- #include <EGL/eglext.h>
- "
- AC_CHECK_TYPES(EGLAttrib, [], [], [[$EGL_INCLUDES]])
- if test "x$ac_cv_type_EGLAttrib" = "xyes"; then
- GST_GL_HAVE_EGLATTRIB=1
- fi
-fi
-
-CFLAGS=$old_CFLAGS
-
-GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
-#define GST_GL_HAVE_GLEGLIMAGEOES $GST_GL_HAVE_GLEGLIMAGEOES
-#define GST_GL_HAVE_GLCHAR $GST_GL_HAVE_GLCHAR
-#define GST_GL_HAVE_GLSIZEIPTR $GST_GL_HAVE_GLSIZEIPTR
-#define GST_GL_HAVE_GLINTPTR $GST_GL_HAVE_GLINTPTR
-#define GST_GL_HAVE_GLSYNC $GST_GL_HAVE_GLSYNC
-#define GST_GL_HAVE_GLUINT64 $GST_GL_HAVE_GLUINT64
-#define GST_GL_HAVE_GLINT64 $GST_GL_HAVE_GLINT64
-#define GST_GL_HAVE_EGLATTRIB $GST_GL_HAVE_EGLATTRIB
-"
-
-AC_CONFIG_COMMANDS([gst-libs/gst/gl/gstglconfig.h], [
- outfile=gstglconfig.h-tmp
- cat > $outfile <<\_______EOF
-/* gstglconfig.h
- *
- * This is a generated file. Please modify `configure.ac'
- */
-
-#ifndef __GST_GL_CONFIG_H__
-#define __GST_GL_CONFIG_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-_______EOF
-
- cat >>$outfile <<_______EOF
-$gl_config_defines
-_______EOF
-
- cat >>$outfile <<_______EOF
-
-G_END_DECLS
-
-#endif /* __GST_GL_CONFIG_H__ */
-_______EOF
-
-
- if cmp -s $outfile gst-libs/gst/gl/gstglconfig.h; then
- AC_MSG_NOTICE([gst-libs/gst/gl/gstglconfig.h is unchanged])
- rm -f $outfile
- else
- mv $outfile gst-libs/gst/gl/gstglconfig.h
- fi
-],[
-gl_config_defines='$GL_CONFIG_DEFINES'
-])
-
-dnl libpng is optional
-PKG_CHECK_MODULES(LIBPNG, libpng >= 1.0, HAVE_PNG=yes, HAVE_PNG=no)
-if test "x$HAVE_PNG" = "xyes"; then
- AC_DEFINE(HAVE_PNG, [1] , [Use libpng])
-fi
-AC_SUBST(HAVE_PNG)
-AC_SUBST(LIBPNG_LIBS)
-AC_SUBST(LIBPNG_CFLAGS)
-AM_CONDITIONAL(HAVE_PNG, test "x$HAVE_PNG" = "xyes")
-
-dnl libjpeg is optional
-AC_ARG_WITH(jpeg-mmx, [ --with-jpeg-mmx, path to MMX'ified JPEG library])
-OLD_LIBS="$LIBS"
-if test x$with_jpeg_mmx != x; then
- LIBS="$LIBS -L$with_jpeg_mmx"
-fi
-AC_CHECK_LIB(jpeg-mmx, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
-JPEG_LIBS="$LIBS -ljpeg-mmx"
-LIBS="$OLD_LIBS"
-if test x$HAVE_JPEG != xyes; then
- JPEG_LIBS="-ljpeg"
- AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
-fi
-
-if test x$HAVE_JPEG = xyes; then
- AC_DEFINE(HAVE_JPEG, [1], [Use libjpeg])
-else
- AC_DEFINE(HAVE_JPEG, [0], [Use libjpeg])
- JPEG_LIBS=
-fi
-AC_SUBST(JPEG_LIBS)
-AC_SUBST(HAVE_JPEG)
-AM_CONDITIONAL(HAVE_JPEG, test "x$HAVE_JPEG" = "xyes")
-
dnl Vulkan
PKG_CHECK_MODULES(XCB, xcb >= 1.10, GST_VULKAN_HAVE_WINDOW_XCB=1, GST_VULKAN_HAVE_WINDOW_XCB=0)
AM_CONDITIONAL(USE_XCB, test "x$GST_VULKAN_HAVE_WINDOW_XCB" = "x1")
@@ -2947,9 +1894,10 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_GL, true)
AG_GST_CHECK_FEATURE(GL, [gl elements], gl, [
HAVE_GL="no"
- if test x"$USE_OPENGL" = x"yes" -o x"$USE_GLES2" = x"yes"; then
- HAVE_GL="yes"
- fi
+ dnl FIXME: detect and re-enable opengl plugin
+ dnl if test x"$USE_OPENGL" = x"yes" -o x"$USE_GLES2" = x"yes"; then
+ dnl HAVE_GL="yes"
+ dnlfi
])
dnl *** gtk+ ***
@@ -3465,7 +2413,6 @@ AM_CONDITIONAL(USE_FBDEV, false)
AM_CONDITIONAL(USE_FDK_AAC, false)
AM_CONDITIONAL(USE_FLITE, false)
AM_CONDITIONAL(USE_FLUIDSYNTH, false)
-AM_CONDITIONAL(USE_GL, false)
AM_CONDITIONAL(USE_GSM, false)
AM_CONDITIONAL(USE_GTK3, false)
AM_CONDITIONAL(USE_GTK3_GL, false)
@@ -3680,17 +2627,6 @@ gst-libs/Makefile
gst-libs/gst/Makefile
gst-libs/gst/adaptivedemux/Makefile
gst-libs/gst/basecamerabinsrc/Makefile
-gst-libs/gst/gl/Makefile
-gst-libs/gst/gl/android/Makefile
-gst-libs/gst/gl/cocoa/Makefile
-gst-libs/gst/gl/dispmanx/Makefile
-gst-libs/gst/gl/glprototypes/Makefile
-gst-libs/gst/gl/eagl/Makefile
-gst-libs/gst/gl/egl/Makefile
-gst-libs/gst/gl/wayland/Makefile
-gst-libs/gst/gl/win32/Makefile
-gst-libs/gst/gl/x11/Makefile
-gst-libs/gst/gl/viv-fb/Makefile
gst-libs/gst/insertbin/Makefile
gst-libs/gst/interfaces/Makefile
gst-libs/gst/isoff/Makefile
@@ -3740,22 +2676,6 @@ tests/examples/camerabin2/Makefile
tests/examples/codecparsers/Makefile
tests/examples/directfb/Makefile
tests/examples/audiomixmatrix/Makefile
-tests/examples/gl/Makefile
-tests/examples/gl/cocoa/Makefile
-tests/examples/gl/clutter/Makefile
-tests/examples/gl/generic/Makefile
-tests/examples/gl/generic/cube/Makefile
-tests/examples/gl/generic/cubeyuv/Makefile
-tests/examples/gl/generic/doublecube/Makefile
-tests/examples/gl/generic/recordgraphic/Makefile
-tests/examples/gl/gtk/Makefile
-tests/examples/gl/gtk/3dvideo/Makefile
-tests/examples/gl/gtk/filternovideooverlay/Makefile
-tests/examples/gl/gtk/filtervideooverlay/Makefile
-tests/examples/gl/gtk/fxtest/Makefile
-tests/examples/gl/gtk/switchvideooverlay/Makefile
-tests/examples/gl/qt/Makefile
-tests/examples/gl/sdl/Makefile
tests/examples/gtk/Makefile
tests/examples/ipcpipeline/Makefile
tests/examples/mpegts/Makefile
@@ -3779,7 +2699,6 @@ ext/directfb/Makefile
ext/wayland/Makefile
ext/daala/Makefile
ext/dts/Makefile
-ext/gl/Makefile
ext/gtk/Makefile
ext/faac/Makefile
ext/faad/Makefile
@@ -3846,8 +2765,6 @@ pkgconfig/gstreamer-codecparsers.pc
pkgconfig/gstreamer-codecparsers-uninstalled.pc
pkgconfig/gstreamer-insertbin.pc
pkgconfig/gstreamer-insertbin-uninstalled.pc
-pkgconfig/gstreamer-gl.pc
-pkgconfig/gstreamer-gl-uninstalled.pc
pkgconfig/gstreamer-mpegts.pc
pkgconfig/gstreamer-mpegts-uninstalled.pc
pkgconfig/gstreamer-player.pc
diff --git a/docs/libs/Makefile.am b/docs/libs/Makefile.am
index a5ae1f845..dfc20ff53 100644
--- a/docs/libs/Makefile.am
+++ b/docs/libs/Makefile.am
@@ -40,9 +40,7 @@ IGNORE_HFILES = \
$(top_srcdir)/gst-libs/gst/mpegts/gstmpegts-private.h \
$(top_srcdir)/gst-libs/gst/player/gstplayer-signal-dispatcher-private.h \
$(top_srcdir)/gst-libs/gst/player/gstplayer-video-renderer-private.h \
- $(top_srcdir)/gst-libs/gst/player/gstplayer-media-info-private.h \
- $(top_srcdir)/gst-libs/gst/gl/gstglcontext_private.h \
- $(top_srcdir)/gst-libs/gst/gl/gstglsl_private.h
+ $(top_srcdir)/gst-libs/gst/player/gstplayer-media-info-private.h
# Images to copy into HTML directory.
HTML_IMAGES =
@@ -60,7 +58,6 @@ GTKDOC_LIBS = \
$(top_builddir)/gst-libs/gst/audio/libgstbadaudio-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/video/libgstbadvideo-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/codecparsers/libgstcodecparsers-@GST_API_VERSION@.la \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/insertbin/libgstinsertbin-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/mpegts/libgstmpegts-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/player/libgstplayer-@GST_API_VERSION@.la \
diff --git a/docs/libs/gst-plugins-bad-libs-docs.sgml b/docs/libs/gst-plugins-bad-libs-docs.sgml
index 39cecdddf..530af2b4d 100644
--- a/docs/libs/gst-plugins-bad-libs-docs.sgml
+++ b/docs/libs/gst-plugins-bad-libs-docs.sgml
@@ -64,64 +64,6 @@
<xi:include href="xml/gstvideoaggregatorpad.xml" />
</chapter>
- <chapter id="gl">
- <title>OpenGL Helper Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-gl-&GST_API_VERSION;.pc</filename>
- </para>
- <xi:include href="xml/gstglapi.xml"/>
- <xi:include href="xml/gstglbasefilter.xml"/>
- <xi:include href="xml/gstglbasememory.xml"/>
- <xi:include href="xml/gstglbuffer.xml"/>
- <xi:include href="xml/gstglbufferpool.xml"/>
- <xi:include href="xml/gstglcolorconvert.xml"/>
- <xi:include href="xml/gstglcontext.xml"/>
- <!-- Not exposed as public API
- <xi:include href="xml/gstglcontextcocoa.xml"/>
- <xi:include href="xml/gstglcontexteagl.xml"/>
- <xi:include href="xml/gstglcontextegl.xml"/>
- <xi:include href="xml/gstglcontextglx.xml"/>
- <xi:include href="xml/gstglcontextwgl.xml"/>
- -->
- <xi:include href="xml/gstgldisplay.xml"/>
- <!-- Not exposed as public API
- <xi:include href="xml/gstgldisplaycocoa.xml"/>
- <xi:include href="xml/gstgldisplayegl.xml"/>
- -->
- <xi:include href="xml/gstgldisplaywayland.xml"/>
- <xi:include href="xml/gstgldisplayx11.xml"/>
- <xi:include href="xml/gsteglimage.xml"/>
- <xi:include href="xml/gstglfilter.xml"/>
- <xi:include href="xml/gstglframebuffer.xml"/>
- <xi:include href="xml/gstglmemory.xml"/>
- <xi:include href="xml/gstglmemoryegl.xml"/>
- <xi:include href="xml/gstglmemorypbo.xml"/>
- <xi:include href="xml/gstgloverlaycompositor.xml"/>
- <xi:include href="xml/gstglquery.xml"/>
- <xi:include href="xml/gstglrenderbuffer.xml"/>
- <xi:include href="xml/gstglshader.xml"/>
- <xi:include href="xml/gstglsl.xml"/>
- <xi:include href="xml/gstglslstage.xml"/>
- <xi:include href="xml/gstglsyncmeta.xml"/>
- <xi:include href="xml/gstglupload.xml"/>
- <xi:include href="xml/gstglviewconvert.xml"/>
- <xi:include href="xml/gstglwindow.xml"/>
- <!-- Not exposed as public API
- <xi:include href="xml/gstglwindowandroid.xml"/>
- <xi:include href="xml/gstglwindowcocoa.xml"/>
- <xi:include href="xml/gstglwindowdispmanx.xml"/>
- <xi:include href="xml/gstglwindoweagl.xml"/>
- <xi:include href="xml/gstglwindowwayland.xml"/>
- <xi:include href="xml/gstglwindowwin32.xml"/>
- <xi:include href="xml/gstglwindowx11.xml"/>
- -->
- <!-- Some utilities -->
- <xi:include href="xml/gstgldebug.xml"/>
- <xi:include href="xml/gstglformat.xml"/>
- <xi:include href="xml/gstglutils.xml"/>
- </chapter>
-
<chapter id="player">
<title>Player Library</title>
<xi:include href="xml/gstplayer.xml"/>
diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt
index 53a8d8504..7becdeb68 100644
--- a/docs/libs/gst-plugins-bad-libs-sections.txt
+++ b/docs/libs/gst-plugins-bad-libs-sections.txt
@@ -762,1090 +762,6 @@ GstInsertBinPrivate
</SECTION>
<SECTION>
-<FILE>gstglapi</FILE>
-<TITLE>GstGLAPI</TITLE>
-GstGLAPI
-gst_gl_api_to_string
-gst_gl_api_from_string
-GstGLPlatform
-gst_gl_platform_to_string
-gst_gl_platform_from_string
-GST_GL_API_GLES1_NAME
-GST_GL_API_GLES2_NAME
-GST_GL_API_OPENGL3_NAME
-GST_GL_API_OPENGL_NAME
-<SUBSECTION Private>
-GST_GL_CHECK_GL_VERSION
-GSTGLAPI
-GST_GL_EXT_BEGIN
-GST_GL_EXT_END
-GST_GL_EXT_FUNCTION
-GstGLFeatureData
-GstGLFeatureFunction
-</SECTION>
-
-<SECTION>
-<FILE>gstglbuffer</FILE>
-<TITLE>GstGLBuffer</TITLE>
-GstGLBuffer
-gst_gl_buffer_init_once
-gst_is_gl_buffer
-GstGLBufferAllocationParams
-GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER
-gst_gl_buffer_allocation_params_new
-GstGLBufferAllocator
-GstGLBufferAllocatorClass
-GST_GL_BUFFER_ALLOCATOR_NAME
-GST_CAPS_FEATURE_MEMORY_GL_BUFFER
-<SUBSECTION Standard>
-gst_gl_buffer_allocation_params_get_type
-GST_TYPE_GL_BUFFER_ALLOCATION_PARAMS
-GST_GL_BUFFER_CAST
-GST_GL_BUFFER_ALLOCATOR
-GST_GL_BUFFER_ALLOCATOR_CAST
-GST_GL_BUFFER_ALLOCATOR_CLASS
-GST_GL_BUFFER_ALLOCATOR_GET_CLASS
-gst_gl_buffer_allocator_get_type
-GST_IS_GL_BUFFER_ALLOCATOR
-GST_IS_GL_BUFFER_ALLOCATOR_CLASS
-GST_TYPE_GL_BUFFER_ALLOCATOR
-</SECTION>
-
-<SECTION>
-<FILE>gstglbufferpool</FILE>
-<TITLE>GstGLBufferPool</TITLE>
-GstGLBufferPool
-GstGLBufferPoolClass
-gst_gl_buffer_pool_new
-gst_buffer_pool_config_get_gl_allocation_params
-gst_buffer_pool_config_set_gl_allocation_params
-<SUBSECTION Standard>
-gst_gl_buffer_pool_replace_last_buffer
-GstGLBufferPoolPrivate
-GST_GL_BUFFER_POOL
-GST_GL_BUFFER_POOL_CAST
-gst_gl_buffer_pool_get_type
-GST_IS_GL_BUFFER_POOL
-GST_TYPE_GL_BUFFER_POOL
-</SECTION>
-
-<SECTION>
-<FILE>gstglcolorconvert</FILE>
-<TITLE>GstGLColorConvert</TITLE>
-GST_GL_COLOR_CONVERT_FORMATS
-GST_GL_COLOR_CONVERT_VIDEO_CAPS
-GstGLColorConvert
-GstGLColorConvertClass
-gst_gl_color_convert_new
-gst_gl_color_convert_set_caps
-gst_gl_color_convert_transform_caps
-gst_gl_color_convert_fixate_caps
-gst_gl_color_convert_decide_allocation
-gst_gl_color_convert_perform
-<SUBSECTION Standard>
-GstGLColorConvertPrivate
-GST_GL_COLOR_CONVERT
-GST_GL_COLOR_CONVERT_CAST
-GST_GL_COLOR_CONVERT_CLASS
-gst_gl_color_convert_get_type
-GST_IS_GL_COLOR_CONVERT
-GST_IS_GL_COLOR_CONVERT_CLASS
-GST_TYPE_GL_COLOR_CONVERT
-</SECTION>
-
-<SECTION>
-<FILE>gstglcontext</FILE>
-<TITLE>GstGLContext</TITLE>
-GST_GL_CONTEXT_ERROR
-GstGLContextError
-GstGLContextThreadFunc
-GstGLContext
-gst_gl_context_new
-gst_gl_context_new_wrapped
-gst_gl_context_create
-gst_gl_context_destroy
-gst_gl_context_activate
-gst_gl_context_swap_buffers
-gst_gl_context_default_get_proc_address
-gst_gl_context_get_proc_address
-gst_gl_context_get_proc_address_with_platform
-gst_gl_context_get_window
-gst_gl_context_set_window
-gst_gl_context_thread_add
-gst_gl_context_get_display
-gst_gl_context_get_gl_api
-gst_gl_context_get_gl_context
-gst_gl_context_get_gl_platform
-gst_gl_context_get_gl_platform_version
-gst_gl_context_get_current_gl_context
-gst_gl_context_get_current_gl_api
-gst_gl_context_get_thread
-gst_gl_context_can_share
-gst_gl_context_is_shared
-gst_gl_context_set_shared_with
-gst_gl_context_check_feature
-gst_gl_context_check_gl_version
-gst_gl_context_get_gl_version
-gst_gl_context_fill_info
-gst_gl_context_get_current
-<SUBSECTION Standard>
-GST_GL_CONTEXT
-GST_IS_GL_CONTEXT
-GST_TYPE_GL_CONTEXT
-GST_GL_CONTEXT_CLASS
-GST_GL_CONTEXT_GET_CLASS
-GST_IS_GL_CONTEXT_CLASS
-GST_GL_CONTEXT_CAST
-GstGLContextPrivate
-gst_gl_context_get_type
-<SUBSECTION Private>
-gst_gl_context_error_quark
-GST_GL_DEBUG_PROC
-GST_GL_HAVE_DMABUF
-GST_GL_HAVE_EGLATTRIB
-GST_GL_HAVE_GLCHAR
-GST_GL_HAVE_GLEGLIMAGEOES
-GST_GL_HAVE_GLES2
-GST_GL_HAVE_GLES3
-GST_GL_HAVE_GLES3EXT3_H
-GST_GL_HAVE_GLINT64
-GST_GL_HAVE_GLINTPTR
-GST_GL_HAVE_GLSIZEIPTR
-GST_GL_HAVE_GLSYNC
-GST_GL_HAVE_GLUINT64
-GST_GL_HAVE_OPENGL
-GST_GL_HAVE_PLATFORM_CGL
-GST_GL_HAVE_PLATFORM_EAGL
-GST_GL_HAVE_PLATFORM_EGL
-GST_GL_HAVE_PLATFORM_GLX
-GST_GL_HAVE_PLATFORM_WGL
-GST_GL_HAVE_WINDOW_ANDROID
-GST_GL_HAVE_WINDOW_COCOA
-GST_GL_HAVE_WINDOW_DISPMANX
-GST_GL_HAVE_WINDOW_EAGL
-GST_GL_HAVE_WINDOW_WAYLAND
-GST_GL_HAVE_WINDOW_WIN32
-GST_GL_HAVE_WINDOW_X11
-GST_GL_HAVE_WINDOW_VIV_FB
-GST_GL_HAVE_VIV_DIRECTVIV
-</SECTION>
-
-<SECTION>
-<FILE>gstglcontextcocoa</FILE>
-<TITLE>GstGLContextCocoa</TITLE>
-GstGLContextCocoa
-gst_gl_context_cocoa_new
-gst_gl_context_cocoa_get_current_context
-gst_gl_context_cocoa_get_pixel_format
-<SUBSECTION Standard>
-GST_GL_CONTEXT_COCOA
-GST_IS_GL_CONTEXT_COCOA
-GST_TYPE_GL_CONTEXT_COCOA
-GST_GL_CONTEXT_COCOA_CLASS
-GST_GL_CONTEXT_COCOA_GET_CLASS
-GST_IS_GL_CONTEXT_COCOA_CLASS
-GST_GL_CONTEXT_COCOA_CAST
-GstGLContextCocoaPrivate
-gst_gl_context_cocoa_get_type
-<SUBSECTION Private>
-gst_gl_context_cocoa_dump_pixel_format
-</SECTION>
-
-<SECTION>
-<FILE>gstglcontextegl</FILE>
-<TITLE>GstGLContextEGL</TITLE>
-GstGLContextEGL
-gst_gl_context_egl_new
-gst_gl_context_egl_get_current_context
-gst_gl_context_egl_get_proc_address
-gst_egl_get_error_string
-<SUBSECTION Standard>
-GST_GL_CONTEXT_EGL
-GST_IS_GL_CONTEXT_EGL
-GST_TYPE_GL_CONTEXT_EGL
-GST_GL_CONTEXT_EGL_CLASS
-GST_GL_CONTEXT_EGL_GET_CLASS
-GST_IS_GL_CONTEXT_EGL_CLASS
-GST_GL_CONTEXT_EGL_CAST
-GstGLContextEGLPrivate
-gst_gl_context_egl_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstglcontextglx</FILE>
-<TITLE>GstGLContextGLX</TITLE>
-GstGLContextGLX
-gst_gl_context_glx_new
-gst_gl_context_glx_get_current_context
-gst_gl_context_glx_get_proc_address
-<SUBSECTION Standard>
-GST_GL_CONTEXT_GLX
-GST_IS_GL_CONTEXT_GLX
-GST_TYPE_GL_CONTEXT_GLX
-GST_GL_CONTEXT_GLX_CLASS
-GST_GL_CONTEXT_GLX_GET_CLASS
-GST_IS_GL_CONTEXT_GLX_CLASS
-GST_GL_CONTEXT_GLX_CAST
-GstGLContextGLXPrivate
-gst_gl_context_glx_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstglcontextwgl</FILE>
-<TITLE>GstGLContextWGL</TITLE>
-GstGLContextWGL
-gst_gl_context_wgl_new
-gst_gl_context_wgl_get_current_context
-gst_gl_context_wgl_get_proc_address
-<SUBSECTION Standard>
-GST_GL_CONTEXT_WGL
-GST_IS_GL_CONTEXT_WGL
-GST_TYPE_GL_CONTEXT_WGL
-GST_GL_CONTEXT_WGL_CLASS
-GST_GL_CONTEXT_WGL_GET_CLASS
-GST_IS_GL_CONTEXT_WGL_CLASS
-GST_GL_CONTEXT_WGL_CAST
-GstGLContextWGLPrivate
-gst_gl_context_wgl_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstglcontexteagl</FILE>
-<TITLE>GstGLContextEagl</TITLE>
-GstGLContextEagl
-gst_gl_context_eagl_new
-gst_gl_context_eagl_get_current_context
-<SUBSECTION Standard>
-GST_GL_CONTEXT_EAGL
-GST_IS_GL_CONTEXT_EAGL
-GST_TYPE_GL_CONTEXT_EAGL
-GST_GL_CONTEXT_EAGL_CLASS
-GST_GL_CONTEXT_EAGL_GET_CLASS
-GST_IS_GL_CONTEXT_EAGL_CLASS
-GST_GL_CONTEXT_EAGL_CAST
-GstGLContextEaglPrivate
-
-<SUBSECTION Private>
-gst_gl_context_eagl_get_type
-gst_gl_context_eagl_prepare_draw
-gst_gl_context_eagl_finish_draw
-gst_gl_context_eagl_resize
-gst_gl_context_eagl_update_layer
-</SECTION>
-
-<SECTION>
-<FILE>gstgldisplay</FILE>
-<TITLE>GstGLDisplay</TITLE>
-GST_GL_DISPLAY_CONTEXT_TYPE
-GstGLDisplayType
-GstGLDisplay
-gst_gl_display_new
-gst_gl_display_get_handle_type
-gst_gl_display_filter_gl_api
-gst_gl_display_get_gl_api
-gst_gl_display_add_context
-gst_gl_display_get_gl_context_for_thread
-gst_gl_display_get_handle
-gst_gl_display_create_context
-gst_gl_display_create_window
-gst_gl_display_find_window
-gst_gl_display_remove_window
-gst_context_get_gl_display
-gst_context_set_gl_display
-<SUBSECTION Standard>
-GST_GL_DISPLAY
-GST_IS_GL_DISPLAY
-GST_TYPE_GL_DISPLAY
-GST_GL_DISPLAY_CLASS
-GST_GL_DISPLAY_GET_CLASS
-GST_IS_GL_DISPLAY_CLASS
-GST_GL_DISPLAY_CAST
-GstGLDisplayPrivate
-gst_gl_display_get_type
-<SUBSECTION Private>
-gst_gl_display_lock
-gst_gl_display_unlock
-gst_gl_display_get_gl_api_unlocked
-</SECTION>
-
-<SECTION>
-<FILE>gstgldisplaycocoa</FILE>
-<TITLE>GstGLDisplayCocoa</TITLE>
-gst_gl_display_cocoa_new
-<SUBSECTION Standard>
-GstGLDisplayCocoa
-GstGLDisplayCocoaClass
-GST_TYPE_GL_DISPLAY_COCOA
-gst_gl_display_cocoa_get_type
-GST_GL_DISPLAY_COCOA
-GST_GL_DISPLAY_COCOA_CAST
-GST_GL_DISPLAY_COCOA_CLASS
-GST_IS_GL_DISPLAY_COCOA
-GST_IS_GL_DISPLAY_COCOA_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstgldisplayegl</FILE>
-<TITLE>GstGLDisplayEGL</TITLE>
-gst_gl_display_egl_new
-gst_gl_display_egl_new_with_egl_display
-gst_gl_display_egl_from_gl_display
-gst_gl_display_egl_get_from_native
-<SUBSECTION Standard>
-GstGLDisplayEGL
-GstGLDisplayEGLClass
-GST_GL_DISPLAY_EGL
-GST_GL_DISPLAY_EGL_CAST
-GST_GL_DISPLAY_EGL_CLASS
-GST_TYPE_GL_DISPLAY_EGL
-gst_gl_display_egl_get_type
-GST_IS_GL_DISPLAY_EGL
-GST_IS_GL_DISPLAY_EGL_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstgldisplaywayland</FILE>
-<TITLE>GstGLDisplayWayland</TITLE>
-gst_gl_display_wayland_new
-gst_gl_display_wayland_new_with_display
-<SUBSECTION Standard>
-GST_TYPE_GL_DISPLAY_WAYLAND
-gst_gl_display_wayland_get_type
-GST_GL_DISPLAY_WAYLAND
-GST_GL_DISPLAY_WAYLAND_CAST
-GST_GL_DISPLAY_WAYLAND_CLASS
-GST_IS_GL_DISPLAY_WAYLAND
-GST_IS_GL_DISPLAY_WAYLAND_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstgldisplayx11</FILE>
-<TITLE>GstGLDisplayX11</TITLE>
-gst_gl_display_x11_new
-gst_gl_display_x11_new_with_display
-<SUBSECTION Standard>
-GST_TYPE_GL_DISPLAY_X11
-gst_gl_display_x11_get_type
-GST_GL_DISPLAY_X11
-GST_GL_DISPLAY_X11_CAST
-GST_GL_DISPLAY_X11_CLASS
-GST_IS_GL_DISPLAY_X11
-GST_IS_GL_DISPLAY_X11_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstgldebug</FILE>
-GstGLAsyncDebugLogGetMessage
-<TITLE>OpenGL Debugging</TITLE>
-GstGLAsyncDebug
-gst_gl_async_debug_new
-gst_gl_async_debug_free
-gst_gl_async_debug_init
-gst_gl_async_debug_unset
-gst_gl_async_debug_freeze
-gst_gl_async_debug_thaw
-gst_gl_async_debug_output_log_msg
-gst_gl_async_debug_store_log_msg
-gst_gl_async_debug_store_log_msg_valist
-GST_GL_ASYNC_CAT_LEVEL_LOG_valist
-GST_GL_ASYNC_CAT_LEVEL_LOG
-gst_gl_insert_debug_marker
-</SECTION>
-
-<SECTION>
-<FILE>gstglbasefilter</FILE>
-<TITLE>GstGLBaseFilter</TITLE>
-GstGLBaseFilter
-GstGLBaseFilterClass
-<SUBSECTION Standard>
-GST_GL_BASE_FILTER
-GST_IS_GL_BASE_FILTER
-GST_TYPE_GL_BASE_FILTER
-gst_gl_base_filter_get_type
-GST_GL_BASE_FILTER_CLASS
-GST_IS_GL_BASE_FILTER_CLASS
-GST_GL_BASE_FILTER_GET_CLASS
-GstGLBaseFilterPrivate
-</SECTION>
-
-<SECTION>
-<FILE>gsteglimage</FILE>
-<TITLE>GstEGLImage</TITLE>
-gst_egl_image_from_dmabuf
-gst_egl_image_from_texture
-gst_egl_image_get_image
-gst_egl_image_new_wrapped
-gst_egl_image_ref
-gst_egl_image_unref
-GstEGLImageDestroyNotify
-<SUBSECTION Standard>
-GST_TYPE_EGL_IMAGE
-gst_egl_image_get_type
-GST_EGL_IMAGE
-GST_EGL_IMAGE_CAST
-GST_IS_EGL_IMAGE
-</SECTION>
-
-<SECTION>
-<FILE>gstglfilter</FILE>
-<TITLE>GstGLFilter</TITLE>
-GstGLFilter
-GstGLFilterClass
-GstGLFilterRenderFunc
-gst_gl_filter_render_to_target
-gst_gl_filter_render_to_target_with_shader
-gst_gl_filter_filter_texture
-gst_gl_filter_draw_fullscreen_quad
-<SUBSECTION Standard>
-GST_GL_FILTER
-GST_IS_GL_FILTER
-GST_TYPE_GL_FILTER
-gst_gl_filter_get_type
-GST_GL_FILTER_CLASS
-GST_IS_GL_FILTER_CLASS
-GST_GL_FILTER_GET_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstglformat</FILE>
-<TITLE>OpenGL Formats</TITLE>
-GstGLTextureTarget
-GST_GL_TEXTURE_TARGET_2D_STR
-GST_GL_TEXTURE_TARGET_RECTANGLE_STR
-GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR
-GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D
-GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE
-GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES
-GstGLFormat
-gst_gl_format_type_n_bytes
-gst_gl_format_from_video_info
-gst_gl_sized_gl_format_from_gl_format_type
-gst_gl_texture_target_from_string
-gst_gl_texture_target_to_string
-gst_gl_texture_target_to_gl
-gst_gl_texture_target_from_gl
-gst_gl_texture_target_to_buffer_pool_option
-<SUBSECTION Standard>
-</SECTION>
-
-<SECTION>
-<FILE>gstglframebuffer</FILE>
-<TITLE>GstGLFramebuffer</TITLE>
-GstGLFramebuffer
-GstGLFramebufferClass
-gst_gl_framebuffer_new
-gst_gl_framebuffer_new_with_default_depth
-gst_gl_framebuffer_attach
-gst_gl_framebuffer_bind
-gst_gl_context_clear_framebuffer
-GstGLFramebufferFunc
-gst_gl_framebuffer_draw_to_texture
-gst_gl_framebuffer_get_effective_dimensions
-gst_gl_framebuffer_get_id
-gst_gl_context_check_framebuffer_status
-<SUBSECTION Standard>
-GstGLFramebufferPrivate
-GST_GL_FRAMEBUFFER
-GST_GL_FRAMEBUFFER_CAST
-GST_IS_GL_FRAMEBUFFER
-GST_TYPE_GL_FRAMEBUFFER
-gst_gl_framebuffer_get_type
-GST_GL_FRAMEBUFFER_CLASS
-GST_IS_GL_FRAMEBUFFER_CLASS
-GST_GL_FRAMEBUFFER_GET_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstglbasememory</FILE>
-GstGLBaseMemoryAllocator
-GstGLBaseMemoryAllocatorClass
-GST_GL_BASE_MEMORY_ALLOCATOR_NAME
-GST_MAP_GL
-GstGLBaseMemoryError
-GST_GL_BASE_MEMORY_ERROR
-GstGLBaseMemoryTransfer
-GstGLAllocationParams
-GstGLAllocationParamsCopyFunc
-GstGLAllocationParamsFreeFunc
-GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_ALLOC
-GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM
-GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE
-GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_USER
-gst_gl_allocation_params_init
-gst_gl_allocation_params_copy
-gst_gl_allocation_params_free
-gst_gl_allocation_params_free_data
-gst_gl_allocation_params_copy_data
-<TITLE>GstGLBaseMemory</TITLE>
-GstGLBaseMemory
-gst_gl_base_memory_init_once
-gst_gl_base_memory_init
-gst_is_gl_base_memory
-GstGLBaseMemoryAllocatorAllocFunction
-GstGLBaseMemoryAllocatorCreateFunction
-GstGLBaseMemoryAllocatorMapFunction
-GstGLBaseMemoryAllocatorUnmapFunction
-GstGLBaseMemoryAllocatorCopyFunction
-GstGLBaseMemoryAllocatorDestroyFunction
-gst_gl_base_memory_alloc
-gst_gl_base_memory_alloc_data
-gst_gl_base_memory_memcpy
-<SUBSECTION Standard>
-GST_TYPE_GL_ALLOCATION_PARAMS
-gst_gl_allocation_params_get_type
-gst_gl_base_memory_error_quark
-GST_TYPE_GL_BASE_MEMORY
-gst_gl_base_memory_get_type
-GST_GL_BASE_MEMORY_CAST
-GST_GL_BASE_MEMORY_ALLOCATOR
-GST_GL_BASE_MEMORY_ALLOCATOR_CAST
-GST_GL_BASE_MEMORY_ALLOCATOR_CLASS
-GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS
-gst_gl_base_memory_allocator_get_type
-GST_IS_GL_BASE_MEMORY_ALLOCATOR
-GST_IS_GL_BASE_MEMORY_ALLOCATOR_CLASS
-GST_TYPE_GL_BASE_MEMORY_ALLOCATOR
-</SECTION>
-
-<SECTION>
-<FILE>gstglmemory</FILE>
-<TITLE>GstGLMemory</TITLE>
-GST_GL_MEMORY_VIDEO_FORMATS_STR
-GST_CAPS_FEATURE_MEMORY_GL_MEMORY
-GstGLVideoAllocationParams
-GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO
-gst_gl_video_allocation_params_copy_data
-gst_gl_video_allocation_params_free_data
-gst_gl_video_allocation_params_init_full
-gst_gl_video_allocation_params_new
-gst_gl_video_allocation_params_new_wrapped_data
-gst_gl_video_allocation_params_new_wrapped_gl_handle
-gst_gl_video_allocation_params_new_wrapped_texture
-GstGLMemoryAllocator
-GstGLMemoryAllocatorClass
-gst_gl_memory_allocator_get_default
-gst_gl_memory_init_once
-GstGLMemory
-gst_gl_memory_init
-gst_is_gl_memory
-GST_GL_MEMORY_ALLOCATOR_NAME
-gst_gl_memory_copy_into
-gst_gl_memory_copy_teximage
-gst_gl_memory_read_pixels
-gst_gl_memory_texsubimage
-gst_gl_memory_get_texture_height
-gst_gl_memory_get_texture_id
-gst_gl_memory_get_texture_target
-gst_gl_memory_get_texture_format
-gst_gl_memory_get_texture_width
-gst_gl_memory_setup_buffer
-<SUBSECTION Standard>
-gst_gl_video_allocation_params_get_type
-GST_TYPE_GL_VIDEO_ALLOCATION_PARAMS
-GST_GL_MEMORY_CAST
-GST_GL_MEMORY_ALLOCATOR
-GST_GL_MEMORY_ALLOCATOR_CAST
-GST_GL_MEMORY_ALLOCATOR_CLASS
-GST_GL_MEMORY_ALLOCATOR_GET_CLASS
-gst_gl_memory_allocator_get_type
-GST_IS_GL_MEMORY_ALLOCATOR
-GST_IS_GL_MEMORY_ALLOCATOR_CLASS
-GST_TYPE_GL_MEMORY_ALLOCATOR
-</SECTION>
-
-<SECTION>
-<FILE>gstglmemoryegl</FILE>
-GstGLMemoryEGLAllocator
-GstGLMemoryEGLAllocatorClass
-GST_GL_MEMORY_EGL_ALLOCATOR_NAME
-<TITLE>GstGLMemoryEGL</TITLE>
-GstGLMemoryEGL
-gst_gl_memory_egl_init_once
-gst_gl_memory_egl_get_display
-gst_gl_memory_egl_get_image
-gst_is_gl_memory_egl
-<SUBSECTION Standard>
-GST_GL_MEMORY_EGL_CAST
-GST_GL_MEMORY_EGL_ALLOCATOR
-GST_GL_MEMORY_EGL_ALLOCATOR_CAST
-GST_GL_MEMORY_EGL_ALLOCATOR_CLASS
-GST_GL_MEMORY_EGL_ALLOCATOR_GET_CLASS
-gst_gl_memory_egl_allocator_get_type
-GST_IS_GL_MEMORY_EGL_ALLOCATOR
-GST_IS_GL_MEMORY_EGL_ALLOCATOR_CLASS
-GST_TYPE_GL_MEMORY_EGL_ALLOCATOR
-</SECTION>
-
-<SECTION>
-<FILE>gstglmemorypbo</FILE>
-GstGLMemoryPBOAllocator
-GstGLMemoryPBOAllocatorClass
-GST_GL_MEMORY_PBO_ALLOCATOR_NAME
-<TITLE>GstGLMemoryPBO</TITLE>
-GstGLMemoryPBO
-gst_is_gl_memory_pbo
-gst_gl_memory_pbo_copy_into_texture
-gst_gl_memory_pbo_download_transfer
-gst_gl_memory_pbo_init_once
-gst_gl_memory_pbo_upload_transfer
-<SUBSECTION Standard>
-GST_GL_MEMORY_PBO_CAST
-GST_GL_MEMORY_PBO_ALLOCATOR
-GST_GL_MEMORY_PBO_ALLOCATOR_CAST
-GST_GL_MEMORY_PBO_ALLOCATOR_CLASS
-GST_GL_MEMORY_PBO_ALLOCATOR_GET_CLASS
-gst_gl_memory_pbo_allocator_get_type
-GST_IS_GL_MEMORY_PBO_ALLOCATOR
-GST_IS_GL_MEMORY_PBO_ALLOCATOR_CLASS
-GST_TYPE_GL_MEMORY_PBO_ALLOCATOR
-</SECTION>
-
-<SECTION>
-<FILE>gstgloverlaycompositor</FILE>
-<TITLE>GstGLOverlayCompositor</TITLE>
-gst_gl_overlay_compositor_new
-gst_gl_overlay_compositor_add_caps
-gst_gl_overlay_compositor_draw_overlays
-gst_gl_overlay_compositor_upload_overlays
-gst_gl_overlay_compositor_free_overlays
-<SUBSECTION Standard>
-GST_TYPE_GL_OVERLAY_COMPOSITOR
-gst_gl_overlay_compositor_get_type
-GST_GL_OVERLAY_COMPOSITOR
-GST_GL_OVERLAY_COMPOSITOR_CAST
-GST_GL_OVERLAY_COMPOSITOR_CLASS
-GST_IS_GL_OVERLAY_COMPOSITOR
-GST_IS_GL_OVERLAY_COMPOSITOR_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstglquery</FILE>
-<TITLE>GstGLQuery</TITLE>
-GstGLQueryType
-gst_gl_query_counter
-gst_gl_query_counter_log
-gst_gl_query_counter_log_valist
-gst_gl_query_end
-gst_gl_query_free
-gst_gl_query_init
-gst_gl_query_new
-gst_gl_query_result
-gst_gl_query_start
-gst_gl_query_start_log
-gst_gl_query_start_log_valist
-gst_gl_query_unset
-</SECTION>
-
-<SECTION>
-<FILE>gstglrenderbuffer</FILE>
-<TITLE>GstGLRenderbuffer</TITLE>
-GstGLRenderbufferAllocator
-GstGLRenderbufferAllocatorClass
-GST_GL_RENDERBUFFER_ALLOCATOR_NAME
-gst_gl_renderbuffer_allocation_params_new
-gst_gl_renderbuffer_allocation_params_new_wrapped
-gst_gl_renderbuffer_get_height
-gst_gl_renderbuffer_get_id
-gst_gl_renderbuffer_get_format
-gst_gl_renderbuffer_get_width
-gst_gl_renderbuffer_init_once
-gst_is_gl_renderbuffer
-<SUBSECTION Standard>
-GST_TYPE_RENDERBUFFER_ALLOCATION_PARAMS
-gst_gl_renderbuffer_allocation_params_get_type
-GST_GL_RENDERBUFFER_CAST
-GST_GL_RENDERBUFFER_ALLOCATOR
-GST_GL_RENDERBUFFER_ALLOCATOR_CAST
-GST_GL_RENDERBUFFER_ALLOCATOR_CLASS
-GST_GL_RENDERBUFFER_ALLOCATOR_GET_CLASS
-GST_TYPE_GL_RENDERBUFFER_ALLOCATOR
-gst_gl_renderbuffer_allocator_get_type
-GST_IS_GL_RENDERBUFFER_ALLOCATOR
-GST_IS_GL_RENDERBUFFER_ALLOCATOR_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstglshader</FILE>
-<TITLE>GstGLShader</TITLE>
-GstGLShader
-gst_gl_shader_new
-gst_gl_shader_new_default
-gst_gl_shader_new_link_with_stages
-gst_gl_shader_new_with_stages
-gst_gl_shader_use
-gst_gl_context_clear_shader
-gst_gl_shader_get_program_handle
-gst_gl_shader_release
-gst_gl_shader_release_unlocked
-gst_gl_shader_attach
-gst_gl_shader_attach_unlocked
-gst_gl_shader_compile_attach_stage
-gst_gl_shader_detach
-gst_gl_shader_detach_unlocked
-gst_gl_shader_is_linked
-gst_gl_shader_link
-gst_gl_shader_set_uniform_1i
-gst_gl_shader_set_uniform_1f
-gst_gl_shader_set_uniform_1fv
-gst_gl_shader_set_uniform_1iv
-gst_gl_shader_set_uniform_2f
-gst_gl_shader_set_uniform_2fv
-gst_gl_shader_set_uniform_2i
-gst_gl_shader_set_uniform_2iv
-gst_gl_shader_set_uniform_3f
-gst_gl_shader_set_uniform_3fv
-gst_gl_shader_set_uniform_3i
-gst_gl_shader_set_uniform_3iv
-gst_gl_shader_set_uniform_4f
-gst_gl_shader_set_uniform_4fv
-gst_gl_shader_set_uniform_4i
-gst_gl_shader_set_uniform_4iv
-gst_gl_shader_set_uniform_matrix_2fv
-gst_gl_shader_set_uniform_matrix_2x3fv
-gst_gl_shader_set_uniform_matrix_2x4fv
-gst_gl_shader_set_uniform_matrix_3fv
-gst_gl_shader_set_uniform_matrix_3x2fv
-gst_gl_shader_set_uniform_matrix_3x4fv
-gst_gl_shader_set_uniform_matrix_4fv
-gst_gl_shader_set_uniform_matrix_4x2fv
-gst_gl_shader_set_uniform_matrix_4x3fv
-gst_gl_shader_get_attribute_location
-gst_gl_shader_bind_attribute_location
-gst_gl_shader_bind_frag_data_location
-gst_gl_shader_string_fragment_default
-gst_gl_shader_string_fragment_external_oes_default
-gst_gl_shader_string_vertex_default
-gst_gl_shader_string_vertex_mat4_texture_transform
-gst_gl_shader_string_vertex_mat4_vertex_transform
-<SUBSECTION Standard>
-GstGLShaderPrivate
-GST_GL_SHADER
-GST_IS_GL_SHADER
-GST_TYPE_GL_SHADER
-gst_gl_shader_get_type
-GST_GL_SHADER_CLASS
-GST_IS_GL_SHADER_CLASS
-GST_GL_SHADER_GET_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstglsl</FILE>
-<TITLE>GstGLSL</TITLE>
-GST_GLSL_ERROR
-GstGLSLError
-GstGLSLProfile
-GstGLSLVersion
-gst_glsl_profile_from_string
-gst_glsl_profile_to_string
-gst_glsl_version_from_string
-gst_glsl_version_to_string
-gst_glsl_version_profile_from_string
-gst_glsl_version_profile_to_string
-gst_glsl_string_get_version_profile
-gst_gl_context_supports_glsl_profile_version
-gst_gl_version_to_glsl_version
-<SUBSECTION Standard>
-gst_glsl_error_quark
-</SECTION>
-
-<SECTION>
-<FILE>gstglslstage</FILE>
-<TITLE>GstGLSLStage</TITLE>
-GstGLSLStage
-GstGLSLStageClass
-gst_glsl_stage_new
-gst_glsl_stage_new_default_fragment
-gst_glsl_stage_new_default_vertex
-gst_glsl_stage_new_with_string
-gst_glsl_stage_new_with_strings
-gst_glsl_stage_set_strings
-gst_glsl_stage_compile
-gst_glsl_stage_get_handle
-gst_glsl_stage_get_profile
-gst_glsl_stage_get_shader_type
-gst_glsl_stage_get_version
-<SUBSECTION Standard>
-GstGLSLStagePrivate
-gst_glsl_stage_get_type
-GST_TYPE_GLSL_STAGE
-GST_IS_GLSL_STAGE
-GST_IS_GLSL_STAGE_CLASS
-GST_GLSL_STAGE
-GST_GLSL_STAGE_CLASS
-GST_GLSL_STAGE_GET_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstglsyncmeta</FILE>
-<TITLE>GstGLSyncMeta</TITLE>
-GstGLSyncMeta
-gst_gl_sync_meta_get_info
-gst_buffer_add_gl_sync_meta
-gst_buffer_add_gl_sync_meta_full
-gst_buffer_get_gl_sync_meta
-gst_gl_sync_meta_set_sync_point
-gst_gl_sync_meta_wait
-gst_gl_sync_meta_wait_cpu
-GST_BUFFER_POOL_OPTION_GL_SYNC_META
-<SUBSECTION Standard>
-GST_GL_SYNC_META_API_TYPE
-GST_GL_SYNC_META_INFO
-gst_gl_sync_meta_api_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstglupload</FILE>
-<TITLE>GstGLUpload</TITLE>
-GstGLUpload
-gst_gl_upload_new
-gst_gl_upload_set_context
-gst_gl_upload_get_caps
-gst_gl_upload_set_caps
-gst_gl_upload_propose_allocation
-gst_gl_upload_transform_caps
-GstGLUploadReturn
-gst_gl_upload_perform_with_buffer
-gst_gl_upload_get_input_template_caps
-<SUBSECTION Standard>
-GST_GL_UPLOAD
-GST_GL_UPLOAD_CAST
-GST_GL_UPLOAD_CLASS
-GST_GL_UPLOAD_GET_CLASS
-gst_gl_upload_get_type
-GST_IS_GL_UPLOAD
-GST_IS_GL_UPLOAD_CLASS
-GST_TYPE_GL_UPLOAD
-GstGLUploadPrivate
-</SECTION>
-
-<SECTION>
-<FILE>gstglutils</FILE>
-<TITLE>OpenGL Miscellaneous Utilities</TITLE>
-gst_gl_handle_set_context
-gst_gl_handle_context_query
-gst_gl_ensure_element_data
-gst_gl_query_local_gl_context
-gst_gl_get_plane_data_size
-gst_gl_get_plane_start
-gst_gl_value_get_texture_target_mask
-gst_gl_value_set_texture_target
-gst_gl_value_set_texture_target_from_mask
-gst_gl_check_extension
-</SECTION>
-
-<SECTION>
-<FILE>gstglviewconvert</FILE>
-<TITLE>GstGLViewConvert</TITLE>
-GstGLStereoDownmix
-GstGLViewConvert
-GstGLViewConvertClass
-gst_gl_view_convert_new
-gst_gl_view_convert_set_caps
-gst_gl_view_convert_transform_caps
-gst_gl_view_convert_fixate_caps
-gst_gl_view_convert_submit_input_buffer
-gst_gl_view_convert_get_output
-gst_gl_view_convert_perform
-gst_gl_view_convert_reset
-gst_gl_view_convert_set_context
-<SUBSECTION Standard>
-GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE
-gst_gl_stereo_downmix_mode_get_type
-GST_IS_GL_VIEW_CONVERT
-GST_IS_GL_VIEW_CONVERT_CLASS
-GST_TYPE_GL_VIEW_CONVERT
-GST_GL_VIEW_CONVERT
-GST_GL_VIEW_CONVERT_CLASS
-GST_GL_VIEW_CONVERT_GET_CLASS
-gst_gl_view_convert_get_type
-GstGLViewConvertPrivate
-</SECTION>
-
-<SECTION>
-<FILE>gstglwindow</FILE>
-<TITLE>GstGLWindow</TITLE>
-GstGLWindowError
-gst_gl_window_error_quark
-GST_GL_WINDOW_ERROR
-GstGLWindowResizeCB
-GST_GL_WINDOW_RESIZE_CB
-GstGLWindowCB
-GST_GL_WINDOW_CB
-GstGLWindow
-GstGLWindowClass
-gst_gl_window_new
-gst_gl_window_draw
-gst_gl_window_quit
-gst_gl_window_run
-gst_gl_window_get_context
-gst_gl_window_get_display
-gst_gl_window_send_message
-gst_gl_window_send_message_async
-gst_gl_window_set_close_callback
-gst_gl_window_set_draw_callback
-gst_gl_window_set_resize_callback
-gst_gl_window_set_window_handle
-gst_gl_window_get_window_handle
-gst_gl_window_set_preferred_size
-gst_gl_window_show
-gst_gl_window_get_surface_dimensions
-gst_gl_window_handle_events
-gst_gl_window_queue_resize
-gst_gl_window_resize
-gst_gl_window_set_render_rectangle
-<SUBSECTION Standard>
-GST_IS_GL_WINDOW
-GST_IS_GL_WINDOW_CLASS
-GST_TYPE_GL_WINDOW
-GST_GL_WINDOW
-GST_GL_WINDOW_CLASS
-GST_GL_WINDOW_GET_CLASS
-gst_gl_window_get_type
-GstGLWindowPrivate
-<SUBSECTION Private>
-gst_gl_window_key_event_cb
-gst_gl_window_mouse_event_cb
-gst_gl_window_send_key_event
-gst_gl_window_send_key_event_async
-gst_gl_window_send_mouse_event
-gst_gl_window_send_mouse_event_async
-GST_GL_WINDOW_GET_LOCK
-GST_GL_WINDOW_LOCK
-GST_GL_WINDOW_UNLOCK
-</SECTION>
-
-<SECTION>
-<FILE>gstglwindowandroid</FILE>
-<TITLE>GstGLWindowAndroid</TITLE>
-GstGLWindowAndroidEGL
-GstGLWindowAndroidEGLClass
-gst_gl_window_android_egl_new
-<SUBSECTION Standard>
-GST_IS_GL_WINDOW_ANDROID_EGL
-GST_IS_GL_WINDOW_ANDROID_EGL_CLASS
-GST_TYPE_GL_WINDOW_ANDROID_EGL
-GST_GL_WINDOW_ANDROID_EGL
-GST_GL_WINDOW_ANDROID_EGL_CLASS
-GST_GL_WINDOW_ANDROID_EGL_GET_CLASS
-gst_gl_window_android_egl_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstglwindowcocoa</FILE>
-<TITLE>GstGLWindowCocoa</TITLE>
-GstGLWindowCocoa
-GstGLWindowCocoaClass
-gst_gl_window_cocoa_new
-gst_gl_window_cocoa_create_window
-<SUBSECTION Standard>
-GST_IS_GL_WINDOW_COCOA
-GST_IS_GL_WINDOW_COCOA_CLASS
-GST_TYPE_GL_WINDOW_COCOA
-GST_GL_WINDOW_COCOA
-GST_GL_WINDOW_COCOA_CLASS
-GST_GL_WINDOW_COCOA_GET_CLASS
-gst_gl_window_cocoa_get_type
-GstGLWindowCocoaPrivate
-<SUBSECTION Private>
-gst_gl_window_cocoa_draw_thread
-</SECTION>
-
-<SECTION>
-<FILE>gstglwindowdispmanx</FILE>
-<TITLE>GstGLWindowDispmanx</TITLE>
-GstGLWindowDispmanxEGL
-GstGLWindowDispmanxEGLClass
-gst_gl_window_dispmanx_egl_new
-<SUBSECTION Standard>
-GST_IS_GL_WINDOW_DISPMANX_EGL
-GST_IS_GL_WINDOW_DISPMANX_EGL_CLASS
-GST_TYPE_GL_WINDOW_DISPMANX_EGL
-GST_GL_WINDOW_DISPMANX_EGL
-GST_GL_WINDOW_DISPMANX_EGL_CLASS
-GST_GL_WINDOW_DISPMANX_EGL_GET_CLASS
-gst_gl_window_dispmanx_egl_get_type
-<SUBSECTION Private>
-gst_gl_window_dispmanx_egl_create_window
-</SECTION>
-
-<SECTION>
-<FILE>gstglwindoweagl</FILE>
-<TITLE>GstGLWindowEagl</TITLE>
-<SUBSECTION Standard>
-GST_IS_GL_WINDOW_EAGL
-GST_IS_GL_WINDOW_EAGL_CLASS
-GST_GL_TYPE_WINDOW_EAGL
-GST_GL_WINDOW_EAGL
-GST_GL_WINDOW_EAGL_CLASS
-GST_GL_WINDOW_EAGL_GET_CLASS
-gst_gl_window_eagl_get_type
-<SUBSECTION Private>
-GST_TYPE_GL_WINDOW_EAGL
-GstGLWindowEagl
-GstGLWindowEaglClass
-GstGLWindowEaglPrivate
-gst_gl_window_eagl_new
-</SECTION>
-
-<SECTION>
-<FILE>gstglwindowwayland</FILE>
-<TITLE>GstGLWindowWayland</TITLE>
-GstGLWindowWaylandEGL
-GstGLWindowWaylandEGLClass
-gst_gl_window_wayland_egl_new
-<SUBSECTION Standard>
-GST_IS_GL_WINDOW_WAYLAND_EGL
-GST_IS_GL_WINDOW_WAYLAND_EGL_CLASS
-GST_TYPE_GL_WINDOW_WAYLAND_EGL
-GST_GL_WINDOW_WAYLAND_EGL
-GST_GL_WINDOW_WAYLAND_EGL_CLASS
-GST_GL_WINDOW_WAYLAND_EGL_GET_CLASS
-gst_gl_window_wayland_egl_get_type
-wayland_event_source_new
-<SUBSECTION Private>
-gst_gl_window_wayland_egl_create_window
-</SECTION>
-
-<SECTION>
-<FILE>gstglwindowwin32</FILE>
-<TITLE>GstGLWindowWin32</TITLE>
-GstGLWindowWin32
-GstGLWindowWin32Class
-gst_gl_window_win32_new
-gst_gl_window_win32_create_window
-<SUBSECTION Standard>
-GST_IS_GL_WINDOW_WIN32
-GST_IS_GL_WINDOW_WIN32_CLASS
-GST_TYPE_GL_WINDOW_WIN32
-GST_GL_WINDOW_WIN32
-GST_GL_WINDOW_WIN32_CLASS
-GST_GL_WINDOW_WIN32_GET_CLASS
-gst_gl_window_win32_get_type
-GstGLWindowWin32Private
-</SECTION>
-
-<SECTION>
-<FILE>gstglwindowx11</FILE>
-<TITLE>GstGLWindowX11</TITLE>
-GstGLWindowX11
-GstGLWindowX11Class
-gst_gl_window_x11_new
-gst_gl_window_x11_create_window
-gst_gl_window_x11_trap_x_errors
-gst_gl_window_x11_untrap_x_errors
-<SUBSECTION Standard>
-GST_IS_GL_WINDOW_X11
-GST_IS_GL_WINDOW_X11_CLASS
-GST_TYPE_GL_WINDOW_X11
-GST_GL_WINDOW_X11
-GST_GL_WINDOW_X11_CLASS
-GST_GL_WINDOW_X11_GET_CLASS
-gst_gl_window_x11_get_type
-GstGLWindowX11Private
-x11_event_source_new
-</SECTION>
-
-<SECTION>
<FILE>gstvideoaggregator</FILE>
<TITLE>GstVideoAggregator</TITLE>
GstVideoAggregator
diff --git a/docs/libs/gst-plugins-bad-libs.types b/docs/libs/gst-plugins-bad-libs.types
index b107113ed..1b3a55534 100644
--- a/docs/libs/gst-plugins-bad-libs.types
+++ b/docs/libs/gst-plugins-bad-libs.types
@@ -6,7 +6,6 @@
#include <gst/codecparsers/gstmpegvideoparser.h>
#include <gst/insertbin/gstinsertbin.h>
#include <gst/mpegts/mpegts.h>
-#include <gst/gl/gl.h>
#include <gst/player/player.h>
gst_audio_aggregator_get_type
@@ -35,29 +34,6 @@ gst_mpegts_stream_type_get_type
gst_insert_bin_get_type
-gst_gl_allocation_params_get_type
-gst_gl_base_memory_allocator_get_type
-gst_gl_buffer_allocation_params_get_type
-gst_gl_buffer_allocator_get_type
-gst_gl_video_allocation_params_get_type
-gst_gl_memory_allocator_get_type
-gst_gl_memory_pbo_allocator_get_type
-gst_gl_renderbuffer_allocation_params_get_type
-gst_gl_renderbuffer_allocator_get_type
-gst_gl_base_filter_get_type
-gst_gl_buffer_pool_get_type
-gst_gl_color_convert_get_type
-gst_gl_context_get_type
-gst_gl_display_get_type
-gst_gl_filter_get_type
-gst_gl_framebuffer_get_type
-gst_gl_shader_get_type
-gst_glsl_stage_get_type
-gst_gl_overlay_compositor_get_type
-gst_gl_upload_get_type
-gst_gl_view_convert_get_type
-gst_gl_window_get_type
-
gst_player_audio_info_get_type
gst_player_color_balance_type_get_type
gst_player_error_get_type
diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am
index 7f9163612..887dc4e91 100644
--- a/docs/plugins/Makefile.am
+++ b/docs/plugins/Makefile.am
@@ -39,7 +39,7 @@ HFILE_GLOB= \
CFILE_GLOB= \
$(top_srcdir)/gst/*/*.c $(top_srcdir)/ext/*/*.c $(top_srcdir)/sys/*/*.c \
$(top_srcdir)/ext/*/*.cc $(top_srcdir)/ext/*/*.cpp $(top_srcdir)/sys/*/*.cpp \
- $(top_srcdir)/ext/*/*.m $(top_srcdir)/sys/*/*.m
+ $(top_srcdir)/sys/*/*.m
# Header files to ignore when scanning.
IGNORE_HFILES =
diff --git a/docs/plugins/gst-plugins-bad-plugins-docs.sgml b/docs/plugins/gst-plugins-bad-plugins-docs.sgml
index be0c0fab4..db624a1d2 100644
--- a/docs/plugins/gst-plugins-bad-plugins-docs.sgml
+++ b/docs/plugins/gst-plugins-bad-plugins-docs.sgml
@@ -57,52 +57,11 @@
<xi:include href="xml/element-fisheye.xml" />
<xi:include href="xml/element-fpsdisplaysink.xml" />
<xi:include href="xml/element-gaussianblur.xml" />
- <xi:include href="xml/element-glcolorbalance.xml" />
- <xi:include href="xml/element-glcolorconvert.xml" />
- <xi:include href="xml/element-glcolorscale.xml" />
- <xi:include href="xml/element-gldeinterlace.xml" />
- <xi:include href="xml/element-gldifferencematte.xml" />
- <xi:include href="xml/element-gldownload.xml" />
- <xi:include href="xml/element-gleffects_blur.xml" />
- <xi:include href="xml/element-gleffects_bulge.xml" />
- <xi:include href="xml/element-gleffects_fisheye.xml" />
- <xi:include href="xml/element-gleffects_glow.xml" />
- <xi:include href="xml/element-gleffects_heat.xml" />
- <xi:include href="xml/element-gleffects_identity.xml" />
- <xi:include href="xml/element-gleffects_laplacian.xml" />
- <xi:include href="xml/element-gleffects_lumaxpro.xml" />
- <xi:include href="xml/element-gleffects_mirror.xml" />
- <xi:include href="xml/element-gleffects_sepia.xml" />
- <xi:include href="xml/element-gleffects_sin.xml" />
- <xi:include href="xml/element-gleffects_sobel.xml" />
- <xi:include href="xml/element-gleffects_square.xml" />
- <xi:include href="xml/element-gleffects_squeeze.xml" />
- <xi:include href="xml/element-gleffects_stretch.xml" />
- <xi:include href="xml/element-gleffects_tunnel.xml" />
- <xi:include href="xml/element-gleffects_twirl.xml" />
- <xi:include href="xml/element-gleffects.xml" />
- <xi:include href="xml/element-gleffects_xpro.xml" />
- <xi:include href="xml/element-gleffects_xray.xml" />
- <xi:include href="xml/element-glfilterapp.xml" />
- <xi:include href="xml/element-glfilterbin.xml" />
- <xi:include href="xml/element-glfiltercube.xml" />
- <xi:include href="xml/element-glfilterglass.xml" />
- <xi:include href="xml/element-glimagesinkelement.xml" />
- <xi:include href="xml/element-glimagesink.xml" />
<xi:include href="xml/element-glmixerbin.xml" />
<xi:include href="xml/element-glmosaic.xml" />
- <xi:include href="xml/element-gloverlay.xml" />
- <xi:include href="xml/element-glshader.xml" />
- <xi:include href="xml/element-glsinkbin.xml" />
- <xi:include href="xml/element-glsrcbin.xml" />
<xi:include href="xml/element-glstereomix.xml" />
- <xi:include href="xml/element-glstereosplit.xml" />
- <xi:include href="xml/element-gltestsrc.xml" />
- <xi:include href="xml/element-gltransformation.xml" />
- <xi:include href="xml/element-glupload.xml" />
<xi:include href="xml/element-glvideomixerelement.xml" />
<xi:include href="xml/element-glvideomixer.xml" />
- <xi:include href="xml/element-glviewconvert.xml" />
<xi:include href="xml/element-iqa.xml" />
<xi:include href="xml/element-jpegparse.xml" />
<xi:include href="xml/element-kaleidoscope.xml" />
@@ -189,7 +148,7 @@
<xi:include href="xml/plugin-neon.xml" />
<xi:include href="xml/plugin-ofa.xml" />
<xi:include href="xml/plugin-openal.xml" />
- <xi:include href="xml/plugin-opengl.xml" />
+ <xi:include href="xml/plugin-openglmixers.xml" />
<xi:include href="xml/plugin-opencv.xml" />
<xi:include href="xml/plugin-pcapparse.xml" />
<xi:include href="xml/plugin-rawparse.xml" />
diff --git a/docs/plugins/gst-plugins-bad-plugins-sections.txt b/docs/plugins/gst-plugins-bad-plugins-sections.txt
index 4912657aa..324e17db6 100644
--- a/docs/plugins/gst-plugins-bad-plugins-sections.txt
+++ b/docs/plugins/gst-plugins-bad-plugins-sections.txt
@@ -1440,231 +1440,6 @@ gst_gdp_pay_get_type
</SECTION>
<SECTION>
-<FILE>element-glcolorbalance</FILE>
-<TITLE>glcolorbalance</TITLE>
-GstGLColorBalance
-<SUBSECTION Standard>
-GstGLColorBalanceClass
-GST_GL_COLOR_BALANCE
-GST_GL_COLOR_BALANCE_CAST
-GST_IS_GL_COLOR_BALANCE
-GST_GL_COLOR_BALANCE_CLASS
-GST_IS_GL_COLOR_BALANCE_CLASS
-GST_TYPE_GL_COLOR_BALANCE
-<SUBSECTION Private>
-gst_gl_color_balance_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glcolorconvert</FILE>
-<TITLE>glcolorconvert</TITLE>
-GstGLColorConvertElement
-<SUBSECTION Standard>
-GstGLColorConvertElementClass
-GST_GL_COLOR_CONVERT_ELEMENT
-GST_GL_COLOR_CONVERT_ELEMENT_CAST
-GST_IS_GL_COLOR_CONVERT_ELEMENT
-GST_GL_COLOR_CONVERT_ELEMENT_CLASS
-GST_IS_GL_COLOR_CONVERT_ELEMENT_CLASS
-GST_TYPE_GL_COLOR_CONVERT_ELEMENT
-<SUBSECTION Private>
-gst_gl_color_convert_element_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glcolorscale</FILE>
-<TITLE>glcolorscale</TITLE>
-GstGLColorscale
-<SUBSECTION Standard>
-GstGLColorscaleClass
-GST_GL_COLORSCALE
-GST_GL_COLORSCALE_CAST
-GST_IS_GL_COLORSCALE
-GST_GL_COLORSCALE_CLASS
-GST_IS_GL_COLORSCALE_CLASS
-GST_TYPE_GL_COLORSCALE
-<SUBSECTION Private>
-gst_gl_colorscale_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gldeinterlace</FILE>
-<TITLE>gldeinterlace</TITLE>
-GstGLDeinterlace
-GstGLDeinterlaceMethod
-<SUBSECTION Standard>
-GstGLDeinterlaceClass
-GST_GL_DEINTERLACE
-GST_GL_DEINTERLACE_CAST
-GST_IS_GL_DEINTERLACE
-GST_GL_DEINTERLACE_CLASS
-GST_IS_GL_DEINTERLACE_CLASS
-GST_TYPE_GL_DEINTERLACE
-<SUBSECTION Private>
-gst_gl_deinterlace_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gldifferencematte</FILE>
-<TITLE>gldifferencematte</TITLE>
-GstGLDifferenceMatte
-<SUBSECTION Standard>
-GstGLDifferenceMatteClass
-GST_GL_DIFFERENCE_MATTE
-GST_GL_DIFFERENCE_MATTE_CAST
-GST_IS_GL_DIFFERENCE_MATTE
-GST_GL_DIFFERENCE_MATTE_CLASS
-GST_IS_GL_DIFFERENCE_MATTE_CLASS
-GST_TYPE_GL_DIFFERENCE_MATTE
-<SUBSECTION Private>
-gst_gl_difference_matte_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gldownload</FILE>
-<TITLE>gldownload</TITLE>
-GstGLDownloadElement
-<SUBSECTION Standard>
-GstGLDownloadElementClass
-GST_GL_DOWNLOAD_ELEMENT
-GST_GL_DOWNLOAD_ELEMENT_CAST
-GST_IS_GL_DOWNLOAD_ELEMENT
-GST_GL_DOWNLOAD_ELEMENT_CLASS
-GST_IS_GL_DOWNLOAD_ELEMENT_CLASS
-GST_TYPE_GL_DOWNLOAD_ELEMENT
-<SUBSECTION Private>
-gst_gl_download_element_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects</FILE>
-<TITLE>gleffects</TITLE>
-GstGLEffectsGeneric
-<SUBSECTION Standard>
-GstGLEffectsGenericClass
-GST_GL_EFFECTS_GENERIC
-GST_GL_EFFECTS_GENERIC_CAST
-GST_IS_GL_EFFECTS_GENERIC
-GST_GL_EFFECTS_GENERIC_CLASS
-GST_IS_GL_EFFECTS_GENERIC_CLASS
-GST_TYPE_GL_EFFECTS_GENERIC
-<SUBSECTION Private>
-gst_gl_effects_generic_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glfilterapp</FILE>
-<TITLE>glfilterapp</TITLE>
-GstGLFilterApp
-<SUBSECTION Standard>
-GstGLFilterAppClass
-GST_GL_FILTER_APP
-GST_GL_FILTER_APP_CAST
-GST_IS_GL_FILTER_APP
-GST_GL_FILTER_APP_CLASS
-GST_IS_GL_FILTER_APP_CLASS
-GST_TYPE_GL_FILTER_APP
-<SUBSECTION Private>
-gst_gl_filter_app_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glfilterbin</FILE>
-<TITLE>glfilterbin</TITLE>
-GstGLFilterBin
-<SUBSECTION Standard>
-GstGLFilterBinClass
-GST_GL_FILTER_BIN
-GST_GL_FILTER_BIN_CAST
-GST_IS_GL_FILTER_BIN
-GST_GL_FILTER_BIN_CLASS
-GST_IS_GL_FILTER_BIN_CLASS
-GST_TYPE_GL_FILTER_BIN
-<SUBSECTION Private>
-gst_gl_filter_bin_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glfiltercube</FILE>
-<TITLE>glfiltercube</TITLE>
-GstGLFilterCube
-<SUBSECTION Standard>
-GstGLFilterCubeClass
-GST_GL_FILTER_CUBE
-GST_GL_FILTER_CUBE_CAST
-GST_IS_GL_FILTER_CUBE
-GST_GL_FILTER_CUBE_CLASS
-GST_IS_GL_FILTER_CUBE_CLASS
-GST_TYPE_GL_FILTER_CUBE
-<SUBSECTION Private>
-gst_gl_filter_cube_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glfilterglass</FILE>
-<TITLE>glfilterglass</TITLE>
-GstGLFilterGlass
-<SUBSECTION Standard>
-GstGLFilterGlassClass
-GST_GL_FILTER_GLASS
-GST_GL_FILTER_GLASS_CAST
-GST_IS_GL_FILTER_GLASS
-GST_GL_FILTER_GLASS_CLASS
-GST_IS_GL_FILTER_GLASS_CLASS
-GST_TYPE_GL_FILTER_GLASS
-<SUBSECTION Private>
-gst_gl_filter_glass_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glshader</FILE>
-<TITLE>glshader</TITLE>
-GstGLFilterShader
-<SUBSECTION Standard>
-GstGLFilterShaderClass
-GST_GL_FILTER_SHADER
-GST_GL_FILTER_SHADER_CAST
-GST_IS_GL_FILTER_SHADER
-GST_GL_FILTER_SHADER_CLASS
-GST_IS_GL_FILTER_SHADER_CLASS
-GST_TYPE_GL_FILTER_SHADER
-<SUBSECTION Private>
-gst_gl_filter_shader_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glimagesinkelement</FILE>
-<TITLE>glimagesinkelement</TITLE>
-GstGLImageSink
-<SUBSECTION Standard>
-GstGLImageSinkClass
-GST_GL_IMAGE_SINK
-GST_GL_IMAGE_SINK_CAST
-GST_IS_GL_IMAGE_SINK
-GST_GL_IMAGE_SINK_CLASS
-GST_IS_GL_IMAGE_SINK_CLASS
-GST_TYPE_GL_IMAGE_SINK
-<SUBSECTION Private>
-gst_gl_image_sink_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glimagesink</FILE>
-<TITLE>glimagesink</TITLE>
-GstGLImageSinkBin
-<SUBSECTION Standard>
-GstGLImageSinkBinClass
-GST_GL_IMAGE_SINK_BIN
-GST_GL_IMAGE_SINK_BIN_CAST
-GST_IS_GL_IMAGE_SINK_BIN
-GST_GL_IMAGE_SINK_BIN_CLASS
-GST_IS_GL_IMAGE_SINK_BIN_CLASS
-GST_TYPE_GL_IMAGE_SINK_BIN
-<SUBSECTION Private>
-gst_gl_image_sink_bin_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-glmixerbin</FILE>
<TITLE>glmixerbin</TITLE>
GstGLMixerBin
@@ -1698,54 +1473,6 @@ gst_gl_mosaic_get_type
</SECTION>
<SECTION>
-<FILE>element-gloverlay</FILE>
-<TITLE>gloverlay</TITLE>
-GstGLOverlay
-<SUBSECTION Standard>
-GstGLOverlayClass
-GST_GL_OVERLAY
-GST_GL_OVERLAY_CAST
-GST_IS_GL_OVERLAY
-GST_GL_OVERLAY_CLASS
-GST_IS_GL_OVERLAY_CLASS
-GST_TYPE_GL_OVERLAY
-<SUBSECTION Private>
-gst_gl_overlay_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glsinkbin</FILE>
-<TITLE>glsinkbin</TITLE>
-GstGLSinkBin
-<SUBSECTION Standard>
-GstGLSinkBinClass
-GST_GL_SINK_BIN
-GST_GL_SINK_BIN_CAST
-GST_IS_GL_SINK_BIN
-GST_GL_SINK_BIN_CLASS
-GST_IS_GL_SINK_BIN_CLASS
-GST_TYPE_GL_SINK_BIN
-<SUBSECTION Private>
-gst_gl_sink_bin_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-glsrcbin</FILE>
-<TITLE>glsrcbin</TITLE>
-GstGLSrcBin
-<SUBSECTION Standard>
-GstGLSrcBinClass
-GST_GL_SRC_BIN
-GST_GL_SRC_BIN_CAST
-GST_IS_GL_SRC_BIN
-GST_GL_SRC_BIN_CLASS
-GST_IS_GL_SRC_BIN_CLASS
-GST_TYPE_GL_SRC_BIN
-<SUBSECTION Private>
-gst_gl_src_bin_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-glstereomix</FILE>
<TITLE>glstereomix</TITLE>
GstGLStereoMix
@@ -1762,68 +1489,6 @@ gst_gl_stereo_mix_get_type
</SECTION>
<SECTION>
-<FILE>element-glstereosplit</FILE>
-<TITLE>glstereosplit</TITLE>
-GstGLStereoSplit
-<SUBSECTION Standard>
-GstGLStereoSplitClass
-GST_GL_STEREO_SPLIT
-GST_GL_STEREO_SPLIT_CAST
-GST_IS_GL_STEREO_SPLIT
-GST_GL_STEREO_SPLIT_CLASS
-GST_IS_GL_STEREO_SPLIT_CLASS
-GST_TYPE_GL_STEREO_SPLIT
-<SUBSECTION Private>
-gst_gl_stereo_split_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gltestsrc</FILE>
-<TITLE>gltestsrc</TITLE>
-GstGLTestSrc
-GstGLTestSrcPattern
-<SUBSECTION Standard>
-GstGLTestSrcClass
-GST_GL_TEST_SRC
-GST_GL_TEST_SRC_CAST
-GST_IS_GL_TEST_SRC
-GST_GL_TEST_SRC_CLASS
-GST_IS_GL_TEST_SRC_CLASS
-GST_TYPE_GL_TEST_SRC
-<SUBSECTION Private>
-gst_gl_test_src_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gltransformation</FILE>
-<TITLE>gltransformation</TITLE>
-GstGLTransformation
-<SUBSECTION Standard>
-GstGLTransformationClass
-GST_GL_TRANSFORMATION
-GST_GL_TRANSFORMATION_CLASS
-GST_IS_GL_TRANSFORMATION
-GST_IS_GL_TRANSFORMATION_CLASS
-GST_TYPE_GL_TRANSFORMATION
-</SECTION>
-
-<SECTION>
-<FILE>element-glupload</FILE>
-<TITLE>glupload</TITLE>
-GstGLUploadElement
-<SUBSECTION Standard>
-GstGLUploadElementClass
-GST_GL_UPLOAD_ELEMENT
-GST_GL_UPLOAD_ELEMENT_CAST
-GST_IS_GL_UPLOAD_ELEMENT
-GST_GL_UPLOAD_ELEMENT_CLASS
-GST_IS_GL_UPLOAD_ELEMENT_CLASS
-GST_TYPE_GL_UPLOAD_ELEMENT
-<SUBSECTION Private>
-gst_gl_upload_element_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-glvideomixerelement</FILE>
<TITLE>glvideomixerelement</TITLE>
GstGLVideoMixer
@@ -1857,22 +1522,6 @@ gst_gl_video_mixer_bin_get_type
</SECTION>
<SECTION>
-<FILE>element-glviewconvert</FILE>
-<TITLE>glviewconvert</TITLE>
-GstGLViewConvertElement
-<SUBSECTION Standard>
-GstGLViewConvertElementClass
-GST_GL_VIEW_CONVERT_ELEMENT
-GST_GL_VIEW_CONVERT_ELEMENT_CAST
-GST_IS_GL_VIEW_CONVERT_ELEMENT
-GST_GL_VIEW_CONVERT_ELEMENT_CLASS
-GST_IS_GL_VIEW_CONVERT_ELEMENT_CLASS
-GST_TYPE_GL_VIEW_CONVERT_ELEMENT
-<SUBSECTION Private>
-gst_gl_view_convert_element_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-gsmdec</FILE>
<TITLE>gsmdec</TITLE>
GstGSMDec
@@ -4398,310 +4047,6 @@ gst_dvd_bin_get_type
</SECTION>
<SECTION>
-<FILE>element-gleffects_blur</FILE>
-<TITLE>gleffects_blur</TITLE>
-Gstffects_blur
-<SUBSECTION Standard>
-Gstffects_blurClass
-GST_FFECTS_BLUR
-GST_FFECTS_BLUR_CAST
-GST_IS_FFECTS_BLUR
-GST_FFECTS_BLUR_CLASS
-GST_IS_FFECTS_BLUR_CLASS
-GST_TYPE_FFECTS_BLUR
-<SUBSECTION Private>
-gst_ffects_blur_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_bulge</FILE>
-<TITLE>gleffects_bulge</TITLE>
-Gstffects_bulge
-<SUBSECTION Standard>
-Gstffects_bulgeClass
-GST_FFECTS_BULGE
-GST_FFECTS_BULGE_CAST
-GST_IS_FFECTS_BULGE
-GST_FFECTS_BULGE_CLASS
-GST_IS_FFECTS_BULGE_CLASS
-GST_TYPE_FFECTS_BULGE
-<SUBSECTION Private>
-gst_ffects_bulge_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_fisheye</FILE>
-<TITLE>gleffects_fisheye</TITLE>
-Gstffects_fisheye
-<SUBSECTION Standard>
-Gstffects_fisheyeClass
-GST_FFECTS_FISHEYE
-GST_FFECTS_FISHEYE_CAST
-GST_IS_FFECTS_FISHEYE
-GST_FFECTS_FISHEYE_CLASS
-GST_IS_FFECTS_FISHEYE_CLASS
-GST_TYPE_FFECTS_FISHEYE
-<SUBSECTION Private>
-gst_ffects_fisheye_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_glow</FILE>
-<TITLE>gleffects_glow</TITLE>
-Gstffects_glow
-<SUBSECTION Standard>
-Gstffects_glowClass
-GST_FFECTS_GLOW
-GST_FFECTS_GLOW_CAST
-GST_IS_FFECTS_GLOW
-GST_FFECTS_GLOW_CLASS
-GST_IS_FFECTS_GLOW_CLASS
-GST_TYPE_FFECTS_GLOW
-<SUBSECTION Private>
-gst_ffects_glow_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_heat</FILE>
-<TITLE>gleffects_heat</TITLE>
-Gstffects_heat
-<SUBSECTION Standard>
-Gstffects_heatClass
-GST_FFECTS_HEAT
-GST_FFECTS_HEAT_CAST
-GST_IS_FFECTS_HEAT
-GST_FFECTS_HEAT_CLASS
-GST_IS_FFECTS_HEAT_CLASS
-GST_TYPE_FFECTS_HEAT
-<SUBSECTION Private>
-gst_ffects_heat_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_identity</FILE>
-<TITLE>gleffects_identity</TITLE>
-Gstffects_identity
-<SUBSECTION Standard>
-Gstffects_identityClass
-GST_FFECTS_IDENTITY
-GST_FFECTS_IDENTITY_CAST
-GST_IS_FFECTS_IDENTITY
-GST_FFECTS_IDENTITY_CLASS
-GST_IS_FFECTS_IDENTITY_CLASS
-GST_TYPE_FFECTS_IDENTITY
-<SUBSECTION Private>
-gst_ffects_identity_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_laplacian</FILE>
-<TITLE>gleffects_laplacian</TITLE>
-Gstffects_laplacian
-<SUBSECTION Standard>
-Gstffects_laplacianClass
-GST_FFECTS_LAPLACIAN
-GST_FFECTS_LAPLACIAN_CAST
-GST_IS_FFECTS_LAPLACIAN
-GST_FFECTS_LAPLACIAN_CLASS
-GST_IS_FFECTS_LAPLACIAN_CLASS
-GST_TYPE_FFECTS_LAPLACIAN
-<SUBSECTION Private>
-gst_ffects_laplacian_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_lumaxpro</FILE>
-<TITLE>gleffects_lumaxpro</TITLE>
-Gstffects_lumaxpro
-<SUBSECTION Standard>
-Gstffects_lumaxproClass
-GST_FFECTS_LUMAXPRO
-GST_FFECTS_LUMAXPRO_CAST
-GST_IS_FFECTS_LUMAXPRO
-GST_FFECTS_LUMAXPRO_CLASS
-GST_IS_FFECTS_LUMAXPRO_CLASS
-GST_TYPE_FFECTS_LUMAXPRO
-<SUBSECTION Private>
-gst_ffects_lumaxpro_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_mirror</FILE>
-<TITLE>gleffects_mirror</TITLE>
-Gstffects_mirror
-<SUBSECTION Standard>
-Gstffects_mirrorClass
-GST_FFECTS_MIRROR
-GST_FFECTS_MIRROR_CAST
-GST_IS_FFECTS_MIRROR
-GST_FFECTS_MIRROR_CLASS
-GST_IS_FFECTS_MIRROR_CLASS
-GST_TYPE_FFECTS_MIRROR
-<SUBSECTION Private>
-gst_ffects_mirror_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_sepia</FILE>
-<TITLE>gleffects_sepia</TITLE>
-Gstffects_sepia
-<SUBSECTION Standard>
-Gstffects_sepiaClass
-GST_FFECTS_SEPIA
-GST_FFECTS_SEPIA_CAST
-GST_IS_FFECTS_SEPIA
-GST_FFECTS_SEPIA_CLASS
-GST_IS_FFECTS_SEPIA_CLASS
-GST_TYPE_FFECTS_SEPIA
-<SUBSECTION Private>
-gst_ffects_sepia_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_sin</FILE>
-<TITLE>gleffects_sin</TITLE>
-Gstffects_sin
-<SUBSECTION Standard>
-Gstffects_sinClass
-GST_FFECTS_SIN
-GST_FFECTS_SIN_CAST
-GST_IS_FFECTS_SIN
-GST_FFECTS_SIN_CLASS
-GST_IS_FFECTS_SIN_CLASS
-GST_TYPE_FFECTS_SIN
-<SUBSECTION Private>
-gst_ffects_sin_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_sobel</FILE>
-<TITLE>gleffects_sobel</TITLE>
-Gstffects_sobel
-<SUBSECTION Standard>
-Gstffects_sobelClass
-GST_FFECTS_SOBEL
-GST_FFECTS_SOBEL_CAST
-GST_IS_FFECTS_SOBEL
-GST_FFECTS_SOBEL_CLASS
-GST_IS_FFECTS_SOBEL_CLASS
-GST_TYPE_FFECTS_SOBEL
-<SUBSECTION Private>
-gst_ffects_sobel_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_square</FILE>
-<TITLE>gleffects_square</TITLE>
-Gstffects_square
-<SUBSECTION Standard>
-Gstffects_squareClass
-GST_FFECTS_SQUARE
-GST_FFECTS_SQUARE_CAST
-GST_IS_FFECTS_SQUARE
-GST_FFECTS_SQUARE_CLASS
-GST_IS_FFECTS_SQUARE_CLASS
-GST_TYPE_FFECTS_SQUARE
-<SUBSECTION Private>
-gst_ffects_square_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_squeeze</FILE>
-<TITLE>gleffects_squeeze</TITLE>
-Gstffects_squeeze
-<SUBSECTION Standard>
-Gstffects_squeezeClass
-GST_FFECTS_SQUEEZE
-GST_FFECTS_SQUEEZE_CAST
-GST_IS_FFECTS_SQUEEZE
-GST_FFECTS_SQUEEZE_CLASS
-GST_IS_FFECTS_SQUEEZE_CLASS
-GST_TYPE_FFECTS_SQUEEZE
-<SUBSECTION Private>
-gst_ffects_squeeze_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_stretch</FILE>
-<TITLE>gleffects_stretch</TITLE>
-Gstffects_stretch
-<SUBSECTION Standard>
-Gstffects_stretchClass
-GST_FFECTS_STRETCH
-GST_FFECTS_STRETCH_CAST
-GST_IS_FFECTS_STRETCH
-GST_FFECTS_STRETCH_CLASS
-GST_IS_FFECTS_STRETCH_CLASS
-GST_TYPE_FFECTS_STRETCH
-<SUBSECTION Private>
-gst_ffects_stretch_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_tunnel</FILE>
-<TITLE>gleffects_tunnel</TITLE>
-Gstffects_tunnel
-<SUBSECTION Standard>
-Gstffects_tunnelClass
-GST_FFECTS_TUNNEL
-GST_FFECTS_TUNNEL_CAST
-GST_IS_FFECTS_TUNNEL
-GST_FFECTS_TUNNEL_CLASS
-GST_IS_FFECTS_TUNNEL_CLASS
-GST_TYPE_FFECTS_TUNNEL
-<SUBSECTION Private>
-gst_ffects_tunnel_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_twirl</FILE>
-<TITLE>gleffects_twirl</TITLE>
-Gstffects_twirl
-<SUBSECTION Standard>
-Gstffects_twirlClass
-GST_FFECTS_TWIRL
-GST_FFECTS_TWIRL_CAST
-GST_IS_FFECTS_TWIRL
-GST_FFECTS_TWIRL_CLASS
-GST_IS_FFECTS_TWIRL_CLASS
-GST_TYPE_FFECTS_TWIRL
-<SUBSECTION Private>
-gst_ffects_twirl_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_xpro</FILE>
-<TITLE>gleffects_xpro</TITLE>
-Gstffects_xpro
-<SUBSECTION Standard>
-Gstffects_xproClass
-GST_FFECTS_XPRO
-GST_FFECTS_XPRO_CAST
-GST_IS_FFECTS_XPRO
-GST_FFECTS_XPRO_CLASS
-GST_IS_FFECTS_XPRO_CLASS
-GST_TYPE_FFECTS_XPRO
-<SUBSECTION Private>
-gst_ffects_xpro_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-gleffects_xray</FILE>
-<TITLE>gleffects_xray</TITLE>
-Gstffects_xray
-<SUBSECTION Standard>
-Gstffects_xrayClass
-GST_FFECTS_XRAY
-GST_FFECTS_XRAY_CAST
-GST_IS_FFECTS_XRAY
-GST_FFECTS_XRAY_CLASS
-GST_IS_FFECTS_XRAY_CLASS
-GST_TYPE_FFECTS_XRAY
-<SUBSECTION Private>
-gst_ffects_xray_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-ttmlparse</FILE>
<TITLE>ttmlparse</TITLE>
GstTtmlParse
diff --git a/docs/plugins/gst-plugins-bad-plugins.args b/docs/plugins/gst-plugins-bad-plugins.args
index 8183f59e6..b194e1096 100644
--- a/docs/plugins/gst-plugins-bad-plugins.args
+++ b/docs/plugins/gst-plugins-bad-plugins.args
@@ -47223,9 +47223,9 @@
<TYPE>gint</TYPE>
<RANGE>>= 0</RANGE>
<FLAGS>rw</FLAGS>
-<NICK>height (kernel height)</NICK>
-<BLURB>The gaussian kernel height (must be positive and odd).</BLURB>
-<DEFAULT>3</DEFAULT>
+<NICK>height of area to blur</NICK>
+<BLURB>Height of the area to blur (in pixels).</BLURB>
+<DEFAULT>2147483647</DEFAULT>
</ARG>
<ARG>
@@ -47241,14 +47241,54 @@
<ARG>
<NAME>GstCvSmooth::width</NAME>
<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>width of area to blur</NICK>
+<BLURB>Width of the area to blur (in pixels).</BLURB>
+<DEFAULT>2147483647</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstCvSmooth::kernel-height</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>kernel height</NICK>
+<BLURB>The gaussian kernel height (must be positive and odd).</BLURB>
+<DEFAULT>3</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstCvSmooth::kernel-width</NAME>
+<TYPE>gint</TYPE>
<RANGE>>= 1</RANGE>
<FLAGS>rw</FLAGS>
-<NICK>width (kernel width)</NICK>
+<NICK>kernel width</NICK>
<BLURB>The gaussian kernel width (must be positive and odd).If type is median, this means the aperture linear size.Check OpenCV docs: http://docs.opencv.org/2.4/modules/imgproc/doc/filtering.htm.</BLURB>
<DEFAULT>3</DEFAULT>
</ARG>
<ARG>
+<NAME>GstCvSmooth::position-x</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>starting x position for blur</NICK>
+<BLURB>Starting x position for blur (in pixels).</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstCvSmooth::position-y</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>starting y position for blur</NICK>
+<BLURB>Starting y position for blur (in pixels).</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
<NAME>GstCvLaplace::aperture-size</NAME>
<TYPE>gint</TYPE>
<RANGE>[1,7]</RANGE>
@@ -67911,6 +67951,16 @@ Gestures in the defined region of interest will emit messages.</BLURB>
</ARG>
<ARG>
+<NAME>GstDecklinkVideoSrc::hw-serial-number</NAME>
+<TYPE>gchar*</TYPE>
+<RANGE></RANGE>
+<FLAGS>r</FLAGS>
+<NICK>Hardware serial number</NICK>
+<BLURB>The serial number (hardware ID) of the Decklink card.</BLURB>
+<DEFAULT>NULL</DEFAULT>
+</ARG>
+
+<ARG>
<NAME>GstDecklinkVideoSink::device-number</NAME>
<TYPE>gint</TYPE>
<RANGE>>= 0</RANGE>
@@ -67951,6 +68001,36 @@ Gestures in the defined region of interest will emit messages.</BLURB>
</ARG>
<ARG>
+<NAME>GstDecklinkVideoSink::hw-serial-number</NAME>
+<TYPE>gchar*</TYPE>
+<RANGE></RANGE>
+<FLAGS>r</FLAGS>
+<NICK>Hardware serial number</NICK>
+<BLURB>The serial number (hardware ID) of the Decklink card.</BLURB>
+<DEFAULT>NULL</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkVideoSink::keyer-level</NAME>
+<TYPE>gint</TYPE>
+<RANGE>[0,255]</RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Keyer level</NICK>
+<BLURB>Keyer level.</BLURB>
+<DEFAULT>255</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstDecklinkVideoSink::keyer-mode</NAME>
+<TYPE>GstDecklinkKeyerMode</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Keyer mode</NICK>
+<BLURB>Keyer mode to be enabled.</BLURB>
+<DEFAULT>Off</DEFAULT>
+</ARG>
+
+<ARG>
<NAME>GstDecklinkAudioSrc::alignment-threshold</NAME>
<TYPE>guint64</TYPE>
<RANGE><= 18446744073709551614</RANGE>
@@ -68011,6 +68091,16 @@ Gestures in the defined region of interest will emit messages.</BLURB>
</ARG>
<ARG>
+<NAME>GstDecklinkAudioSrc::hw-serial-number</NAME>
+<TYPE>gchar*</TYPE>
+<RANGE></RANGE>
+<FLAGS>r</FLAGS>
+<NICK>Hardware serial number</NICK>
+<BLURB>The serial number (hardware ID) of the Decklink card.</BLURB>
+<DEFAULT>NULL</DEFAULT>
+</ARG>
+
+<ARG>
<NAME>GstDecklinkAudioSink::device-number</NAME>
<TYPE>gint</TYPE>
<RANGE>>= 0</RANGE>
@@ -68021,6 +68111,16 @@ Gestures in the defined region of interest will emit messages.</BLURB>
</ARG>
<ARG>
+<NAME>GstDecklinkAudioSink::hw-serial-number</NAME>
+<TYPE>gchar*</TYPE>
+<RANGE></RANGE>
+<FLAGS>r</FLAGS>
+<NICK>Hardware serial number</NICK>
+<BLURB>The serial number (hardware ID) of the Decklink card.</BLURB>
+<DEFAULT>NULL</DEFAULT>
+</ARG>
+
+<ARG>
<NAME>GstOpenh264Enc::adaptive-quantization</NAME>
<TYPE>gboolean</TYPE>
<RANGE></RANGE>
@@ -69446,7 +69546,7 @@ Gestures in the defined region of interest will emit messages.</BLURB>
<RANGE></RANGE>
<FLAGS>rwx</FLAGS>
<NICK>Maximum delay (ms)</NICK>
-<BLURB>The maximum delay in ms to apply to buffers.</BLURB>
+<BLURB>The maximum delay (inclusive) in ms to apply to buffers.</BLURB>
<DEFAULT>400</DEFAULT>
</ARG>
@@ -69461,6 +69561,46 @@ Gestures in the defined region of interest will emit messages.</BLURB>
</ARG>
<ARG>
+<NAME>GstNetSim::allow-reordering</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Allow Reordering</NICK>
+<BLURB>When delaying packets, are they allowed to be reordered or not.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstNetSim::delay-distribution</NAME>
+<TYPE>GstNetSimDistribution</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Delay Distribution</NICK>
+<BLURB>Distribution for the amount of delay.</BLURB>
+<DEFAULT>uniform</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstNetSim::max-bucket-size</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= G_MAXULONG</RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Maximum Bucket Size (Kb)</NICK>
+<BLURB>The size of the token bucket, related to burstiness resilience (-1 = unlimited).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstNetSim::max-kbps</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= G_MAXULONG</RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Maximum Kbps</NICK>
+<BLURB>The maximum number of kilobits to let through per second (-1 = unlimited).</BLURB>
+<DEFAULT>-1</DEFAULT>
+</ARG>
+
+<ARG>
<NAME>GstGDPDepay::ts-offset</NAME>
<TYPE>gint64</TYPE>
<RANGE></RANGE>
@@ -72221,6 +72361,46 @@ Gestures in the defined region of interest will emit messages.</BLURB>
</ARG>
<ARG>
+<NAME>GstKMSSink::bus-id</NAME>
+<TYPE>gchar*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Bus ID</NICK>
+<BLURB>DRM bus ID.</BLURB>
+<DEFAULT>NULL</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstKMSSink::can-scale</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>can scale</NICK>
+<BLURB>User can tell kmssink if the driver can support scale.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstKMSSink::display-height</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>r</FLAGS>
+<NICK>Display Height</NICK>
+<BLURB>Height of the display surface in pixels.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstKMSSink::display-width</NAME>
+<TYPE>gint</TYPE>
+<RANGE>>= 0</RANGE>
+<FLAGS>r</FLAGS>
+<NICK>Display Width</NICK>
+<BLURB>Width of the display surface in pixels.</BLURB>
+<DEFAULT>0</DEFAULT>
+</ARG>
+
+<ARG>
<NAME>GstBs2b::fcut</NAME>
<TYPE>gint</TYPE>
<RANGE>[300,2000]</RANGE>
@@ -72881,6 +73061,16 @@ Gestures in the defined region of interest will emit messages.</BLURB>
</ARG>
<ARG>
+<NAME>GstAvWait::end-timecode</NAME>
+<TYPE>GstVideoTimeCode*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>End timecode (object)</NICK>
+<BLURB>Timecode to end at in timecode mode (object).</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
+<ARG>
<NAME>GstDewarp::display-mode</NAME>
<TYPE>GstDewarpDisplayMode</TYPE>
<RANGE></RANGE>
@@ -73102,12 +73292,12 @@ Gestures in the defined region of interest will emit messages.</BLURB>
<ARG>
<NAME>GstCurlHttpSrc::http-version</NAME>
-<TYPE>gfloat</TYPE>
-<RANGE>[1,2]</RANGE>
+<TYPE>GstCurlHttpVersionType</TYPE>
+<RANGE></RANGE>
<FLAGS>rw</FLAGS>
<NICK>HTTP-Version</NICK>
-<BLURB>The preferred HTTP protocol version (Supported 1.0, 1.1, 2.0).</BLURB>
-<DEFAULT>2</DEFAULT>
+<BLURB>The preferred HTTP protocol version.</BLURB>
+<DEFAULT>HTTP Version 2.0</DEFAULT>
</ARG>
<ARG>
@@ -73257,7 +73447,7 @@ Gestures in the defined region of interest will emit messages.</BLURB>
<FLAGS>rw</FLAGS>
<NICK>User-Agent</NICK>
<BLURB>URI of resource requested.</BLURB>
-<DEFAULT>"GStreamer curlhttpsrc libcurl/7.52.1"</DEFAULT>
+<DEFAULT>"GStreamer curlhttpsrc libcurl/7.56.1"</DEFAULT>
</ARG>
<ARG>
@@ -73380,3 +73570,62 @@ Gestures in the defined region of interest will emit messages.</BLURB>
<DEFAULT>15</DEFAULT>
</ARG>
+<ARG>
+<NAME>GstLcms::dest-profile</NAME>
+<TYPE>gchar*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Destination ICC profile file</NICK>
+<BLURB>Specify the destination ICC profile file to apply.</BLURB>
+<DEFAULT>NULL</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstLcms::embedded-profile</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Embedded Profile</NICK>
+<BLURB>Extract and use source profiles embedded in images.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstLcms::input-profile</NAME>
+<TYPE>gchar*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Input ICC profile file</NICK>
+<BLURB>Specify the input ICC profile file to apply.</BLURB>
+<DEFAULT>NULL</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstLcms::intent</NAME>
+<TYPE>GstLcmsIntent</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Rendering intent</NICK>
+<BLURB>Select the rendering intent of the color correction.</BLURB>
+<DEFAULT>Perceptual</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstLcms::lookup</NAME>
+<TYPE>GstLcmsLookupMethod</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Lookup method</NICK>
+<BLURB>Select the caching method for the color compensation calculations.</BLURB>
+<DEFAULT>Calculate and cache color replacement values on first occurence</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GstLcms::preserve-black</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Preserve black</NICK>
+<BLURB>Select whether purely black pixels should be preserved.</BLURB>
+<DEFAULT>FALSE</DEFAULT>
+</ARG>
diff --git a/docs/plugins/gst-plugins-bad-plugins.hierarchy b/docs/plugins/gst-plugins-bad-plugins.hierarchy
index d2b04104b..63c911ea3 100644
--- a/docs/plugins/gst-plugins-bad-plugins.hierarchy
+++ b/docs/plugins/gst-plugins-bad-plugins.hierarchy
@@ -95,13 +95,10 @@ GObject
GstVideoSink
GstDfbVideoSink
GstFBDEVSink
- GstGLImageSink
GstGtkBaseSink
- GstGtkGLSink
GstGtkSink
GstInterVideoSink
GstKMSSink
- GstQtSink
GstVulkanSink
GstWaylandSink
GstBaseSrc
@@ -122,10 +119,8 @@ GObject
GstDecklinkAudioSrc
GstDecklinkVideoSrc
GstDvbSrc
- GstGLTestSrc
GstMMS
GstNeonhttpSrc
- GstQtSrc
GstRTMPSrc
GstRfbSrc
GstShmSrc
@@ -153,42 +148,6 @@ GObject
GstDebugSpy
GstDtmfDetect
GstFreeverb
- GstGLBaseFilter
- GstGLColorConvertElement
- GstGLDownloadElement
- GstGLFilter
- GstGLColorBalance
- GstGLColorscale
- GstGLDeinterlace
- GstGLDifferenceMatte
- GstGLEffects
- GstGLEffectsGeneric
- gleffects_blur
- gleffects_bulge
- gleffects_fisheye
- gleffects_glow
- gleffects_heat
- gleffects_identity
- gleffects_laplacian
- gleffects_lumaxpro
- gleffects_mirror
- gleffects_sepia
- gleffects_sin
- gleffects_sobel
- gleffects_square
- gleffects_squeeze
- gleffects_stretch
- gleffects_tunnel
- gleffects_twirl
- gleffects_xpro
- gleffects_xray
- GstGLFilterApp
- GstGLFilterCube
- GstGLFilterGlass
- GstGLFilterShader
- GstGLOverlay
- GstGLViewConvertElement
- GstGLUploadElement
GstIvtc
GstRGB2Bayer
GstRemoveSilence
@@ -221,6 +180,7 @@ GObject
GstPerspective
GstRotate
GstSquare
+ GstLcms
GstOpencvVideoFilter
GstCvDilateErode
GstCvDilate
@@ -271,12 +231,8 @@ GObject
GstDtlsSrtpEnc
GstFPSDisplaySink
GstFaceOverlay
- GstGLFilterBin
GstGLMixerBin
GstGLVideoMixerBin
- GstGLSinkBin
- GstGLImageSinkBin
- GstGLSrcBin
GstHlsSink
GstHlsSink2
GstPipeline
@@ -303,7 +259,6 @@ GObject
GstFluidDec
GstGDPDepay
GstGDPPay
- GstGLStereoSplit
GstGmeDec
GstInterlace
GstIpcPipelineSink
@@ -343,6 +298,7 @@ GObject
GstTtmlRender
GstUvcH264MjpgDemux
GstVideoDecoder
+ GstLibde265Dec
GstOpenEXRDec
GstOpenJPEGDec
GstOpenh264Dec
@@ -369,7 +325,6 @@ GObject
MpegTSParse2
MpegTsMux
GstGLContext
- GstGLShader
GstPad
GstAggregatorPad
GstAudioAggregatorPad
diff --git a/ext/Makefile.am b/ext/Makefile.am
index e4e0db7d6..3d7c4b207 100644
--- a/ext/Makefile.am
+++ b/ext/Makefile.am
@@ -82,8 +82,9 @@ else
DTS_DIR=
endif
+# FIXME: re-enable for gl mixers
if USE_GL
-GL_DIR=gl
+#GL_DIR=gl
else
GL_DIR=
endif
diff --git a/ext/meson.build b/ext/meson.build
index d4730b7ce..7267c5baa 100644
--- a/ext/meson.build
+++ b/ext/meson.build
@@ -15,7 +15,7 @@ subdir('faad')
subdir('fdkaac')
subdir('flite')
subdir('fluidsynth')
-subdir('gl')
+#subdir('gl') # FIXME: re-enable for gl mixers
#subdir('gme')
subdir('gsm')
subdir('gtk')
diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am
index 1939611a2..62dd9fdfa 100644
--- a/gst-libs/gst/Makefile.am
+++ b/gst-libs/gst/Makefile.am
@@ -1,11 +1,3 @@
-
-if USE_OPENGL
-GL_DIR = gl
-endif
-if USE_GLES2
-GL_DIR = gl
-endif
-
if USE_WAYLAND
WAYLAND_DIR=wayland
endif
@@ -15,21 +7,18 @@ OPENCV_DIR=opencv
endif
SUBDIRS = uridownloader adaptivedemux interfaces basecamerabinsrc codecparsers \
- insertbin mpegts video audio player allocators isoff $(GL_DIR) $(WAYLAND_DIR) \
+ insertbin mpegts video audio player allocators isoff $(WAYLAND_DIR) \
$(OPENCV_DIR)
noinst_HEADERS = gst-i18n-plugin.h gettext.h glib-compat-private.h
-DIST_SUBDIRS = uridownloader adaptivedemux interfaces gl basecamerabinsrc \
+DIST_SUBDIRS = uridownloader adaptivedemux interfaces basecamerabinsrc \
codecparsers insertbin mpegts wayland opencv video audio player allocators isoff
-#dependencies
-gl: allocators
-
adaptivedemux: uridownloader
INDEPENDENT_SUBDIRS = \
interfaces basecamerabinsrc codecparsers insertbin uridownloader \
- mpegts player allocators isoff $(GL_DIR) $(WAYLAND_DIR) $(OPENCV_DIR)
+ mpegts player allocators isoff $(WAYLAND_DIR) $(OPENCV_DIR)
.PHONY: independent-subdirs $(INDEPENDENT_SUBDIRS)
diff --git a/gst-libs/gst/gl/.gitignore b/gst-libs/gst/gl/.gitignore
deleted file mode 100644
index a663943b8..000000000
--- a/gst-libs/gst/gl/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-gstglconfig.h
-stamp-gc-h
diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
deleted file mode 100644
index 269fdb6a4..000000000
--- a/gst-libs/gst/gl/Makefile.am
+++ /dev/null
@@ -1,215 +0,0 @@
-
-lib_LTLIBRARIES = libgstgl-@GST_API_VERSION@.la
-
-SUBDIRS = glprototypes
-DIST_SUBDIRS = glprototypes android x11 win32 cocoa wayland dispmanx egl eagl viv-fb
-
-built_sys_header_configure = gstglconfig.h
-
-libgstgl_@GST_API_VERSION@_la_SOURCES = \
- gstgldisplay.c \
- gstglcontext.c \
- gstgldebug.c \
- gstglbasememory.c \
- gstglbuffer.c \
- gstglmemory.c \
- gstglmemorypbo.c \
- gstglrenderbuffer.c \
- gstglbufferpool.c \
- gstglfilter.c \
- gstglformat.c \
- gstglbasefilter.c \
- gstglshader.c \
- gstglshaderstrings.c \
- gstglsl.c \
- gstglslstage.c \
- gstglcolorconvert.c \
- gstglupload.c \
- gstglwindow.c \
- gstglapi.c \
- gstglfeature.c \
- gstglutils.c \
- gstglframebuffer.c \
- gstglsyncmeta.c \
- gstglviewconvert.c \
- gstgloverlaycompositor.c \
- gstglquery.c
-
-libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl
-libgstgl_@GST_API_VERSION@include_HEADERS = \
- gstglwindow.h \
- gstgldisplay.h \
- gstglcontext.h \
- gstgldebug.h \
- gstglbasememory.h \
- gstglbuffer.h \
- gstglmemory.h \
- gstglmemorypbo.h \
- gstglrenderbuffer.h \
- gstglbufferpool.h \
- gstglfilter.h \
- gstglformat.h \
- gstglfuncs.h \
- gstglbasefilter.h \
- gstglshader.h \
- gstglshaderstrings.h \
- gstglsl.h \
- gstglslstage.h \
- gstglcolorconvert.h \
- gstglupload.h \
- gstglapi.h \
- gstglfeature.h \
- gstglutils.h \
- gstglframebuffer.h \
- gstglsyncmeta.h \
- gstglviewconvert.h \
- gstgloverlaycompositor.h \
- gstglquery.h \
- gstgl_fwd.h \
- gstgl_enums.h \
- gl.h
-
-noinst_HEADERS = \
- gstglcontext_private.h \
- gstglfeature_private.h \
- gstglsl_private.h \
- gstglwindow_private.h \
- gstglutils_private.h \
- utils/opengl_versions.h \
- utils/gles_versions.h
-
-
-libgstgl_@GST_API_VERSION@_la_LIBADD = \
- $(GMODULE_NO_EXPORT_LIBS) \
- $(GST_PLUGINS_BASE_LIBS) \
- -lgstvideo-$(GST_API_VERSION) \
- $(GST_BASE_LIBS) \
- $(GST_LIBS) \
- $(GL_LIBS) \
- $(top_builddir)/gst-libs/gst/allocators/libgstbadallocators-@GST_API_VERSION@.la
-
-if HAVE_WINDOW_WIN32
-SUBDIRS += win32
-libgstgl_@GST_API_VERSION@_la_LIBADD += win32/libgstgl-win32.la
-endif
-
-if HAVE_WINDOW_COCOA
-SUBDIRS += cocoa
-libgstgl_@GST_API_VERSION@_la_LIBADD += cocoa/libgstgl-cocoa.la
-endif
-
-if HAVE_WINDOW_X11
-SUBDIRS += x11
-libgstgl_@GST_API_VERSION@_la_LIBADD += x11/libgstgl-x11.la
-endif
-
-if HAVE_WINDOW_WAYLAND
-SUBDIRS += wayland
-libgstgl_@GST_API_VERSION@_la_LIBADD += wayland/libgstgl-wayland.la
-endif
-
-if HAVE_WINDOW_DISPMANX
-SUBDIRS += dispmanx
-libgstgl_@GST_API_VERSION@_la_LIBADD += dispmanx/libgstgl-dispmanx.la
-endif
-
-if HAVE_WINDOW_ANDROID
-SUBDIRS += android
-libgstgl_@GST_API_VERSION@_la_LIBADD += android/libgstgl-android.la
-endif
-
-if HAVE_WINDOW_EAGL
-SUBDIRS += eagl
-libgstgl_@GST_API_VERSION@_la_LIBADD += eagl/libgstgl-eagl.la
-endif
-
-if HAVE_WINDOW_VIV_FB
-SUBDIRS += viv-fb
-libgstgl_@GST_API_VERSION@_la_LIBADD += viv-fb/libgstgl-viv-fb.la
-endif
-
-if USE_EGL
-SUBDIRS += egl
-libgstgl_@GST_API_VERSION@_la_LIBADD += egl/libgstgl-egl.la
-libgstgl_@GST_API_VERSION@_la_LIBADD += -lgstallocators-$(GST_API_VERSION)
-endif
-
-configexecincludedir = $(libdir)/gstreamer-@GST_API_VERSION@/include/gst/gl
-nodist_configexecinclude_HEADERS = $(built_sys_header_configure)
-
-libgstgl_@GST_API_VERSION@_la_CFLAGS = \
- -DGST_EXPORTS \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS) \
- $(GL_CFLAGS)
-
-libgstgl_@GST_API_VERSION@_la_LDFLAGS = \
- $(GST_LIB_LDFLAGS) \
- $(GST_ALL_LDFLAGS) \
- $(GST_LT_LDFLAGS)
-
-# DISTCLEANFILES is for files generated by configure
-DISTCLEANFILES = $(built_sys_header_configure)
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstGL-@GST_API_VERSION@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstgl_@GST_API_VERSION@include_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstgl_@GST_API_VERSION@_la_SOURCES))
-
-GstGL-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstgl-@GST_API_VERSION@.la
- $(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" GI_SCANNER_DISABLE_CACHE=yes\
- GST_PLUGIN_SYSTEM_PATH_1_0="" GST_PLUGIN_PATH_1_0="" GST_REGISTRY_UPDATE=no \
- CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" PKG_CONFIG="$(PKG_CONFIG)" DLLTOOL="$(DLLTOOL)" \
- $(INTROSPECTION_SCANNER) -v --namespace GstGL \
- --nsversion=@GST_API_VERSION@ \
- --identifier-prefix=Gst \
- --symbol-prefix=gst \
- --warn-all \
- --c-include "gst/gl/gl.h" \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GL_CFLAGS) \
- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- --add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-video-@GST_API_VERSION@` \
- --library=libgstgl-@GST_API_VERSION@.la \
- --include=Gst-@GST_API_VERSION@ \
- --include=GstBase-@GST_API_VERSION@ \
- --include=GstVideo-@GST_API_VERSION@ \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-@GST_API_VERSION@ \
- --pkg gstreamer-base-@GST_API_VERSION@ \
- --pkg gstreamer-video-@GST_API_VERSION@ \
- --pkg-export gstreamer-gl-@GST_API_VERSION@ \
- --add-init-section="$(INTROSPECTION_INIT)" \
- -DGST_USE_UNSTABLE_API \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
- $(INTROSPECTION_COMPILER) \
- --includedir=$(srcdir) \
- --includedir=$(builddir) \
- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
- --includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-video-@GST_API_VERSION@` \
- $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/gl/android/Makefile.am b/gst-libs/gst/gl/android/Makefile.am
deleted file mode 100644
index c21097bc9..000000000
--- a/gst-libs/gst/gl/android/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES = libgstgl-android.la
-
-libgstgl_android_la_SOURCES = \
- gstglwindow_android_egl.c
-
-noinst_HEADERS = \
- gstglwindow_android_egl.h
-
-libgstgl_android_la_CFLAGS = \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GL_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-
-libgstgl_android_la_LDFLAGS = \
- $(GST_LIB_LDFLAGS) \
- $(GST_ALL_LDFLAGS)
diff --git a/gst-libs/gst/gl/android/gstglwindow_android_egl.c b/gst-libs/gst/gl/android/gstglwindow_android_egl.c
deleted file mode 100644
index 68c1c9403..000000000
--- a/gst-libs/gst/gl/android/gstglwindow_android_egl.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
- * Copyright (C) 2013 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * 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.
- */
-
-/* TODO: - Window resize handling
- * - Event handling input event handling
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include <gst/gl/egl/gstglcontext_egl.h>
-#include "gstglwindow_android_egl.h"
-#include "../gstglwindow_private.h"
-
-#define GST_CAT_DEFAULT gst_gl_window_debug
-
-#define gst_gl_window_android_egl_parent_class parent_class
-G_DEFINE_TYPE (GstGLWindowAndroidEGL, gst_gl_window_android_egl,
- GST_TYPE_GL_WINDOW);
-
-static guintptr gst_gl_window_android_egl_get_display (GstGLWindow * window);
-static guintptr gst_gl_window_android_egl_get_window_handle (GstGLWindow *
- window);
-static void gst_gl_window_android_egl_set_window_handle (GstGLWindow * window,
- guintptr handle);
-static void gst_gl_window_android_egl_draw (GstGLWindow * window);
-
-static void
-gst_gl_window_android_egl_class_init (GstGLWindowAndroidEGLClass * klass)
-{
- GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
-
- window_class->get_display =
- GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_get_display);
- window_class->get_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_get_window_handle);
- window_class->set_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_set_window_handle);
- window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_draw);
-}
-
-static void
-gst_gl_window_android_egl_init (GstGLWindowAndroidEGL * window)
-{
-}
-
-/* Must be called in the gl thread */
-GstGLWindowAndroidEGL *
-gst_gl_window_android_egl_new (GstGLDisplay * display)
-{
- GstGLWindowAndroidEGL *window;
-
- if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_EGL) == 0)
- /* we require an egl display to create android windows */
- return NULL;
-
- GST_DEBUG ("creating Android EGL window");
-
- window = g_object_new (GST_TYPE_GL_WINDOW_ANDROID_EGL, NULL);
- gst_object_ref_sink (window);
-
- return window;
-}
-
-static void
-gst_gl_window_android_egl_set_window_handle (GstGLWindow * window,
- guintptr handle)
-{
- GstGLWindowAndroidEGL *window_egl = GST_GL_WINDOW_ANDROID_EGL (window);
-
- window_egl->native_window = (EGLNativeWindowType) handle;
-}
-
-static guintptr
-gst_gl_window_android_egl_get_window_handle (GstGLWindow * window)
-{
- GstGLWindowAndroidEGL *window_egl = GST_GL_WINDOW_ANDROID_EGL (window);
-
- return (guintptr) window_egl->native_window;
-}
-
-static void
-draw_cb (gpointer data)
-{
- GstGLWindowAndroidEGL *window_egl = data;
- GstGLWindow *window = GST_GL_WINDOW (window_egl);
- GstGLContext *context = gst_gl_window_get_context (window);
- GstGLContextEGL *context_egl = GST_GL_CONTEXT_EGL (context);
-
- if (context_egl->egl_surface) {
- gint width, height;
- guint window_width, window_height;
-
- gst_gl_window_get_surface_dimensions (window, &window_width,
- &window_height);
- if (eglQuerySurface (context_egl->egl_display, context_egl->egl_surface,
- EGL_WIDTH, &width)
- && eglQuerySurface (context_egl->egl_display, context_egl->egl_surface,
- EGL_HEIGHT, &height)
- && (window->queue_resize || width != window_egl->window_width
- || height != window_egl->window_height)) {
- gst_gl_window_resize (window, width, height);
- }
- }
-
- if (window->draw)
- window->draw (window->draw_data);
-
- gst_gl_context_swap_buffers (context);
-
- gst_object_unref (context);
-}
-
-static void
-gst_gl_window_android_egl_draw (GstGLWindow * window)
-{
- gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
-}
-
-static guintptr
-gst_gl_window_android_egl_get_display (GstGLWindow * window)
-{
- return 0;
-}
diff --git a/gst-libs/gst/gl/android/gstglwindow_android_egl.h b/gst-libs/gst/gl/android/gstglwindow_android_egl.h
deleted file mode 100644
index b467b6dbd..000000000
--- a/gst-libs/gst/gl/android/gstglwindow_android_egl.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
- * Copyright (C) 2013 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * 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_WINDOW_ANDROID_EGL_H__
-#define __GST_GL_WINDOW_ANDROID_EGL_H__
-
-#include <gst/gl/gl.h>
-#include <gst/gl/egl/gstegl.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_WINDOW_ANDROID_EGL (gst_gl_window_android_egl_get_type())
-#define GST_GL_WINDOW_ANDROID_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW_ANDROID_EGL, GstGLWindowAndroidEGL))
-#define GST_GL_WINDOW_ANDROID_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_WINDOW_ANDROID_EGL, GstGLWindowAndroidEGLClass))
-#define GST_IS_GL_WINDOW_ANDROID_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW_ANDROID_EGL))
-#define GST_IS_GL_WINDOW_ANDROID_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW_ANDROID_EGL))
-#define GST_GL_WINDOW_ANDROID_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW_ANDROID_EGL, GstGLWindowAndroidEGL_Class))
-
-typedef struct _GstGLWindowAndroidEGL GstGLWindowAndroidEGL;
-typedef struct _GstGLWindowAndroidEGLClass GstGLWindowAndroidEGLClass;
-
-struct _GstGLWindowAndroidEGL {
- /*< private >*/
- GstGLWindow parent;
-
- /* This is actually an ANativeWindow */
- EGLNativeWindowType native_window;
- gint window_width, window_height;
-
- gpointer _reserved[GST_PADDING];
-};
-
-struct _GstGLWindowAndroidEGLClass {
- /*< private >*/
- GstGLWindowClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING];
-};
-
-GType gst_gl_window_android_egl_get_type (void);
-
-GstGLWindowAndroidEGL * gst_gl_window_android_egl_new (GstGLDisplay * display);
-
-G_END_DECLS
-
-#endif /* __GST_GL_WINDOW_ANDROID_H__ */
diff --git a/gst-libs/gst/gl/cocoa/Makefile.am b/gst-libs/gst/gl/cocoa/Makefile.am
deleted file mode 100644
index 018d280b3..000000000
--- a/gst-libs/gst/gl/cocoa/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES = libgstgl-cocoa.la
-
-libgstgl_cocoa_la_SOURCES = \
- gstglwindow_cocoa.m \
- gstglcontext_cocoa.m \
- gstgldisplay_cocoa.m \
- gstglcaopengllayer.m
-
-noinst_HEADERS = \
- gstglcontext_cocoa.h \
- gstglwindow_cocoa.h \
- gstgl_cocoa_private.h
-
-libgstgl_cocoaincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/cocoa
-libgstgl_cocoainclude_HEADERS = \
- gstglcaopengllayer.h \
- gstgldisplay_cocoa.h
-
-libgstgl_cocoa_la_CFLAGS = \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GL_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-
-libgstgl_cocoa_la_OBJCFLAGS = \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- -fobjc-arc \
- $(GL_OBJCFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_OBJCFLAGS)
-
-libgstgl_cocoa_la_LDFLAGS = \
- $(GST_LIB_LDFLAGS) \
- $(GST_ALL_LDFLAGS)
-
-libgstgl_cocoa_la_LIBTOOLFLAGS = --tag=CC
diff --git a/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h b/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h
deleted file mode 100644
index 380d6f704..000000000
--- a/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_COCOA_PRIVATE_H__
-#define __GST_GL_COCOA_PRIVATE_H__
-
-#include <gst/gst.h>
-#include <gst/gl/gstglfuncs.h>
-
-#include <Cocoa/Cocoa.h>
-
-#include "gstglwindow_cocoa.h"
-#include "gstglcontext_cocoa.h"
-#include "gstglcaopengllayer.h"
-
-G_BEGIN_DECLS
-
-struct _GstGLContextCocoaPrivate
-{
- CGLPixelFormatObj pixel_format;
- CGLContextObj gl_context;
- CGLContextObj external_gl_context;
-
- GstGLAPI context_api;
-
- gint source_id;
-};
-
-
-/* =============================================================*/
-/* */
-/* GstGLNSView declaration */
-/* */
-/* =============================================================*/
-
-@interface GstGLNSView: NSView {
-@public
- GstGLWindowCocoa *window_cocoa;
- GstGLCAOpenGLLayer *layer;
-}
-- (id) initWithFrameLayer:(GstGLWindowCocoa *)window rect:(NSRect)contentRect layer:(CALayer *)layerContent;
-@end
-
-gboolean gst_gl_window_cocoa_create_window (GstGLWindowCocoa *window_cocoa);
-
-void _invoke_on_main (GstGLWindowCB func, gpointer data, GDestroyNotify notify);
-
-G_END_DECLS
-
-#endif /* __GST_GL_COCOA_PRIVATE_H__ */
diff --git a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h
deleted file mode 100644
index 808604d27..000000000
--- a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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_CA_OPENGL_LAYER__
-#define __GST_GL_CA_OPENGL_LAYER__
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-#include <Cocoa/Cocoa.h>
-
-G_BEGIN_DECLS
-
-@interface GstGLCAOpenGLLayer : CAOpenGLLayer {
-@public
- GstGLContext *gst_gl_context;
- CGLContextObj gl_context;
-
-@private
- GstGLContext *draw_context;
- CGRect last_bounds;
- gint expected_dims[4];
-
- GstGLWindowCB draw_cb;
- gpointer draw_data;
- GDestroyNotify draw_notify;
-
- GstGLWindowResizeCB resize_cb;
- gpointer resize_data;
- GDestroyNotify resize_notify;
-
- gint can_draw;
- gboolean queue_resize;
-}
-- (void) setDrawCallback:(GstGLWindowCB)cb data:(gpointer)a notify:(GDestroyNotify)notify;
-- (void) setResizeCallback:(GstGLWindowResizeCB)cb data:(gpointer)a notify:(GDestroyNotify)notify;
-- (void) queueResize;
-- (id) initWithGstGLContext: (GstGLContext *)context;
-@end
-
-G_END_DECLS
-
-#endif /* __GST_GL_CA_OPENGL_LAYER__ */
diff --git a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m b/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m
deleted file mode 100644
index 065d596de..000000000
--- a/gst-libs/gst/gl/cocoa/gstglcaopengllayer.m
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <Cocoa/Cocoa.h>
-
-#include "gstglcaopengllayer.h"
-#include "gstgl_cocoa_private.h"
-
-#define GST_CAT_DEFAULT gst_gl_ca_opengl_layer_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-static void
-_init_debug (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_INIT(gst_gl_ca_opengl_layer_debug, "glcaopengllayer",
- 0, "CAOpenGLLayer");
-
- g_once_init_leave (&_init, 1);
- }
-}
-
-@implementation GstGLCAOpenGLLayer
-- (void)dealloc {
- if (self->draw_notify)
- self->draw_notify (self->draw_data);
-
- if (self->draw_context)
- gst_object_unref (self->draw_context);
-
- GST_TRACE ("dealloc GstGLCAOpenGLLayer %p context %p", self, self->gst_gl_context);
-}
-
-static void
-_context_ready (gpointer data)
-{
- GstGLCAOpenGLLayer *ca_layer = (__bridge GstGLCAOpenGLLayer *) data;
-
- g_atomic_int_set (&ca_layer->can_draw, 1);
-}
-
-- (id)initWithGstGLContext:(GstGLContext *)parent_gl_context {
- g_return_val_if_fail (GST_IS_GL_CONTEXT_COCOA (parent_gl_context), nil);
-
- self = [super init];
-
- _init_debug();
-
- GST_LOG ("init CAOpenGLLayer");
-
- self->gst_gl_context = parent_gl_context;
- self.needsDisplayOnBoundsChange = YES;
-
- gst_gl_window_send_message_async (parent_gl_context->window,
- (GstGLWindowCB) _context_ready, (__bridge_retained gpointer)self, (GDestroyNotify)CFRelease);
-
- return self;
-}
-
-- (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask {
- CGLPixelFormatObj fmt = NULL;
-
- if (self->gst_gl_context)
- fmt = gst_gl_context_cocoa_get_pixel_format (GST_GL_CONTEXT_COCOA (self->gst_gl_context));
-
- if (!fmt) {
- CGLPixelFormatAttribute attribs[] = {
- kCGLPFADoubleBuffer,
- kCGLPFAAccumSize, 32,
- 0
- };
- CGLError ret;
- gint npix = 0;
-
- GST_DEBUG ("creating new pixel format for CAOpenGLLayer %p", self);
-
- ret = CGLChoosePixelFormat (attribs, &fmt, &npix);
- if (ret != kCGLNoError) {
- GST_ERROR ("CAOpenGLLayer cannot choose a pixel format: %s", CGLErrorString (ret));
- }
- }
-
- return fmt;
-}
-
-- (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat {
- GstGLDisplay *display;
- CGLContextObj external_context = NULL;
- CGLError ret;
- GError *error = NULL;
-
- if (self->gst_gl_context)
- external_context = (CGLContextObj) gst_gl_context_get_gl_context (self->gst_gl_context);
-
- GST_INFO ("attempting to create CGLContext for CAOpenGLLayer with "
- "share context %p", external_context);
-
- ret = CGLCreateContext (pixelFormat, external_context, &self->gl_context);
- if (ret != kCGLNoError) {
- GST_ERROR ("failed to create CGL context in CAOpenGLLayer with share context %p: %s", external_context, CGLErrorString(ret));
- return NULL;
- }
-
- if (self->draw_context)
- gst_object_unref (self->draw_context);
-
- if (kCGLNoError != CGLSetCurrentContext (self->gl_context)) {
- GST_ERROR ("failed set cgl context %p current", self->gl_context);
- return NULL;
- }
-
- display = gst_gl_context_get_display (self->gst_gl_context);
- self->draw_context = gst_gl_context_new_wrapped (display,
- (guintptr) self->gl_context, GST_GL_PLATFORM_CGL,
- gst_gl_context_get_current_gl_api (GST_GL_PLATFORM_CGL, NULL, NULL));
- gst_object_unref (display);
-
- if (!self->draw_context) {
- GST_ERROR ("failed to create wrapped context");
- return NULL;
- }
-
- gst_gl_context_activate (self->draw_context, TRUE);
- gst_gl_context_set_shared_with (self->draw_context, self->gst_gl_context);
- if (!gst_gl_context_fill_info (self->draw_context, &error)) {
- GST_ERROR ("failed to fill wrapped context information: %s", error->message);
- return NULL;
- }
- gst_gl_context_activate (self->draw_context, FALSE);
-
- return self->gl_context;
-}
-
-- (void)queueResize {
- self->queue_resize = TRUE;
-}
-
-- (void)releaseCGLContext:(CGLContextObj)glContext {
- CGLReleaseContext (glContext);
-}
-
-- (void)setDrawCallback:(GstGLWindowCB)cb data:(gpointer)data
- notify:(GDestroyNotify)notify {
- g_return_if_fail (cb);
-
- if (self->draw_notify)
- self->draw_notify (self->draw_data);
-
- self->draw_cb = cb;
- self->draw_data = data;
- self->draw_notify = notify;
-}
-
-- (void)setResizeCallback:(GstGLWindowResizeCB)cb data:(gpointer)data
- notify:(GDestroyNotify)notify {
- if (self->resize_notify)
- self->resize_notify (self->resize_data);
-
- self->resize_cb = cb;
- self->resize_data = data;
- self->resize_notify = notify;
-}
-
-- (BOOL)canDrawInCGLContext:(CGLContextObj)glContext
- pixelFormat:(CGLPixelFormatObj)pixelFormat
- forLayerTime:(CFTimeInterval)interval
- displayTime:(const CVTimeStamp *)timeStamp {
- return g_atomic_int_get (&self->can_draw);
-}
-
-- (void)drawInCGLContext:(CGLContextObj)glContext
- pixelFormat:(CGLPixelFormatObj)pixelFormat
- forLayerTime:(CFTimeInterval)interval
- displayTime:(const CVTimeStamp *)timeStamp {
- const GstGLFuncs *gl = ((GstGLContext *)self->gst_gl_context)->gl_vtable;
- GstVideoRectangle src, dst, result;
- gint ca_viewport[4];
-
- GST_LOG ("CAOpenGLLayer drawing with cgl context %p", glContext);
-
- /* attempt to get the correct viewport back due to CA being too smart
- * and messing around with it so center the expected viewport into
- * the CA viewport set up on entry to this function */
- gl->GetIntegerv (GL_VIEWPORT, ca_viewport);
-
- gst_gl_context_activate (self->draw_context, TRUE);
- if (self->queue_resize || self->last_bounds.size.width != self.bounds.size.width
- || self->last_bounds.size.height != self.bounds.size.height) {
- if (self->resize_cb) {
- self->resize_cb (self->resize_data,
- self.bounds.size.width*self.contentsScale,
- self.bounds.size.height*self.contentsScale);
-
- gl->GetIntegerv (GL_VIEWPORT, self->expected_dims);
- } else {
- /* default to whatever ca gives us */
- self->expected_dims[0] = ca_viewport[0];
- self->expected_dims[1] = ca_viewport[1];
- self->expected_dims[2] = ca_viewport[2];
- self->expected_dims[3] = ca_viewport[3];
- }
-
- self->last_bounds = self.bounds;
- self->queue_resize = FALSE;
- }
-
- src.x = self->expected_dims[0];
- src.y = self->expected_dims[1];
- src.w = self->expected_dims[2];
- src.h = self->expected_dims[3];
-
- dst.x = ca_viewport[0];
- dst.y = ca_viewport[1];
- dst.w = ca_viewport[2];
- dst.h = ca_viewport[3];
-
- gst_video_sink_center_rect (src, dst, &result, TRUE);
-
- gl->Viewport (result.x, result.y, result.w, result.h);
-
- if (self->draw_cb)
- self->draw_cb (self->draw_data);
- gst_gl_context_activate (self->draw_context, FALSE);
-
- /* flushes the buffer */
- [super drawInCGLContext:glContext pixelFormat:pixelFormat forLayerTime:interval displayTime:timeStamp];
-}
-
-@end
diff --git a/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.h b/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.h
deleted file mode 100644
index b767bb3ba..000000000
--- a/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_CONTEXT_COCOA_H__
-#define __GST_GL_CONTEXT_COCOA_H__
-
-#include <gst/gst.h>
-
-#include <gst/gl/gl.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_CONTEXT_COCOA (gst_gl_context_cocoa_get_type())
-GType gst_gl_context_cocoa_get_type (void);
-
-/* FIXME: remove this when moving to -base */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_GL_TYPE_CONTEXT_COCOA GST_TYPE_GL_CONTEXT_COCOA
-#endif
-#define GST_GL_CONTEXT_COCOA(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_CONTEXT_COCOA, GstGLContextCocoa))
-#define GST_GL_CONTEXT_COCOA_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_CONTEXT_COCOA, GstGLContextCocoaClass))
-#define GST_IS_GL_CONTEXT_COCOA(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_CONTEXT_COCOA))
-#define GST_IS_GL_CONTEXT_COCOA_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_CONTEXT_COCOA))
-#define GST_GL_CONTEXT_COCOA_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_CONTEXT_COCOA, GstGLContextCocoaClass))
-
-typedef struct _GstGLContextCocoa GstGLContextCocoa;
-typedef struct _GstGLContextCocoaPrivate GstGLContextCocoaPrivate;
-typedef struct _GstGLContextCocoaClass GstGLContextCocoaClass;
-
-struct _GstGLContextCocoa {
- /*< private >*/
- GstGLContext parent;
-
- /*< private >*/
- GstGLContextCocoaPrivate *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-struct _GstGLContextCocoaClass {
- /*< private >*/
- GstGLContextClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING_LARGE];
-
- GstGLContextCocoaPrivate *priv;
-};
-
-GstGLContextCocoa * gst_gl_context_cocoa_new (GstGLDisplay * display);
-guintptr gst_gl_context_cocoa_get_current_context (void);
-CGLPixelFormatObj gst_gl_context_cocoa_get_pixel_format (GstGLContextCocoa *context);
-void gst_gl_context_cocoa_dump_pixel_format (CGLPixelFormatObj fmt);
-
-
-G_END_DECLS
-
-#endif /* __GST_GL_CONTEXT_COCOA_H__ */
diff --git a/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m b/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m
deleted file mode 100644
index b3ba59e9c..000000000
--- a/gst-libs/gst/gl/cocoa/gstglcontext_cocoa.m
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <Cocoa/Cocoa.h>
-
-#include "gstglcontext_cocoa.h"
-#include "gstgl_cocoa_private.h"
-
-static gboolean gst_gl_context_cocoa_create_context (GstGLContext *context, GstGLAPI gl_api,
- GstGLContext * other_context, GError **error);
-static void gst_gl_context_cocoa_destroy_context (GstGLContext *context);
-static guintptr gst_gl_context_cocoa_get_gl_context (GstGLContext * window);
-static gboolean gst_gl_context_cocoa_activate (GstGLContext * context, gboolean activate);
-static GstGLAPI gst_gl_context_cocoa_get_gl_api (GstGLContext * context);
-static GstGLPlatform gst_gl_context_cocoa_get_gl_platform (GstGLContext * context);
-static void gst_gl_context_cocoa_swap_buffers (GstGLContext * context);
-
-#define GST_GL_CONTEXT_COCOA_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT_COCOA, GstGLContextCocoaPrivate))
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_context_cocoa_debug);
-#define GST_CAT_DEFAULT gst_gl_context_cocoa_debug
-
-G_DEFINE_TYPE_WITH_CODE (GstGLContextCocoa, gst_gl_context_cocoa,
- GST_TYPE_GL_CONTEXT, GST_DEBUG_CATEGORY_INIT (gst_gl_context_cocoa_debug, "glcontext_cocoa", 0, "Cocoa GL Context"); );
-
-static void
-gst_gl_context_cocoa_class_init (GstGLContextCocoaClass * klass)
-{
- GstGLContextClass *context_class = (GstGLContextClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstGLContextCocoaPrivate));
-
- context_class->swap_buffers =
- GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_swap_buffers);
- context_class->destroy_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_destroy_context);
- context_class->create_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_create_context);
- context_class->get_gl_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_get_gl_context);
- context_class->activate = GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_activate);
- context_class->get_gl_api =
- GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_get_gl_api);
- context_class->get_gl_platform =
- GST_DEBUG_FUNCPTR (gst_gl_context_cocoa_get_gl_platform);
-}
-
-static void
-gst_gl_context_cocoa_init (GstGLContextCocoa * context)
-{
- context->priv = GST_GL_CONTEXT_COCOA_GET_PRIVATE (context);
-}
-
-/* Must be called in the gl thread */
-GstGLContextCocoa *
-gst_gl_context_cocoa_new (GstGLDisplay * display)
-{
- GstGLContextCocoa *context;
-
- if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_COCOA) == 0)
- /* we require an cocoa display to create CGL contexts */
- return NULL;
-
- context = g_object_new (GST_TYPE_GL_CONTEXT_COCOA, NULL);
- gst_object_ref_sink (context);
-
- return context;
-}
-
-struct pixel_attr
-{
- CGLPixelFormatAttribute attr;
- const gchar *attr_name;
-};
-
-static struct pixel_attr pixel_attrs[] = {
- {kCGLPFAAllRenderers, "All Renderers"},
- {kCGLPFADoubleBuffer, "Double Buffered"},
- {kCGLPFAAuxBuffers, "Aux Buffers"},
- {kCGLPFAColorSize, "Color Size"},
- {kCGLPFAAlphaSize, "Alpha Size"},
- {kCGLPFADepthSize, "Depth Size"},
- {kCGLPFAStencilSize, "Stencil Size"},
- {kCGLPFAAccumSize, "Accum Size"},
- {kCGLPFAMinimumPolicy, "Minimum Policy"},
- {kCGLPFAMaximumPolicy, "Maximum Policy"},
- {kCGLPFASampleBuffers, "Sample Buffers"},
- {kCGLPFASamples, "Samples"},
- {kCGLPFAAuxDepthStencil, "Aux Depth Stencil"},
- {kCGLPFAColorFloat, "Color Float"},
- {kCGLPFAMultisample, "Multisample"},
- {kCGLPFASupersample, "Supersample"},
- {kCGLPFARendererID, "Renderer ID"},
- {kCGLPFANoRecovery, "No Recovery"},
- {kCGLPFAAccelerated, "Accelerated"},
- {kCGLPFAClosestPolicy, "Closest Policy"},
- {kCGLPFABackingStore, "Backing Store"},
- {kCGLPFADisplayMask, "Display Mask"},
- {kCGLPFAAllowOfflineRenderers, "Allow Offline Renderers"},
- {kCGLPFAAcceleratedCompute, "Accelerated Compute"},
- {kCGLPFAOpenGLProfile, "OpenGL Profile"},
- {kCGLPFAVirtualScreenCount, "Virtual Screen Count"},
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11
- {kCGLPFAStereo, "Stereo"},
-#endif
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
- {kCGLPFACompliant, "Compliant"},
- {kCGLPFARemotePBuffer, "Remote PBuffer"},
- {kCGLPFASingleRenderer, "Single Renderer"},
- {kCGLPFAWindow, "Window"},
-#endif
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
-// {kCGLPFAOffScreen, "Off Screen"},
-// {kCGLPFAPBuffer, "PBuffer"},
-#endif
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
-// {kCGLPFAFullScreen, "Full Screen"},
-#endif
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
-// {kCGLPFAMPSafe, "MP Safe"},
-// {kCGLPFAMultiScreen, "Multi Screen"},
-// {kCGLPFARobust, "Robust"},
-#endif
-};
-
-void
-gst_gl_context_cocoa_dump_pixel_format (CGLPixelFormatObj fmt)
-{
- int i;
-
- for (i = 0; i < G_N_ELEMENTS (pixel_attrs); i++) {
- gint val;
- CGLError ret = CGLDescribePixelFormat (fmt, 0, pixel_attrs[i].attr, &val);
-
- if (ret != kCGLNoError) {
- GST_WARNING ("failed to get pixel format %p attribute %s", fmt, pixel_attrs[i].attr_name);
- } else {
- GST_DEBUG ("Pixel format %p attr %s = %i", fmt, pixel_attrs[i].attr_name,
- val);
- }
- }
-}
-
-CGLPixelFormatObj
-gst_gl_context_cocoa_get_pixel_format (GstGLContextCocoa *context)
-{
- return context->priv->pixel_format;
-}
-
-static gboolean
-gst_gl_context_cocoa_create_context (GstGLContext *context, GstGLAPI gl_api,
- GstGLContext *other_context, GError **error)
-{
- GstGLContextCocoa *context_cocoa = GST_GL_CONTEXT_COCOA (context);
- GstGLContextCocoaPrivate *priv = context_cocoa->priv;
- GstGLWindow *window = gst_gl_context_get_window (context);
- GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
- GstGLAPI context_api = GST_GL_API_NONE;
- const GLint swapInterval = 1;
- CGLPixelFormatObj fmt = NULL;
- CGLContextObj glContext;
- CGLPixelFormatAttribute attribs[] = {
- kCGLPFADoubleBuffer,
- kCGLPFAAccumSize, 32,
- 0
- };
- CGLError ret;
- gint pix_fmt_i = 0;
- gint npix;
-
- if ((gl_api & (GST_GL_API_OPENGL | GST_GL_API_OPENGL3)) == GST_GL_API_NONE) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
- "The CGL backend only supports GL and GL3");
- goto error;
- }
-
- priv->gl_context = nil;
- if (other_context)
- priv->external_gl_context = (CGLContextObj) gst_gl_context_get_gl_context (other_context);
- else
- priv->external_gl_context = NULL;
-
- if (priv->external_gl_context) {
- gint profile;
-
- fmt = CGLGetPixelFormat (priv->external_gl_context);
-
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
- /* core profile is only available in >= 10.7 */
- if (kCGLNoError == CGLDescribePixelFormat (fmt, 0, kCGLPFAOpenGLProfile,
- &profile)) {
- if (profile == kCGLOGLPVersion_3_2_Core) {
- context_api = GST_GL_API_OPENGL3;
- } else {
- context_api =GST_GL_API_OPENGL;
- }
- }
-#else
- context_api = GST_GL_API_OPENGL;
-#endif
- }
-
- if (!fmt) {
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
- if (gl_api & GST_GL_API_OPENGL3) {
- attribs[pix_fmt_i++] = kCGLPFAOpenGLProfile;
- attribs[pix_fmt_i++] = (int) kCGLOGLPVersion_3_2_Core;
- context_api = GST_GL_API_OPENGL3;
- } else {
- context_api = GST_GL_API_OPENGL;
- }
-#else
- context_api = GST_GL_API_OPENGL;
-#endif
-
- attribs[pix_fmt_i++] = 0;
-
- ret = CGLChoosePixelFormat (attribs, &fmt, &npix);
- if (ret != kCGLNoError) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "cannot choose a pixel format: %s", CGLErrorString (ret));
- goto error;
- }
- }
-
- gst_gl_context_cocoa_dump_pixel_format (fmt);
-
- ret = CGLCreateContext (fmt, priv->external_gl_context, &glContext);
- if (ret != kCGLNoError) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
- "failed to create context: %s", CGLErrorString (ret));
- goto error;
- }
-
- context_cocoa->priv->pixel_format = fmt;
- context_cocoa->priv->gl_context = glContext;
-
- _invoke_on_main ((GstGLWindowCB) gst_gl_window_cocoa_create_window,
- gst_object_ref (window_cocoa), (GDestroyNotify) gst_object_unref);
-
- if (!context_cocoa->priv->gl_context) {
- goto error;
- }
-
- GST_INFO_OBJECT (context, "GL context created: %p", context_cocoa->priv->gl_context);
-
- CGLSetCurrentContext (context_cocoa->priv->gl_context);
-
- /* Back and front buffers are swapped only during the vertical retrace of the monitor.
- * Discarded if you configured your driver to Never-use-V-Sync.
- */
- CGLSetParameter (context_cocoa->priv->gl_context, kCGLCPSwapInterval, &swapInterval);
-
- context_cocoa->priv->context_api = context_api;
-
- if (window)
- gst_object_unref (window);
-
- return TRUE;
-
-error:
- {
- if (window)
- gst_object_unref (window);
- return FALSE;
- }
-}
-
-static void
-gst_gl_context_cocoa_swap_buffers (GstGLContext * context)
-{
-}
-
-static void
-gst_gl_context_cocoa_destroy_context (GstGLContext *context)
-{
- /* FIXME: Need to release context and other things? */
-}
-
-static guintptr
-gst_gl_context_cocoa_get_gl_context (GstGLContext * context)
-{
- return (guintptr) GST_GL_CONTEXT_COCOA (context)->priv->gl_context;
-}
-
-static gboolean
-gst_gl_context_cocoa_activate (GstGLContext * context, gboolean activate)
-{
- GstGLContextCocoa *context_cocoa = GST_GL_CONTEXT_COCOA (context);
- gpointer context_handle = activate ? context_cocoa->priv->gl_context : NULL;
-
- return kCGLNoError == CGLSetCurrentContext (context_handle);
-}
-
-static GstGLAPI
-gst_gl_context_cocoa_get_gl_api (GstGLContext * context)
-{
- GstGLContextCocoa *context_cocoa = GST_GL_CONTEXT_COCOA (context);
-
- if (context_cocoa->priv->gl_context)
- return context_cocoa->priv->context_api;
-
- return GST_GL_API_OPENGL | GST_GL_API_OPENGL3;
-}
-
-static GstGLPlatform
-gst_gl_context_cocoa_get_gl_platform (GstGLContext * context)
-{
- return GST_GL_PLATFORM_CGL;
-}
-
-guintptr
-gst_gl_context_cocoa_get_current_context (void)
-{
- return (guintptr) CGLGetCurrentContext ();
-}
diff --git a/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.h b/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.h
deleted file mode 100644
index 5551f0f29..000000000
--- a/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 Julien Isorce <julien.isorce@gmail.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_DISPLAY_COCOA_H__
-#define __GST_GL_DISPLAY_COCOA_H__
-
-#include <gst/gst.h>
-
-#include <gst/gl/gstgl_fwd.h>
-#include <gst/gl/gstgldisplay.h>
-
-G_BEGIN_DECLS
-
-GType gst_gl_display_cocoa_get_type (void);
-
-#define GST_TYPE_GL_DISPLAY_COCOA (gst_gl_display_cocoa_get_type())
-#define GST_GL_DISPLAY_COCOA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_COCOA,GstGLDisplayCocoa))
-#define GST_GL_DISPLAY_COCOA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_COCOA,GstGLDisplayCocoaClass))
-#define GST_IS_GL_DISPLAY_COCOA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_COCOA))
-#define GST_IS_GL_DISPLAY_COCOA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_COCOA))
-#define GST_GL_DISPLAY_COCOA_CAST(obj) ((GstGLDisplayCocoa*)(obj))
-
-typedef struct _GstGLDisplayCocoa GstGLDisplayCocoa;
-typedef struct _GstGLDisplayCocoaClass GstGLDisplayCocoaClass;
-
-/**
- * GstGLDisplayCocoa:
- *
- * Initialized NSApp if the application has not done it.
- */
-struct _GstGLDisplayCocoa
-{
- GstGLDisplay parent;
-};
-
-struct _GstGLDisplayCocoaClass
-{
- GstGLDisplayClass object_class;
-};
-
-GstGLDisplayCocoa *gst_gl_display_cocoa_new (void);
-
-G_END_DECLS
-
-#endif /* __GST_GL_DISPLAY_COCOA_H__ */
diff --git a/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.m b/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.m
deleted file mode 100644
index 5b9205b45..000000000
--- a/gst-libs/gst/gl/cocoa/gstgldisplay_cocoa.m
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <Cocoa/Cocoa.h>
-
-#include <gst/gl/cocoa/gstgldisplay_cocoa.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
-#define GST_CAT_DEFAULT gst_gl_display_debug
-
-G_DEFINE_TYPE (GstGLDisplayCocoa, gst_gl_display_cocoa, GST_TYPE_GL_DISPLAY);
-
-static void gst_gl_display_cocoa_finalize (GObject * object);
-static guintptr gst_gl_display_cocoa_get_handle (GstGLDisplay * display);
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
-#define NSEventMaskAny NSAnyEventMask
-#endif
-
-/* Define this if the GLib patch from
- * https://bugzilla.gnome.org/show_bug.cgi?id=741450
- * is used
- */
-#ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION
-
-static GstGLDisplayCocoa *singleton = NULL;
-static gint nsapp_source_id = 0;
-static GMutex nsapp_lock;
-static GCond nsapp_cond;
-
-static gboolean
-gst_gl_display_cocoa_nsapp_iteration (gpointer data)
-{
- NSEvent *event = nil;
-
- if (![NSThread isMainThread]) {
- GST_WARNING ("NSApp iteration not running in the main thread");
- return FALSE;
- }
-
-
- while ((event = ([NSApp nextEventMatchingMask:NSEventMaskAny
- untilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]
- inMode:NSDefaultRunLoopMode dequeue:YES])) != nil) {
- [NSApp sendEvent:event];
- }
-
- return TRUE;
-}
-
-static void
-gst_gl_display_cocoa_open_and_attach_source (gpointer data)
-{
- if ([NSThread isMainThread]) {
- /* The sharedApplication class method initializes
- * the display environment and connects your program
- * to the window server and the display server.
- * It has to be done in the main thread.
- */
- [NSApplication sharedApplication];
-
- GST_DEBUG ("Custom NSApp initialization done");
-
- nsapp_source_id = g_timeout_add (60, gst_gl_display_cocoa_nsapp_iteration,
- NULL);
-
- GST_DEBUG ("NSApp iteration loop attached, id %d", nsapp_source_id);
- }
-}
-
-static gboolean
-gst_gl_display_cocoa_init_nsapp (gpointer data)
-{
- g_mutex_lock (&nsapp_lock);
-
- gst_gl_display_cocoa_open_and_attach_source (data);
-
- g_cond_signal (&nsapp_cond);
- g_mutex_unlock (&nsapp_lock);
-
- return FALSE;
-}
-
-static GstGLDisplayCocoa *
-gst_gl_display_cocoa_setup_nsapp (gpointer data)
-{
- GMainContext *context = g_main_context_default ();
- gint delta_ms = 0;
-
- g_mutex_lock (&nsapp_lock);
-
- if (singleton) {
- GST_DEBUG ("Get existing display");
- singleton = gst_object_ref (singleton);
- g_mutex_unlock (&nsapp_lock);
- return singleton;
- }
-
- if (NSApp != nil && !singleton) {
- GstGLDisplayCocoa *ret = g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL);
- gst_object_ref_sink (ret);
- g_mutex_unlock (&nsapp_lock);
- return ret;
- }
-
- /* All application have to start with [NSApplication sharedApplication]
- * so if NSApp is nil here let's assume this is a debugging application
- * that runs a glib main loop. */
- g_assert (NSApp == nil);
-
- GST_DEBUG ("The application has not initialized NSApp");
-
- if ([NSThread isMainThread]) {
-
- GST_DEBUG ("Setting up NSApp from the main thread");
- if (g_main_context_is_owner (context)) {
- GST_DEBUG ("The main thread own the context");
- gst_gl_display_cocoa_open_and_attach_source (data);
- } else if (g_main_context_acquire (context)) {
- GST_DEBUG ("The main loop should be shortly running in the main thread");
- gst_gl_display_cocoa_open_and_attach_source (data);
- g_main_context_release (context);
- } else {
- GST_WARNING ("Main loop running in another thread");
- }
- } else {
-
- GST_DEBUG ("Setting up NSApp not from the main thread");
-
- if (g_main_context_is_owner (context)) {
- GST_WARNING ("Default context not own by the main thread");
- delta_ms = -1;
- } else if (g_main_context_acquire (context)) {
- GST_DEBUG ("The main loop should be shortly running in the main thread");
- delta_ms = 1000;
- g_main_context_release (context);
- } else {
- GST_DEBUG ("Main loop running in main thread");
- delta_ms = 500;
- }
-
- if (delta_ms > 0) {
- gint64 end_time = g_get_monotonic_time () + delta_ms * 1000;;
- g_idle_add_full (G_PRIORITY_HIGH, gst_gl_display_cocoa_init_nsapp, data, NULL);
- g_cond_wait_until (&nsapp_cond, &nsapp_lock, end_time);
- }
- }
-
- if (NSApp == nil) {
- GST_ERROR ("Custom NSApp initialization failed");
- } else {
- GST_DEBUG ("Create display");
- singleton = g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL);
- gst_object_ref_sink (singleton);
- }
-
- g_mutex_unlock (&nsapp_lock);
-
- return singleton;
-}
-
-#endif
-
-static void
-gst_gl_display_cocoa_class_init (GstGLDisplayCocoaClass * klass)
-{
- GST_GL_DISPLAY_CLASS (klass)->get_handle =
- GST_DEBUG_FUNCPTR (gst_gl_display_cocoa_get_handle);
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_display_cocoa_finalize;
-}
-
-static void
-gst_gl_display_cocoa_init (GstGLDisplayCocoa * display_cocoa)
-{
- GstGLDisplay *display = (GstGLDisplay *) display_cocoa;
- display->type = GST_GL_DISPLAY_TYPE_COCOA;
-}
-
-static void
-gst_gl_display_cocoa_finalize (GObject * object)
-{
-#ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION
- g_mutex_lock (&nsapp_lock);
- if (singleton) {
- GST_DEBUG ("Destroy display");
- singleton = NULL;
- if (nsapp_source_id) {
- GST_DEBUG ("Remove NSApp loop iteration, id %d", nsapp_source_id);
- g_source_remove (nsapp_source_id);
- }
- nsapp_source_id = 0;
- g_mutex_unlock (&nsapp_lock);
- }
- g_mutex_unlock (&nsapp_lock);
-#endif
-
- G_OBJECT_CLASS (gst_gl_display_cocoa_parent_class)->finalize (object);
-}
-
-/**
- * gst_gl_display_cocoa_new:
- *
- * Create a new #GstGLDisplayCocoa.
- *
- * Returns: (transfer full): a new #GstGLDisplayCocoa or %NULL
- */
-GstGLDisplayCocoa *
-gst_gl_display_cocoa_new (void)
-{
- GstGLDisplayCocoa *display;
-
- GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-
-#ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION
- display = gst_gl_display_cocoa_setup_nsapp (NULL);
-#else
- display = g_object_new (GST_TYPE_GL_DISPLAY_COCOA, NULL);
- gst_object_ref_sink (display);
-#endif
-
- return display;
-}
-
-static guintptr
-gst_gl_display_cocoa_get_handle (GstGLDisplay * display)
-{
- return (guintptr) NSApp;
-}
diff --git a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.h b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.h
deleted file mode 100644
index 4c0bf4fc3..000000000
--- a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_WINDOW_COCOA_H__
-#define __GST_GL_WINDOW_COCOA_H__
-
-#include <gst/gst.h>
-
-#include <gst/gl/gl.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_WINDOW_COCOA (gst_gl_window_cocoa_get_type())
-#define GST_GL_WINDOW_COCOA(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW_COCOA, GstGLWindowCocoa))
-#define GST_GL_WINDOW_COCOA_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_WINDOW_COCOA, GstGLWindowCocoaClass))
-#define GST_IS_GL_WINDOW_COCOA(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW_COCOA))
-#define GST_IS_GL_WINDOW_COCOA_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW_COCOA))
-#define GST_GL_WINDOW_COCOA_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW_COCOA, GstGLWindowCocoaClass))
-
-typedef struct _GstGLWindowCocoa GstGLWindowCocoa;
-typedef struct _GstGLWindowCocoaPrivate GstGLWindowCocoaPrivate;
-typedef struct _GstGLWindowCocoaClass GstGLWindowCocoaClass;
-
-struct _GstGLWindowCocoa {
- /*< private >*/
- GstGLWindow parent;
-
- /*< private >*/
- GstGLWindowCocoaPrivate *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-struct _GstGLWindowCocoaClass {
- /*< private >*/
- GstGLWindowClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING_LARGE];
-};
-
-GType gst_gl_window_cocoa_get_type (void);
-
-GstGLWindowCocoa * gst_gl_window_cocoa_new (GstGLDisplay * display);
-
-void gst_gl_window_cocoa_draw_thread (GstGLWindowCocoa *window_cocoa);
-
-G_END_DECLS
-
-#endif /* __GST_GL_WINDOW_COCOA_H__ */
diff --git a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m
deleted file mode 100644
index 4533b83c9..000000000
--- a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m
+++ /dev/null
@@ -1,604 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it un der 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <Cocoa/Cocoa.h>
-#include <QuartzCore/QuartzCore.h>
-
-#include "gstgl_cocoa_private.h"
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
-#define NSWindowStyleMaskTitled NSTitledWindowMask
-#define NSWindowStyleMaskClosable NSClosableWindowMask
-#define NSWindowStyleMaskResizable NSResizableWindowMask
-#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
-#endif
-
-/* =============================================================*/
-/* */
-/* GstGLNSWindow declaration */
-/* */
-/* =============================================================*/
-
-@interface GstGLNSWindow: NSWindow {
- BOOL m_isClosed;
- GstGLWindowCocoa *window_cocoa;
-}
-- (id)initWithContentRect:(NSRect)contentRect
- styleMask: (unsigned int) styleMask
- backing: (NSBackingStoreType) bufferingType
- defer: (BOOL) flag screen: (NSScreen *) aScreen
- gstWin: (GstGLWindowCocoa *) window;
-- (void) setClosed;
-- (BOOL) isClosed;
-- (BOOL) canBecomeMainWindow;
-- (BOOL) canBecomeKeyWindow;
-@end
-
-/* =============================================================*/
-/* */
-/* GstGLWindow */
-/* */
-/* =============================================================*/
-
-#define GST_GL_WINDOW_COCOA_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_WINDOW_COCOA, GstGLWindowCocoaPrivate))
-
-#define GST_CAT_DEFAULT gst_gl_window_cocoa_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-#define DEBUG_INIT \
- GST_DEBUG_CATEGORY_GET (GST_CAT_DEFAULT, "glwindow");
-#define gst_gl_window_cocoa_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstGLWindowCocoa, gst_gl_window_cocoa, GST_TYPE_GL_WINDOW, DEBUG_INIT);
-static void gst_gl_window_cocoa_finalize (GObject * object);
-
-static gboolean gst_gl_window_cocoa_open (GstGLWindow *window, GError **err);
-static void gst_gl_window_cocoa_close (GstGLWindow *window);
-static guintptr gst_gl_window_cocoa_get_window_handle (GstGLWindow * window);
-static void gst_gl_window_cocoa_set_window_handle (GstGLWindow * window,
- guintptr handle);
-static void gst_gl_window_cocoa_draw (GstGLWindow * window);
-static void gst_gl_window_cocoa_set_preferred_size (GstGLWindow * window,
- gint width, gint height);
-static void gst_gl_window_cocoa_show (GstGLWindow * window);
-static void gst_gl_window_cocoa_queue_resize (GstGLWindow * window);
-static void gst_gl_window_cocoa_send_message_async (GstGLWindow * window,
- GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
-
-struct _GstGLWindowCocoaPrivate
-{
- gpointer internal_win_id;
- gpointer external_view;
- gboolean visible;
- gint preferred_width;
- gint preferred_height;
-
- GLint viewport_dim[4];
-
- /* atomic set when the internal NSView has been created */
- int view_ready;
-
- gpointer gl_queue;
-};
-
-static void
-gst_gl_window_cocoa_class_init (GstGLWindowCocoaClass * klass)
-{
- GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
- GObjectClass *gobject_class = (GObjectClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstGLWindowCocoaPrivate));
-
- window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_open);
- window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_close);
- window_class->get_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_get_window_handle);
- window_class->set_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_set_window_handle);
- window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_draw);
- window_class->set_preferred_size =
- GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_set_preferred_size);
- window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_show);
- window_class->queue_resize = GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_queue_resize);
- window_class->send_message_async =
- GST_DEBUG_FUNCPTR (gst_gl_window_cocoa_send_message_async);
-
- gobject_class->finalize = gst_gl_window_cocoa_finalize;
-}
-
-static void
-gst_gl_window_cocoa_init (GstGLWindowCocoa * window)
-{
- window->priv = GST_GL_WINDOW_COCOA_GET_PRIVATE (window);
-
- window->priv->preferred_width = 320;
- window->priv->preferred_height = 240;
- window->priv->gl_queue = (__bridge_retained gpointer)
- (dispatch_queue_create ("org.freedesktop.gstreamer.glwindow", NULL));
-}
-
-static void
-gst_gl_window_cocoa_finalize (GObject * object)
-{
- GstGLWindowCocoa *window = GST_GL_WINDOW_COCOA (object);
- window->priv->gl_queue = NULL;
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-GstGLWindowCocoa *
-gst_gl_window_cocoa_new (GstGLDisplay * display)
-{
- GstGLWindowCocoa *window;
-
- if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_COCOA) == 0)
- /* we require an cocoa display to create CGL windows */
- return NULL;
-
- window = g_object_new (GST_TYPE_GL_WINDOW_COCOA, NULL);
- gst_object_ref_sink (window);
-
- return window;
-}
-
-/* Must be called from the main thread */
-gboolean
-gst_gl_window_cocoa_create_window (GstGLWindowCocoa *window_cocoa)
-{
- GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
- GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
- GstGLNSWindow *internal_win_id;
- NSRect mainRect = [[NSScreen mainScreen] visibleFrame];
- gint h = priv->preferred_height;
- gint y = mainRect.size.height > h ? (mainRect.size.height - h) * 0.5 : 0;
- NSRect rect = NSMakeRect (0, y, priv->preferred_width, priv->preferred_height);
- NSRect windowRect = NSMakeRect (0, y, priv->preferred_width, priv->preferred_height);
- GstGLContext *context = gst_gl_window_get_context (window);
- GstGLContextCocoa *context_cocoa;
- GstGLCAOpenGLLayer *layer;
- GstGLNSView *glView;
-
- if (!context)
- return FALSE;
-
- context_cocoa = GST_GL_CONTEXT_COCOA (context);
- layer = [[GstGLCAOpenGLLayer alloc] initWithGstGLContext:context];
- glView = [[GstGLNSView alloc] initWithFrameLayer:window_cocoa rect:windowRect layer:layer];
-
- gst_object_unref (context);
-
- internal_win_id = [[GstGLNSWindow alloc] initWithContentRect:rect styleMask:
- (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
- NSWindowStyleMaskResizable | NSWindowStyleMaskMiniaturizable)
- backing: NSBackingStoreBuffered defer: NO screen: nil gstWin: window_cocoa];
-
- priv->internal_win_id = (__bridge_retained gpointer)internal_win_id;
-
- GST_DEBUG ("NSWindow id: %"G_GUINTPTR_FORMAT, (guintptr) priv->internal_win_id);
-
- [internal_win_id setContentView:glView];
-
- g_atomic_int_set (&window_cocoa->priv->view_ready, 1);
-
- /* Set the window handle for real now that the NSWindow has been created. */
- if (priv->external_view)
- gst_gl_window_cocoa_set_window_handle (window,
- (guintptr) priv->external_view);
-
- return TRUE;
-}
-
-static gboolean
-gst_gl_window_cocoa_open (GstGLWindow *window, GError **err)
-{
- GstGLWindowCocoa *window_cocoa;
-
- window_cocoa = GST_GL_WINDOW_COCOA (window);
-
- return TRUE;
-}
-
-static void
-gst_gl_window_cocoa_close (GstGLWindow *window)
-{
- GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
- GstGLNSWindow *internal_win_id = (__bridge GstGLNSWindow *)window_cocoa->priv->internal_win_id;
-
- [[internal_win_id contentView] removeFromSuperview];
- CFBridgingRelease(window_cocoa->priv->internal_win_id);
- window_cocoa->priv->internal_win_id = NULL;
-}
-
-static guintptr
-gst_gl_window_cocoa_get_window_handle (GstGLWindow *window)
-{
- return (guintptr) GST_GL_WINDOW_COCOA (window)->priv->internal_win_id;
-}
-
-static void
-gst_gl_window_cocoa_set_window_handle (GstGLWindow * window, guintptr handle)
-{
- GstGLWindowCocoa *window_cocoa;
- GstGLWindowCocoaPrivate *priv;
-
- window_cocoa = GST_GL_WINDOW_COCOA (window);
- priv = window_cocoa->priv;
-
- if (priv->internal_win_id) {
- if (handle) {
- priv->external_view = (gpointer)handle;
- priv->visible = TRUE;
- } else {
- /* bring back our internal window */
- priv->external_view = 0;
- priv->visible = FALSE;
- }
-
-
- dispatch_async (dispatch_get_main_queue (), ^{
- GstGLNSWindow *internal_win_id =
- (__bridge GstGLNSWindow *)window_cocoa->priv->internal_win_id;
- NSView *external_view =
- (__bridge NSView *)window_cocoa->priv->external_view;
-
- NSView *view = [internal_win_id contentView];
- [internal_win_id orderOut:internal_win_id];
-
- [external_view addSubview: view];
-
- [view setFrame: [external_view bounds]];
- [view setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
- });
- } else {
- /* no internal window yet so delay it to the next drawing */
- priv->external_view = (gpointer)handle;
- priv->visible = FALSE;
- }
-}
-
-static void
-_show_window (gpointer data)
-{
- GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (data);
- GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
- GstGLNSWindow *internal_win_id = (__bridge GstGLNSWindow *)priv->internal_win_id;
-
- GST_DEBUG_OBJECT (window_cocoa, "make the window available\n");
- [internal_win_id makeMainWindow];
- [internal_win_id orderFrontRegardless];
- [internal_win_id setViewsNeedDisplay:YES];
-
- priv->visible = TRUE;
-}
-
-static void
-gst_gl_window_cocoa_show (GstGLWindow * window)
-{
- GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
- GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
-
- if (!priv->visible) {
- /* useful when set_window_handle is called before
- * the internal NSWindow */
- if (priv->external_view) {
- gst_gl_window_cocoa_set_window_handle (window, (guintptr) priv->external_view);
- priv->visible = TRUE;
- return;
- }
-
- if (!priv->external_view && !priv->visible)
- _invoke_on_main ((GstGLWindowCB) _show_window, gst_object_ref (window),
- (GDestroyNotify) gst_object_unref);
- }
-}
-
-static void
-gst_gl_window_cocoa_queue_resize (GstGLWindow * window)
-{
- GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
- GstGLNSView *view;
- GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
- GstGLNSWindow *internal_win_id = (__bridge GstGLNSWindow *)priv->internal_win_id;
-
- if (!g_atomic_int_get (&window_cocoa->priv->view_ready))
- return;
-
- view = (GstGLNSView *)[internal_win_id contentView];
-
- [view->layer queueResize];
-}
-
-static void
-gst_gl_window_cocoa_draw (GstGLWindow * window)
-{
- GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
- GstGLNSView *view;
- GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
- GstGLNSWindow *internal_win_id = (__bridge GstGLNSWindow *)priv->internal_win_id;
-
- /* As the view is created asynchronously in the main thread we cannot know
- * exactly when it will be ready to draw to */
- if (!g_atomic_int_get (&window_cocoa->priv->view_ready))
- return;
-
- view = (GstGLNSView *)[internal_win_id contentView];
-
- /* this redraws the GstGLCAOpenGLLayer which calls
- * gst_gl_window_cocoa_draw_thread(). Use an explicit CATransaction since we
- * don't know how often the main runloop is running.
- */
- [CATransaction begin];
- [view setNeedsDisplay:YES];
- [CATransaction commit];
-}
-
-static void
-gst_gl_window_cocoa_set_preferred_size (GstGLWindow * window, gint width,
- gint height)
-{
- GstGLWindowCocoa *window_cocoa = GST_GL_WINDOW_COCOA (window);
-
- window_cocoa->priv->preferred_width = width;
- window_cocoa->priv->preferred_height = height;
-}
-
-static void
-gst_gl_cocoa_draw_cb (GstGLWindowCocoa *window_cocoa)
-{
- GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
- GstGLNSWindow *internal_win_id = (__bridge GstGLNSWindow *)priv->internal_win_id;
-
- if (internal_win_id && ![internal_win_id isClosed]) {
- GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
-
- /* draw opengl scene in the back buffer */
- if (window->draw)
- window->draw (window->draw_data);
- }
-}
-
-static void
-gst_gl_cocoa_resize_cb (GstGLNSView * view, guint width, guint height)
-{
- GstGLWindowCocoa *window_cocoa = view->window_cocoa;
- GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
- GstGLContext *context = gst_gl_window_get_context (window);
- GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
- GstGLNSWindow *internal_win_id = (__bridge GstGLNSWindow *)priv->internal_win_id;
-
- if (internal_win_id && ![internal_win_id isClosed]) {
- const GstGLFuncs *gl;
- NSRect bounds = [view bounds];
- NSRect visibleRect = [view visibleRect];
- gint viewport_dim[4];
-
- gl = context->gl_vtable;
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- bounds = [view convertRectToBacking:bounds];
- visibleRect = [view convertRectToBacking:visibleRect];
-#endif
-
- GST_DEBUG_OBJECT (window, "Window resized: bounds %lf %lf %lf %lf "
- "visibleRect %lf %lf %lf %lf",
- bounds.origin.x, bounds.origin.y,
- bounds.size.width, bounds.size.height,
- visibleRect.origin.x, visibleRect.origin.y,
- visibleRect.size.width, visibleRect.size.height);
-
- gst_gl_window_resize (window, width, height);
- gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
-
- gl->Viewport (viewport_dim[0] - visibleRect.origin.x,
- viewport_dim[1] - visibleRect.origin.y,
- viewport_dim[2], viewport_dim[3]);
- }
-
- gst_object_unref (context);
-}
-
-static void
-gst_gl_window_cocoa_send_message_async (GstGLWindow * window,
- GstGLWindowCB callback, gpointer data, GDestroyNotify destroy)
-{
- GstGLWindowCocoa *window_cocoa = (GstGLWindowCocoa *) window;
- GstGLContext *context = gst_gl_window_get_context (window);
- GThread *thread = gst_gl_context_get_thread (context);
- GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
- dispatch_queue_t gl_queue = (__bridge dispatch_queue_t)priv->gl_queue;
-
- if (thread == g_thread_self()) {
- /* this case happens for nested calls happening from inside the GCD queue */
- callback (data);
- if (destroy)
- destroy (data);
- gst_object_unref (context);
- } else {
- dispatch_async (gl_queue, ^{
- gst_gl_context_activate (context, TRUE);
- gst_object_unref (context);
- callback (data);
- if (destroy)
- destroy (data);
- });
- }
- if (thread)
- g_thread_unref (thread);
-}
-
-/* =============================================================*/
-/* */
-/* GstGLNSWindow implementation */
-/* */
-/* =============================================================*/
-
-/* Must be called from the main thread */
-@implementation GstGLNSWindow
-
-- (id) initWithContentRect: (NSRect) contentRect
- styleMask: (unsigned int) styleMask
- backing: (NSBackingStoreType) bufferingType
- defer: (BOOL) flag screen: (NSScreen *) aScreen
- gstWin: (GstGLWindowCocoa *) cocoa {
-
- m_isClosed = NO;
- window_cocoa = cocoa;
- GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
- GstGLNSWindow *internal_win_id = (__bridge GstGLNSWindow *)priv->internal_win_id;
-
- self = [super initWithContentRect: contentRect
- styleMask: styleMask backing: bufferingType
- defer: flag screen:aScreen];
-
- [self setReleasedWhenClosed:NO];
-
- GST_DEBUG ("initializing GstGLNSWindow\n");
-
- [self setTitle:@"OpenGL renderer"];
-
- [self setBackgroundColor:[NSColor blackColor]];
-
- [self orderOut:internal_win_id];
-
- return self;
-}
-
-- (void) setClosed {
- m_isClosed = YES;
-}
-
-- (BOOL) isClosed {
- return m_isClosed;
-}
-
-- (BOOL) canBecomeMainWindow {
- return YES;
-}
-
-- (BOOL) canBecomeKeyWindow {
- return YES;
-}
-
-static void
-close_window_cb (gpointer data)
-{
- GstGLWindowCocoa *window_cocoa = data;
- GstGLWindow *window;
-
- window = GST_GL_WINDOW (window_cocoa);
-
- if (window->close) {
- window->close (window->close_data);
- }
-}
-
-/* Called in the main thread which is never the gl thread */
-- (BOOL) windowShouldClose:(id)sender {
-
- GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
- GstGLNSWindow *internal_win_id = (__bridge GstGLNSWindow *)priv->internal_win_id;
- GST_DEBUG ("user clicked the close button\n");
- [internal_win_id setClosed];
- gst_gl_window_send_message_async (GST_GL_WINDOW (window_cocoa),
- (GstGLWindowCB) close_window_cb, gst_object_ref (window_cocoa),
- (GDestroyNotify) gst_object_unref);
- return YES;
-}
-
-@end
-
-/* =============================================================*/
-/* */
-/* GstGLNSView implementation */
-/* */
-/* =============================================================*/
-
-@implementation GstGLNSView
-
-/* Must be called from the application main thread */
-- (id)initWithFrameLayer:(GstGLWindowCocoa *)window rect:(NSRect)contentRect layer:(CALayer *)layerContent {
-
- self = [super initWithFrame: contentRect];
-
- window_cocoa = window;
-
- /* The order of the next two calls matters. This creates a layer-hosted
- * NSView. Calling setWantsLayer before setLayer will create a
- * layer-backed NSView. See the apple developer documentation on the
- * difference.
- */
- [self setLayer:layerContent];
- [self setWantsLayer:YES];
- self->layer = (GstGLCAOpenGLLayer *)layerContent;
- [self->layer setDrawCallback:(GstGLWindowCB)gst_gl_cocoa_draw_cb
- data:window notify:NULL];
- [self->layer setResizeCallback:(GstGLWindowResizeCB)gst_gl_cocoa_resize_cb
- data:(__bridge_retained gpointer)self notify:(GDestroyNotify)CFRelease];
-
- [self setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawOnSetNeedsDisplay];
-
- [self setWantsBestResolutionOpenGLSurface:YES];
-
- return self;
-}
-
-- (void) dealloc {
- self->layer = nil;
-}
-
-- (void)renewGState {
- /* Don't update the screen until we redraw, this
- * prevents flickering during scrolling, clipping,
- * resizing, etc
- */
- [[self window] disableScreenUpdatesUntilFlush];
-
- [super renewGState];
-}
-
-- (BOOL) isOpaque {
- return YES;
-}
-
-- (BOOL) isFlipped {
- return NO;
-}
-
-@end
-
-void
-_invoke_on_main (GstGLWindowCB func, gpointer data, GDestroyNotify notify)
-{
- if ([NSThread isMainThread]) {
- func (data);
- if (notify)
- notify (data);
- } else {
- dispatch_async (dispatch_get_main_queue (), ^{
- func (data);
- if (notify)
- notify (data);
- });
- }
-}
diff --git a/gst-libs/gst/gl/dispmanx/Makefile.am b/gst-libs/gst/gl/dispmanx/Makefile.am
deleted file mode 100644
index 28f4430b6..000000000
--- a/gst-libs/gst/gl/dispmanx/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES = libgstgl-dispmanx.la
-
-libgstgl_dispmanx_la_SOURCES = \
- gstglwindow_dispmanx_egl.c
-
-noinst_HEADERS = \
- gstglwindow_dispmanx_egl.h
-
-libgstgl_dispmanx_la_CFLAGS = \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GL_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-
-libgstgl_dispmanx_la_LDFLAGS = \
- $(GST_LIB_LDFLAGS) \
- $(GST_ALL_LDFLAGS)
diff --git a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c
deleted file mode 100644
index 7b10b4d01..000000000
--- a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Julien Isorce <julien.isorce@collabora.co.uk>
- *
- * 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.
- */
-
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "../gstgl_fwd.h"
-#include <gst/gl/gstglcontext.h>
-
-#include "gstglwindow_dispmanx_egl.h"
-#include "../gstglwindow_private.h"
-
-
-#ifndef ELEMENT_CHANGE_LAYER
-/* copied from interface/vmcs_host/vc_vchi_dispmanx.h of userland.git */
-#define ELEMENT_CHANGE_LAYER (1<<0)
-#define ELEMENT_CHANGE_OPACITY (1<<1)
-#define ELEMENT_CHANGE_DEST_RECT (1<<2)
-#define ELEMENT_CHANGE_SRC_RECT (1<<3)
-#define ELEMENT_CHANGE_MASK_RESOURCE (1<<4)
-#define ELEMENT_CHANGE_TRANSFORM (1<<5)
-#endif
-
-#define GST_CAT_DEFAULT gst_gl_window_debug
-
-#define gst_gl_window_dispmanx_egl_parent_class parent_class
-G_DEFINE_TYPE (GstGLWindowDispmanxEGL, gst_gl_window_dispmanx_egl,
- GST_TYPE_GL_WINDOW);
-
-static guintptr gst_gl_window_dispmanx_egl_get_window_handle (GstGLWindow *
- window);
-static void gst_gl_window_dispmanx_egl_set_window_handle (GstGLWindow * window,
- guintptr handle);
-static void gst_gl_window_dispmanx_egl_set_preferred_size (GstGLWindow * window,
- gint width, gint height);
-static void gst_gl_window_dispmanx_egl_show (GstGLWindow * window);
-static void gst_gl_window_dispmanx_egl_close (GstGLWindow * window);
-static gboolean gst_gl_window_dispmanx_egl_open (GstGLWindow * window,
- GError ** error);
-static guintptr gst_gl_window_dispmanx_egl_get_display (GstGLWindow * window);
-static gboolean gst_gl_window_dispmanx_egl_set_render_rectangle (GstGLWindow *
- window, gint x, gint y, gint width, gint height);
-
-static void window_resize (GstGLWindowDispmanxEGL * window_egl, guint width,
- guint height, gboolean visible);
-
-static void
-gst_gl_window_dispmanx_egl_class_init (GstGLWindowDispmanxEGLClass * klass)
-{
- GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
-
- window_class->get_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_get_window_handle);
- window_class->set_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_set_window_handle);
- window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_show);
- window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_close);
- window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_open);
- window_class->get_display =
- GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_get_display);
- window_class->set_preferred_size =
- GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_set_preferred_size);
- window_class->set_render_rectangle =
- GST_DEBUG_FUNCPTR (gst_gl_window_dispmanx_egl_set_render_rectangle);
-}
-
-static void
-gst_gl_window_dispmanx_egl_init (GstGLWindowDispmanxEGL * window_egl)
-{
- window_egl->egldisplay = EGL_DEFAULT_DISPLAY;
-
- window_egl->visible = FALSE;
- window_egl->display = 0;
- window_egl->dp_width = 0;
- window_egl->dp_height = 0;
- window_egl->native.element = 0;
- window_egl->native.width = 0;
- window_egl->native.height = 0;
- window_egl->foreign.element = 0;
- window_egl->foreign.width = 0;
- window_egl->foreign.height = 0;
- window_egl->render_rect.x = 0;
- window_egl->render_rect.y = 0;
- window_egl->render_rect.w = 0;
- window_egl->render_rect.h = 0;
-}
-
-/* Must be called in the gl thread */
-GstGLWindowDispmanxEGL *
-gst_gl_window_dispmanx_egl_new (GstGLDisplay * display)
-{
- GstGLWindowDispmanxEGL *window;
-
- if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_EGL) == 0)
- /* we require an egl display to create dispmanx windows */
- return NULL;
-
- GST_DEBUG ("creating Dispmanx EGL window");
-
- window = g_object_new (GST_TYPE_GL_WINDOW_DISPMANX_EGL, NULL);
- gst_object_ref_sink (window);
-
- return window;
-}
-
-static void
-gst_gl_window_dispmanx_egl_close (GstGLWindow * window)
-{
- GstGLWindowDispmanxEGL *window_egl;
- DISPMANX_UPDATE_HANDLE_T dispman_update;
-
- window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);
-
- if (window_egl->native.element
- && window_egl->native.element != window_egl->foreign.element) {
- dispman_update = vc_dispmanx_update_start (0);
- vc_dispmanx_element_remove (dispman_update, window_egl->native.element);
- vc_dispmanx_update_submit_sync (dispman_update);
- }
- vc_dispmanx_display_close (window_egl->display);
-
- GST_GL_WINDOW_CLASS (parent_class)->close (window);
-}
-
-static gboolean
-gst_gl_window_dispmanx_egl_open (GstGLWindow * window, GError ** error)
-{
- GstGLWindowDispmanxEGL *window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);
- gint ret = graphics_get_display_size (0, &window_egl->dp_width,
- &window_egl->dp_height);
- if (ret < 0) {
- g_set_error (error, GST_GL_WINDOW_ERROR,
- GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE, "Can't open display");
- return FALSE;
- }
- GST_DEBUG ("Got display size: %dx%d\n", window_egl->dp_width,
- window_egl->dp_height);
-
- window_egl->native.element = 0;
-
- return GST_GL_WINDOW_CLASS (parent_class)->open (window, error);
-}
-
-gboolean
-gst_gl_window_dispmanx_egl_create_window (GstGLWindowDispmanxEGL * window_egl)
-{
- window_egl->native.width = 0;
- window_egl->native.height = 0;
- window_egl->display = vc_dispmanx_display_open (0);
- window_resize (window_egl, 16, 16, FALSE);
- return TRUE;
-}
-
-static guintptr
-gst_gl_window_dispmanx_egl_get_window_handle (GstGLWindow * window)
-{
- GstGLWindowDispmanxEGL *window_egl;
- window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);
- if (window_egl->native.element)
- return (guintptr) & window_egl->native;
- return 0;
-}
-
-static void
-gst_gl_window_dispmanx_egl_set_window_handle (GstGLWindow * window,
- guintptr handle)
-{
- GstGLWindowDispmanxEGL *window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);
- EGL_DISPMANX_WINDOW_T *foreign_window = (EGL_DISPMANX_WINDOW_T *) handle;
- DISPMANX_UPDATE_HANDLE_T dispman_update;
-
- GST_DEBUG_OBJECT (window, "set window handle with size %dx%d",
- foreign_window->width, foreign_window->height);
-
- if (window_egl->native.element) {
- dispman_update = vc_dispmanx_update_start (0);
- vc_dispmanx_element_remove (dispman_update, window_egl->native.element);
- vc_dispmanx_update_submit_sync (dispman_update);
- }
-
- window_egl->native.element = window_egl->foreign.element =
- foreign_window->element;
- window_egl->native.width = window_egl->foreign.width = foreign_window->width;
- window_egl->native.height = window_egl->foreign.height =
- foreign_window->height;
-}
-
-static void
-gst_gl_window_dispmanx_egl_set_preferred_size (GstGLWindow * window, gint width,
- gint height)
-{
- GstGLWindowDispmanxEGL *window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);
-
- GST_DEBUG_OBJECT (window, "set preferred size to %dx%d", width, height);
- window_egl->preferred_width = width;
- window_egl->preferred_height = height;
-}
-
-static void
-window_resize (GstGLWindowDispmanxEGL * window_egl, guint width, guint height,
- gboolean visible)
-{
- GstGLWindow *window = GST_GL_WINDOW (window_egl);
-
- GST_DEBUG ("resizing %s window from %ux%u to %ux%u",
- visible ? "visible" : "invisible", window_egl->native.width,
- window_egl->native.height, width, height);
-
- if (window_egl->display) {
- VC_RECT_T dst_rect;
- VC_RECT_T src_rect;
- GstVideoRectangle src, res;
- DISPMANX_UPDATE_HANDLE_T dispman_update;
- uint32_t opacity = visible ? 255 : 0;
- VC_DISPMANX_ALPHA_T alpha =
- { DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS, opacity, 0 };
-
- src.w = width;
- src.h = height;
- src.x = src.y = 0;
-
- /* If there is no render rectangle, center the width*height frame
- * inside dp_width*dp_height */
- if (window_egl->render_rect.w <= 0 || window_egl->render_rect.h <= 0) {
- GstVideoRectangle dst;
- dst.w = window_egl->dp_width;
- dst.h = window_egl->dp_height;
- dst.x = dst.y = 0;
- gst_video_sink_center_rect (src, dst, &res, FALSE);
- } else {
- gst_video_sink_center_rect (src, window_egl->render_rect, &res, FALSE);
- }
-
- dst_rect.x = res.x;
- dst_rect.y = res.y;
- dst_rect.width = res.w;
- dst_rect.height = res.h;
-
- src_rect.x = 0;
- src_rect.y = 0;
- src_rect.width = width << 16;
- src_rect.height = height << 16;
-
- dispman_update = vc_dispmanx_update_start (0);
-
- if (window_egl->native.element) {
- uint32_t change_flags =
- ELEMENT_CHANGE_OPACITY | ELEMENT_CHANGE_DEST_RECT |
- ELEMENT_CHANGE_SRC_RECT;
- vc_dispmanx_element_change_attributes (dispman_update,
- window_egl->native.element, change_flags, 0, opacity, &dst_rect,
- &src_rect, 0, 0);
- } else {
- window_egl->native.element = vc_dispmanx_element_add (dispman_update,
- window_egl->display, 0, &dst_rect, 0, &src_rect,
- DISPMANX_PROTECTION_NONE, &alpha, 0, 0);
- }
-
- vc_dispmanx_update_submit_sync (dispman_update);
-
- gst_gl_window_resize (window, width, height);
- }
-
- window_egl->native.width = width;
- window_egl->native.height = height;
-}
-
-static gboolean
-gst_gl_window_dispmanx_egl_set_render_rectangle (GstGLWindow * window,
- gint x, gint y, gint width, gint height)
-{
- GstGLWindowDispmanxEGL *window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);
- window_egl->render_rect.x = x;
- window_egl->render_rect.y = y;
- window_egl->render_rect.w = width;
- window_egl->render_rect.h = height;
-
- window_resize (window_egl, window_egl->render_rect.w,
- window_egl->render_rect.h, TRUE);
- return TRUE;
-}
-
-static void
-gst_gl_window_dispmanx_egl_show (GstGLWindow * window)
-{
- GstGLWindowDispmanxEGL *window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);
-
- if (!window_egl->visible) {
- if (window_egl->render_rect.w <= 0 || window_egl->render_rect.h <= 0) {
- window_resize (window_egl, window_egl->preferred_width,
- window_egl->preferred_height, TRUE);
- }
- window_egl->visible = TRUE;
- }
-}
-
-static guintptr
-gst_gl_window_dispmanx_egl_get_display (GstGLWindow * window)
-{
- GstGLWindowDispmanxEGL *window_egl;
-
- window_egl = GST_GL_WINDOW_DISPMANX_EGL (window);
-
- return (guintptr) window_egl->egldisplay;
-}
diff --git a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h b/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h
deleted file mode 100644
index 34f1964be..000000000
--- a/gst-libs/gst/gl/dispmanx/gstglwindow_dispmanx_egl.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Julien Isorce <julien.isorce@collabora.co.uk>
- *
- * 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_WINDOW_DISPMANX_EGL_H__
-#define __GST_GL_WINDOW_DISPMANX_EGL_H__
-
-#include <gst/video/gstvideosink.h>
-#include <gst/gl/gl.h>
-#include <gst/gl/egl/gstegl.h>
-
-#if defined(__GNUC__)
-#ifndef __VCCOREVER__
-#define __VCCOREVER__ 0x04000000
-#endif
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#pragma GCC optimize ("gnu89-inline")
-#endif
-
-#include <bcm_host.h>
-
-#if defined(__GNUC__)
-#pragma GCC reset_options
-#pragma GCC diagnostic pop
-#endif
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_WINDOW_DISPMANX_EGL (gst_gl_window_dispmanx_egl_get_type())
-#define GST_GL_WINDOW_DISPMANX_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW_DISPMANX_EGL, GstGLWindowDispmanxEGL))
-#define GST_GL_WINDOW_DISPMANX_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_WINDOW_DISPMANX_EGL, GstGLWindowDispmanxEGLClass))
-#define GST_IS_GL_WINDOW_DISPMANX_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW_DISPMANX_EGL))
-#define GST_IS_GL_WINDOW_DISPMANX_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW_DISPMANX_EGL))
-#define GST_GL_WINDOW_DISPMANX_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW_DISPMANX_EGL, GstGLWindowDispmanxEGL_Class))
-
-typedef struct _GstGLWindowDispmanxEGL GstGLWindowDispmanxEGL;
-typedef struct _GstGLWindowDispmanxEGLClass GstGLWindowDispmanxEGLClass;
-
-struct _GstGLWindowDispmanxEGL {
- /*< private >*/
- GstGLWindow parent;
-
- EGLDisplay egldisplay;
-
- DISPMANX_DISPLAY_HANDLE_T display;
- uint32_t dp_height;
- uint32_t dp_width;
- EGL_DISPMANX_WINDOW_T native;
- EGL_DISPMANX_WINDOW_T foreign;
-
- gint preferred_width;
- gint preferred_height;
- GstVideoRectangle render_rect;
-
- gboolean visible;
-
- gpointer _reserved[GST_PADDING];
-};
-
-struct _GstGLWindowDispmanxEGLClass {
- /*< private >*/
- GstGLWindowClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING];
-};
-
-GType gst_gl_window_dispmanx_egl_get_type (void);
-
-GstGLWindowDispmanxEGL * gst_gl_window_dispmanx_egl_new (GstGLDisplay * display);
-gboolean gst_gl_window_dispmanx_egl_create_window (GstGLWindowDispmanxEGL * window_egl);
-
-G_END_DECLS
-
-#endif /* __GST_GL_WINDOW_X11_H__ */
diff --git a/gst-libs/gst/gl/eagl/Makefile.am b/gst-libs/gst/gl/eagl/Makefile.am
deleted file mode 100644
index a02092012..000000000
--- a/gst-libs/gst/gl/eagl/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES = libgstgl-eagl.la
-
-libgstgl_eagl_la_SOURCES = \
- gstglwindow_eagl.m \
- gstglcontext_eagl.m
-
-noinst_HEADERS = \
- gstglwindow_eagl.h \
- gstglcontext_eagl.h
-
-libgstgl_eagl_la_CFLAGS = \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GL_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-
-libgstgl_eagl_la_OBJCFLAGS = \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- -fobjc-arc \
- $(GL_CFLAGS) \
- $(GL_OBJCFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-
-libgstgl_eagl_la_LDFLAGS = \
- $(GST_LIB_LDFLAGS) \
- $(GST_ALL_LDFLAGS)
-
-libgstgl_eagl_la_LIBTOOLFLAGS = --tag=CC
diff --git a/gst-libs/gst/gl/eagl/gstglcontext_eagl.h b/gst-libs/gst/gl/eagl/gstglcontext_eagl.h
deleted file mode 100644
index 670adb5e9..000000000
--- a/gst-libs/gst/gl/eagl/gstglcontext_eagl.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Sebastian Dröge <sebastian@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_CONTEXT_EAGL_H__
-#define __GST_GL_CONTEXT_EAGL_H__
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_CONTEXT_EAGL (gst_gl_context_eagl_get_type())
-#define GST_GL_CONTEXT_EAGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_CONTEXT_EAGL, GstGLContextEagl))
-#define GST_GL_CONTEXT_EAGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_CONTEXT_EAGL, GstGLContextEaglClass))
-#define GST_IS_GL_CONTEXT_EAGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_CONTEXT_EAGL))
-#define GST_IS_GL_CONTEXT_EAGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_CONTEXT_EAGL))
-#define GST_GL_CONTEXT_EAGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_CONTEXT_EAGL, GstGLContextEaglClass))
-
-#define GS_GL_CONTEXT_EAGL_CONTEXT(obj) \
- ((__bridge EAGLContext *)(obj->priv->eagl_context))
-#define GS_GL_CONTEXT_EAGL_LAYER(obj) \
- ((__bridge CAEAGLLayer *)(obj->priv->eagl_layer))
-
-typedef struct _GstGLContextEagl GstGLContextEagl;
-typedef struct _GstGLContextEaglPrivate GstGLContextEaglPrivate;
-typedef struct _GstGLContextEaglClass GstGLContextEaglClass;
-
-struct _GstGLContextEagl {
- /*< private >*/
- GstGLContext parent;
-
- /*< private >*/
- GstGLContextEaglPrivate *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-struct _GstGLContextEaglClass {
- /*< private >*/
- GstGLContextClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING_LARGE];
-};
-
-GType gst_gl_context_eagl_get_type (void);
-
-GstGLContextEagl * gst_gl_context_eagl_new (GstGLDisplay * display);
-
-void gst_gl_context_eagl_update_layer (GstGLContext * context);
-void gst_gl_context_eagl_resize (GstGLContextEagl * eagl_context);
-void gst_gl_context_eagl_prepare_draw (GstGLContextEagl * context);
-void gst_gl_context_eagl_finish_draw (GstGLContextEagl * context);
-guintptr gst_gl_context_eagl_get_current_context (void);
-
-G_END_DECLS
-
-#endif /* __GST_GL_CONTEXT_EAGL_H__ */
diff --git a/gst-libs/gst/gl/eagl/gstglcontext_eagl.m b/gst-libs/gst/gl/eagl/gstglcontext_eagl.m
deleted file mode 100644
index 392eeee49..000000000
--- a/gst-libs/gst/gl/eagl/gstglcontext_eagl.m
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Sebastian Dröge <sebastian@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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#import <OpenGLES/EAGL.h>
-#import <QuartzCore/QuartzCore.h>
-#import <UIKit/UIKit.h>
-#include <OpenGLES/ES2/gl.h>
-
-#include "gstglcontext_eagl.h"
-#include "../gstglcontext_private.h"
-
-#define GST_CAT_DEFAULT gst_gl_context_debug
-
-static gboolean gst_gl_context_eagl_create_context (GstGLContext * context,
- GstGLAPI gl_api, GstGLContext * other_context, GError ** error);
-static void gst_gl_context_eagl_destroy_context (GstGLContext * context);
-static gboolean gst_gl_context_eagl_choose_format (GstGLContext * context,
- GError ** error);
-static guintptr gst_gl_context_eagl_get_gl_context (GstGLContext * window);
-static gboolean gst_gl_context_eagl_activate (GstGLContext * context,
- gboolean activate);
-static void gst_gl_context_eagl_swap_buffers (GstGLContext * context);
-static GstGLAPI gst_gl_context_eagl_get_gl_api (GstGLContext * context);
-static GstGLPlatform gst_gl_context_eagl_get_gl_platform (GstGLContext *
- context);
-
-struct _GstGLContextEaglPrivate
-{
- gpointer eagl_context;
-
- /* Used if we render to a window */
- gpointer eagl_layer;
- GLuint framebuffer;
- GLuint color_renderbuffer;
- GLuint depth_renderbuffer;
-};
-
-#define GST_GL_CONTEXT_EAGL_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT_EAGL, GstGLContextEaglPrivate))
-
-G_DEFINE_TYPE (GstGLContextEagl, gst_gl_context_eagl, GST_TYPE_GL_CONTEXT);
-
-static void
-gst_gl_context_eagl_class_init (GstGLContextEaglClass * klass)
-{
- GstGLContextClass *context_class;
-
- context_class = (GstGLContextClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstGLContextEaglPrivate));
-
- context_class->destroy_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_eagl_destroy_context);
- context_class->create_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_eagl_create_context);
- context_class->choose_format =
- GST_DEBUG_FUNCPTR (gst_gl_context_eagl_choose_format);
- context_class->get_gl_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_eagl_get_gl_context);
- context_class->activate = GST_DEBUG_FUNCPTR (gst_gl_context_eagl_activate);
- context_class->swap_buffers =
- GST_DEBUG_FUNCPTR (gst_gl_context_eagl_swap_buffers);
- context_class->get_gl_api =
- GST_DEBUG_FUNCPTR (gst_gl_context_eagl_get_gl_api);
- context_class->get_gl_platform =
- GST_DEBUG_FUNCPTR (gst_gl_context_eagl_get_gl_platform);
-}
-
-static void
-gst_gl_context_eagl_init (GstGLContextEagl * context)
-{
- context->priv = GST_GL_CONTEXT_EAGL_GET_PRIVATE (context);
-}
-
-/* Must be called in the gl thread */
-GstGLContextEagl *
-gst_gl_context_eagl_new (GstGLDisplay * display)
-{
- GstGLContextEagl *context;
-
- /* there isn't actually a display type for eagl yet? */
- context = g_object_new (GST_TYPE_GL_CONTEXT_EAGL, NULL);
- gst_object_ref_sink (context);
-
- return context;
-}
-
-void
-gst_gl_context_eagl_resize (GstGLContextEagl * eagl_context)
-{
- int width, height;
-
- glBindRenderbuffer (GL_RENDERBUFFER, eagl_context->priv->color_renderbuffer);
- [GS_GL_CONTEXT_EAGL_CONTEXT(eagl_context) renderbufferStorage:GL_RENDERBUFFER fromDrawable:GS_GL_CONTEXT_EAGL_LAYER(eagl_context)];
- glGetRenderbufferParameteriv (GL_RENDERBUFFER,
- GL_RENDERBUFFER_WIDTH, &width);
- glGetRenderbufferParameteriv (GL_RENDERBUFFER,
- GL_RENDERBUFFER_HEIGHT, &height);
- glBindRenderbuffer (GL_RENDERBUFFER, eagl_context->priv->depth_renderbuffer);
- glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width,
- height);
-}
-
-static void
-gst_gl_context_eagl_release_layer (GstGLContext * context)
-{
- GstGLContextEagl *context_eagl;
-
- context_eagl = GST_GL_CONTEXT_EAGL (context);
-
- if (context_eagl->priv->eagl_layer) {
- gst_gl_context_eagl_activate (context, TRUE);
-
- [GS_GL_CONTEXT_EAGL_CONTEXT(context_eagl) renderbufferStorage: GL_RENDERBUFFER fromDrawable:nil];
-
- glDeleteFramebuffers (1, &context_eagl->priv->framebuffer);
- context_eagl->priv->framebuffer = 0;
-
- glDeleteRenderbuffers (1, &context_eagl->priv->depth_renderbuffer);
- context_eagl->priv->depth_renderbuffer = 0;
- glDeleteRenderbuffers (1, &context_eagl->priv->color_renderbuffer);
- context_eagl->priv->color_renderbuffer = 0;
-
- context_eagl->priv->eagl_layer = nil;
- gst_gl_context_eagl_activate (context, FALSE);
- }
-}
-
-void
-gst_gl_context_eagl_update_layer (GstGLContext * context)
-{
- GLuint framebuffer;
- GLuint color_renderbuffer;
- GLuint depth_renderbuffer;
- GLint width;
- GLint height;
- CAEAGLLayer *eagl_layer;
- GLenum status;
- GstGLContextEagl *context_eagl = GST_GL_CONTEXT_EAGL (context);
- GstGLContextEaglPrivate *priv = context_eagl->priv;
- UIView *window_handle = nil;
- GstGLWindow *window = gst_gl_context_get_window (context);
- if (window)
- window_handle = (__bridge UIView *)((void *)gst_gl_window_get_window_handle (window));
-
- if (!window_handle) {
- GST_INFO_OBJECT (context, "window handle not set yet, not updating layer");
- goto out;
- }
-
- GST_INFO_OBJECT (context, "updating layer, frame %fx%f",
- window_handle.frame.size.width, window_handle.frame.size.height);
-
- if (priv->eagl_layer)
- gst_gl_context_eagl_release_layer (context);
-
- eagl_layer = (CAEAGLLayer *)[window_handle layer];
- [EAGLContext setCurrentContext:GS_GL_CONTEXT_EAGL_CONTEXT(context_eagl)];
-
- /* Allocate framebuffer */
- glGenFramebuffers (1, &framebuffer);
- glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
- /* Allocate color render buffer */
- glGenRenderbuffers (1, &color_renderbuffer);
- glBindRenderbuffer (GL_RENDERBUFFER, color_renderbuffer);
- [GS_GL_CONTEXT_EAGL_CONTEXT(context_eagl) renderbufferStorage: GL_RENDERBUFFER fromDrawable:eagl_layer];
- glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_RENDERBUFFER, color_renderbuffer);
- /* Get renderbuffer width/height */
- glGetRenderbufferParameteriv (GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH,
- &width);
- glGetRenderbufferParameteriv (GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT,
- &height);
- /* allocate depth render buffer */
- glGenRenderbuffers (1, &depth_renderbuffer);
- glBindRenderbuffer (GL_RENDERBUFFER, depth_renderbuffer);
- glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width,
- height);
- glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
- GL_RENDERBUFFER, depth_renderbuffer);
-
- /* check creation status */
- status = glCheckFramebufferStatus (GL_FRAMEBUFFER);
- if (status != GL_FRAMEBUFFER_COMPLETE) {
- GST_ERROR ("Failed to make complete framebuffer object %x", status);
- goto out;
- }
- glBindRenderbuffer (GL_RENDERBUFFER, 0);
- glBindFramebuffer (GL_FRAMEBUFFER, 0);
-
- priv->eagl_layer = (__bridge_retained gpointer)eagl_layer;
- priv->framebuffer = framebuffer;
- priv->color_renderbuffer = color_renderbuffer;
- priv->depth_renderbuffer = depth_renderbuffer;
-
-out:
- if (window)
- gst_object_unref (window);
-}
-
-static gboolean
-gst_gl_context_eagl_create_context (GstGLContext * context, GstGLAPI gl_api,
- GstGLContext * other_context, GError ** error)
-{
- GstGLContextEagl *context_eagl = GST_GL_CONTEXT_EAGL (context);
- GstGLContextEaglPrivate *priv = context_eagl->priv;
- EAGLSharegroup *share_group;
-
- if (other_context) {
- EAGLContext *external_gl_context = (__bridge EAGLContext *)(void *)
- gst_gl_context_get_gl_context (other_context);
- share_group = [external_gl_context sharegroup];
- } else {
- share_group = nil;
- }
-
- priv->eagl_context = (__bridge_retained gpointer)[[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3 sharegroup:share_group];
- if (!priv->eagl_context) {
- priv->eagl_context = (__bridge_retained gpointer)[[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup:share_group];
- }
- if (!priv->eagl_context) {
- g_set_error_literal (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
- "Failed to create OpenGL ES context");
- return FALSE;
- }
-
- priv->eagl_layer = NULL;
- priv->framebuffer = 0;
- priv->color_renderbuffer = 0;
- priv->depth_renderbuffer = 0;
-
- GST_INFO_OBJECT (context, "context created, updating layer");
- gst_gl_context_eagl_update_layer (context);
-
- return TRUE;
-}
-
-static void
-gst_gl_context_eagl_destroy_context (GstGLContext * context)
-{
- GstGLContextEagl *context_eagl;
-
- context_eagl = GST_GL_CONTEXT_EAGL (context);
-
- if (!context_eagl->priv->eagl_context)
- return;
-
- gst_gl_context_eagl_release_layer (context);
-
- CFRelease(context_eagl->priv->eagl_context);
- context_eagl->priv->eagl_context = NULL;
-}
-
-static gboolean
-gst_gl_context_eagl_choose_format (GstGLContext * context, GError ** error)
-{
- GstGLContextEagl *context_eagl;
- GstGLWindow *window;
- UIView *window_handle = nil;
-
- context_eagl = GST_GL_CONTEXT_EAGL (context);
- window = gst_gl_context_get_window (context);
-
- if (!window)
- return TRUE;
-
- if (window)
- window_handle = (__bridge UIView *)(void *)gst_gl_window_get_window_handle (window);
-
- if (!window_handle) {
- gst_object_unref (window);
- return TRUE;
- }
-
- CAEAGLLayer *eagl_layer;
- NSDictionary * dict =[NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking,
- kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
-
- eagl_layer = (CAEAGLLayer *)[window_handle layer];
- [eagl_layer setOpaque:YES];
- [eagl_layer setDrawableProperties:dict];
-
- gst_object_unref (window);
-
- return TRUE;
-}
-
-static guintptr
-gst_gl_context_eagl_get_gl_context (GstGLContext * context)
-{
- return (guintptr) GST_GL_CONTEXT_EAGL (context)->priv->eagl_context;
-}
-
-void
-gst_gl_context_eagl_prepare_draw (GstGLContextEagl * context)
-{
- if (!context->priv->eagl_layer)
- return;
-
- glBindFramebuffer (GL_FRAMEBUFFER, context->priv->framebuffer);
- glBindRenderbuffer (GL_RENDERBUFFER, context->priv->color_renderbuffer);
-}
-
-void
-gst_gl_context_eagl_finish_draw (GstGLContextEagl * context)
-{
- if (!context->priv->eagl_layer)
- return;
-
- glBindRenderbuffer (GL_RENDERBUFFER, 0);
- glBindFramebuffer (GL_FRAMEBUFFER, 0);
-}
-
-static void
-gst_gl_context_eagl_swap_buffers (GstGLContext * context)
-{
- GstGLContextEagl *context_eagl;
-
- context_eagl = GST_GL_CONTEXT_EAGL (context);
-
- if (!context_eagl->priv->eagl_layer)
- return;
-
- [GS_GL_CONTEXT_EAGL_CONTEXT(context_eagl) presentRenderbuffer:GL_RENDERBUFFER];
-}
-
-static gboolean
-gst_gl_context_eagl_activate (GstGLContext * context, gboolean activate)
-{
- GstGLContextEagl *context_eagl;
-
- context_eagl = GST_GL_CONTEXT_EAGL (context);
-
- if (activate) {
- EAGLContext *cur_ctx =[EAGLContext currentContext];
-
- if (cur_ctx == context_eagl->priv->eagl_context) {
- GST_DEBUG ("Already attached the context to thread %p", g_thread_self ());
- return TRUE;
- }
-
- GST_DEBUG ("Attaching context to thread %p", g_thread_self ());
- if ([EAGLContext setCurrentContext:GS_GL_CONTEXT_EAGL_CONTEXT(context_eagl)] == NO) {
- GST_ERROR ("Couldn't make context current");
- return FALSE;
- }
- } else {
- GST_DEBUG ("Detaching context from thread %p", g_thread_self ());
- if ([EAGLContext setCurrentContext:nil] == NO) {
- GST_ERROR ("Couldn't unbind context");
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-static GstGLAPI
-gst_gl_context_eagl_get_gl_api (GstGLContext * context)
-{
- return GST_GL_API_GLES2;
-}
-
-static GstGLPlatform
-gst_gl_context_eagl_get_gl_platform (GstGLContext * context)
-{
- return GST_GL_PLATFORM_EAGL;
-}
-
-guintptr
-gst_gl_context_eagl_get_current_context (void)
-{
- return (guintptr) [EAGLContext currentContext];
-}
diff --git a/gst-libs/gst/gl/eagl/gstglwindow_eagl.h b/gst-libs/gst/gl/eagl/gstglwindow_eagl.h
deleted file mode 100644
index 6c80963d6..000000000
--- a/gst-libs/gst/gl/eagl/gstglwindow_eagl.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Sebastian Dröge <sebastian@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_WINDOW_EAGL_H__
-#define __GST_GL_WINDOW_EAGL_H__
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_WINDOW_EAGL (gst_gl_window_eagl_get_type())
-#define GST_GL_WINDOW_EAGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW_EAGL, GstGLWindowEagl))
-#define GST_GL_WINDOW_EAGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_WINDOW_EAGL, GstGLWindowEaglClass))
-#define GST_IS_GL_WINDOW_EAGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW_EAGL))
-#define GST_IS_GL_WINDOW_EAGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW_EAGL))
-#define GST_GL_WINDOW_EAGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW_EAGL, GstGLWindowEaglClass))
-
-#define GS_GL_WINDOW_EAGL_VIEW(obj) \
- ((__bridge UIView *)(obj->priv->view))
-#define GS_GL_WINDOW_EAGL_QUEUE(obj) \
- ((__bridge dispatch_queue_t)(obj->priv->gl_queue))
-
-typedef struct _GstGLWindowEagl GstGLWindowEagl;
-typedef struct _GstGLWindowEaglPrivate GstGLWindowEaglPrivate;
-typedef struct _GstGLWindowEaglClass GstGLWindowEaglClass;
-
-struct _GstGLWindowEagl {
- /*< private >*/
- GstGLWindow parent;
-
- /*< private >*/
- GstGLWindowEaglPrivate *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-struct _GstGLWindowEaglClass {
- /*< private >*/
- GstGLWindowClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING_LARGE];
-};
-
-GType gst_gl_window_eagl_get_type (void);
-
-GstGLWindowEagl * gst_gl_window_eagl_new (GstGLDisplay * display);
-
-G_END_DECLS
-
-#endif /* __GST_GL_WINDOW_EAGL_H__ */
diff --git a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m b/gst-libs/gst/gl/eagl/gstglwindow_eagl.m
deleted file mode 100644
index d98cb84c2..000000000
--- a/gst-libs/gst/gl/eagl/gstglwindow_eagl.m
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it un der 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#import <OpenGLES/EAGL.h>
-#import <QuartzCore/QuartzCore.h>
-#import <UIKit/UIKit.h>
-
-#include "gstglwindow_eagl.h"
-#include "gstglcontext_eagl.h"
-
-#define GST_GL_WINDOW_EAGL_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_WINDOW_EAGL, GstGLWindowEaglPrivate))
-
-#define GST_CAT_DEFAULT gst_gl_window_eagl_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-#define DEBUG_INIT \
- GST_DEBUG_CATEGORY_GET (GST_CAT_DEFAULT, "glwindow");
-#define gst_gl_window_eagl_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstGLWindowEagl, gst_gl_window_eagl,
- GST_TYPE_GL_WINDOW, DEBUG_INIT);
-static void gst_gl_window_eagl_finalize (GObject * object);
-
-static guintptr gst_gl_window_eagl_get_display (GstGLWindow * window);
-static guintptr gst_gl_window_eagl_get_window_handle (GstGLWindow * window);
-static void gst_gl_window_eagl_set_window_handle (GstGLWindow * window,
- guintptr handle);
-static void gst_gl_window_eagl_set_preferred_size (GstGLWindow * window,
- gint width, gint height);
-static void gst_gl_window_eagl_draw (GstGLWindow * window);
-static void gst_gl_window_eagl_send_message_async (GstGLWindow * window,
- GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
-
-struct _GstGLWindowEaglPrivate
-{
- gpointer view;
- gint window_width, window_height;
- gint preferred_width, preferred_height;
- gpointer gl_queue;
-};
-
-static void
-gst_gl_window_eagl_class_init (GstGLWindowEaglClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstGLWindowEaglPrivate));
-
- gobject_class->finalize = gst_gl_window_eagl_finalize;
-
- window_class->get_display =
- GST_DEBUG_FUNCPTR (gst_gl_window_eagl_get_display);
- window_class->get_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_eagl_get_window_handle);
- window_class->set_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_eagl_set_window_handle);
- window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_eagl_draw);
- window_class->set_preferred_size =
- GST_DEBUG_FUNCPTR (gst_gl_window_eagl_set_preferred_size);
- window_class->send_message_async =
- GST_DEBUG_FUNCPTR (gst_gl_window_eagl_send_message_async);
-}
-
-static void
-gst_gl_window_eagl_init (GstGLWindowEagl * window)
-{
- window->priv = GST_GL_WINDOW_EAGL_GET_PRIVATE (window);
- window->priv->gl_queue =
- (__bridge_retained gpointer)dispatch_queue_create ("org.freedesktop.gstreamer.glwindow", NULL);
-}
-
-static void
-gst_gl_window_eagl_finalize (GObject * object)
-{
- GstGLWindowEagl *window = GST_GL_WINDOW_EAGL (object);
- CFRelease(window->priv->gl_queue);
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/* Must be called in the gl thread */
-GstGLWindowEagl *
-gst_gl_window_eagl_new (GstGLDisplay * display)
-{
- GstGLWindowEagl *window;
-
- /* there isn't an eagl display type */
- window = g_object_new (GST_TYPE_GL_WINDOW_EAGL, NULL);
- gst_object_ref_sink (window);
-
- return window;
-}
-
-static guintptr
-gst_gl_window_eagl_get_display (GstGLWindow * window)
-{
- return 0;
-}
-
-static guintptr
-gst_gl_window_eagl_get_window_handle (GstGLWindow * window)
-{
- return (guintptr) GST_GL_WINDOW_EAGL (window)->priv->view;
-}
-
-static void
-gst_gl_window_eagl_set_window_handle (GstGLWindow * window, guintptr handle)
-{
- GstGLWindowEagl *window_eagl;
- GstGLContext *context;
-
- window_eagl = GST_GL_WINDOW_EAGL (window);
- context = gst_gl_window_get_context (window);
-
- window_eagl->priv->view = (gpointer)handle;
- GST_INFO_OBJECT (context, "handle set, updating layer");
- gst_gl_context_eagl_update_layer (context);
-
- gst_object_unref (context);
-}
-
-static void
-gst_gl_window_eagl_set_preferred_size (GstGLWindow * window, gint width, gint height)
-{
- GstGLWindowEagl *window_eagl = GST_GL_WINDOW_EAGL (window);
-
- window_eagl->priv->preferred_width = width;
- window_eagl->priv->preferred_height = height;
-}
-
-static void
-gst_gl_window_eagl_send_message_async (GstGLWindow * window,
- GstGLWindowCB callback, gpointer data, GDestroyNotify destroy)
-{
- GstGLWindowEagl *window_eagl = (GstGLWindowEagl *) window;
- GstGLContext *context = gst_gl_window_get_context (window);
- GThread *thread = gst_gl_context_get_thread (context);
-
- if (thread == g_thread_self()) {
- /* this case happens for nested calls happening from inside the GCD queue */
- callback (data);
- if (destroy)
- destroy (data);
- gst_object_unref (context);
- } else {
- dispatch_async ((__bridge dispatch_queue_t)(window_eagl->priv->gl_queue), ^{
- gst_gl_context_activate (context, TRUE);
- callback (data);
- gst_object_unref (context);
- if (destroy)
- destroy (data);
- });
- }
- if (thread)
- g_thread_unref (thread);
-}
-
-static void
-draw_cb (gpointer data)
-{
- GstGLWindowEagl *window_eagl = data;
- GstGLWindow *window = GST_GL_WINDOW (window_eagl);
- GstGLContext *context = gst_gl_window_get_context (window);
- GstGLContextEagl *eagl_context = GST_GL_CONTEXT_EAGL (context);
-
- if (window_eagl->priv->view) {
- CGSize size;
- CAEAGLLayer *eagl_layer;
-
- eagl_layer = (CAEAGLLayer *)[GS_GL_WINDOW_EAGL_VIEW(window_eagl) layer];
- size = eagl_layer.frame.size;
-
- if (window->queue_resize || window_eagl->priv->window_width != size.width ||
- window_eagl->priv->window_height != size.height) {
-
- window_eagl->priv->window_width = size.width;
- window_eagl->priv->window_height = size.height;
-
- gst_gl_context_eagl_resize (eagl_context);
-
- gst_gl_window_resize (window, window_eagl->priv->window_width,
- window_eagl->priv->window_height);
- }
- }
-
- gst_gl_context_eagl_prepare_draw (eagl_context);
-
- if (window->draw)
- window->draw (window->draw_data);
-
- gst_gl_context_swap_buffers (context);
-
- gst_gl_context_eagl_finish_draw (eagl_context);
-
- gst_object_unref (context);
-}
-
-static void
-gst_gl_window_eagl_draw (GstGLWindow * window)
-{
- gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
-}
diff --git a/gst-libs/gst/gl/egl/Makefile.am b/gst-libs/gst/gl/egl/Makefile.am
deleted file mode 100644
index da80fbc4f..000000000
--- a/gst-libs/gst/gl/egl/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES = libgstgl-egl.la
-
-libgstgl_egl_la_SOURCES = \
- gstgldisplay_egl.c \
- gstglcontext_egl.c \
- gstglmemoryegl.c \
- gsteglimage.c \
- gstegl.c
-
-noinst_HEADERS = \
- gstglcontext_egl.h
-
-libgstgl_eglincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/egl
-libgstgl_eglinclude_HEADERS = \
- gstgldisplay_egl.h \
- gstglmemoryegl.h \
- gsteglimage.h \
- gstegl.h
-
-libgstgl_egl_la_CFLAGS = \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GL_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-
-libgstgl_egl_la_LDFLAGS = \
- $(GST_LIB_LDFLAGS) \
- $(GST_ALL_LDFLAGS)
diff --git a/gst-libs/gst/gl/egl/gstegl.c b/gst-libs/gst/gl/egl/gstegl.c
deleted file mode 100644
index 9f455e52c..000000000
--- a/gst-libs/gst/gl/egl/gstegl.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2016 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.
- */
-
-#include <gst/gl/egl/gstegl.h>
-
-/**
- * gst_egl_get_error_string:
- * @err: an EGL error code
- *
- * Returns: the short string representation of @err
- */
-const gchar *
-gst_egl_get_error_string (EGLint err)
-{
- switch (err) {
- case EGL_SUCCESS:
- return "EGL_SUCCESS";
- case EGL_BAD_DISPLAY:
- return "EGL_BAD_DISPLAY";
- case EGL_NOT_INITIALIZED:
- return "EGL_NOT_INITIALIZED";
- case EGL_BAD_ACCESS:
- return "EGL_BAD_ACCESS";
- case EGL_BAD_ALLOC:
- return "EGL_BAD_ALLOC";
- case EGL_BAD_ATTRIBUTE:
- return "EGL_BAD_ATTRIBUTE";
- case EGL_BAD_CONFIG:
- return "EGL_BAD_CONFIG";
- case EGL_BAD_CONTEXT:
- return "EGL_BAD_CONTEXT";
- case EGL_BAD_CURRENT_SURFACE:
- return "EGL_BAD_CURRENT_SURFACE";
- case EGL_BAD_MATCH:
- return "EGL_BAD_MATCH";
- case EGL_BAD_NATIVE_PIXMAP:
- return "EGL_BAD_NATIVE_PIXMAP";
- case EGL_BAD_NATIVE_WINDOW:
- return "EGL_BAD_NATIVE_WINDOW";
- case EGL_BAD_PARAMETER:
- return "EGL_BAD_PARAMETER";
- case EGL_BAD_SURFACE:
- return "EGL_BAD_SURFACE";
- default:
- return "unknown";
- }
-}
diff --git a/gst-libs/gst/gl/egl/gstegl.h b/gst-libs/gst/gl/egl/gstegl.h
deleted file mode 100644
index 0bbda81dc..000000000
--- a/gst-libs/gst/gl/egl/gstegl.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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_EGL_H_
-#define _GST_EGL_H_
-
-#include <gst/gl/gstglconfig.h>
-
-#if GST_GL_HAVE_WINDOW_DISPMANX && defined(__GNUC__)
-#ifndef __VCCOREVER__
-#define __VCCOREVER__ 0x04000000
-#endif
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#if !defined(__cplusplus)
-#pragma GCC optimize ("gnu89-inline")
-#endif
-#endif
-
-#ifndef EGL_EGLEXT_PROTOTYPES
-#define EGL_EGLEXT_PROTOTYPES 1
-#endif
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#if GST_GL_HAVE_WINDOW_DISPMANX && defined(__GNUC__)
-#pragma GCC reset_options
-#pragma GCC diagnostic pop
-#endif
-
-/* compatibility definitions... */
-#if !GST_GL_HAVE_EGLATTRIB
-typedef gintptr EGLAttrib;
-#endif
-
-GST_EXPORT
-const gchar * gst_egl_get_error_string (EGLint err);
-
-#endif /* _GST_EGL_H_ */
diff --git a/gst-libs/gst/gl/egl/gsteglimage.c b/gst-libs/gst/gl/egl/gsteglimage.c
deleted file mode 100644
index fdd603807..000000000
--- a/gst-libs/gst/gl/egl/gsteglimage.c
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Collabora Ltd.
- * @author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
- * Copyright (C) 2014 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2016 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.
- */
-
-/**
- * SECTION:gsteglimage
- * @short_description: EGLImage abstraction
- * @title: GstEGLImage
- * @see_also: #GstGLMemoryEGL, #GstGLContext
- *
- * #GstEGLImage represents and holds an #EGLImage handle.
- *
- * A #GstEGLImage can be created from a dmabuf with gst_egl_image_from_dmabuf()
- * or #GstGLMemoryEGL provides a #GstAllocator to allocate #EGLImage's bound to
- * and OpenGL texture.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gsteglimage.h"
-
-#include <string.h>
-
-#include <gst/gl/gstglfeature.h>
-#include <gst/gl/gstglmemory.h>
-
-#include "gst/gl/egl/gstegl.h"
-#include "gst/gl/egl/gstglcontext_egl.h"
-#include "gst/gl/egl/gstgldisplay_egl.h"
-
-#if GST_GL_HAVE_DMABUF
-#include <gst/allocators/gstdmabuf.h>
-#include <libdrm/drm_fourcc.h>
-
-#ifndef DRM_FORMAT_R8
-#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ')
-#endif
-
-#ifndef DRM_FORMAT_RG88
-#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8')
-#endif
-
-#ifndef DRM_FORMAT_GR88
-#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8')
-#endif
-#endif
-
-#ifndef EGL_LINUX_DMA_BUF_EXT
-#define EGL_LINUX_DMA_BUF_EXT 0x3270
-#endif
-
-#ifndef EGL_LINUX_DRM_FOURCC_EXT
-#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
-#endif
-
-#ifndef EGL_DMA_BUF_PLANE0_FD_EXT
-#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
-#endif
-
-#ifndef EGL_DMA_BUF_PLANE0_OFFSET_EXT
-#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
-#endif
-
-#ifndef EGL_DMA_BUF_PLANE0_PITCH_EXT
-#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
-#endif
-
-GST_DEFINE_MINI_OBJECT_TYPE (GstEGLImage, gst_egl_image);
-
-#ifndef GST_DISABLE_GST_DEBUG
-#define GST_CAT_DEFAULT gst_egl_image_ensure_debug_category()
-
-static GstDebugCategory *
-gst_egl_image_ensure_debug_category (void)
-{
- static gsize cat_gonce = 0;
-
- if (g_once_init_enter (&cat_gonce)) {
- GstDebugCategory *cat = NULL;
-
- GST_DEBUG_CATEGORY_INIT (cat, "gleglimage", 0, "EGLImage wrapper");
-
- g_once_init_leave (&cat_gonce, (gsize) cat);
- }
-
- return (GstDebugCategory *) cat_gonce;
-}
-#endif /* GST_DISABLE_GST_DEBUG */
-
-/**
- * gst_egl_image_get_image:
- * @image: a #GstEGLImage
- *
- * Returns: the #EGLImageKHR of @image
- */
-gpointer
-gst_egl_image_get_image (GstEGLImage * image)
-{
- g_return_val_if_fail (GST_IS_EGL_IMAGE (image), EGL_NO_IMAGE_KHR);
-
- return image->image;
-}
-
-static void
-_gst_egl_image_free_thread (GstGLContext * context, GstEGLImage * image)
-{
- if (image->destroy_notify)
- image->destroy_notify (image, image->destroy_data);
-}
-
-static void
-_gst_egl_image_free (GstMiniObject * object)
-{
- GstEGLImage *image = GST_EGL_IMAGE (object);
-
- if (image->context) {
- gst_gl_context_thread_add (GST_GL_CONTEXT (image->context),
- (GstGLContextThreadFunc) _gst_egl_image_free_thread, image);
- gst_object_unref (image->context);
- }
-}
-
-static GstMiniObject *
-_gst_egl_image_copy (GstMiniObject * obj)
-{
- return gst_mini_object_ref (obj);
-}
-
-/**
- * gst_egl_image_new_wrapped:
- * @context: a #GstGLContext (must be an EGL context)
- * @image: the image to wrap
- * @format: the #GstGLFormat
- * @user_data: user data
- * @user_data_destroy: called when @user_data is no longer needed
- *
- * Returns: a new #GstEGLImage wrapping @image
- */
-GstEGLImage *
-gst_egl_image_new_wrapped (GstGLContext * context, gpointer image,
- GstGLFormat format, gpointer user_data,
- GstEGLImageDestroyNotify user_data_destroy)
-{
- GstEGLImage *img = NULL;
-
- g_return_val_if_fail (context != NULL, NULL);
- g_return_val_if_fail ((gst_gl_context_get_gl_platform (context) &
- GST_GL_PLATFORM_EGL) != 0, NULL);
- g_return_val_if_fail (image != EGL_NO_IMAGE_KHR, NULL);
-
- img = g_new0 (GstEGLImage, 1);
- gst_mini_object_init (GST_MINI_OBJECT_CAST (img), 0, GST_TYPE_EGL_IMAGE,
- (GstMiniObjectCopyFunction) _gst_egl_image_copy, NULL,
- (GstMiniObjectFreeFunction) _gst_egl_image_free);
-
- img->context = gst_object_ref (context);
- img->image = image;
- img->format = format;
-
- img->destroy_data = user_data;
- img->destroy_notify = user_data_destroy;
-
- return img;
-}
-
-static EGLImageKHR
-_gst_egl_image_create (GstGLContext * context, guint target,
- EGLClientBuffer buffer, guintptr * attribs)
-{
- EGLDisplay egl_display = EGL_DEFAULT_DISPLAY;
- EGLContext egl_context = EGL_NO_CONTEXT;
- EGLImageKHR img = EGL_NO_IMAGE_KHR;
- GstGLDisplayEGL *display_egl;
- gint plat_major, plat_minor;
- guint attrib_len = 0;
-
- gst_gl_context_get_gl_platform_version (context, &plat_major, &plat_minor);
-
- display_egl = gst_gl_display_egl_from_gl_display (context->display);
- if (!display_egl) {
- GST_WARNING_OBJECT (context, "Failed to retrieve GstGLDisplayEGL from %"
- GST_PTR_FORMAT, context->display);
- return EGL_NO_IMAGE_KHR;
- }
- egl_display =
- (EGLDisplay) gst_gl_display_get_handle (GST_GL_DISPLAY (display_egl));
- gst_object_unref (display_egl);
-
- if (target != EGL_LINUX_DMA_BUF_EXT)
- egl_context = (EGLContext) gst_gl_context_get_gl_context (context);
-
- if (attribs)
- while (attribs[attrib_len++] != EGL_NONE) {
- }
-#ifdef EGL_VERSION_1_5
- if (GST_GL_CHECK_GL_VERSION (plat_major, plat_minor, 1, 5)) {
- EGLImageKHR (*gst_eglCreateImage) (EGLDisplay dpy, EGLContext ctx,
- EGLenum target, EGLClientBuffer buffer, const EGLAttrib * attrib_list);
- EGLAttrib *egl_attribs = NULL;
- guint i;
-
- gst_eglCreateImage = gst_gl_context_get_proc_address (context,
- "eglCreateImage");
- if (!gst_eglCreateImage) {
- GST_ERROR_OBJECT (context, "\"eglCreateImage\" not exposed by the "
- "implementation as required by EGL >= 1.5");
- return EGL_NO_IMAGE_KHR;
- }
-
- if (attribs) {
- egl_attribs = g_new0 (EGLAttrib, attrib_len);
- for (i = 0; i < attrib_len; i++)
- egl_attribs[i] = (EGLAttrib) attribs[i];
- }
-
- img = gst_eglCreateImage (egl_display, egl_context, target, buffer,
- egl_attribs);
-
- g_free (egl_attribs);
- } else
-#endif
- {
- EGLImageKHR (*gst_eglCreateImageKHR) (EGLDisplay dpy, EGLContext ctx,
- EGLenum target, EGLClientBuffer buffer, const EGLint * attrib_list);
- EGLint *egl_attribs = NULL;
- gint i;
-
- gst_eglCreateImageKHR = gst_gl_context_get_proc_address (context,
- "eglCreateImageKHR");
- if (!gst_eglCreateImageKHR) {
- GST_WARNING_OBJECT (context, "\"eglCreateImageKHR\" not exposed by the "
- "implementation");
- return EGL_NO_IMAGE_KHR;
- }
-
- if (attribs) {
- egl_attribs = g_new0 (EGLint, attrib_len);
- for (i = 0; i < attrib_len; i++)
- egl_attribs[i] = (EGLint) attribs[i];
- }
-
- img = gst_eglCreateImageKHR (egl_display, egl_context, target, buffer,
- egl_attribs);
-
- g_free (egl_attribs);
- }
-
- return img;
-}
-
-static void
-_gst_egl_image_destroy (GstGLContext * context, EGLImageKHR image)
-{
- EGLBoolean (*gst_eglDestroyImage) (EGLDisplay dpy, EGLImageKHR image);
- EGLDisplay egl_display = EGL_DEFAULT_DISPLAY;
- GstGLDisplayEGL *display_egl;
-
- gst_eglDestroyImage = gst_gl_context_get_proc_address (context,
- "eglDestroyImage");
- if (!gst_eglDestroyImage) {
- gst_eglDestroyImage = gst_gl_context_get_proc_address (context,
- "eglDestroyImageKHR");
- if (!gst_eglDestroyImage) {
- GST_ERROR_OBJECT (context, "\"eglDestroyImage\" not exposed by the "
- "implementation");
- return;
- }
- }
-
- display_egl = gst_gl_display_egl_from_gl_display (context->display);
- if (!display_egl) {
- GST_WARNING_OBJECT (context, "Failed to retrieve GstGLDisplayEGL from %"
- GST_PTR_FORMAT, context->display);
- return;
- }
- egl_display =
- (EGLDisplay) gst_gl_display_get_handle (GST_GL_DISPLAY (display_egl));
- gst_object_unref (display_egl);
-
- if (!gst_eglDestroyImage (egl_display, image))
- GST_WARNING_OBJECT (context, "eglDestroyImage failed");
-}
-
-static void
-_destroy_egl_image (GstEGLImage * image, gpointer user_data)
-{
- _gst_egl_image_destroy (image->context, image->image);
-}
-
-/**
- * gst_egl_image_from_texture:
- * @context: a #GstGLContext (must be an EGL context)
- * @gl_mem: a #GstGLMemory
- * @attribs: additional attributes to add to the eglCreateImage() call.
- *
- * Returns: (transfer full): a #GstEGLImage wrapping @gl_mem or %NULL on failure
- */
-GstEGLImage *
-gst_egl_image_from_texture (GstGLContext * context, GstGLMemory * gl_mem,
- guintptr * attribs)
-{
- EGLenum egl_target;
- EGLImageKHR img;
-
- if (gl_mem->tex_target != GST_GL_TEXTURE_TARGET_2D) {
- GST_FIXME_OBJECT (context, "Only know how to create EGLImage's from 2D "
- "textures");
- return NULL;
- }
-
- egl_target = EGL_GL_TEXTURE_2D_KHR;
-
- img = _gst_egl_image_create (context, egl_target,
- (EGLClientBuffer) (guintptr) gl_mem->tex_id, attribs);
- if (!img)
- return NULL;
-
- return gst_egl_image_new_wrapped (context, img, gl_mem->tex_format, NULL,
- (GstEGLImageDestroyNotify) _destroy_egl_image);
-}
-
-#if GST_GL_HAVE_DMABUF
-/*
- * GStreamer format descriptions differ from DRM formats as the representation
- * is relative to a register, hence in native endianness. To reduce the driver
- * requirement, we only import with a subset of texture formats and use
- * shaders to convert. This way we avoid having to use external texture
- * target.
- */
-static int
-_drm_fourcc_from_info (GstVideoInfo * info, int plane)
-{
- GstVideoFormat format = GST_VIDEO_INFO_FORMAT (info);
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- const gint rgba_fourcc = DRM_FORMAT_ABGR8888;
- const gint rgb_fourcc = DRM_FORMAT_BGR888;
- const gint rg_fourcc = DRM_FORMAT_GR88;
-#else
- const gint rgba_fourcc = DRM_FORMAT_RGBA8888;
- const gint rgb_fourcc = DRM_FORMAT_RGB888;
- const gint rg_fourcc = DRM_FORMAT_RG88;
-#endif
-
- GST_DEBUG ("Getting DRM fourcc for %s plane %i",
- gst_video_format_to_string (format), plane);
-
- switch (format) {
- case GST_VIDEO_FORMAT_RGB16:
- case GST_VIDEO_FORMAT_BGR16:
- return DRM_FORMAT_RGB565;
-
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- return rgb_fourcc;
-
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_ABGR:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_AYUV:
- return rgba_fourcc;
-
- case GST_VIDEO_FORMAT_GRAY8:
- return DRM_FORMAT_R8;
-
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_UYVY:
- case GST_VIDEO_FORMAT_GRAY16_LE:
- case GST_VIDEO_FORMAT_GRAY16_BE:
- return rg_fourcc;
-
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- return plane == 0 ? DRM_FORMAT_R8 : rg_fourcc;
-
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- case GST_VIDEO_FORMAT_Y41B:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_Y444:
- return DRM_FORMAT_R8;
-
- default:
- GST_ERROR ("Unsupported format for DMABuf.");
- return -1;
- }
-}
-
-/**
- * gst_egl_image_from_dmabuf:
- * @context: a #GstGLContext (must be an EGL context)
- * @dmabuf: the DMA-Buf file descriptor
- * @in_info: the #GstVideoInfo in @dmabuf
- * @plane: the plane in @in_info to create and #GstEGLImage for
- * @offset: the byte-offset in the data
- *
- * Returns: a #GstEGLImage wrapping @dmabuf or %NULL on failure
- */
-GstEGLImage *
-gst_egl_image_from_dmabuf (GstGLContext * context,
- gint dmabuf, GstVideoInfo * in_info, gint plane, gsize offset)
-{
- GstGLFormat format;
- guintptr attribs[13];
- EGLImageKHR img;
- gint atti = 0;
- gint fourcc;
- gint i;
-
- fourcc = _drm_fourcc_from_info (in_info, plane);
- format = gst_gl_format_from_video_info (context, in_info, plane);
-
- GST_DEBUG ("fourcc %.4s (%d) plane %d (%dx%d)",
- (char *) &fourcc, fourcc, plane,
- GST_VIDEO_INFO_COMP_WIDTH (in_info, plane),
- GST_VIDEO_INFO_COMP_HEIGHT (in_info, plane));
-
- attribs[atti++] = EGL_WIDTH;
- attribs[atti++] = GST_VIDEO_INFO_COMP_WIDTH (in_info, plane);
- attribs[atti++] = EGL_HEIGHT;
- attribs[atti++] = GST_VIDEO_INFO_COMP_HEIGHT (in_info, plane);
- attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT;
- attribs[atti++] = fourcc;
- attribs[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT;
- attribs[atti++] = dmabuf;
- attribs[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
- attribs[atti++] = offset;
- attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
- attribs[atti++] = GST_VIDEO_INFO_PLANE_STRIDE (in_info, plane);
- attribs[atti] = EGL_NONE;
-
- for (i = 0; i < atti; i++)
- GST_LOG ("attr %i: %" G_GINTPTR_FORMAT, i, attribs[i]);
-
- g_assert (atti == 12);
-
- img = _gst_egl_image_create (context, EGL_LINUX_DMA_BUF_EXT, NULL, attribs);
- if (!img) {
- GST_WARNING ("eglCreateImage failed: %s",
- gst_egl_get_error_string (eglGetError ()));
- return NULL;
- }
-
- return gst_egl_image_new_wrapped (context, img, format, NULL,
- (GstEGLImageDestroyNotify) _destroy_egl_image);
-}
-
-gboolean
-gst_egl_image_export_dmabuf (GstEGLImage * image, int *fd, gint * stride,
- gsize * offset)
-{
- EGLBoolean (*gst_eglExportDMABUFImageQueryMESA) (EGLDisplay dpy,
- EGLImageKHR image, int *fourcc, int *num_planes,
- EGLuint64KHR * modifiers);
- EGLBoolean (*gst_eglExportDMABUFImageMESA) (EGLDisplay dpy, EGLImageKHR image,
- int *fds, EGLint * strides, EGLint * offsets);
- GstGLDisplayEGL *display_egl;
- EGLDisplay egl_display = EGL_DEFAULT_DISPLAY;
- int num_planes = 0;
- int egl_fd = 0;
- EGLint egl_stride = 0;
- EGLint egl_offset = 0;
-
- gst_eglExportDMABUFImageQueryMESA =
- gst_gl_context_get_proc_address (image->context,
- "eglExportDMABUFImageQueryMESA");
- gst_eglExportDMABUFImageMESA =
- gst_gl_context_get_proc_address (image->context,
- "eglExportDMABUFImageMESA");
-
- if (!gst_eglExportDMABUFImageQueryMESA || !gst_eglExportDMABUFImageMESA)
- return FALSE;
-
- display_egl =
- (GstGLDisplayEGL *) gst_gl_display_egl_from_gl_display (image->
- context->display);
- if (!display_egl) {
- GST_WARNING_OBJECT (image->context,
- "Failed to retrieve GstGLDisplayEGL from %" GST_PTR_FORMAT,
- image->context->display);
- return FALSE;
- }
- egl_display =
- (EGLDisplay) gst_gl_display_get_handle (GST_GL_DISPLAY (display_egl));
- gst_object_unref (display_egl);
-
- if (!gst_eglExportDMABUFImageQueryMESA (egl_display, image->image,
- NULL, &num_planes, NULL))
- return FALSE;
-
- /* Don't allow multi-plane dmabufs */
- if (num_planes > 1)
- return FALSE;
-
- if (!gst_eglExportDMABUFImageMESA (egl_display, image->image, &egl_fd,
- &egl_stride, &egl_offset))
- return FALSE;
-
- *fd = egl_fd;
- *stride = egl_stride;
- *offset = egl_offset;
-
- return TRUE;
-}
-
-#endif /* GST_GL_HAVE_DMABUF */
diff --git a/gst-libs/gst/gl/egl/gsteglimage.h b/gst-libs/gst/gl/egl/gsteglimage.h
deleted file mode 100644
index b96cc2d3d..000000000
--- a/gst-libs/gst/gl/egl/gsteglimage.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Collabora Ltd.
- * @author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
- * Copyright (C) 2014 Julien Isorce <julien.isorce@gmail.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_EGL_IMAGE_H_
-#define _GST_EGL_IMAGE_H_
-
-#include <gst/gl/gstgl_fwd.h>
-#include <gst/gl/gstglformat.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT GType gst_egl_image_get_type (void);
-
-#define GST_TYPE_EGL_IMAGE (gst_egl_image_get_type())
-#define GST_IS_EGL_IMAGE(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_EGL_IMAGE))
-#define GST_EGL_IMAGE_CAST(obj) ((GstEGLImage *)(obj))
-#define GST_EGL_IMAGE(obj) (GST_EGL_IMAGE_CAST(obj))
-
-typedef struct _GstEGLImage GstEGLImage;
-
-/**
- * GstEGLImageDestroyNotify:
- * @image: a #GstEGLImage
- * @data: user data passed to gst_egl_image_new_wrapped()
- *
- * Function to be called when the GstEGLImage is destroyed. It should free
- * the associated #EGLImage if necessary
- */
-typedef void (*GstEGLImageDestroyNotify) (GstEGLImage * image,
- gpointer data);
-
-/**
- * GstEGLImage:
- *
- * Opaque #GstEGLImage struct.
- */
-struct _GstEGLImage
-{
- GstMiniObject parent;
-
- GstGLContext *context;
- gpointer image;
- GstGLFormat format;
-
- /* <private> */
- gpointer destroy_data;
- GstEGLImageDestroyNotify destroy_notify;
-
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstEGLImage * gst_egl_image_new_wrapped (GstGLContext * context,
- gpointer image,
- GstGLFormat format,
- gpointer user_data,
- GstEGLImageDestroyNotify user_data_destroy);
-GST_EXPORT
-gpointer gst_egl_image_get_image (GstEGLImage * image);
-
-GST_EXPORT
-GstEGLImage * gst_egl_image_from_texture (GstGLContext * context,
- GstGLMemory * gl_mem,
- guintptr * attribs);
-#if GST_GL_HAVE_DMABUF
-GST_EXPORT
-GstEGLImage * gst_egl_image_from_dmabuf (GstGLContext * context,
- gint dmabuf,
- GstVideoInfo * in_info,
- gint plane,
- gsize offset);
-GST_EXPORT
-gboolean gst_egl_image_export_dmabuf (GstEGLImage *image, int *fd, gint *stride, gsize *offset);
-#endif
-
-/**
- * gst_egl_image_ref:
- * @image: a #GstEGLImage.
- *
- * Increases the refcount of the given image by one.
- *
- * Returns: (transfer full): @image
- */
-static inline GstEGLImage *
-gst_egl_image_ref (GstEGLImage * image)
-{
- return (GstEGLImage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (image));
-}
-
-/**
- * gst_egl_image_unref:
- * @image: (transfer full): a #GstEGLImage.
- *
- * Decreases the refcount of the image. If the refcount reaches 0, the image
- * with the associated metadata and memory will be freed.
- */
-static inline void
-gst_egl_image_unref (GstEGLImage * image)
-{
- gst_mini_object_unref (GST_MINI_OBJECT_CAST (image));
-}
-
-G_END_DECLS
-
-#endif /* _GST_EGL_IMAGE_H_ */
diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c
deleted file mode 100644
index 868e766c2..000000000
--- a/gst-libs/gst/gl/egl/gstglcontext_egl.c
+++ /dev/null
@@ -1,798 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gmodule.h>
-
-/* FIXME: Sharing contexts requires the EGLDisplay to be the same
- * may need to box it.
- */
-
-#include "gstglcontext_egl.h"
-
-#include <gst/gl/gstglcontext_private.h>
-#include <gst/gl/gstglfeature.h>
-#include <gst/gl/gstglwindow.h>
-
-#include "gstegl.h"
-#include "../utils/opengl_versions.h"
-#include "../utils/gles_versions.h"
-
-#if GST_GL_HAVE_WINDOW_X11
-#include "../x11/gstglwindow_x11.h"
-#include <gst/gl/x11/gstgldisplay_x11.h>
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND
-#include "../wayland/gstglwindow_wayland_egl.h"
-#endif
-#if GST_GL_HAVE_WINDOW_WIN32
-#include "../win32/gstglwindow_win32.h"
-#endif
-#if GST_GL_HAVE_WINDOW_DISPMANX
-#include "../dispmanx/gstglwindow_dispmanx_egl.h"
-#endif
-
-#define GST_CAT_DEFAULT gst_gl_context_debug
-
-static gboolean gst_gl_context_egl_create_context (GstGLContext * context,
- GstGLAPI gl_api, GstGLContext * other_context, GError ** error);
-static void gst_gl_context_egl_destroy_context (GstGLContext * context);
-static gboolean gst_gl_context_egl_choose_format (GstGLContext * context,
- GError ** error);
-
-static gboolean gst_gl_context_egl_activate (GstGLContext * context,
- gboolean activate);
-static void gst_gl_context_egl_swap_buffers (GstGLContext * context);
-static guintptr gst_gl_context_egl_get_gl_context (GstGLContext * context);
-static GstGLAPI gst_gl_context_egl_get_gl_api (GstGLContext * context);
-static GstGLPlatform gst_gl_context_egl_get_gl_platform (GstGLContext *
- context);
-static gboolean gst_gl_context_egl_check_feature (GstGLContext * context,
- const gchar * feature);
-static void gst_gl_context_egl_get_gl_platform_version (GstGLContext * context,
- gint * major, gint * minor);
-
-G_DEFINE_TYPE (GstGLContextEGL, gst_gl_context_egl, GST_TYPE_GL_CONTEXT);
-
-static void
-gst_gl_context_egl_class_init (GstGLContextEGLClass * klass)
-{
- GstGLContextClass *context_class = (GstGLContextClass *) klass;
-
- context_class->get_gl_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_egl_get_gl_context);
- context_class->activate = GST_DEBUG_FUNCPTR (gst_gl_context_egl_activate);
- context_class->create_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_egl_create_context);
- context_class->destroy_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_egl_destroy_context);
- context_class->choose_format =
- GST_DEBUG_FUNCPTR (gst_gl_context_egl_choose_format);
- context_class->swap_buffers =
- GST_DEBUG_FUNCPTR (gst_gl_context_egl_swap_buffers);
-
- context_class->get_gl_api = GST_DEBUG_FUNCPTR (gst_gl_context_egl_get_gl_api);
- context_class->get_gl_platform =
- GST_DEBUG_FUNCPTR (gst_gl_context_egl_get_gl_platform);
- context_class->get_proc_address =
- GST_DEBUG_FUNCPTR (gst_gl_context_egl_get_proc_address);
- context_class->check_feature =
- GST_DEBUG_FUNCPTR (gst_gl_context_egl_check_feature);
- context_class->get_current_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_egl_get_current_context);
- context_class->get_gl_platform_version =
- GST_DEBUG_FUNCPTR (gst_gl_context_egl_get_gl_platform_version);
-}
-
-static void
-gst_gl_context_egl_init (GstGLContextEGL * context)
-{
-}
-
-/* Must be called in the gl thread */
-GstGLContextEGL *
-gst_gl_context_egl_new (GstGLDisplay * display)
-{
- GstGLContextEGL *context;
-
- /* XXX: display type could theoretically be anything, as long as
- * eglGetDisplay supports it. */
- context = g_object_new (GST_TYPE_GL_CONTEXT_EGL, NULL);
- gst_object_ref_sink (context);
-
- return context;
-}
-
-static gboolean
-gst_gl_context_egl_choose_format (GstGLContext * context, GError ** error)
-{
-#if GST_GL_HAVE_WINDOW_X11
- if (GST_IS_GL_WINDOW_X11 (context->window)) {
- GstGLWindow *window = gst_gl_context_get_window (context);
- GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
- gint ret;
-
- window_x11->visual_info = g_new0 (XVisualInfo, 1);
- ret = XMatchVisualInfo (window_x11->device, window_x11->screen_num,
- window_x11->depth, TrueColor, window_x11->visual_info);
-
- gst_object_unref (window);
-
- if (ret == 0) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "Failed to match XVisualInfo");
- return FALSE;
- }
- }
-#endif
-
- return TRUE;
-}
-
-static gboolean
-gst_gl_context_egl_choose_config (GstGLContextEGL * egl, GstGLAPI gl_api,
- gint major, GError ** error)
-{
- gboolean create_context;
- EGLint numConfigs;
- gint i = 0;
- EGLint config_attrib[20];
-
- create_context =
- gst_gl_check_extension ("EGL_KHR_create_context", egl->egl_exts);
- /* silence unused warnings */
- (void) create_context;
-
- config_attrib[i++] = EGL_SURFACE_TYPE;
- config_attrib[i++] = EGL_WINDOW_BIT;
- config_attrib[i++] = EGL_RENDERABLE_TYPE;
- if (gl_api & GST_GL_API_GLES2) {
- if (major == 3) {
-#if defined(EGL_KHR_create_context)
- if (create_context) {
- config_attrib[i++] = EGL_OPENGL_ES3_BIT_KHR;
- } else
-#endif
- {
- return FALSE;
- }
- } else {
- config_attrib[i++] = EGL_OPENGL_ES2_BIT;
- }
- } else
- config_attrib[i++] = EGL_OPENGL_BIT;
-#if defined(USE_EGL_RPI) && GST_GL_HAVE_WINDOW_WAYLAND
- /* The configurations with a=0 seems to be buggy whereas
- * it works when using dispmanx directly */
- config_attrib[i++] = EGL_ALPHA_SIZE;
- config_attrib[i++] = 1;
-#endif
- config_attrib[i++] = EGL_DEPTH_SIZE;
- config_attrib[i++] = 16;
- config_attrib[i++] = EGL_RED_SIZE;
- config_attrib[i++] = 1;
- config_attrib[i++] = EGL_GREEN_SIZE;
- config_attrib[i++] = 1;
- config_attrib[i++] = EGL_BLUE_SIZE;
- config_attrib[i++] = 1;
- config_attrib[i++] = EGL_NONE;
-
- if (eglChooseConfig (egl->egl_display, config_attrib,
- &egl->egl_config, 1, &numConfigs)) {
- GST_INFO ("config set: %" G_GUINTPTR_FORMAT ", %u",
- (guintptr) egl->egl_config, (unsigned int) numConfigs);
- } else {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
- "Failed to set window configuration: %s",
- gst_egl_get_error_string (eglGetError ()));
- goto failure;
- }
-
- return TRUE;
-
-failure:
- return FALSE;
-}
-
-static EGLContext
-_create_context_with_flags (GstGLContextEGL * egl, EGLContext share_context,
- GstGLAPI gl_api, gint major, gint minor, gint contextFlags,
- gint profileMask)
-{
- gboolean create_context;
-#define N_ATTRIBS 20
- gint attribs[N_ATTRIBS];
- gint n = 0;
-
- /* fail creation of apis/versions/flags that require EGL_KHR_create_context
- * if the extension doesn't exist, namely:0
- *
- * - profile mask
- * - context flags
- * - GL3 > 3.1
- * - GLES2 && minor > 0
- */
- create_context =
- gst_gl_check_extension ("EGL_KHR_create_context", egl->egl_exts);
- (void) create_context;
- if (!create_context && (profileMask || contextFlags
- || ((gl_api & GST_GL_API_OPENGL3)
- && GST_GL_CHECK_GL_VERSION (major, minor, 3, 2))
- || ((gl_api & GST_GL_API_GLES2) && minor > 0))) {
- return 0;
- }
-
- GST_DEBUG_OBJECT (egl, "attempting to create OpenGL%s context version %d.%d "
- "flags %x profile %x", gl_api & GST_GL_API_GLES2 ? " ES" : "", major,
- minor, contextFlags, profileMask);
-
-#if defined(EGL_KHR_create_context)
- if (create_context) {
- if (major) {
- attribs[n++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
- attribs[n++] = major;
- }
- if (minor) {
- attribs[n++] = EGL_CONTEXT_MINOR_VERSION_KHR;
- attribs[n++] = minor;
- }
- if (contextFlags) {
- attribs[n++] = EGL_CONTEXT_FLAGS_KHR;
- attribs[n++] = contextFlags;
- }
- if (profileMask) {
- attribs[n++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
- attribs[n++] = profileMask;
- }
- } else
-#endif
- {
- attribs[n++] = EGL_CONTEXT_CLIENT_VERSION;
- attribs[n++] = major;
- }
- attribs[n++] = EGL_NONE;
-
- g_assert (n < N_ATTRIBS);
-#undef N_ATTRIBS
-
- return eglCreateContext (egl->egl_display, egl->egl_config, share_context,
- attribs);
-}
-
-static gboolean
-gst_gl_context_egl_create_context (GstGLContext * context,
- GstGLAPI gl_api, GstGLContext * other_context, GError ** error)
-{
- GstGLContextEGL *egl;
- GstGLWindow *window = NULL;
- guintptr window_handle = 0;
- EGLint egl_major;
- EGLint egl_minor;
- gboolean need_surface = TRUE;
- guintptr external_gl_context = 0;
- guintptr egl_display;
-
- egl = GST_GL_CONTEXT_EGL (context);
- window = gst_gl_context_get_window (context);
-
- GST_DEBUG_OBJECT (context, "Creating EGL context");
-
- if (other_context) {
- if (gst_gl_context_get_gl_platform (other_context) != GST_GL_PLATFORM_EGL) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
- "Cannot share context with non-EGL context");
- goto failure;
- }
- external_gl_context = gst_gl_context_get_gl_context (other_context);
- }
-
- if ((gl_api & (GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2)) ==
- GST_GL_API_NONE) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
- "EGL supports opengl or gles2");
- goto failure;
- }
-
- if (!egl->display_egl) {
- GstGLDisplay *display = gst_gl_context_get_display (context);
-
- egl->display_egl = gst_gl_display_egl_from_gl_display (display);
- if (!egl->display_egl) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
- "Failed to create EGLDisplay from native display");
- gst_object_unref (display);
- goto failure;
- }
-
- gst_object_unref (display);
- }
-
- egl_display = gst_gl_display_get_handle (GST_GL_DISPLAY (egl->display_egl));
- egl->egl_display = (EGLDisplay) egl_display;
-
- if (eglInitialize (egl->egl_display, &egl_major, &egl_minor)) {
- GST_INFO ("egl initialized, version: %d.%d", egl_major, egl_minor);
- } else {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
- "Failed to initialize egl: %s",
- gst_egl_get_error_string (eglGetError ()));
- goto failure;
- }
-
- egl->egl_exts = eglQueryString (egl->egl_display, EGL_EXTENSIONS);
-
- if (gl_api & (GST_GL_API_OPENGL | GST_GL_API_OPENGL3)) {
- GstGLAPI chosen_gl_api = 0;
- gint i;
-
- /* egl + opengl only available with EGL 1.4+ */
- if (egl_major == 1 && egl_minor <= 3) {
- if ((gl_api & ~GST_GL_API_OPENGL) == GST_GL_API_NONE) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_OLD_LIBS,
- "EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
- egl_major, egl_minor);
- goto failure;
- } else {
- GST_WARNING
- ("EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
- egl_major, egl_minor);
- if (gl_api & GST_GL_API_GLES2) {
- goto try_gles2;
- } else {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
- "Failed to choose a suitable OpenGL API");
- goto failure;
- }
- }
- }
-
- if (!eglBindAPI (EGL_OPENGL_API)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "Failed to bind OpenGL API: %s",
- gst_egl_get_error_string (eglGetError ()));
- goto failure;
- }
-
- GST_INFO ("Bound OpenGL");
-
- /* api, version only matters for gles */
- if (!gst_gl_context_egl_choose_config (egl, GST_GL_API_OPENGL, 0, error)) {
- g_assert (error == NULL || *error != NULL);
- goto failure;
- }
-
- for (i = 0; i < G_N_ELEMENTS (opengl_versions); i++) {
- gint profileMask = 0;
- gint contextFlags = 0;
-
- if (GST_GL_CHECK_GL_VERSION (opengl_versions[i].major,
- opengl_versions[i].minor, 3, 2)) {
- /* skip gl3 contexts if requested */
- if ((gl_api & GST_GL_API_OPENGL3) == 0)
- continue;
-
- chosen_gl_api = GST_GL_API_OPENGL3;
-#if defined(EGL_KHR_create_context)
- profileMask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
- contextFlags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
-#endif
- } else if (opengl_versions[i].major == 3 && opengl_versions[i].minor == 1) {
- /* skip 3.1, the implementation is free to give us either a core or a
- * compatibility context (we have no say) */
- continue;
- } else {
- /* skip legacy contexts if requested */
- if ((gl_api & GST_GL_API_OPENGL) == 0)
- continue;
-
- chosen_gl_api = GST_GL_API_OPENGL;
- }
-
- egl->egl_context =
- _create_context_with_flags (egl, (EGLContext) external_gl_context,
- chosen_gl_api, opengl_versions[i].major,
- opengl_versions[i].minor, contextFlags, profileMask);
-
- if (egl->egl_context)
- break;
-
-#if defined(EGL_KHR_create_context)
- profileMask &= ~EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
-
- egl->egl_context =
- _create_context_with_flags (egl, (EGLContext) external_gl_context,
- chosen_gl_api, opengl_versions[i].major,
- opengl_versions[i].minor, contextFlags, profileMask);
-
- if (egl->egl_context)
- break;
-#endif
- }
-
- egl->gl_api = chosen_gl_api;
- } else if (gl_api & GST_GL_API_GLES2) {
- gint i;
-
- try_gles2:
- if (!eglBindAPI (EGL_OPENGL_ES_API)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "Failed to bind OpenGL|ES API: %s",
- gst_egl_get_error_string (eglGetError ()));
- goto failure;
- }
-
- GST_INFO ("Bound OpenGL|ES");
-
- for (i = 0; i < G_N_ELEMENTS (gles2_versions); i++) {
- gint profileMask = 0;
- gint contextFlags = 0;
- guint maj = gles2_versions[i].major;
- guint min = gles2_versions[i].minor;
-
- if (!gst_gl_context_egl_choose_config (egl, GST_GL_API_GLES2, maj, error)) {
- GST_DEBUG_OBJECT (context, "Failed to choose a GLES%d config: %s",
- maj, error && *error ? (*error)->message : "Unknown");
- g_clear_error (error);
- continue;
- }
-#if defined(EGL_KHR_create_context)
- /* try a debug context */
- contextFlags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
-
- egl->egl_context =
- _create_context_with_flags (egl, (EGLContext) external_gl_context,
- GST_GL_API_GLES2, maj, min, contextFlags, profileMask);
-
- if (egl->egl_context)
- break;
-
- /* try without a debug context */
- contextFlags &= ~EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
-#endif
-
- egl->egl_context =
- _create_context_with_flags (egl, (EGLContext) external_gl_context,
- GST_GL_API_GLES2, maj, min, contextFlags, profileMask);
-
- if (egl->egl_context)
- break;
- }
- egl->gl_api = GST_GL_API_GLES2;
- }
-
- if (egl->egl_context != EGL_NO_CONTEXT) {
- GST_INFO ("gl context created: %" G_GUINTPTR_FORMAT,
- (guintptr) egl->egl_context);
- } else {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
- "Failed to create a OpenGL context: %s",
- gst_egl_get_error_string (eglGetError ()));
- goto failure;
- }
- /* FIXME do we want a window vfunc ? */
-#if GST_GL_HAVE_WINDOW_X11
- if (GST_IS_GL_WINDOW_X11 (context->window)) {
- gst_gl_window_x11_create_window ((GstGLWindowX11 *) context->window);
- }
-#endif
-
- if (other_context == NULL) {
- /* FIXME: fails to show two outputs at all. We need a property/option for
- * glimagesink to say its a visible context */
-#if GST_GL_HAVE_WINDOW_WAYLAND
- if (GST_IS_GL_WINDOW_WAYLAND_EGL (context->window)) {
- gst_gl_window_wayland_egl_create_window ((GstGLWindowWaylandEGL *)
- context->window);
- }
-#endif
-#if GST_GL_HAVE_WINDOW_WIN32
- if (GST_IS_GL_WINDOW_WIN32 (context->window)) {
- gst_gl_window_win32_create_window ((GstGLWindowWin32 *) context->window);
- }
-#endif
-#if GST_GL_HAVE_WINDOW_DISPMANX
- if (GST_IS_GL_WINDOW_DISPMANX_EGL (context->window)) {
- gst_gl_window_dispmanx_egl_create_window ((GstGLWindowDispmanxEGL *)
- context->window);
- }
-#endif
- }
-
- if (window)
- window_handle = gst_gl_window_get_window_handle (window);
-
- if (window_handle) {
- GST_DEBUG ("Creating EGLSurface from window_handle %p",
- (void *) window_handle);
- egl->egl_surface =
- eglCreateWindowSurface (egl->egl_display, egl->egl_config,
- (EGLNativeWindowType) window_handle, NULL);
- /* Store window handle for later comparision */
- egl->window_handle = window_handle;
- } else if (!gst_gl_check_extension ("EGL_KHR_surfaceless_context",
- egl->egl_exts)) {
- EGLint surface_attrib[7];
- gint j = 0;
-
- GST_DEBUG ("Surfaceless context, creating PBufferSurface");
- /* FIXME: Width/height doesn't seem to matter but we can't leave them
- * at 0, otherwise X11 complains about BadValue */
- surface_attrib[j++] = EGL_WIDTH;
- surface_attrib[j++] = 1;
- surface_attrib[j++] = EGL_HEIGHT;
- surface_attrib[j++] = 1;
- surface_attrib[j++] = EGL_LARGEST_PBUFFER;
- surface_attrib[j++] = EGL_TRUE;
- surface_attrib[j++] = EGL_NONE;
-
- egl->egl_surface =
- eglCreatePbufferSurface (egl->egl_display, egl->egl_config,
- surface_attrib);
- } else {
- GST_DEBUG ("No surface/handle !");
- egl->egl_surface = EGL_NO_SURFACE;
- need_surface = FALSE;
- }
-
- if (need_surface) {
- if (egl->egl_surface != EGL_NO_SURFACE) {
- GST_INFO ("surface created");
- } else {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "Failed to create window surface: %s",
- gst_egl_get_error_string (eglGetError ()));
- goto failure;
- }
- }
- egl->egl_major = egl_major;
- egl->egl_minor = egl_minor;
-
- if (window)
- gst_object_unref (window);
-
- return TRUE;
-
-failure:
- if (window)
- gst_object_unref (window);
-
- return FALSE;
-}
-
-static void
-gst_gl_context_egl_destroy_context (GstGLContext * context)
-{
- GstGLContextEGL *egl;
-
- egl = GST_GL_CONTEXT_EGL (context);
-
- gst_gl_context_egl_activate (context, FALSE);
-
- if (egl->egl_surface) {
- eglDestroySurface (egl->egl_display, egl->egl_surface);
- egl->egl_surface = EGL_NO_SURFACE;
- }
-
- if (egl->egl_context) {
- eglDestroyContext (egl->egl_display, egl->egl_context);
- egl->egl_context = NULL;
- }
- egl->window_handle = 0;
-
- eglReleaseThread ();
-
- if (egl->display_egl) {
- gst_object_unref (egl->display_egl);
- egl->display_egl = NULL;
- }
-}
-
-static gboolean
-gst_gl_context_egl_activate (GstGLContext * context, gboolean activate)
-{
- GstGLContextEGL *egl;
- gboolean result;
-
- egl = GST_GL_CONTEXT_EGL (context);
-
- if (activate) {
- GstGLWindow *window = gst_gl_context_get_window (context);
- guintptr handle = 0;
- /* Check if the backing handle changed */
- if (window) {
- handle = gst_gl_window_get_window_handle (window);
- gst_object_unref (window);
- }
- if (handle && handle != egl->window_handle) {
- GST_DEBUG_OBJECT (context,
- "Handle changed (have:%p, now:%p), switching surface",
- (void *) egl->window_handle, (void *) handle);
- if (egl->egl_surface) {
- result = eglDestroySurface (egl->egl_display, egl->egl_surface);
- egl->egl_surface = EGL_NO_SURFACE;
- if (!result) {
- GST_ERROR_OBJECT (context, "Failed to destroy old window surface: %s",
- gst_egl_get_error_string (eglGetError ()));
- goto done;
- }
- }
- egl->egl_surface =
- eglCreateWindowSurface (egl->egl_display, egl->egl_config,
- (EGLNativeWindowType) handle, NULL);
- egl->window_handle = handle;
-
- if (egl->egl_surface == EGL_NO_SURFACE) {
- GST_ERROR_OBJECT (context, "Failed to create window surface: %s",
- gst_egl_get_error_string (eglGetError ()));
- result = FALSE;
- goto done;
- }
- }
- result = eglMakeCurrent (egl->egl_display, egl->egl_surface,
- egl->egl_surface, egl->egl_context);
- } else {
- result = eglMakeCurrent (egl->egl_display, EGL_NO_SURFACE,
- EGL_NO_SURFACE, EGL_NO_CONTEXT);
- }
-
- if (!result) {
- GST_ERROR_OBJECT (context,
- "Failed to bind context to the current rendering thread: %s",
- gst_egl_get_error_string (eglGetError ()));
- }
-
-done:
- return result;
-}
-
-static guintptr
-gst_gl_context_egl_get_gl_context (GstGLContext * context)
-{
- return (guintptr) GST_GL_CONTEXT_EGL (context)->egl_context;
-}
-
-static void
-gst_gl_context_egl_swap_buffers (GstGLContext * context)
-{
- GstGLContextEGL *egl;
-
- egl = GST_GL_CONTEXT_EGL (context);
-
- eglSwapBuffers (egl->egl_display, egl->egl_surface);
-}
-
-static GstGLAPI
-gst_gl_context_egl_get_gl_api (GstGLContext * context)
-{
- return GST_GL_CONTEXT_EGL (context)->gl_api;
-}
-
-static GstGLPlatform
-gst_gl_context_egl_get_gl_platform (GstGLContext * context)
-{
- return GST_GL_PLATFORM_EGL;
-}
-
-static GModule *module_egl;
-
-static gpointer
-load_egl_module (gpointer user_data)
-{
-#ifdef GST_GL_LIBEGL_MODULE_NAME
- module_egl = g_module_open (GST_GL_LIBEGL_MODULE_NAME, G_MODULE_BIND_LAZY);
-#else
- /* On Linux the .so is only in -dev packages, try with a real soname
- * Proper compilers will optimize away the strcmp */
- if (g_strcmp0 (G_MODULE_SUFFIX, "so") == 0)
- module_egl = g_module_open ("libEGL.so.1", G_MODULE_BIND_LAZY);
-
- /* This automatically handles the suffix and even .la files */
- if (!module_egl)
- module_egl = g_module_open ("libEGL", G_MODULE_BIND_LAZY);
-#endif
-
- return NULL;
-}
-
-gpointer
-gst_gl_context_egl_get_proc_address (GstGLAPI gl_api, const gchar * name)
-{
- gpointer result = NULL;
- static GOnce g_once = G_ONCE_INIT;
-
-#ifdef __APPLE__
-#if GST_GL_HAVE_OPENGL && !defined(GST_GL_LIBGL_MODULE_NAME)
- if (!result && (gl_api & (GST_GL_API_OPENGL | GST_GL_API_OPENGL3))) {
- static GModule *module_opengl = NULL;
- if (g_once_init_enter (&module_opengl)) {
- GModule *setup_module_opengl =
- g_module_open ("libGL.dylib", G_MODULE_BIND_LAZY);
- g_once_init_leave (&module_opengl, setup_module_opengl);
- }
- if (module_opengl)
- g_module_symbol (module_opengl, name, &result);
- }
-#endif
-#if GST_GL_HAVE_GLES2 && !defined(GST_GL_LIBGLESV2_MODULE_NAME)
- if (!result && (gl_api & (GST_GL_API_GLES2))) {
- static GModule *module_gles2 = NULL;
- if (g_once_init_enter (&module_gles2)) {
- GModule *setup_module_gles2 =
- g_module_open ("libGLESv2.dylib", G_MODULE_BIND_LAZY);
- g_once_init_leave (&module_gles2, setup_module_gles2);
- }
- if (module_gles2)
- g_module_symbol (module_gles2, name, &result);
- }
-#endif
-#endif // __APPLE__
-
- if (!result)
- result = gst_gl_context_default_get_proc_address (gl_api, name);
-
- g_once (&g_once, load_egl_module, NULL);
-
- if (!result && module_egl) {
- g_module_symbol (module_egl, name, &result);
- }
-
- /* FIXME: On Android this returns wrong addresses for non-EGL functions */
-#if GST_GL_HAVE_WINDOW_ANDROID
- if (!result && g_str_has_prefix (name, "egl")) {
-#else
- if (!result) {
- result = eglGetProcAddress (name);
-#endif
- }
-
- return result;
-}
-
-static gboolean
-gst_gl_context_egl_check_feature (GstGLContext * context, const gchar * feature)
-{
- GstGLContextEGL *context_egl = GST_GL_CONTEXT_EGL (context);
-
- return gst_gl_check_extension (feature, context_egl->egl_exts);
-}
-
-guintptr
-gst_gl_context_egl_get_current_context (void)
-{
- return (guintptr) eglGetCurrentContext ();
-}
-
-static void
-gst_gl_context_egl_get_gl_platform_version (GstGLContext * context,
- gint * major, gint * minor)
-{
- GstGLContextEGL *context_egl = GST_GL_CONTEXT_EGL (context);
-
- *major = context_egl->egl_major;
- *minor = context_egl->egl_minor;
-}
diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.h b/gst-libs/gst/gl/egl/gstglcontext_egl.h
deleted file mode 100644
index 67947a885..000000000
--- a/gst-libs/gst/gl/egl/gstglcontext_egl.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * 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_EGL_H__
-#define __GST_GL_EGL_H__
-
-#include <gst/gl/gstglcontext.h>
-#include <gst/gl/egl/gstgldisplay_egl.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GstGLContextEGL GstGLContextEGL;
-typedef struct _GstGLContextEGLClass GstGLContextEGLClass;
-
-G_GNUC_INTERNAL GType gst_gl_context_egl_get_type (void);
-#define GST_TYPE_GL_CONTEXT_EGL (gst_gl_context_egl_get_type())
-
-/* FIXME: remove this when moving to -base */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_GL_TYPE_CONTEXT_EGL GST_TYPE_GL_CONTEXT_EGL
-#endif
-#define GST_GL_CONTEXT_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_CONTEXT_EGL, GstGLContextEGL))
-#define GST_GL_CONTEXT_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_CONTEXT_EGL, GstGLContextEGLClass))
-#define GST_IS_GL_CONTEXT_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_CONTEXT_EGL))
-#define GST_IS_GL_CONTEXT_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_CONTEXT_EGL))
-#define GST_GL_CONTEXT_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_CONTEXT_EGL, GstGLContextEGLClass))
-
-/**
- * GstGLContextEGL:
- *
- * Opaque #GstGLContextEGL struct
- */
-struct _GstGLContextEGL
-{
- /* <private> */
- GstGLContext context;
-
- GstGLDisplayEGL *display_egl;
-
- gpointer egl_context;
- gpointer egl_display;
- gpointer egl_surface;
- gpointer egl_config;
-
- gint egl_major;
- gint egl_minor;
-
- GstGLAPI gl_api;
-
- const gchar *egl_exts;
-
- /* Cached handle */
- guintptr window_handle;
-};
-
-/**
- * GstGLContextEGLCLass:
- *
- * Opaque #GstGLContextEGLClass struct
- */
-struct _GstGLContextEGLClass
-{
- /* <private> */
- GstGLContextClass parent;
-};
-
-G_GNUC_INTERNAL
-GstGLContextEGL * gst_gl_context_egl_new (GstGLDisplay * display);
-
-G_GNUC_INTERNAL
-guintptr gst_gl_context_egl_get_current_context (void);
-
-G_GNUC_INTERNAL
-gpointer gst_gl_context_egl_get_proc_address (GstGLAPI gl_api, const gchar * name);
-
-G_END_DECLS
-
-#endif /* __GST_GL_EGL_H__ */
diff --git a/gst-libs/gst/gl/egl/gstgldisplay_egl.c b/gst-libs/gst/gl/egl/gstgldisplay_egl.c
deleted file mode 100644
index 448899ccc..000000000
--- a/gst-libs/gst/gl/egl/gstgldisplay_egl.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstgldisplay_egl.h"
-
-#include <gst/gl/gstglfeature.h>
-
-#include "gstegl.h"
-#include "gsteglimage.h"
-#include "gstglmemoryegl.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
-#define GST_CAT_DEFAULT gst_gl_display_debug
-
-#ifndef EGL_PLATFORM_X11
-#define EGL_PLATFORM_X11 0x31D5
-#endif
-#ifndef EGL_PLATFORM_WAYLAND
-#define EGL_PLATFORM_WAYLAND 0x31D8
-#endif
-#ifndef EGL_PLATFORM_ANDROID
-#define EGL_PLATFORM_ANDROID 0x3141
-#endif
-
-typedef EGLDisplay (*_gst_eglGetPlatformDisplay_type) (EGLenum platform,
- void *native_display, const EGLint * attrib_list);
-
-G_DEFINE_TYPE (GstGLDisplayEGL, gst_gl_display_egl, GST_TYPE_GL_DISPLAY);
-
-static void gst_gl_display_egl_finalize (GObject * object);
-static guintptr gst_gl_display_egl_get_handle (GstGLDisplay * display);
-
-static void
-gst_gl_display_egl_class_init (GstGLDisplayEGLClass * klass)
-{
- GST_GL_DISPLAY_CLASS (klass)->get_handle =
- GST_DEBUG_FUNCPTR (gst_gl_display_egl_get_handle);
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_display_egl_finalize;
-}
-
-static void
-gst_gl_display_egl_init (GstGLDisplayEGL * display_egl)
-{
- GstGLDisplay *display = (GstGLDisplay *) display_egl;
-
- display->type = GST_GL_DISPLAY_TYPE_EGL;
- display_egl->foreign_display = FALSE;
-
- gst_gl_memory_egl_init_once ();
-}
-
-static void
-gst_gl_display_egl_finalize (GObject * object)
-{
- GstGLDisplayEGL *display_egl = GST_GL_DISPLAY_EGL (object);
-
- if (display_egl->display && !display_egl->foreign_display) {
- eglTerminate (display_egl->display);
- display_egl->display = NULL;
- }
-
- G_OBJECT_CLASS (gst_gl_display_egl_parent_class)->finalize (object);
-}
-
-/**
- * gst_gl_display_egl_get_from_native:
- * @type: a #GstGLDisplayType
- * @display: pointer to a display (or 0)
- *
- * Attempts to create a new #EGLDisplay from @display. If @type is
- * %GST_GL_DISPLAY_TYPE_ANY, then @display must be 0.
- *
- * Returns: A #EGLDisplay or %EGL_NO_DISPLAY
- *
- * Since: 1.12
- */
-gpointer
-gst_gl_display_egl_get_from_native (GstGLDisplayType type, guintptr display)
-{
- const gchar *egl_exts;
- EGLDisplay ret = EGL_NO_DISPLAY;
- _gst_eglGetPlatformDisplay_type _gst_eglGetPlatformDisplay;
-
- g_return_val_if_fail ((type != GST_GL_DISPLAY_TYPE_ANY && display != 0)
- || (type == GST_GL_DISPLAY_TYPE_ANY && display == 0), EGL_NO_DISPLAY);
- g_return_val_if_fail ((type != GST_GL_DISPLAY_TYPE_NONE
- || (type == GST_GL_DISPLAY_TYPE_NONE
- && display == 0)), EGL_NO_DISPLAY);
-
- /* given an EGLDisplay already */
- if (type == GST_GL_DISPLAY_TYPE_EGL)
- return (gpointer) display;
-
- if (type == GST_GL_DISPLAY_TYPE_NONE)
- type = GST_GL_DISPLAY_TYPE_ANY;
-
- egl_exts = eglQueryString (EGL_NO_DISPLAY, EGL_EXTENSIONS);
- GST_DEBUG ("egl no display extensions: %s", egl_exts);
-
- if (eglGetError () != EGL_SUCCESS || !egl_exts)
- goto default_display;
-
- /* check if we can actually choose the egl display type */
- if (!gst_gl_check_extension ("EGL_KHR_client_get_all_proc_addresses",
- egl_exts))
- goto default_display;
- if (!gst_gl_check_extension ("EGL_EXT_platform_base", egl_exts))
- goto default_display;
-
- _gst_eglGetPlatformDisplay = (_gst_eglGetPlatformDisplay_type)
- eglGetProcAddress ("eglGetPlatformDisplay");
- if (!_gst_eglGetPlatformDisplay)
- _gst_eglGetPlatformDisplay = (_gst_eglGetPlatformDisplay_type)
- eglGetProcAddress ("eglGetPlatformDisplayEXT");
- if (!_gst_eglGetPlatformDisplay)
- goto default_display;
-
- /* try each platform in turn */
-#if GST_GL_HAVE_WINDOW_X11
- if (ret == EGL_NO_DISPLAY && (type & GST_GL_DISPLAY_TYPE_X11) &&
- (gst_gl_check_extension ("EGL_KHR_platform_x11", egl_exts) ||
- gst_gl_check_extension ("EGL_EXT_platform_x11", egl_exts))) {
- ret = _gst_eglGetPlatformDisplay (EGL_PLATFORM_X11, (gpointer) display,
- NULL);
- }
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND
- if (ret == EGL_NO_DISPLAY && (type & GST_GL_DISPLAY_TYPE_WAYLAND) &&
- (gst_gl_check_extension ("EGL_KHR_platform_wayland", egl_exts) ||
- gst_gl_check_extension ("EGL_EXT_platform_wayland", egl_exts))) {
- ret = _gst_eglGetPlatformDisplay (EGL_PLATFORM_WAYLAND, (gpointer) display,
- NULL);
- }
-#endif
- /* android only has one winsys/display connection */
-
- if (ret != EGL_NO_DISPLAY)
- return ret;
-
- /* otherwise rely on the implementation to choose the correct display
- * based on the pointer */
-default_display:
- return (gpointer) eglGetDisplay ((EGLNativeDisplayType) display);
-}
-
-/**
- * gst_gl_display_egl_new:
- *
- * Create a new #GstGLDisplayEGL using the default EGL_DEFAULT_DISPLAY.
- *
- * Returns: (transfer full): a new #GstGLDisplayEGL or %NULL
- */
-GstGLDisplayEGL *
-gst_gl_display_egl_new (void)
-{
- GstGLDisplayEGL *ret;
-
- GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-
- ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL);
- gst_object_ref_sink (ret);
- ret->display =
- gst_gl_display_egl_get_from_native (GST_GL_DISPLAY_TYPE_ANY, 0);
-
- if (!ret->display) {
- GST_INFO ("Failed to open EGL display connection");
- }
-
- return ret;
-}
-
-/**
- * gst_gl_display_egl_new_with_display:
- * @display: an existing and connected EGLDisplay
- *
- * Creates a new display connection from a EGLDisplay.
- *
- * Returns: (transfer full): a new #GstGLDisplayEGL
- *
- * Since: 1.12
- */
-GstGLDisplayEGL *
-gst_gl_display_egl_new_with_egl_display (gpointer display)
-{
- GstGLDisplayEGL *ret;
-
- g_return_val_if_fail (display != NULL, NULL);
-
- GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-
- ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL);
- gst_object_ref_sink (ret);
-
- ret->display = display;
- ret->foreign_display = TRUE;
-
- return ret;
-}
-
-static gpointer
-_ref_if_set (gpointer data, gpointer user_data)
-{
- if (data)
- gst_object_ref (data);
- return data;
-}
-
-/**
- * gst_gl_display_egl_from_gl_display:
- * @display: an existing #GstGLDisplay
- *
- * Creates a EGL display connection from a native Display.
- *
- * This function will return the same value for multiple calls with the same
- * @display.
- *
- * Returns: (transfer full): a new #GstGLDisplayEGL
- *
- * Since: 1.12
- */
-GstGLDisplayEGL *
-gst_gl_display_egl_from_gl_display (GstGLDisplay * display)
-{
- GstGLDisplayEGL *ret;
- GstGLDisplayType display_type;
- guintptr native_display;
-
- g_return_val_if_fail (GST_IS_GL_DISPLAY (display), NULL);
-
- GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-
- if (GST_IS_GL_DISPLAY_EGL (display)) {
- GST_LOG_OBJECT (display, "display %" GST_PTR_FORMAT "is already a "
- "GstGLDisplayEGL", display);
- return gst_object_ref (display);
- }
-
- /* try to get a previously set GstGLDisplayEGL */
- ret = g_object_dup_data (G_OBJECT (display), GST_GL_DISPLAY_EGL_NAME,
- (GDuplicateFunc) _ref_if_set, NULL);
- if (ret && GST_IS_GL_DISPLAY_EGL (ret)) {
- GST_LOG_OBJECT (display, "display %" GST_PTR_FORMAT "already has a "
- "GstGLDisplayEGL %" GST_PTR_FORMAT, display, ret);
- return ret;
- }
-
- if (ret)
- gst_object_unref (ret);
-
- display_type = gst_gl_display_get_handle_type (display);
- native_display = gst_gl_display_get_handle (display);
-
- g_return_val_if_fail (native_display != 0, NULL);
- g_return_val_if_fail (display_type != GST_GL_DISPLAY_TYPE_NONE, NULL);
-
- ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL);
- gst_object_ref_sink (ret);
-
- ret->display =
- gst_gl_display_egl_get_from_native (display_type, native_display);
-
- if (!ret->display) {
- GST_WARNING_OBJECT (ret, "failed to get EGLDisplay from native display");
- gst_object_unref (ret);
- return NULL;
- }
- g_object_set_data_full (G_OBJECT (display), GST_GL_DISPLAY_EGL_NAME,
- gst_object_ref (ret), (GDestroyNotify) gst_object_unref);
-
- return ret;
-}
-
-static guintptr
-gst_gl_display_egl_get_handle (GstGLDisplay * display)
-{
- return (guintptr) GST_GL_DISPLAY_EGL (display)->display;
-}
diff --git a/gst-libs/gst/gl/egl/gstgldisplay_egl.h b/gst-libs/gst/gl/egl/gstgldisplay_egl.h
deleted file mode 100644
index 319a04724..000000000
--- a/gst-libs/gst/gl/egl/gstgldisplay_egl.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.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_DISPLAY_EGL_H__
-#define __GST_GL_DISPLAY_EGL_H__
-
-#include <gst/gl/gstgldisplay.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_display_egl_get_type (void);
-
-#define GST_TYPE_GL_DISPLAY_EGL (gst_gl_display_egl_get_type())
-#define GST_GL_DISPLAY_EGL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_EGL,GstGLDisplayEGL))
-#define GST_GL_DISPLAY_EGL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_EGL,GstGLDisplayEGLClass))
-#define GST_IS_GL_DISPLAY_EGL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_EGL))
-#define GST_IS_GL_DISPLAY_EGL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_EGL))
-#define GST_GL_DISPLAY_EGL_CAST(obj) ((GstGLDisplayEGL*)(obj))
-
-typedef struct _GstGLDisplayEGL GstGLDisplayEGL;
-typedef struct _GstGLDisplayEGLClass GstGLDisplayEGLClass;
-
-/**
- * GstGLDisplayEGL:
- *
- * the contents of a #GstGLDisplayEGL are private and should only be accessed
- * through the provided API
- */
-struct _GstGLDisplayEGL
-{
- GstGLDisplay parent;
-
- /* <private> */
- gpointer display;
-
- gboolean foreign_display;
-
- gpointer _padding[GST_PADDING];
-};
-
-struct _GstGLDisplayEGLClass
-{
- GstGLDisplayClass object_class;
-
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstGLDisplayEGL *gst_gl_display_egl_new (void);
-
-GST_EXPORT
-GstGLDisplayEGL *gst_gl_display_egl_new_with_egl_display (gpointer display);
-
-GST_EXPORT
-GstGLDisplayEGL *gst_gl_display_egl_from_gl_display (GstGLDisplay * display);
-
-GST_EXPORT
-gpointer gst_gl_display_egl_get_from_native (GstGLDisplayType type, guintptr display);
-
-#define GST_GL_DISPLAY_EGL_NAME "gst.gl.display.egl"
-
-G_END_DECLS
-
-#endif /* __GST_GL_DISPLAY_EGL_H__ */
diff --git a/gst-libs/gst/gl/egl/gstglmemoryegl.c b/gst-libs/gst/gl/egl/gstglmemoryegl.c
deleted file mode 100644
index 1f461149d..000000000
--- a/gst-libs/gst/gl/egl/gstglmemoryegl.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Collabora Ltd.
- * @author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
- * Copyright (C) 2014 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2015 Igalia
- * Author: Gwang Yoon Hwang <yoon@igalia.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.
- */
-
-/**
- * SECTION:gstglmemoryegl
- * @short_description: memory subclass for EGLImage's
- * @see_also: #GstGLMemory, #GstGLAllocator, #GstGLBufferPool
- *
- * #GstGLMemoryEGL is created or wrapped through gst_gl_base_memory_alloc()
- * with #GstGLVideoAllocationParams.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstglmemoryegl.h"
-
-#include <gst/gl/gstglfuncs.h>
-
-#include "gstegl.h"
-#include "gsteglimage.h"
-#include "gstglcontext_egl.h"
-
-static GstAllocator *_gl_memory_egl_allocator;
-
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
-#define GST_CAT_DEFAULT GST_CAT_GL_MEMORY
-
-#define parent_class gst_gl_memory_egl_allocator_parent_class
-G_DEFINE_TYPE (GstGLMemoryEGLAllocator, gst_gl_memory_egl_allocator,
- GST_TYPE_GL_MEMORY_ALLOCATOR);
-
-/**
- * gst_is_gl_memory_egl:
- * @mem: a #GstMemory to test
- *
- * Returns: whether @mem is a #GstGLMemoryEGL
- *
- * Since: 1.10
- */
-gboolean
-gst_is_gl_memory_egl (GstMemory * mem)
-{
- return mem != NULL && mem->allocator != NULL
- && g_type_is_a (G_OBJECT_TYPE (mem->allocator),
- GST_TYPE_GL_MEMORY_EGL_ALLOCATOR);
-}
-
-static GstGLMemoryEGL *
-_gl_mem_get_parent (GstGLMemoryEGL * gl_mem)
-{
- GstGLMemoryEGL *parent = (GstGLMemoryEGL *) gl_mem->mem.mem.mem.parent;
- return parent ? parent : gl_mem;
-}
-
-/**
- * gst_gl_memory_egl_get_image:
- * @mem: a #GstGLMemoryEGL
- *
- * Returns: The EGLImage held by @mem
- *
- * Since: 1.10
- */
-gpointer
-gst_gl_memory_egl_get_image (GstGLMemoryEGL * mem)
-{
- g_return_val_if_fail (gst_is_gl_memory_egl (GST_MEMORY_CAST (mem)),
- EGL_NO_IMAGE_KHR);
- return gst_egl_image_get_image (_gl_mem_get_parent (mem)->image);
-}
-
-/**
- * gst_gl_memory_egl_get_display:
- * @mem: a #GstGLMemoryEGL
- *
- * Returns: The EGLDisplay @mem is associated with
- *
- * Since: 1.10
- */
-gpointer
-gst_gl_memory_egl_get_display (GstGLMemoryEGL * mem)
-{
- g_return_val_if_fail (gst_is_gl_memory_egl (GST_MEMORY_CAST (mem)), NULL);
- return GST_GL_CONTEXT_EGL (_gl_mem_get_parent (mem)->mem.mem.
- context)->egl_display;
-}
-
-static GstMemory *
-_gl_mem_alloc (GstAllocator * allocator, gsize size,
- GstAllocationParams * params)
-{
- g_warning ("Use gst_gl_base_memory_allocator_alloc() to allocate from this "
- "GstGLMemoryEGL allocator");
-
- return NULL;
-}
-
-static void
-_gl_mem_destroy (GstGLMemoryEGL * mem)
-{
- if (mem->image)
- gst_egl_image_unref (mem->image);
-
- GST_GL_BASE_MEMORY_ALLOCATOR_CLASS (parent_class)->destroy ((GstGLBaseMemory
- *) mem);
-}
-
-static GstGLMemoryEGL *
-_gl_mem_egl_alloc (GstGLBaseMemoryAllocator * allocator,
- GstGLVideoAllocationParams * params)
-{
- guint alloc_flags = params->parent.alloc_flags;
- GstGLMemoryEGL *mem;
-
- g_return_val_if_fail (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
- NULL);
- g_return_val_if_fail ((alloc_flags &
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) == 0, NULL);
- if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
- g_return_val_if_fail (GST_IS_EGL_IMAGE (params->parent.gl_handle), NULL);
- }
-
- mem = g_new0 (GstGLMemoryEGL, 1);
- if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
- if (params->target != GST_GL_TEXTURE_TARGET_2D) {
- g_free (mem);
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "GstGLMemoryEGL only supports wrapping "
- "2D textures");
- return NULL;
- }
- mem->image = gst_egl_image_ref (params->parent.gl_handle);
- }
-
- gst_gl_memory_init (GST_GL_MEMORY_CAST (mem), GST_ALLOCATOR_CAST (allocator),
- NULL, params->parent.context, params->target, params->tex_format,
- params->parent.alloc_params, params->v_info, params->plane,
- params->valign, params->parent.user_data, params->parent.notify);
-
- if (!mem->image) {
- gst_allocator_free (GST_ALLOCATOR_CAST (allocator), GST_MEMORY_CAST (mem));
- return NULL;
- }
-
- return mem;
-}
-
-static gboolean
-_gl_mem_create (GstGLMemoryEGL * gl_mem, GError ** error)
-{
- GstGLContext *context = gl_mem->mem.mem.context;
- const GstGLFuncs *gl = context->gl_vtable;
- GstGLBaseMemoryAllocatorClass *alloc_class;
-
- if (!gst_gl_context_check_feature (GST_GL_CONTEXT (context),
- "EGL_KHR_image_base")) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
- "EGL_KHR_image_base is not supported");
- return FALSE;
- }
-
- alloc_class = GST_GL_BASE_MEMORY_ALLOCATOR_CLASS (parent_class);
- if (!alloc_class->create ((GstGLBaseMemory *) gl_mem, error))
- return FALSE;
-
- if (gl_mem->image == NULL) {
- gl_mem->image = gst_egl_image_from_texture (context,
- (GstGLMemory *) gl_mem, NULL);
-
- if (!gl_mem->image) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "Failed to create EGLImage");
- return FALSE;
- }
- } else {
- gl->ActiveTexture (GL_TEXTURE0 + gl_mem->mem.plane);
- gl->BindTexture (GL_TEXTURE_2D, gl_mem->mem.tex_id);
- gl->EGLImageTargetTexture2D (GL_TEXTURE_2D,
- gst_egl_image_get_image (GST_EGL_IMAGE (gl_mem->image)));
- }
-
- return TRUE;
-}
-
-static GstMemory *
-_gl_mem_copy (GstGLMemoryEGL * src, gssize offset, gssize size)
-{
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "GstGLMemoryEGL does not support copy");
- return NULL;
-}
-
-static void
-gst_gl_memory_egl_allocator_class_init (GstGLMemoryEGLAllocatorClass * klass)
-{
- GstGLBaseMemoryAllocatorClass *gl_base;
- GstGLMemoryAllocatorClass *gl_tex;
- GstAllocatorClass *allocator_class;
-
- gl_tex = (GstGLMemoryAllocatorClass *) klass;
- gl_base = (GstGLBaseMemoryAllocatorClass *) klass;
- allocator_class = (GstAllocatorClass *) klass;
-
- gl_base->alloc = (GstGLBaseMemoryAllocatorAllocFunction) _gl_mem_egl_alloc;
- gl_base->create = (GstGLBaseMemoryAllocatorCreateFunction) _gl_mem_create;
- gl_base->destroy = (GstGLBaseMemoryAllocatorDestroyFunction) _gl_mem_destroy;
- gl_tex->copy = (GstGLBaseMemoryAllocatorCopyFunction) _gl_mem_copy;
-
- allocator_class->alloc = _gl_mem_alloc;
-}
-
-static void
-gst_gl_memory_egl_allocator_init (GstGLMemoryEGLAllocator * allocator)
-{
- GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
-
- alloc->mem_type = GST_GL_MEMORY_EGL_ALLOCATOR_NAME;
-
- GST_OBJECT_FLAG_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
-}
-
-/**
- * gst_gl_memory_egl_init_once:
- *
- * Initializes the GL Memory allocator. It is safe to call this function
- * multiple times. This must be called before any other GstGLMemoryEGL operation.
- *
- * Since: 1.10
- */
-void
-gst_gl_memory_egl_init_once (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- gst_gl_memory_init_once ();
-
- GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_MEMORY, "glmemory", 0,
- "OpenGL Texture with EGLImage memory");
-
- _gl_memory_egl_allocator =
- g_object_new (GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, NULL);
- gst_object_ref_sink (_gl_memory_egl_allocator);
-
- /* The allocator is never unreffed */
- GST_OBJECT_FLAG_SET (_gl_memory_egl_allocator,
- GST_OBJECT_FLAG_MAY_BE_LEAKED);
-
- gst_allocator_register (GST_GL_MEMORY_EGL_ALLOCATOR_NAME,
- gst_object_ref (_gl_memory_egl_allocator));
- g_once_init_leave (&_init, 1);
- }
-}
diff --git a/gst-libs/gst/gl/egl/gstglmemoryegl.h b/gst-libs/gst/gl/egl/gstglmemoryegl.h
deleted file mode 100644
index 098e7cf0d..000000000
--- a/gst-libs/gst/gl/egl/gstglmemoryegl.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Collabora Ltd.
- * @author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
- * Copyright (C) 2014 Julien Isorce <julien.isorce@gmail.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_MEMORY_EGL_H_
-#define _GST_GL_MEMORY_EGL_H_
-
-#include <gst/gl/gstglmemory.h>
-#include <gst/gl/egl/gsteglimage.h>
-#include <gst/gl/egl/gstgldisplay_egl.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_MEMORY_EGL_ALLOCATOR (gst_gl_memory_egl_allocator_get_type())
-GST_EXPORT GType gst_gl_memory_egl_allocator_get_type(void);
-
-#define GST_IS_GL_MEMORY_EGL_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR))
-#define GST_IS_GL_MEMORY_EGL_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR))
-#define GST_GL_MEMORY_EGL_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, GstGLMemoryEGLAllocatorClass))
-#define GST_GL_MEMORY_EGL_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, GstGLMemoryEGLAllocator))
-#define GST_GL_MEMORY_EGL_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, GstGLAllocatorClass))
-#define GST_GL_MEMORY_EGL_ALLOCATOR_CAST(obj) ((GstGLMemoryEGLAllocator *)(obj))
-
-/**
- * GstGLMemoryEGL:
- *
- * Private instance
- */
-struct _GstGLMemoryEGL
-{
- /* <private> */
- GstGLMemory mem;
-
- GstEGLImage *image;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GST_GL_MEMORY_EGL_ALLOCATOR_NAME:
- *
- * The name of the GL Memory EGL allocator
- */
-#define GST_GL_MEMORY_EGL_ALLOCATOR_NAME "GLMemoryEGL"
-
-GST_EXPORT
-void gst_gl_memory_egl_init_once (void);
-
-GST_EXPORT
-gboolean gst_is_gl_memory_egl (GstMemory * mem);
-
-GST_EXPORT
-gpointer gst_gl_memory_egl_get_image (GstGLMemoryEGL * mem);
-
-GST_EXPORT
-gpointer gst_gl_memory_egl_get_display (GstGLMemoryEGL * mem);
-
-/**
- * GstGLMemoryEGLAllocator
- *
- * Opaque #GstGLMemoryEGLAllocator struct
- */
-struct _GstGLMemoryEGLAllocator
-{
- /* <private> */
-
- GstGLMemoryAllocator parent;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLMemoryEGLAllocatorClass:
- *
- * The #GstGLMemoryEGLAllocatorClass only contains private data
- */
-struct _GstGLMemoryEGLAllocatorClass
-{
- /* <private> */
- GstGLMemoryAllocatorClass parent_class;
-
- gpointer _padding[GST_PADDING];
-};
-
-G_END_DECLS
-
-#endif /* _GST_GL_MEMORY_EGL_H_ */
diff --git a/gst-libs/gst/gl/gl.h b/gst-libs/gst/gl/gl.h
deleted file mode 100644
index 33d1f3578..000000000
--- a/gst-libs/gst/gl/gl.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Julien Isorce <julien.isorce@gmail.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_H__
-#define __GST_GL_H__
-
-#ifndef GST_USE_UNSTABLE_API
-#warning "The GL library from gst-plugins-bad is unstable API and may change in future."
-#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
-#endif
-
-#include <gst/gl/gstgl_fwd.h>
-#include <gst/gl/gstglapi.h>
-#include <gst/gl/gstglconfig.h>
-#include <gst/gl/gstglcontext.h>
-#include <gst/gl/gstgldebug.h>
-#include <gst/gl/gstgldisplay.h>
-#include <gst/gl/gstglfeature.h>
-#include <gst/gl/gstglformat.h>
-#include <gst/gl/gstglutils.h>
-#include <gst/gl/gstglwindow.h>
-#include <gst/gl/gstglslstage.h>
-#include <gst/gl/gstglshader.h>
-#include <gst/gl/gstglshaderstrings.h>
-#include <gst/gl/gstglcolorconvert.h>
-#include <gst/gl/gstglupload.h>
-#include <gst/gl/gstglbasememory.h>
-#include <gst/gl/gstglbuffer.h>
-#include <gst/gl/gstglmemory.h>
-#include <gst/gl/gstglmemorypbo.h>
-#include <gst/gl/gstglrenderbuffer.h>
-#include <gst/gl/gstglbufferpool.h>
-#include <gst/gl/gstglframebuffer.h>
-#include <gst/gl/gstglbasefilter.h>
-#include <gst/gl/gstglviewconvert.h>
-#include <gst/gl/gstglfilter.h>
-#include <gst/gl/gstglsyncmeta.h>
-#include <gst/gl/gstgloverlaycompositor.h>
-#include <gst/gl/gstglquery.h>
-
-#endif /* __GST_GL_H__ */
diff --git a/gst-libs/gst/gl/glprototypes/Makefile.am b/gst-libs/gst/gl/glprototypes/Makefile.am
deleted file mode 100644
index 54ebc27ce..000000000
--- a/gst-libs/gst/gl/glprototypes/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-prototypedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/glprototypes
-
-prototype_HEADERS = \
- all_functions.h \
- base.h \
- blending.h \
- eglimage.h \
- fbo.h \
- fixedfunction.h \
- gles.h \
- opengl.h \
- shaders.h \
- gstgl_compat.h \
- gstgl_gles2compat.h \
- debug.h \
- vao.h \
- sync.h \
- buffers.h \
- query.h
-
diff --git a/gst-libs/gst/gl/glprototypes/README b/gst-libs/gst/gl/glprototypes/README
deleted file mode 100644
index fbd911e6d..000000000
--- a/gst-libs/gst/gl/glprototypes/README
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-/* Original files and function definitions courtesy of cogl
- *
- * Changes:
- * - Namespace COGL -> GST_GL
- * - remove gl from each function (i.e. glTexImage2D -> TexImage2D)
- **/
-
-/* The files in this folder are included multiple times with different
- * definitions for these macros. The macros are given the following arguments:
- *
- * GST_GL_EXT_BEGIN:
- *
- * @name: a unique symbol name for this feature
- *
- * @min_gl_major: the major part of the minimum GL version where these
- * functions are available in core, or 255 if it isn't available in
- * any version.
- * @min_gl_minor: the minor part of the minimum GL version where these
- * functions are available in core, or 255 if it isn't available in
- * any version.
- *
- * @gles_availability: flags to specify which versions of GLES the
- * functions are available in. Should be a combination of
- * GST_GL_API_GLES and GST_GL_API_GLES2.
- *
- * @extension_suffixes: A zero-separated list of suffixes in a
- * string. These are appended to the extension name to get a complete
- * extension name to try. The suffix is also appended to all of the
- * function names. The suffix can optionally include a ':' to specify
- * an alternate suffix for the function names.
- *
- * @extension_names: A list of extension names to try. If any of these
- * extensions match then it will be used.
- */
diff --git a/gst-libs/gst/gl/glprototypes/all_functions.h b/gst-libs/gst/gl/glprototypes/all_functions.h
deleted file mode 100644
index 9f7e4f112..000000000
--- a/gst-libs/gst/gl/glprototypes/all_functions.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-#include "base.h"
-#include "blending.h"
-#include "eglimage.h"
-#include "fbo.h"
-#include "fixedfunction.h"
-#include "gles.h"
-#include "opengl.h"
-#include "shaders.h"
-#include "debug.h"
-#include "vao.h"
-#include "sync.h"
-#include "buffers.h"
-#include "query.h"
diff --git a/gst-libs/gst/gl/glprototypes/base.h b/gst-libs/gst/gl/glprototypes/base.h
deleted file mode 100644
index 8394a3872..000000000
--- a/gst-libs/gst/gl/glprototypes/base.h
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2009, 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-/* These are the core GL functions which we assume will always be
- available */
-GST_GL_EXT_BEGIN (core,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES1 | GST_GL_API_GLES2,
- 1, 0,
- 1, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, BindTexture,
- (GLenum target, GLuint texture))
-GST_GL_EXT_FUNCTION (void, BlendFunc,
- (GLenum sfactor, GLenum dfactor))
-GST_GL_EXT_FUNCTION (void, Clear,
- (GLbitfield mask))
-GST_GL_EXT_FUNCTION (void, ClearColor,
- (GLclampf red,
- GLclampf green,
- GLclampf blue,
- GLclampf alpha))
-GST_GL_EXT_FUNCTION (void, ClearStencil,
- (GLint s))
-GST_GL_EXT_FUNCTION (void, ColorMask,
- (GLboolean red,
- GLboolean green,
- GLboolean blue,
- GLboolean alpha))
-GST_GL_EXT_FUNCTION (void, CopyTexSubImage2D,
- (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height))
-GST_GL_EXT_FUNCTION (void, DeleteTextures,
- (GLsizei n, const GLuint* textures))
-GST_GL_EXT_FUNCTION (void, DepthFunc,
- (GLenum func))
-GST_GL_EXT_FUNCTION (void, DepthMask,
- (GLboolean flag))
-GST_GL_EXT_FUNCTION (void, Disable,
- (GLenum cap))
-GST_GL_EXT_FUNCTION (void, DrawArrays,
- (GLenum mode, GLint first, GLsizei count))
-GST_GL_EXT_FUNCTION (void, DrawElements,
- (GLenum mode,
- GLsizei count,
- GLenum type,
- const GLvoid* indices))
-GST_GL_EXT_FUNCTION (void, Enable,
- (GLenum cap))
-GST_GL_EXT_FUNCTION (void, Finish,
- (void))
-GST_GL_EXT_FUNCTION (void, Flush,
- (void))
-GST_GL_EXT_FUNCTION (void, FrontFace,
- (GLenum mode))
-GST_GL_EXT_FUNCTION (void, CullFace,
- (GLenum mode))
-GST_GL_EXT_FUNCTION (void, GenTextures,
- (GLsizei n, GLuint* textures))
-GST_GL_EXT_FUNCTION (GLenum, GetError,
- (void))
-GST_GL_EXT_FUNCTION (void, GetIntegerv,
- (GLenum pname, GLint* params))
-GST_GL_EXT_FUNCTION (void, GetBooleanv,
- (GLenum pname, GLboolean* params))
-GST_GL_EXT_FUNCTION (void, GetFloatv,
- (GLenum pname, GLfloat* params))
-GST_GL_EXT_FUNCTION (const GLubyte*, GetString,
- (GLenum name))
-GST_GL_EXT_FUNCTION (void, Hint,
- (GLenum target, GLenum mode))
-GST_GL_EXT_FUNCTION (GLboolean, IsTexture,
- (GLuint texture))
-GST_GL_EXT_FUNCTION (void, PixelStorei,
- (GLenum pname, GLint param))
-GST_GL_EXT_FUNCTION (void, ReadPixels,
- (GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- GLvoid* pixels))
-GST_GL_EXT_FUNCTION (void, Scissor,
- (GLint x, GLint y, GLsizei width, GLsizei height))
-GST_GL_EXT_FUNCTION (void, StencilFunc,
- (GLenum func, GLint ref, GLuint mask))
-GST_GL_EXT_FUNCTION (void, StencilMask,
- (GLuint mask))
-GST_GL_EXT_FUNCTION (void, StencilOp,
- (GLenum fail, GLenum zfail, GLenum zpass))
-GST_GL_EXT_FUNCTION (void, TexImage2D,
- (GLenum target,
- GLint level,
- GLint internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid* pixels))
-GST_GL_EXT_FUNCTION (void, TexParameterfv,
- (GLenum target, GLenum pname, const GLfloat* params))
-GST_GL_EXT_FUNCTION (void, TexParameteri,
- (GLenum target, GLenum pname, GLint param))
-GST_GL_EXT_FUNCTION (void, TexParameteriv,
- (GLenum target, GLenum pname, const GLint* params))
-GST_GL_EXT_FUNCTION (void, GetTexParameterfv,
- (GLenum target, GLenum pname, GLfloat* params))
-GST_GL_EXT_FUNCTION (void, GetTexParameteriv,
- (GLenum target, GLenum pname, GLint* params))
-GST_GL_EXT_FUNCTION (void, TexSubImage2D,
- (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLenum type,
- const GLvoid* pixels))
-GST_GL_EXT_FUNCTION (void, CopyTexImage2D,
- (GLenum target,
- GLint level,
- GLenum internalformat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border))
-GST_GL_EXT_FUNCTION (void, Viewport,
- (GLint x, GLint y, GLsizei width, GLsizei height))
-GST_GL_EXT_FUNCTION (GLboolean, IsEnabled, (GLenum cap))
-GST_GL_EXT_FUNCTION (void, LineWidth, (GLfloat width))
-GST_GL_EXT_FUNCTION (void, PolygonOffset, (GLfloat factor, GLfloat units))
-GST_GL_EXT_FUNCTION (void, TexParameterf,
- (GLenum target,
- GLenum pname,
- GLfloat param))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (texture_3d,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
- 1, 2,
- 255, 255, /* not in either GLES */
- "OES\0",
- "texture_3D\0")
-GST_GL_EXT_FUNCTION (void, TexImage3D,
- (GLenum target, GLint level,
- GLint internalFormat,
- GLsizei width, GLsizei height,
- GLsizei depth, GLint border,
- GLenum format, GLenum type,
- const GLvoid *pixels))
-GST_GL_EXT_FUNCTION (void, TexSubImage3D,
- (GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint zoffset, GLsizei width,
- GLsizei height, GLsizei depth,
- GLenum format,
- GLenum type, const GLvoid *pixels))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (only_in_both_gles_and_gl_1_3,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES1 | GST_GL_API_GLES2,
- 1, 3,
- 1, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, CompressedTexImage2D,
- (GLenum target,
- GLint level,
- GLenum internalformat,
- GLsizei width,
- GLsizei height,
- GLint border,
- GLsizei imageSize,
- const GLvoid* data))
-GST_GL_EXT_FUNCTION (void, CompressedTexSubImage2D,
- (GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLsizei width,
- GLsizei height,
- GLenum format,
- GLsizei imageSize,
- const GLvoid* data))
-GST_GL_EXT_FUNCTION (void, SampleCoverage,
- (GLclampf value, GLboolean invert))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (only_in_both_gles_and_gl_1_5,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES1 | GST_GL_API_GLES2,
- 1, 5,
- 1, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, GetBufferParameteriv,
- (GLenum target, GLenum pname, GLint* params))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (vbos,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES1 | GST_GL_API_GLES2,
- 1, 5,
- 1, 0,
- "ARB\0",
- "vertex_buffer_object\0")
-GST_GL_EXT_FUNCTION (void, GenBuffers,
- (GLsizei n,
- GLuint *buffers))
-GST_GL_EXT_FUNCTION (void, BindBuffer,
- (GLenum target,
- GLuint buffer))
-GST_GL_EXT_FUNCTION (void, BufferData,
- (GLenum target,
- GLsizeiptr size,
- const GLvoid *data,
- GLenum usage))
-GST_GL_EXT_FUNCTION (void, BufferSubData,
- (GLenum target,
- GLintptr offset,
- GLsizeiptr size,
- const GLvoid *data))
-GST_GL_EXT_FUNCTION (void, DeleteBuffers,
- (GLsizei n,
- const GLuint *buffers))
-GST_GL_EXT_FUNCTION (GLboolean, IsBuffer,
- (GLuint buffer))
-GST_GL_EXT_END ()
-
-/* Available in GL 1.3, the multitexture extension or GLES. These are
- required */
-GST_GL_EXT_BEGIN (multitexture_part0,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES1 | GST_GL_API_GLES2,
- 1, 3,
- 1, 0,
- "ARB\0",
- "multitexture\0")
-GST_GL_EXT_FUNCTION (void, ActiveTexture,
- (GLenum texture))
-GST_GL_EXT_END ()
-
-
- /* GLES doesn't support mapping buffers in core so this has to be a
- separate check */
-GST_GL_EXT_BEGIN (map_vbos,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
- 1, 5,
- 255, 255, /* not in GLES core */
- "ARB\0OES\0",
- "vertex_buffer_object\0mapbuffer\0")
-GST_GL_EXT_FUNCTION (void *, MapBuffer,
- (GLenum target,
- GLenum access))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (unmap_buffer,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2,
- 1, 5,
- 3, 0,
- "ARB\0OES\0",
- "vertex_buffer_object\0mapbuffer\0")
-GST_GL_EXT_FUNCTION (GLboolean, UnmapBuffer,
- (GLenum target))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (gl3,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 3, 0,
- 3, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (const GLubyte*, GetStringi,
- (GLenum name, GLint index))
-GST_GL_EXT_FUNCTION (void *, MapBufferRange,
- (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/blending.h b/gst-libs/gst/gl/glprototypes/blending.h
deleted file mode 100644
index 8ea514880..000000000
--- a/gst-libs/gst/gl/glprototypes/blending.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2009, 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-GST_GL_EXT_BEGIN (blending,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 1, 2,
- 2, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, BlendEquation,
- (GLenum mode))
-GST_GL_EXT_FUNCTION (void, BlendColor,
- (GLclampf red,
- GLclampf green,
- GLclampf blue,
- GLclampf alpha))
-GST_GL_EXT_END ()
-
-/* Optional, declared in 1.4 or GLES 1.2 */
-GST_GL_EXT_BEGIN (blend_func_separate,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 1, 4,
- 2, 0,
- "EXT\0",
- "blend_func_separate\0")
-GST_GL_EXT_FUNCTION (void, BlendFuncSeparate,
- (GLenum srcRGB,
- GLenum dstRGB,
- GLenum srcAlpha,
- GLenum dstAlpha))
-GST_GL_EXT_END ()
-
-/* Optional, declared in 2.0 */
-GST_GL_EXT_BEGIN (blend_equation_separate,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 2, 0,
- 2, 0,
- "EXT\0",
- "blend_equation_separate\0")
-GST_GL_EXT_FUNCTION (void, BlendEquationSeparate,
- (GLenum modeRGB,
- GLenum modeAlpha))
-GST_GL_EXT_END ()
-
-/* GL and GLES 2.0 apis */
-GST_GL_EXT_BEGIN (two_point_zero_api,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 2, 0,
- 2, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, StencilFuncSeparate,
- (GLenum face, GLenum func, GLint ref, GLuint mask))
-GST_GL_EXT_FUNCTION (void, StencilMaskSeparate,
- (GLenum face, GLuint mask))
-GST_GL_EXT_FUNCTION (void, StencilOpSeparate,
- (GLenum face, GLenum fail, GLenum zfail, GLenum zpass))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/buffers.h b/gst-libs/gst/gl/glprototypes/buffers.h
deleted file mode 100644
index 5e73c624f..000000000
--- a/gst-libs/gst/gl/glprototypes/buffers.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- */
-
-GST_GL_EXT_BEGIN (buffer_copy_sub_data,
- GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 3, 1,
- 3, 0,
- /* extension is available in GL 3.0 */
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, CopyBufferSubData,
- (GLenum readTarget,
- GLenum writeTarget,
- GLintptr readOffset,
- GLintptr writeOffset,
- GLsizeiptr size))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (get_buffer_sub_data,
- GST_GL_API_OPENGL3,
- 1, 5,
- 255, 255,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, GetBufferSubData,
- (GLenum target,
- GLintptr offset,
- GLsizeiptr size,
- void * data))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/debug.h b/gst-libs/gst/gl/glprototypes/debug.h
deleted file mode 100644
index 135d4e672..000000000
--- a/gst-libs/gst/gl/glprototypes/debug.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.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.
- */
-
-GST_GL_EXT_BEGIN (debug,
- GST_GL_API_OPENGL3,
- 4, 3,
- 255, 255,
- "KHR:\0KHR\0ARB\0",
- "debug\0debug_output\0")
-GST_GL_EXT_FUNCTION (void, DebugMessageControl,
- (GLenum source,
- GLenum type,
- GLenum severity,
- GLsizei count,
- const GLuint* ids,
- gboolean enabled))
-GST_GL_EXT_FUNCTION (void, DebugMessageInsert,
- (GLenum source,
- GLenum type,
- GLuint id,
- GLenum severity,
- GLsizei length,
- const gchar *message))
-GST_GL_EXT_FUNCTION (void, DebugMessageCallback,
- (GST_GL_DEBUG_PROC callback,
- gpointer user_data))
-GST_GL_EXT_FUNCTION (GLuint, GetDebugMessageLog,
- (GLuint count,
- GLsizei bufSize,
- GLenum* sources,
- GLenum* types,
- GLuint* ids,
- GLenum* severities,
- GLsizei* lengths,
- gchar* messageLog))
-GST_GL_EXT_FUNCTION (void, GetPointerv,
- (GLenum pname,
- gpointer * params))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (khr_debug,
- GST_GL_API_OPENGL3,
- 4, 3,
- 255, 255,
- "KHR:\0KHR\0",
- "debug\0")
-GST_GL_EXT_FUNCTION (void, PushDebugGroup,
- (GLenum source,
- GLuint id,
- GLsizei length,
- const gchar * message))
-GST_GL_EXT_FUNCTION (void, PopDebugGroup, (void))
-GST_GL_EXT_FUNCTION (void, ObjectLabel,
- (GLenum identifier,
- GLuint name,
- GLsizei length,
- const gchar *label))
-GST_GL_EXT_FUNCTION (void, GetObjectLabel,
- (GLenum identifier,
- GLuint name,
- GLsizei bufSize,
- GLsizei *length,
- gchar *label))
-GST_GL_EXT_FUNCTION (void, ObjectPtrLabel,
- (gpointer ptr,
- GLsizei length,
- const gchar *label))
-GST_GL_EXT_FUNCTION (void, GetObjectPtrLabel,
- (gpointer ptr,
- GLsizei bufSize,
- GLsizei *length,
- gchar *label))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (ext_debug_marker,
- GST_GL_API_NONE,
- 255, 255,
- 255, 255,
- "EXT\0",
- "debug_marker\0")
-GST_GL_EXT_FUNCTION (void, InsertEventMarker,
- (GLsizei length,
- const gchar * message))
-GST_GL_EXT_FUNCTION (void, PushGroupMarker,
- (GLsizei length,
- const gchar * message))
-GST_GL_EXT_FUNCTION (void, PopGroupMarker,
- (void))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (gremedy_string_marker,
- GST_GL_API_NONE,
- 255, 255,
- 255, 255,
- "GREMEDY\0",
- "string_marker\0")
-GST_GL_EXT_FUNCTION (void, StringMarker,
- (GLsizei length,
- const gchar * message))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/eglimage.h b/gst-libs/gst/gl/glprototypes/eglimage.h
deleted file mode 100644
index 0256003b0..000000000
--- a/gst-libs/gst/gl/glprototypes/eglimage.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2009, 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-GST_GL_EXT_BEGIN (EGL_image,
- GST_GL_API_NONE,
- 255, 255,
- 255, 255, /* not in either GLES */
- "OES\0",
- "EGL_image\0")
-GST_GL_EXT_FUNCTION (void, EGLImageTargetTexture2D,
- (GLenum target,
- GLeglImageOES image))
-GST_GL_EXT_FUNCTION (void, EGLImageTargetRenderbufferStorage,
- (GLenum target,
- GLeglImageOES image))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/fbo.h b/gst-libs/gst/gl/glprototypes/fbo.h
deleted file mode 100644
index f210f997d..000000000
--- a/gst-libs/gst/gl/glprototypes/fbo.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2009, 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-GST_GL_EXT_BEGIN (offscreen,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 3, 0,
- 2, 0,
- /* for some reason the ARB version of this
- extension doesn't have an ARB suffix for the
- functions */
- "ARB:\0EXT\0OES\0",
- "framebuffer_object\0")
-GST_GL_EXT_FUNCTION (void, GenRenderbuffers,
- (GLsizei n,
- GLuint *renderbuffers))
-GST_GL_EXT_FUNCTION (void, DeleteRenderbuffers,
- (GLsizei n,
- const GLuint *renderbuffers))
-GST_GL_EXT_FUNCTION (void, BindRenderbuffer,
- (GLenum target,
- GLuint renderbuffer))
-GST_GL_EXT_FUNCTION (void, RenderbufferStorage,
- (GLenum target,
- GLenum internalformat,
- GLsizei width,
- GLsizei height))
-GST_GL_EXT_FUNCTION (void, GenFramebuffers,
- (GLsizei n,
- GLuint *framebuffers))
-GST_GL_EXT_FUNCTION (void, BindFramebuffer,
- (GLenum target,
- GLuint framebuffer))
-GST_GL_EXT_FUNCTION (void, FramebufferTexture2D,
- (GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level))
-GST_GL_EXT_FUNCTION (void, FramebufferRenderbuffer,
- (GLenum target,
- GLenum attachment,
- GLenum renderbuffertarget,
- GLuint renderbuffer))
-GST_GL_EXT_FUNCTION (GLboolean, IsRenderbuffer,
- (GLuint renderbuffer))
-GST_GL_EXT_FUNCTION (GLenum, CheckFramebufferStatus,
- (GLenum target))
-GST_GL_EXT_FUNCTION (void, DeleteFramebuffers,
- (GLsizei n,
- const GLuint *framebuffers))
-GST_GL_EXT_FUNCTION (void, GenerateMipmap,
- (GLenum target))
-GST_GL_EXT_FUNCTION (void, GetFramebufferAttachmentParameteriv,
- (GLenum target,
- GLenum attachment,
- GLenum pname,
- GLint *params))
-GST_GL_EXT_FUNCTION (void, GetRenderbufferParameteriv,
- (GLenum target,
- GLenum pname,
- GLint *params))
-GST_GL_EXT_FUNCTION (GLboolean, IsFramebuffer,
- (GLuint framebuffer))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (offscreen_blit,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 3, 0,
- 3, 0,
- "EXT\0ANGLE\0",
- "framebuffer_blit\0")
-GST_GL_EXT_FUNCTION (void, BlitFramebuffer,
- (GLint srcX0,
- GLint srcY0,
- GLint srcX1,
- GLint srcY1,
- GLint dstX0,
- GLint dstY0,
- GLint dstX1,
- GLint dstY1,
- GLbitfield mask,
- GLenum filter))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (framebuffer_discard,
- GST_GL_API_NONE,
- 255, 255,
- 255, 255, /* not in either GLES */
- "EXT\0",
- "framebuffer_discard\0")
-GST_GL_EXT_FUNCTION (void, DiscardFramebuffer,
- (GLenum target,
- GLsizei numAttachments,
- const GLenum *attachments))
-GST_GL_EXT_END ()
-
-
-GST_GL_EXT_BEGIN (read_buffer,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 1, 0,
- 3, 0,
- "NV\0",
- "read_buffer\0")
-GST_GL_EXT_FUNCTION (void, ReadBuffer,
- (GLenum mode))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (draw_buffers,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 2, 1,
- 3, 0,
- "ARB\0ATI\0NV\0",
- "draw_buffers\0")
-GST_GL_EXT_FUNCTION (void, DrawBuffers,
- (GLsizei n, const GLenum *bufs))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/fixedfunction.h b/gst-libs/gst/gl/glprototypes/fixedfunction.h
deleted file mode 100644
index 3aecbd227..000000000
--- a/gst-libs/gst/gl/glprototypes/fixedfunction.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2009, 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-GST_GL_EXT_BEGIN (multitexture_part1,
- GST_GL_API_OPENGL |
- GST_GL_API_GLES1,
- 1, 3,
- 1, 0,
- "ARB\0",
- "multitexture\0")
-GST_GL_EXT_FUNCTION (void, ClientActiveTexture,
- (GLenum texture))
-GST_GL_EXT_END ()
-
-/* These are the core GL functions which are available when the API
- supports fixed-function (ie, GL and GLES1.1) */
-GST_GL_EXT_BEGIN (fixed_function_core,
- GST_GL_API_OPENGL |
- GST_GL_API_GLES1,
- 0, 0,
- 1, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, AlphaFunc,
- (GLenum func, GLclampf ref))
-GST_GL_EXT_FUNCTION (void, Fogf,
- (GLenum pname, GLfloat param))
-GST_GL_EXT_FUNCTION (void, Fogfv,
- (GLenum pname, const GLfloat *params))
-GST_GL_EXT_FUNCTION (void, LoadMatrixf,
- (const GLfloat *m))
-GST_GL_EXT_FUNCTION (void, Materialfv,
- (GLenum face, GLenum pname, const GLfloat *params))
-GST_GL_EXT_FUNCTION (void, PointSize,
- (GLfloat size))
-GST_GL_EXT_FUNCTION (void, TexEnvfv,
- (GLenum target, GLenum pname, const GLfloat *params))
-GST_GL_EXT_FUNCTION (void, Color4ub,
- (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha))
-GST_GL_EXT_FUNCTION (void, ColorPointer,
- (GLint size,
- GLenum type,
- GLsizei stride,
- const GLvoid *pointer))
-GST_GL_EXT_FUNCTION (void, DisableClientState,
- (GLenum array))
-GST_GL_EXT_FUNCTION (void, EnableClientState,
- (GLenum array))
-GST_GL_EXT_FUNCTION (void, LoadIdentity,
- (void))
-GST_GL_EXT_FUNCTION (void, MatrixMode,
- (GLenum mode))
-GST_GL_EXT_FUNCTION (void, NormalPointer,
- (GLenum type, GLsizei stride, const GLvoid *pointer))
-GST_GL_EXT_FUNCTION (void, TexCoordPointer,
- (GLint size,
- GLenum type,
- GLsizei stride,
- const GLvoid *pointer))
-GST_GL_EXT_FUNCTION (void, TexEnvi,
- (GLenum target,
- GLenum pname,
- GLint param))
-GST_GL_EXT_FUNCTION (void, VertexPointer,
- (GLint size,
- GLenum type,
- GLsizei stride,
- const GLvoid *pointer))
-GST_GL_EXT_FUNCTION (void, PushMatrix,
- (void))
-GST_GL_EXT_FUNCTION (void, PopMatrix,
- (void))
-GST_GL_EXT_END ()
-
-/* Eventually we want to remove this category */
-GST_GL_EXT_BEGIN (fixed_function_gl_only,
- GST_GL_API_OPENGL,
- 0, 0,
- 0, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, PushAttrib,
- (GLbitfield mask))
-GST_GL_EXT_FUNCTION (void, PopAttrib,
- (void))
-GST_GL_EXT_FUNCTION (void, TexImage1D,
- (GLenum target,
- GLint level,
- GLint internalFormat,
- GLsizei width,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *data))
-GST_GL_EXT_FUNCTION (void, Rotatef,
- (GLfloat angle, GLfloat x, GLfloat y, GLfloat z))
-GST_GL_EXT_FUNCTION (void, Translatef,
- (GLfloat x, GLfloat y, GLfloat z))
-GST_GL_EXT_FUNCTION (void, Scalef,
- (GLfloat x, GLfloat y, GLfloat z))
-GST_GL_EXT_FUNCTION (void, Lightfv,
- (GLenum light, GLenum pname, const GLfloat *params))
-GST_GL_EXT_FUNCTION (void, ColorMaterial,
- (GLenum face, GLenum pname))
-GST_GL_EXT_FUNCTION (void, ShadeModel,
- (GLenum value))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/gles.h b/gst-libs/gst/gl/glprototypes/gles.h
deleted file mode 100644
index 7d1cd8871..000000000
--- a/gst-libs/gst/gl/glprototypes/gles.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2009, 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-GST_GL_EXT_BEGIN (only_in_both_gles,
- GST_GL_API_GLES1 |
- GST_GL_API_GLES2,
- 255, 255,
- 1, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, DepthRangef,
- (GLfloat near_val, GLfloat far_val))
-GST_GL_EXT_FUNCTION (void, ClearDepthf,
- (GLclampf depth))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (only_in_gles1,
- GST_GL_API_GLES1,
- 255, 255,
- 1, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, ClipPlanef, (GLenum plane, const GLfloat *equation))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (gles2_only_api,
- GST_GL_API_GLES2,
- 255, 255,
- 2, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, ReleaseShaderCompiler, (void))
-GST_GL_EXT_FUNCTION (void, GetShaderPrecisionFormat,
- (GLenum shadertype,
- GLenum precisiontype,
- GLint* range,
- GLint* precision))
-GST_GL_EXT_FUNCTION (void, ShaderBinary,
- (GLsizei n,
- const GLuint* shaders,
- GLenum binaryformat,
- const GLvoid* binary,
- GLsizei length))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (IMG_multisampled_render_to_texture,
- GST_GL_API_NONE,
- 255, 255,
- 255, 255, /* not in either GLES */
- "\0",
- "IMG_multisampled_render_to_texture\0")
-GST_GL_EXT_FUNCTION (void, RenderbufferStorageMultisampleIMG,
- (GLenum target,
- GLsizei samples,
- GLenum internal_format,
- GLsizei width,
- GLsizei height))
-GST_GL_EXT_FUNCTION (void, FramebufferTexture2DMultisampleIMG,
- (GLenum target,
- GLenum attachment,
- GLenum textarget,
- GLuint texture,
- GLint level,
- GLsizei samples))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/gstgl_compat.h b/gst-libs/gst/gl/glprototypes/gstgl_compat.h
deleted file mode 100644
index 31b1e005d..000000000
--- a/gst-libs/gst/gl/glprototypes/gstgl_compat.h
+++ /dev/null
@@ -1,67 +0,0 @@
- /*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_COMPAT_H__
-#define __GST_GL_COMPAT_H__
-
-#include <gst/gl/gstglconfig.h>
-
-/* undefined typedefs */
-#if !GST_GL_HAVE_GLEGLIMAGEOES
-typedef gpointer GLeglImageOES;
-#endif
-#if !GST_GL_HAVE_GLCHAR
-typedef gchar GLchar;
-#endif
-#if !GST_GL_HAVE_GLSIZEIPTR
-typedef ptrdiff_t GLsizeiptr;
-#endif
-#if !GST_GL_HAVE_GLINTPTR
-typedef ptrdiff_t GLintptr;
-#endif
-#if !GST_GL_HAVE_GLSYNC
-typedef gpointer GLsync;
-#endif
-#if !GST_GL_HAVE_GLUINT64
-typedef guint64 GLuint64;
-#endif
-#if !GST_GL_HAVE_GLINT64
-typedef gint64 GLint64;
-#endif
-
-#if !defined(GST_GL_DEBUG_PROC)
-#if defined(GLDEBUGPROC)
-#define GST_GL_DEBUG_PROC GLDEBUGPROC
-#elif defined(GLDEBUGPROCARB)
-#define GST_GL_DEBUG_PROC GLDEBUGPROCARB
-#elif defined(GLDEBUGPROCKHR)
-#define GST_GL_DEBUG_PROC GLDEBUGPROCKHR
-#else
-typedef void (GSTGLAPI *GST_GL_DEBUG_PROC) (GLenum source,
- GLenum type,
- GLuint id,
- GLenum severity,
- GLsizei length,
- const gchar* message,
- gpointer user_data);
-#endif
-#endif
-
-#endif
diff --git a/gst-libs/gst/gl/glprototypes/gstgl_gles2compat.h b/gst-libs/gst/gl/glprototypes/gstgl_gles2compat.h
deleted file mode 100644
index 6dfd2c3b2..000000000
--- a/gst-libs/gst/gl/glprototypes/gstgl_gles2compat.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-/* Compatibility for OpenGL ES 2.0 */
-
-#ifndef __GST_GL_ES2__
-#define __GST_GL_ES2__
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-#ifndef GL_RGB16
-#define GL_RGB16 GL_RGB565
-#endif
-#ifndef GL_RGB8
-#define GL_RGB8 GL_RGB
-#endif
-
-/* UNSUPPORTED */
-
-#ifndef GL_COLOR_ATTACHMENT1
-#define GL_COLOR_ATTACHMENT1 0x8CE1
-#endif
-#ifndef GL_COLOR_ATTACHMENT2
-#define GL_COLOR_ATTACHMENT2 0x8CE2
-#endif
-#ifndef GL_TEXTURE_ENV
-#define GL_TEXTURE_ENV 0
-#endif
-#ifndef GL_TEXTURE_ENV_MODE
-#define GL_TEXTURE_ENV_MODE 0
-#endif
-#ifndef GL_DEPTH24_STENCIL8
-#define GL_DEPTH24_STENCIL8 0x88F0
-#endif
-
-G_END_DECLS
-
-#endif /* __GST_GL_ES2__ */
diff --git a/gst-libs/gst/gl/glprototypes/opengl.h b/gst-libs/gst/gl/glprototypes/opengl.h
deleted file mode 100644
index ac47d5280..000000000
--- a/gst-libs/gst/gl/glprototypes/opengl.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2009, 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/* These are the core GL functions which are only available in big
- GL */
-GST_GL_EXT_BEGIN (only_in_big_gl,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
- 1, 0,
- 255, 255, /* not in GLES */
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, GetTexLevelParameteriv,
- (GLenum target, GLint level,
- GLenum pname, GLint *params))
-GST_GL_EXT_FUNCTION (void, GetTexImage,
- (GLenum target, GLint level,
- GLenum format, GLenum type,
- GLvoid *pixels))
-GST_GL_EXT_FUNCTION (void, DepthRange,
- (double near_val, double far_val))
-GST_GL_EXT_FUNCTION (void, DrawBuffer,
- (GLenum mode))
-GST_GL_EXT_FUNCTION (void, ClearDepth,
- (double depth))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (only_in_big_gl_compat,
- GST_GL_API_OPENGL,
- 1, 0,
- 255, 255, /* not in GLES */
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, ClipPlane,
- (GLenum plane, const double *equation))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/query.h b/gst-libs/gst/gl/glprototypes/query.h
deleted file mode 100644
index 09f1ba23f..000000000
--- a/gst-libs/gst/gl/glprototypes/query.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2016 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.
- */
-
-GST_GL_EXT_BEGIN (timer_query,
- GST_GL_API_OPENGL3,
- 3, 3,
- 3, 0,
- "ARB:\0ANGLE\0EXT\0",
- "timer_query\0disjoint_timer_query\0")
-GST_GL_EXT_FUNCTION (void, GenQueries,
- (GLsizei n,
- GLuint *ids))
-GST_GL_EXT_FUNCTION (void, DeleteQueries,
- (GLsizei n,
- GLuint *ids))
-GST_GL_EXT_FUNCTION (GLboolean, IsQuery,
- (GLuint id))
-GST_GL_EXT_FUNCTION (void, BeginQuery,
- (GLenum target,
- GLuint id))
-GST_GL_EXT_FUNCTION (void, EndQuery,
- (GLenum target))
-GST_GL_EXT_FUNCTION (void, QueryCounter,
- (GLuint id,
- GLenum target))
-GST_GL_EXT_FUNCTION (void, GetQueryiv,
- (GLenum target,
- GLenum pname,
- GLint *params))
-GST_GL_EXT_FUNCTION (void, GetQueryObjectiv,
- (GLuint id,
- GLenum pname,
- GLint *params))
-GST_GL_EXT_FUNCTION (void, GetQueryObjectuiv,
- (GLuint id,
- GLenum pname,
- GLuint *params))
-GST_GL_EXT_FUNCTION (void, GetQueryObjecti64v,
- (GLuint id,
- GLenum pname,
- GLint64 *params))
-GST_GL_EXT_FUNCTION (void, GetQueryObjectui64v,
- (GLuint id,
- GLenum pname,
- GLuint64 *params))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/shaders.h b/gst-libs/gst/gl/glprototypes/shaders.h
deleted file mode 100644
index 6d828dbac..000000000
--- a/gst-libs/gst/gl/glprototypes/shaders.h
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2009, 2011 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/* This lists functions that are unique to GL 2.0 or GLES 2.0 and are
- * not in the old GLSL extensions */
-GST_GL_EXT_BEGIN (shaders_glsl_2_only,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 2, 0,
- 2, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (GLuint, CreateProgram,
- (void))
-GST_GL_EXT_FUNCTION (GLuint, CreateShader,
- (GLenum shaderType))
-GST_GL_EXT_FUNCTION (void, DeleteShader,
- (GLuint shader))
-GST_GL_EXT_FUNCTION (void, AttachShader,
- (GLuint program,
- GLuint shader))
-GST_GL_EXT_FUNCTION (void, UseProgram,
- (GLuint program))
-GST_GL_EXT_FUNCTION (void, DeleteProgram,
- (GLuint program))
-GST_GL_EXT_FUNCTION (void, GetShaderInfoLog,
- (GLuint shader,
- GLsizei maxLength,
- GLsizei *length,
- char *infoLog))
-GST_GL_EXT_FUNCTION (void, GetProgramInfoLog,
- (GLuint program,
- GLsizei bufSize,
- GLsizei *length,
- char *infoLog))
-GST_GL_EXT_FUNCTION (void, GetShaderiv,
- (GLuint shader,
- GLenum pname,
- GLint *params))
-GST_GL_EXT_FUNCTION (void, GetProgramiv,
- (GLuint program,
- GLenum pname,
- GLint *params))
-GST_GL_EXT_FUNCTION (void, DetachShader,
- (GLuint program, GLuint shader))
-GST_GL_EXT_FUNCTION (void, GetAttachedShaders,
- (GLuint program,
- GLsizei maxcount,
- GLsizei* count,
- GLuint* shaders))
-GST_GL_EXT_FUNCTION (GLboolean, IsShader,
- (GLuint shader))
-GST_GL_EXT_FUNCTION (GLboolean, IsProgram,
- (GLuint program))
-GST_GL_EXT_END ()
-
-/* These functions are provided by GL_ARB_shader_objects or are in GL
- * 2.0 core */
-GST_GL_EXT_BEGIN (shader_objects_or_gl2,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 2, 0,
- 2, 0,
- "ARB\0",
- "shader_objects\0")
-GST_GL_EXT_FUNCTION (void, ShaderSource,
- (GLuint shader,
- GLsizei count,
- const char **string,
- const GLint *length))
-GST_GL_EXT_FUNCTION (void, CompileShader,
- (GLuint shader))
-GST_GL_EXT_FUNCTION (void, LinkProgram,
- (GLuint program))
-GST_GL_EXT_FUNCTION (GLint, GetUniformLocation,
- (GLuint program,
- const char *name))
-GST_GL_EXT_FUNCTION (void, Uniform1f,
- (GLint location,
- GLfloat v0))
-GST_GL_EXT_FUNCTION (void, Uniform2f,
- (GLint location,
- GLfloat v0,
- GLfloat v1))
-GST_GL_EXT_FUNCTION (void, Uniform3f,
- (GLint location,
- GLfloat v0,
- GLfloat v1,
- GLfloat v2))
-GST_GL_EXT_FUNCTION (void, Uniform4f,
- (GLint location,
- GLfloat v0,
- GLfloat v1,
- GLfloat v2,
- GLfloat v3))
-GST_GL_EXT_FUNCTION (void, Uniform1fv,
- (GLint location,
- GLsizei count,
- const GLfloat * value))
-GST_GL_EXT_FUNCTION (void, Uniform2fv,
- (GLint location,
- GLsizei count,
- const GLfloat * value))
-GST_GL_EXT_FUNCTION (void, Uniform3fv,
- (GLint location,
- GLsizei count,
- const GLfloat * value))
-GST_GL_EXT_FUNCTION (void, Uniform4fv,
- (GLint location,
- GLsizei count,
- const GLfloat * value))
-GST_GL_EXT_FUNCTION (void, Uniform1i,
- (GLint location,
- GLint v0))
-GST_GL_EXT_FUNCTION (void, Uniform2i,
- (GLint location,
- GLint v0,
- GLint v1))
-GST_GL_EXT_FUNCTION (void, Uniform3i,
- (GLint location,
- GLint v0,
- GLint v1,
- GLint v2))
-GST_GL_EXT_FUNCTION (void, Uniform4i,
- (GLint location,
- GLint v0,
- GLint v1,
- GLint v2,
- GLint v3))
-GST_GL_EXT_FUNCTION (void, Uniform1iv,
- (GLint location,
- GLsizei count,
- const GLint * value))
-GST_GL_EXT_FUNCTION (void, Uniform2iv,
- (GLint location,
- GLsizei count,
- const GLint * value))
-GST_GL_EXT_FUNCTION (void, Uniform3iv,
- (GLint location,
- GLsizei count,
- const GLint * value))
-GST_GL_EXT_FUNCTION (void, Uniform4iv,
- (GLint location,
- GLsizei count,
- const GLint * value))
-GST_GL_EXT_FUNCTION (void, UniformMatrix2fv,
- (GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value))
-GST_GL_EXT_FUNCTION (void, UniformMatrix3fv,
- (GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value))
-GST_GL_EXT_FUNCTION (void, UniformMatrix4fv,
- (GLint location,
- GLsizei count,
- GLboolean transpose,
- const GLfloat *value))
-
-GST_GL_EXT_FUNCTION (void, GetUniformfv,
- (GLuint program,
- GLint location,
- GLfloat *params))
-GST_GL_EXT_FUNCTION (void, GetUniformiv,
- (GLuint program,
- GLint location,
- GLint *params))
-GST_GL_EXT_FUNCTION (void, GetActiveUniform,
- (GLuint program,
- GLuint index,
- GLsizei bufsize,
- GLsizei* length,
- GLint* size,
- GLenum* type,
- GLchar* name))
-GST_GL_EXT_FUNCTION (void, GetShaderSource,
- (GLuint shader,
- GLsizei bufsize,
- GLsizei* length,
- GLchar* source))
-GST_GL_EXT_FUNCTION (void, ValidateProgram, (GLuint program))
-GST_GL_EXT_END ()
-
-/* These functions are provided by GL_ARB_vertex_shader or are in GL
- * 2.0 core */
-GST_GL_EXT_BEGIN (vertex_shaders,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 2, 0,
- 2, 0,
- "ARB\0",
- "vertex_shader\0")
-GST_GL_EXT_FUNCTION (void, VertexAttribPointer,
- (GLuint index,
- GLint size,
- GLenum type,
- GLboolean normalized,
- GLsizei stride,
- const GLvoid *pointer))
-GST_GL_EXT_FUNCTION (void, EnableVertexAttribArray,
- (GLuint index))
-GST_GL_EXT_FUNCTION (void, DisableVertexAttribArray,
- (GLuint index))
-GST_GL_EXT_FUNCTION (void, VertexAttrib1f, (GLuint indx, GLfloat x))
-GST_GL_EXT_FUNCTION (void, VertexAttrib1fv,
- (GLuint indx, const GLfloat* values))
-GST_GL_EXT_FUNCTION (void, VertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y))
-GST_GL_EXT_FUNCTION (void, VertexAttrib2fv,
- (GLuint indx, const GLfloat* values))
-GST_GL_EXT_FUNCTION (void, VertexAttrib3f,
- (GLuint indx, GLfloat x, GLfloat y, GLfloat z))
-GST_GL_EXT_FUNCTION (void, VertexAttrib3fv,
- (GLuint indx, const GLfloat* values))
-GST_GL_EXT_FUNCTION (void, VertexAttrib4f,
- (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w))
-GST_GL_EXT_FUNCTION (void, VertexAttrib4fv,
- (GLuint indx, const GLfloat* values))
-GST_GL_EXT_FUNCTION (void, GetVertexAttribfv,
- (GLuint index, GLenum pname, GLfloat* params))
-GST_GL_EXT_FUNCTION (void, GetVertexAttribiv,
- (GLuint index, GLenum pname, GLint* params))
-GST_GL_EXT_FUNCTION (void, GetVertexAttribPointerv,
- (GLuint index, GLenum pname, GLvoid** pointer))
-GST_GL_EXT_FUNCTION (GLint, GetAttribLocation,
- (GLuint program, const char *name))
-GST_GL_EXT_FUNCTION (void, BindAttribLocation,
- (GLuint program,
- GLuint index,
- const GLchar* name))
-GST_GL_EXT_FUNCTION (void, GetActiveAttrib,
- (GLuint program,
- GLuint index,
- GLsizei bufsize,
- GLsizei* length,
- GLint* size,
- GLenum* type,
- GLchar* name))
-GST_GL_EXT_END ()
-
-/* These only list functions that come from the old GLSL extensions.
- * Functions that are common to the extensions and GLSL 2.0 should
- * instead be listed in cogl-glsl-functions.h */
-GST_GL_EXT_BEGIN (shader_objects,
- GST_GL_API_NONE,
- 255, 255,
- 255, 255, /* not in either GLES */
- "ARB\0",
- "shader_objects\0")
-GST_GL_EXT_FUNCTION (GLuint, CreateProgramObject,
- (void))
-GST_GL_EXT_FUNCTION (GLuint, CreateShaderObject,
- (GLenum shaderType))
-GST_GL_EXT_FUNCTION (void, DeleteObject,
- (GLuint obj))
-GST_GL_EXT_FUNCTION (void, AttachObject,
- (GLuint container, GLuint obj))
-GST_GL_EXT_FUNCTION (void, UseProgramObject,
- (GLuint programObj))
-GST_GL_EXT_FUNCTION (void, GetInfoLog,
- (GLuint obj,
- GLsizei maxLength,
- GLsizei *length,
- char *infoLog))
-GST_GL_EXT_FUNCTION (void, GetObjectParameteriv,
- (GLuint obj,
- GLenum pname,
- GLint *params))
-GST_GL_EXT_FUNCTION (void, DetachObject,
- (GLuint container, GLuint obj))
-GST_GL_EXT_FUNCTION (void, GetAttachedObjects,
- (GLuint program,
- GLsizei maxcount,
- GLsizei* count,
- GLuint* shaders))
-GST_GL_EXT_END ()
-
-/* ARB_fragment_program */
-GST_GL_EXT_BEGIN (arbfp,
- GST_GL_API_NONE,
- 255, 255,
- 255, 255, /* not in either GLES */
- "ARB\0",
- "fragment_program\0")
-GST_GL_EXT_FUNCTION (void, GenPrograms,
- (GLsizei n,
- GLuint *programs))
-GST_GL_EXT_FUNCTION (void, DeletePrograms,
- (GLsizei n,
- GLuint *programs))
-GST_GL_EXT_FUNCTION (void, BindProgram,
- (GLenum target,
- GLuint program))
-GST_GL_EXT_FUNCTION (void, ProgramString,
- (GLenum target,
- GLenum format,
- GLsizei len,
- const void *program))
-GST_GL_EXT_FUNCTION (void, ProgramLocalParameter4fv,
- (GLenum target,
- GLuint index,
- GLfloat *params))
-GST_GL_EXT_END ()
-
-/* This lists functions that are unique to GL 2.1 or GLES 3.0 and are
- * not in the old GLSL extensions */
-GST_GL_EXT_BEGIN (shaders_2_1,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
- GST_GL_API_GLES2,
- 2, 1,
- 3, 0,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, UniformMatrix2x3fv,
- (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
-GST_GL_EXT_FUNCTION (void, UniformMatrix3x2fv,
- (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
-GST_GL_EXT_FUNCTION (void, UniformMatrix2x4fv,
- (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
-GST_GL_EXT_FUNCTION (void, UniformMatrix4x2fv,
- (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
-GST_GL_EXT_FUNCTION (void, UniformMatrix3x4fv,
- (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
-GST_GL_EXT_FUNCTION (void, UniformMatrix4x3fv,
- (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
-GST_GL_EXT_END ()
-
-GST_GL_EXT_BEGIN (bind_frag_data,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
- 3, 0,
- 255, 255,
- "\0",
- "\0")
-GST_GL_EXT_FUNCTION (void, BindFragDataLocation,
- (GLuint program, GLuint index, const GLchar * name))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/sync.h b/gst-libs/gst/gl/glprototypes/sync.h
deleted file mode 100644
index 30c60e44c..000000000
--- a/gst-libs/gst/gl/glprototypes/sync.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014-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.
- */
-
-GST_GL_EXT_BEGIN (sync,
- GST_GL_API_OPENGL3 | GST_GL_API_GLES2,
- 3, 2,
- 3, 0,
- "APPLE\0",
- "sync\0")
-GST_GL_EXT_FUNCTION (GLsync, FenceSync,
- (GLenum condition,
- GLbitfield flags))
-GST_GL_EXT_FUNCTION (GLboolean, IsSync,
- (GLsync sync))
-GST_GL_EXT_FUNCTION (void, DeleteSync,
- (GLsync sync))
-GST_GL_EXT_FUNCTION (GLenum, ClientWaitSync,
- (GLsync sync,
- GLbitfield flags,
- GLuint64 timeout))
-GST_GL_EXT_FUNCTION (void, WaitSync,
- (GLsync sync,
- GLbitfield flags,
- GLuint64 timeout))
-GST_GL_EXT_FUNCTION (void, GetSynciv,
- (GLsync sync,
- GLenum flags,
- GLuint64 timeout))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/glprototypes/vao.h b/gst-libs/gst/gl/glprototypes/vao.h
deleted file mode 100644
index 32d11599f..000000000
--- a/gst-libs/gst/gl/glprototypes/vao.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 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.
- */
-
-GST_GL_EXT_BEGIN (vao,
- GST_GL_API_OPENGL3 | GST_GL_API_GLES2,
- 3, 0,
- 3, 0,
- "ARB:\0OES\0",
- "vertex_array_object\0")
-GST_GL_EXT_FUNCTION (void, GenVertexArrays,
- (GLsizei n,
- GLuint *arrays))
-GST_GL_EXT_FUNCTION (void, DeleteVertexArrays,
- (GLsizei n,
- GLuint *arrays))
-GST_GL_EXT_FUNCTION (void, BindVertexArray,
- (GLuint array))
-GST_GL_EXT_FUNCTION (GLboolean, IsVertexArray,
- (GLuint array))
-GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/gstgl_enums.h b/gst-libs/gst/gl/gstgl_enums.h
deleted file mode 100644
index 25c7b39ac..000000000
--- a/gst-libs/gst/gl/gstgl_enums.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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_ENUMS_H_
-#define _GST_GL_ENUMS_H_
-
-/**
- * GstGLTextureTarget:
- * @GST_GL_TEXTURE_TARGET_NONE: no texture target
- * @GST_GL_TEXTURE_TARGET_2D: 2D texture target
- * @GST_GL_TEXTURE_TARGET_RECTANGLE: rectangle texture target
- * @GST_GL_TEXTURE_TARGET_EXTERNAL_OES: external oes texture target
- *
- * Since: 1.8
- */
-typedef enum
-{
- GST_GL_TEXTURE_TARGET_NONE,
- GST_GL_TEXTURE_TARGET_2D,
- GST_GL_TEXTURE_TARGET_RECTANGLE,
- GST_GL_TEXTURE_TARGET_EXTERNAL_OES,
-} GstGLTextureTarget;
-
-#endif /* _GST_GL_ENUMS_H_ */
diff --git a/gst-libs/gst/gl/gstgl_fwd.h b/gst-libs/gst/gl/gstgl_fwd.h
deleted file mode 100644
index 19ca6f358..000000000
--- a/gst-libs/gst/gl/gstgl_fwd.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Julien Isorce <julien.isorce@gmail.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_FWD_H__
-#define __GST_GL_FWD_H__
-
-#include <gst/gst.h>
-
-#include <gst/gl/gstglapi.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GstGLDisplay GstGLDisplay;
-typedef struct _GstGLDisplayClass GstGLDisplayClass;
-typedef struct _GstGLDisplayPrivate GstGLDisplayPrivate;
-
-typedef struct _GstGLContext GstGLContext;
-typedef struct _GstGLContextClass GstGLContextClass;
-typedef struct _GstGLContextPrivate GstGLContextPrivate;
-
-typedef struct _GstGLWindow GstGLWindow;
-typedef struct _GstGLWindowPrivate GstGLWindowPrivate;
-typedef struct _GstGLWindowClass GstGLWindowClass;
-
-typedef struct _GstGLBaseMemory GstGLBaseMemory;
-typedef struct _GstGLBaseMemoryAllocator GstGLBaseMemoryAllocator;
-typedef struct _GstGLBaseMemoryAllocatorClass GstGLBaseMemoryAllocatorClass;
-
-typedef struct _GstGLBuffer GstGLBuffer;
-typedef struct _GstGLBufferAllocator GstGLBufferAllocator;
-typedef struct _GstGLBufferAllocatorClass GstGLBufferAllocatorClass;
-
-typedef struct _GstGLMemory GstGLMemory;
-typedef struct _GstGLMemoryAllocator GstGLMemoryAllocator;
-typedef struct _GstGLMemoryAllocatorClass GstGLMemoryAllocatorClass;
-
-typedef struct _GstGLMemoryPBO GstGLMemoryPBO;
-typedef struct _GstGLMemoryPBOAllocator GstGLMemoryPBOAllocator;
-typedef struct _GstGLMemoryPBOAllocatorClass GstGLMemoryPBOAllocatorClass;
-
-typedef struct _GstGLMemoryEGL GstGLMemoryEGL;
-typedef struct _GstGLMemoryEGLAllocator GstGLMemoryEGLAllocator;
-typedef struct _GstGLMemoryEGLAllocatorClass GstGLMemoryEGLAllocatorClass;
-
-typedef struct _GstGLRenderbuffer GstGLRenderbuffer;
-typedef struct _GstGLRenderbufferAllocator GstGLRenderbufferAllocator;
-typedef struct _GstGLRenderbufferAllocatorClass GstGLRenderbufferAllocatorClass;
-
-typedef struct _GstGLFramebuffer GstGLFramebuffer;
-typedef struct _GstGLFramebufferClass GstGLFramebufferClass;
-
-typedef struct _GstGLSLStage GstGLSLStage;
-typedef struct _GstGLSLStagePrivate GstGLSLStagePrivate;
-typedef struct _GstGLSLStageClass GstGLSLStageClass;
-
-typedef struct _GstGLShader GstGLShader;
-typedef struct _GstGLShaderPrivate GstGLShaderPrivate;
-typedef struct _GstGLShaderClass GstGLShaderClass;
-
-typedef struct _GstGLUpload GstGLUpload;
-typedef struct _GstGLUploadClass GstGLUploadClass;
-typedef struct _GstGLUploadPrivate GstGLUploadPrivate;
-
-typedef struct _GstGLBufferPool GstGLBufferPool;
-typedef struct _GstGLBufferPoolClass GstGLBufferPoolClass;
-typedef struct _GstGLBufferPoolPrivate GstGLBufferPoolPrivate;
-
-typedef struct _GstGLColorConvert GstGLColorConvert;
-typedef struct _GstGLColorConvertClass GstGLColorConvertClass;
-typedef struct _GstGLColorConvertPrivate GstGLColorConvertPrivate;
-
-typedef struct _GstGLBaseFilter GstGLBaseFilter;
-typedef struct _GstGLBaseFilterClass GstGLBaseFilterClass;
-typedef struct _GstGLBaseFilterPrivate GstGLBaseFilterPrivate;
-
-typedef struct _GstGLFilter GstGLFilter;
-typedef struct _GstGLFilterClass GstGLFilterClass;
-
-typedef struct _GstGLViewConvert GstGLViewConvert;
-typedef struct _GstGLViewConvertClass GstGLViewConvertClass;
-typedef struct _GstGLViewConvertPrivate GstGLViewConvertPrivate;
-
-typedef struct _GstGLOverlayCompositor GstGLOverlayCompositor;
-typedef struct _GstGLOverlayCompositorClass GstGLOverlayCompositorClass;
-
-typedef struct _GstGLQuery GstGLQuery;
-
-typedef struct _GstGLFuncs GstGLFuncs;
-
-typedef struct _GstGLAsyncDebug GstGLAsyncDebug;
-
-#include <gst/gl/gstgl_enums.h>
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLBaseFilter, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLBaseMemoryAllocator, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLBufferAllocator, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLBufferPool, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLColorConvert, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLContext, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLDisplay, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLFilter, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLMemoryAllocator, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLMemoryPBOAllocator, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLOverlayCompositor, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLSLStage, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLShader, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLUpload, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLViewConvert, gst_object_unref)
-#endif
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLWindow, gst_object_unref)
-#endif
-
-G_END_DECLS
-
-#endif /* __GST_GL_FWD_H__ */
diff --git a/gst-libs/gst/gl/gstglapi.c b/gst-libs/gst/gl/gstglapi.c
deleted file mode 100644
index 6960a5545..000000000
--- a/gst-libs/gst/gl/gstglapi.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-/**
- * SECTION:gstglapi
- * @title: GstGLAPI
- * @short_description: OpenGL API specific functionality
- * @see_also: #GstGLDisplay, #GstGLContext
- *
- * Provides some helper API for dealing with OpenGL API's and platforms
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstglapi.h"
-
-/**
- * gst_gl_api_to_string:
- * @api: a #GstGLAPI to stringify
- *
- * Returns: A space seperated string of the OpenGL api's enabled in @api
- */
-gchar *
-gst_gl_api_to_string (GstGLAPI api)
-{
- GString *str = NULL;
- gchar *ret;
-
- if (api == GST_GL_API_NONE) {
- str = g_string_new ("none");
- goto out;
- } else if (api == GST_GL_API_ANY) {
- str = g_string_new ("any");
- goto out;
- }
-
- if (api & GST_GL_API_OPENGL) {
- str = g_string_new (GST_GL_API_OPENGL_NAME);
- }
- if (api & GST_GL_API_OPENGL3) {
- if (str) {
- g_string_append (str, " " GST_GL_API_OPENGL3_NAME);
- } else {
- str = g_string_new (GST_GL_API_OPENGL3_NAME);
- }
- }
- if (api & GST_GL_API_GLES1) {
- if (str) {
- g_string_append (str, " " GST_GL_API_GLES1_NAME);
- } else {
- str = g_string_new (GST_GL_API_GLES1_NAME);
- }
- }
- if (api & GST_GL_API_GLES2) {
- if (str) {
- g_string_append (str, " " GST_GL_API_GLES2_NAME);
- } else {
- str = g_string_new (GST_GL_API_GLES2_NAME);
- }
- }
-
-out:
- if (!str)
- str = g_string_new ("unknown");
-
- ret = g_string_free (str, FALSE);
- return ret;
-}
-
-/**
- * gst_gl_api_from_string:
- * @api_s: a space seperated string of OpenGL apis
- *
- * Returns: The #GstGLAPI represented by @api_s
- */
-GstGLAPI
-gst_gl_api_from_string (const gchar * apis_s)
-{
- GstGLAPI ret = GST_GL_API_NONE;
- gchar *apis = (gchar *) apis_s;
-
- if (!apis || apis[0] == '\0') {
- ret = GST_GL_API_ANY;
- } else {
- while (apis) {
- if (apis[0] == '\0') {
- break;
- } else if (apis[0] == ' ' || apis[0] == ',') {
- apis = &apis[1];
- } else if (g_strstr_len (apis, 7, GST_GL_API_OPENGL3_NAME)) {
- ret |= GST_GL_API_OPENGL3;
- apis = &apis[7];
- } else if (g_strstr_len (apis, 6, GST_GL_API_OPENGL_NAME)) {
- ret |= GST_GL_API_OPENGL;
- apis = &apis[6];
- } else if (g_strstr_len (apis, 5, GST_GL_API_GLES1_NAME)) {
- ret |= GST_GL_API_GLES1;
- apis = &apis[5];
- } else if (g_strstr_len (apis, 5, GST_GL_API_GLES2_NAME)) {
- ret |= GST_GL_API_GLES2;
- apis = &apis[5];
- } else {
- GST_ERROR ("Error parsing \'%s\'", apis);
- break;
- }
- }
- }
-
- return ret;
-}
-
-/**
- * gst_gl_platform_to_string:
- * @platform: a #GstGLPlatform to stringify
- *
- * Returns: A space seperated string of the OpenGL platforms enabled in @platform
- */
-gchar *
-gst_gl_platform_to_string (GstGLPlatform platform)
-{
- GString *str = NULL;
- gchar *ret;
-
- if (platform == GST_GL_PLATFORM_NONE) {
- str = g_string_new ("none");
- goto out;
- } else if (platform == GST_GL_PLATFORM_ANY) {
- str = g_string_new ("any");
- goto out;
- }
-
- str = g_string_new ("");
-
- if (platform & GST_GL_PLATFORM_GLX) {
- str = g_string_append (str, "glx ");
- }
- if (platform & GST_GL_PLATFORM_EGL) {
- str = g_string_append (str, "egl ");
- }
- if (platform & GST_GL_PLATFORM_WGL) {
- str = g_string_append (str, "wgl ");
- }
- if (platform & GST_GL_PLATFORM_CGL) {
- str = g_string_append (str, "cgl ");
- }
-
-out:
- if (!str)
- str = g_string_new ("unknown");
-
- ret = g_string_free (str, FALSE);
- return ret;
-}
-
-/**
- * gst_gl_platform_from_string:
- * @platform_s: a space seperated string of OpenGL platformss
- *
- * Returns: The #GstGLPlatform represented by @platform_s
- */
-GstGLPlatform
-gst_gl_platform_from_string (const gchar * platform_s)
-{
- GstGLPlatform ret = GST_GL_PLATFORM_NONE;
- gchar *platform = (gchar *) platform_s;
-
- if (!platform || platform[0] == '\0') {
- ret = GST_GL_PLATFORM_ANY;
- } else {
- while (platform) {
- if (platform[0] == '\0') {
- break;
- } else if (platform[0] == ' ' || platform[0] == ',') {
- platform = &platform[1];
- } else if (g_strstr_len (platform, 3, "glx")) {
- ret |= GST_GL_PLATFORM_GLX;
- platform = &platform[3];
- } else if (g_strstr_len (platform, 3, "egl")) {
- ret |= GST_GL_PLATFORM_EGL;
- platform = &platform[3];
- } else if (g_strstr_len (platform, 3, "wgl")) {
- ret |= GST_GL_PLATFORM_WGL;
- platform = &platform[3];
- } else if (g_strstr_len (platform, 3, "cgl")) {
- ret |= GST_GL_PLATFORM_CGL;
- platform = &platform[3];
- } else {
- GST_ERROR ("Error parsing \'%s\'", platform);
- break;
- }
- }
- }
-
- return ret;
-}
diff --git a/gst-libs/gst/gl/gstglapi.h b/gst-libs/gst/gl/gstglapi.h
deleted file mode 100644
index 1622d9095..000000000
--- a/gst-libs/gst/gl/gstglapi.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_API_H__
-#define __GST_GL_API_H__
-
-#include <gst/gl/gstglconfig.h>
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-/**
- * GstGLAPI:
- * @GST_GL_API_NONE: no API
- * @GST_GL_API_OPENGL: Desktop OpenGL up to and including 3.1. The
- * compatibility profile when the OpenGL version is >= 3.2
- * @GST_GL_API_OPENGL3: Desktop OpenGL >= 3.2 core profile
- * @GST_GL_API_GLES1: OpenGL ES 1.x
- * @GST_GL_API_GLES2: OpenGL ES 2.x and 3.x
- * @GST_GL_API_ANY: Any OpenGL API
- */
-typedef enum {
- GST_GL_API_NONE = 0,
- GST_GL_API_OPENGL = (1 << 0),
- GST_GL_API_OPENGL3 = (1 << 1),
- GST_GL_API_GLES1 = (1 << 15),
- GST_GL_API_GLES2 = (1 << 16),
-
- GST_GL_API_ANY = G_MAXUINT32
-} GstGLAPI;
-
-/**
- * GST_GL_API_OPENGL_NAME:
- *
- * The name for %GST_GL_API_OPENGL used in various places
- */
-#define GST_GL_API_OPENGL_NAME "opengl"
-
-/**
- * GST_GL_API_OPENGL3_NAME:
- *
- * The name for %GST_GL_API_OPENGL3 used in various places
- */
-#define GST_GL_API_OPENGL3_NAME "opengl3"
-
-/**
- * GST_GL_API_GLES1_NAME:
- *
- * The name for %GST_GL_API_GLES1 used in various places
- */
-#define GST_GL_API_GLES1_NAME "gles1"
-
-/**
- * GST_GL_API_GLES2_NAME:
- *
- * The name for %GST_GL_API_GLES2 used in various places
- */
-#define GST_GL_API_GLES2_NAME "gles2"
-
-/**
- * GstGLPlatform:
- * @GST_GL_PLATFORM_NONE: no platform
- * @GST_GL_PLATFORM_EGL: the EGL platform used primarily with the X11, wayland
- * and android window systems as well as on embedded Linux
- * @GST_GL_PLATFORM_GLX: the GLX platform used primarily with the X11 window system
- * @GST_GL_PLATFORM_WGL: the WGL platform used primarily on Windows
- * @GST_GL_PLATFORM_CGL: the CGL platform used primarily on OS X
- * @GST_GL_PLATFORM_EAGL: the EAGL platform used primarily on iOS
- * @GST_GL_PLATFORM_ANY: any OpenGL platform
- */
-typedef enum
-{
- GST_GL_PLATFORM_NONE = 0,
- GST_GL_PLATFORM_EGL = (1 << 0),
- GST_GL_PLATFORM_GLX = (1 << 1),
- GST_GL_PLATFORM_WGL = (1 << 2),
- GST_GL_PLATFORM_CGL = (1 << 3),
- GST_GL_PLATFORM_EAGL = (1 << 4),
-
- GST_GL_PLATFORM_ANY = G_MAXUINT32
-} GstGLPlatform;
-
-GST_EXPORT
-gchar * gst_gl_api_to_string (GstGLAPI api);
-GST_EXPORT
-GstGLAPI gst_gl_api_from_string (const gchar * api_s);
-
-GST_EXPORT
-gchar * gst_gl_platform_to_string (GstGLPlatform platform);
-GST_EXPORT
-GstGLPlatform gst_gl_platform_from_string (const gchar * platform_s);
-
-G_END_DECLS
-
-#endif /* __GST_GL_API_H__ */
diff --git a/gst-libs/gst/gl/gstglbasefilter.c b/gst-libs/gst/gl/gstglbasefilter.c
deleted file mode 100644
index 3c9eb9118..000000000
--- a/gst-libs/gst/gl/gstglbasefilter.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/video/gstvideometa.h>
-
-#include <gst/gl/gl.h>
-#include <gst/gl/gstglutils_private.h>
-
-/**
- * SECTION:gstglbasefilter
- * @short_description: #GstBaseTransform subclass for transforming OpenGL resources
- * @title: GstGLBaseFilter
- * @see_also: #GstBaseTransform
- *
- * #GstGLBaseFilter handles the nitty gritty details of retrieving an OpenGL
- * context. It also provided some wrappers around #GstBaseTransform's
- * start(), stop() and set_caps() virtual methods that ensure an OpenGL context
- * is available and current in the calling thread.
- */
-
-#define GST_CAT_DEFAULT gst_gl_base_filter_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-#define GST_GL_BASE_FILTER_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_BASE_FILTER, GstGLBaseFilterPrivate))
-
-struct _GstGLBaseFilterPrivate
-{
- GstGLContext *other_context;
-
- gboolean gl_result;
- gboolean gl_started;
-};
-
-/* Properties */
-enum
-{
- PROP_0,
- PROP_CONTEXT
-};
-
-#define gst_gl_base_filter_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstGLBaseFilter, gst_gl_base_filter,
- GST_TYPE_BASE_TRANSFORM, GST_DEBUG_CATEGORY_INIT (gst_gl_base_filter_debug,
- "glbasefilter", 0, "glbasefilter element"););
-
-static void gst_gl_base_filter_finalize (GObject * object);
-static void gst_gl_base_filter_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_gl_base_filter_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static void gst_gl_base_filter_set_context (GstElement * element,
- GstContext * context);
-static GstStateChangeReturn gst_gl_base_filter_change_state (GstElement *
- element, GstStateChange transition);
-static gboolean gst_gl_base_filter_query (GstBaseTransform * trans,
- GstPadDirection direction, GstQuery * query);
-static void gst_gl_base_filter_reset (GstGLBaseFilter * filter);
-static gboolean gst_gl_base_filter_start (GstBaseTransform * bt);
-static gboolean gst_gl_base_filter_stop (GstBaseTransform * bt);
-static gboolean gst_gl_base_filter_set_caps (GstBaseTransform * bt,
- GstCaps * incaps, GstCaps * outcaps);
-static gboolean gst_gl_base_filter_decide_allocation (GstBaseTransform * trans,
- GstQuery * query);
-
-/* GstGLContextThreadFunc */
-static void gst_gl_base_filter_gl_start (GstGLContext * context, gpointer data);
-static void gst_gl_base_filter_gl_stop (GstGLContext * context, gpointer data);
-
-static gboolean gst_gl_base_filter_default_gl_start (GstGLBaseFilter * filter);
-static void gst_gl_base_filter_default_gl_stop (GstGLBaseFilter * filter);
-
-static void
-gst_gl_base_filter_class_init (GstGLBaseFilterClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *element_class;
-
- g_type_class_add_private (klass, sizeof (GstGLBaseFilterPrivate));
-
- gobject_class = (GObjectClass *) klass;
- element_class = GST_ELEMENT_CLASS (klass);
-
- gobject_class->finalize = gst_gl_base_filter_finalize;
- gobject_class->set_property = gst_gl_base_filter_set_property;
- gobject_class->get_property = gst_gl_base_filter_get_property;
-
- GST_BASE_TRANSFORM_CLASS (klass)->query = gst_gl_base_filter_query;
- GST_BASE_TRANSFORM_CLASS (klass)->set_caps = gst_gl_base_filter_set_caps;
- GST_BASE_TRANSFORM_CLASS (klass)->start = gst_gl_base_filter_start;
- GST_BASE_TRANSFORM_CLASS (klass)->stop = gst_gl_base_filter_stop;
- GST_BASE_TRANSFORM_CLASS (klass)->decide_allocation =
- gst_gl_base_filter_decide_allocation;
-
- element_class->set_context = gst_gl_base_filter_set_context;
- element_class->change_state = gst_gl_base_filter_change_state;
-
- g_object_class_install_property (gobject_class, PROP_CONTEXT,
- g_param_spec_object ("context",
- "OpenGL context",
- "Get OpenGL context",
- GST_TYPE_GL_CONTEXT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- klass->supported_gl_api = GST_GL_API_ANY;
- klass->gl_start = gst_gl_base_filter_default_gl_start;
- klass->gl_stop = gst_gl_base_filter_default_gl_stop;
-}
-
-static void
-gst_gl_base_filter_init (GstGLBaseFilter * filter)
-{
- gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM (filter), TRUE);
-
- filter->priv = GST_GL_BASE_FILTER_GET_PRIVATE (filter);
-}
-
-static void
-gst_gl_base_filter_finalize (GObject * object)
-{
- GstGLBaseFilter *filter = GST_GL_BASE_FILTER (object);
-
- gst_caps_replace (&filter->in_caps, NULL);
- gst_caps_replace (&filter->out_caps, NULL);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_gl_base_filter_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gl_base_filter_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstGLBaseFilter *filter = GST_GL_BASE_FILTER (object);
-
- switch (prop_id) {
- case PROP_CONTEXT:
- g_value_set_object (value, filter->context);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gl_base_filter_set_context (GstElement * element, GstContext * context)
-{
- GstGLBaseFilter *filter = GST_GL_BASE_FILTER (element);
- GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
-
- gst_gl_handle_set_context (element, context, &filter->display,
- &filter->priv->other_context);
- if (filter->display)
- gst_gl_display_filter_gl_api (filter->display,
- filter_class->supported_gl_api);
-
- GST_ELEMENT_CLASS (parent_class)->set_context (element, context);
-}
-
-static gboolean
-_find_local_gl_context (GstGLBaseFilter * filter)
-{
- if (gst_gl_query_local_gl_context (GST_ELEMENT (filter), GST_PAD_SRC,
- &filter->context))
- return TRUE;
- if (gst_gl_query_local_gl_context (GST_ELEMENT (filter), GST_PAD_SINK,
- &filter->context))
- return TRUE;
- return FALSE;
-}
-
-static gboolean
-gst_gl_base_filter_query (GstBaseTransform * trans, GstPadDirection direction,
- GstQuery * query)
-{
- GstGLBaseFilter *filter = GST_GL_BASE_FILTER (trans);
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_ALLOCATION:
- {
- if (direction == GST_PAD_SINK
- && gst_base_transform_is_passthrough (trans)) {
- _find_local_gl_context (filter);
-
- return gst_pad_peer_query (GST_BASE_TRANSFORM_SRC_PAD (trans), query);
- }
- break;
- }
- case GST_QUERY_CONTEXT:
- {
- if (gst_gl_handle_context_query ((GstElement *) filter, query,
- filter->display, filter->context, filter->priv->other_context))
- return TRUE;
- break;
- }
- default:
- break;
- }
-
- return GST_BASE_TRANSFORM_CLASS (parent_class)->query (trans, direction,
- query);
-}
-
-static void
-gst_gl_base_filter_reset (GstGLBaseFilter * filter)
-{
- GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
-
- if (filter->context) {
- if (filter_class->gl_stop != NULL) {
- gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_stop,
- filter);
- }
-
- gst_object_unref (filter->context);
- filter->context = NULL;
- }
-}
-
-static gboolean
-gst_gl_base_filter_start (GstBaseTransform * bt)
-{
- return TRUE;
-}
-
-static gboolean
-gst_gl_base_filter_stop (GstBaseTransform * bt)
-{
- GstGLBaseFilter *filter = GST_GL_BASE_FILTER (bt);
-
- gst_gl_base_filter_reset (filter);
-
- return TRUE;
-}
-
-static gboolean
-gst_gl_base_filter_default_gl_start (GstGLBaseFilter * filter)
-{
- return TRUE;
-}
-
-static void
-gst_gl_base_filter_gl_start (GstGLContext * context, gpointer data)
-{
- GstGLBaseFilter *filter = GST_GL_BASE_FILTER (data);
- GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
-
- gst_gl_insert_debug_marker (filter->context,
- "starting element %s", GST_OBJECT_NAME (filter));
-
- filter->priv->gl_started = filter_class->gl_start (filter);
-}
-
-static void
-gst_gl_base_filter_default_gl_stop (GstGLBaseFilter * filter)
-{
-}
-
-static void
-gst_gl_base_filter_gl_stop (GstGLContext * context, gpointer data)
-{
- GstGLBaseFilter *filter = GST_GL_BASE_FILTER (data);
- GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
-
- gst_gl_insert_debug_marker (filter->context,
- "stopping element %s", GST_OBJECT_NAME (filter));
-
- if (filter->priv->gl_started)
- filter_class->gl_stop (filter);
-
- filter->priv->gl_started = FALSE;
-}
-
-static void
-_gl_set_caps (GstGLContext * context, GstGLBaseFilter * filter)
-{
- GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
-
- if (filter_class->gl_set_caps)
- filter->priv->gl_result =
- filter_class->gl_set_caps (filter, filter->in_caps, filter->out_caps);
-}
-
-static gboolean
-gst_gl_base_filter_decide_allocation (GstBaseTransform * trans,
- GstQuery * query)
-{
- GstGLBaseFilter *filter = GST_GL_BASE_FILTER (trans);
- GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
- GError *error = NULL;
- gboolean new_context = FALSE;
-
- if (!filter->context)
- new_context = TRUE;
-
- _find_local_gl_context (filter);
-
- if (!filter->context) {
- GST_OBJECT_LOCK (filter->display);
- do {
- if (filter->context)
- gst_object_unref (filter->context);
- /* just get a GL context. we don't care */
- filter->context =
- gst_gl_display_get_gl_context_for_thread (filter->display, NULL);
- if (!filter->context) {
- if (!gst_gl_display_create_context (filter->display,
- filter->priv->other_context, &filter->context, &error)) {
- GST_OBJECT_UNLOCK (filter->display);
- goto context_error;
- }
- }
- } while (!gst_gl_display_add_context (filter->display, filter->context));
- GST_OBJECT_UNLOCK (filter->display);
- }
-
- if (new_context || !filter->priv->gl_started) {
- if (filter->priv->gl_started)
- gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_stop,
- filter);
-
- {
- GstGLAPI current_gl_api = gst_gl_context_get_gl_api (filter->context);
- if ((current_gl_api & filter_class->supported_gl_api) == 0)
- goto unsupported_gl_api;
- }
-
- gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_start,
- filter);
-
- if (!filter->priv->gl_started)
- goto error;
- }
-
- if (filter_class->gl_set_caps) {
- gst_gl_context_thread_add (filter->context,
- (GstGLContextThreadFunc) _gl_set_caps, filter);
- if (!filter->priv->gl_result)
- goto error;
- }
-
- return GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans,
- query);
-
-
-unsupported_gl_api:
- {
- GstGLAPI gl_api = gst_gl_context_get_gl_api (filter->context);
- gchar *gl_api_str = gst_gl_api_to_string (gl_api);
- gchar *supported_gl_api_str =
- gst_gl_api_to_string (filter_class->supported_gl_api);
- GST_ELEMENT_ERROR (filter, RESOURCE, BUSY,
- ("GL API's not compatible context: %s supported: %s", gl_api_str,
- supported_gl_api_str), (NULL));
-
- g_free (supported_gl_api_str);
- g_free (gl_api_str);
- return FALSE;
- }
-context_error:
- {
- GST_ELEMENT_ERROR (trans, RESOURCE, NOT_FOUND, ("%s", error->message),
- (NULL));
- g_clear_error (&error);
- return FALSE;
- }
-error:
- {
- GST_ELEMENT_ERROR (trans, LIBRARY, INIT,
- ("Subclass failed to initialize."), (NULL));
- return FALSE;
- }
-}
-
-static gboolean
-gst_gl_base_filter_set_caps (GstBaseTransform * bt, GstCaps * incaps,
- GstCaps * outcaps)
-{
- GstGLBaseFilter *filter = GST_GL_BASE_FILTER (bt);
-
- gst_caps_replace (&filter->in_caps, incaps);
- gst_caps_replace (&filter->out_caps, outcaps);
-
- return TRUE;
-}
-
-static GstStateChangeReturn
-gst_gl_base_filter_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstGLBaseFilter *filter = GST_GL_BASE_FILTER (element);
- GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter);
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
-
- GST_DEBUG_OBJECT (filter, "changing state: %s => %s",
- gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
- gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (!gst_gl_ensure_element_data (element, &filter->display,
- &filter->priv->other_context))
- return GST_STATE_CHANGE_FAILURE;
-
- gst_gl_display_filter_gl_api (filter->display,
- filter_class->supported_gl_api);
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_NULL:
- if (filter->priv->other_context) {
- gst_object_unref (filter->priv->other_context);
- filter->priv->other_context = NULL;
- }
-
- if (filter->display) {
- gst_object_unref (filter->display);
- filter->display = NULL;
- }
- break;
- default:
- break;
- }
-
- return ret;
-}
diff --git a/gst-libs/gst/gl/gstglbasefilter.h b/gst-libs/gst/gl/gstglbasefilter.h
deleted file mode 100644
index fa4958d89..000000000
--- a/gst-libs/gst/gl/gstglbasefilter.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2007 David Schleef <ds@schleef.org>
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.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_BASE_FILTER_H_
-#define _GST_GL_BASE_FILTER_H_
-
-#include <gst/base/gstbasetransform.h>
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_base_filter_get_type(void);
-#define GST_TYPE_GL_BASE_FILTER (gst_gl_base_filter_get_type())
-#define GST_GL_BASE_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_BASE_FILTER,GstGLBaseFilter))
-#define GST_IS_GL_BASE_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_BASE_FILTER))
-#define GST_GL_BASE_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_BASE_FILTER,GstGLBaseFilterClass))
-#define GST_IS_GL_BASE_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_BASE_FILTER))
-#define GST_GL_BASE_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_BASE_FILTER,GstGLBaseFilterClass))
-
-/**
- * GstGLBaseFilter:
- * @parent: parent #GstBaseTransform
- * @display: the currently configured #GstGLDisplay
- * @context: the currently configured #GstGLContext
- * @in_caps: the currently configured input #GstCaps
- * @out_caps: the currently configured output #GstCaps
- */
-struct _GstGLBaseFilter
-{
- GstBaseTransform parent;
-
- GstGLDisplay *display;
- GstGLContext *context;
-
- GstCaps *in_caps;
- GstCaps *out_caps;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-
- GstGLBaseFilterPrivate *priv;
-};
-
-/**
- * GstGLBaseFilterClass:
- * @parent_class: parent class
- * @supported_gl_api: the logical-OR of #GstGLAPI's supported by this element
- * @gl_start: called in the GL thread to setup the element GL state.
- * @gl_stop: called in the GL thread to setup the element GL state.
- * @gl_set_caps: called in the GL thread when caps are set on @filter.
- */
-struct _GstGLBaseFilterClass
-{
- GstBaseTransformClass parent_class;
- GstGLAPI supported_gl_api;
-
- gboolean (*gl_start) (GstGLBaseFilter *filter);
- void (*gl_stop) (GstGLBaseFilter *filter);
- gboolean (*gl_set_caps) (GstGLBaseFilter *filter, GstCaps * incaps, GstCaps * outcaps);
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-G_END_DECLS
-
-#endif /* _GST_GL_BASE_FILTER_H_ */
diff --git a/gst-libs/gst/gl/gstglbasememory.c b/gst-libs/gst/gl/gstglbasememory.c
deleted file mode 100644
index 4bebedc37..000000000
--- a/gst-libs/gst/gl/gstglbasememory.c
+++ /dev/null
@@ -1,759 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstglbasememory.h"
-
-#include "gstglcontext.h"
-#include "gstglquery.h"
-
-/**
- * SECTION:gstglbasememory
- * @title: GstGLBaseMemory
- * @short_description: memory subclass for GL buffers
- * @see_also: #GstMemory, #GstAllocator
- *
- * GstGLBaseMemory is a #GstMemory subclass providing the basis of support
- * for the mapping of GL buffers.
- *
- * Data is uploaded or downloaded from the GPU as is necessary.
- */
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_BASE_MEMORY);
-#define GST_CAT_DEFUALT GST_CAT_GL_BASE_MEMORY
-
-GST_DEFINE_MINI_OBJECT_TYPE (GstGLBaseMemory, gst_gl_base_memory);
-
-GQuark
-gst_gl_base_memory_error_quark (void)
-{
- return g_quark_from_static_string ("gst-gl-base-buffer-error-quark");
-}
-
-static gboolean
-_default_create (GstGLBaseMemory * mem, GError ** error)
-{
- g_set_error (error, GST_GL_BASE_MEMORY_ERROR, GST_GL_BASE_MEMORY_ERROR_FAILED,
- "subclass should define create() vfunc");
-
- g_critical ("subclass should override "
- "GstGLBaseMemoryAllocatorClass::create() function");
-
- return FALSE;
-}
-
-struct create_data
-{
- GstGLBaseMemory *mem;
- gboolean result;
-};
-
-static void
-_mem_create_gl (GstGLContext * context, struct create_data *transfer)
-{
- GstGLBaseMemoryAllocatorClass *alloc_class;
- GError *error = NULL;
-
- GST_CAT_TRACE (GST_CAT_GL_BASE_MEMORY, "Create memory %p", transfer->mem);
-
- alloc_class =
- GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS (transfer->mem->mem.allocator);
-
- g_return_if_fail (alloc_class->create != NULL);
-
- transfer->mem->query = gst_gl_query_new (context, GST_GL_QUERY_TIME_ELAPSED);
-
- if ((transfer->result = alloc_class->create (transfer->mem, &error)))
- return;
-
- g_assert (error != NULL);
-
- GST_CAT_ERROR (GST_CAT_GL_BASE_MEMORY, "Failed to create GL buffer: %s",
- error->message);
- g_clear_error (&error);
-}
-
-/**
- * gst_gl_base_memory_init:
- * @mem: the #GstGLBaseMemory to initialize
- * @allocator: the #GstAllocator to initialize with
- * @parent: (allow-none): the parent #GstMemory to initialize with
- * @context: the #GstGLContext to initialize with
- * @params: (allow-none): the @GstAllocationParams to initialize with
- * @size: the number of bytes to be allocated
- * @user_data: (allow-none): user data to call @notify with
- * @notify: (allow-none): a #GDestroyNotify
- *
- * Initializes @mem with the required parameters
- *
- * Since: 1.8
- */
-void
-gst_gl_base_memory_init (GstGLBaseMemory * mem, GstAllocator * allocator,
- GstMemory * parent, GstGLContext * context, GstAllocationParams * params,
- gsize size, gpointer user_data, GDestroyNotify notify)
-{
- gsize align = gst_memory_alignment, offset = 0, maxsize;
- GstMemoryFlags flags = 0;
- struct create_data data;
-
- /* A note on sizes.
- * gl_mem->alloc_size: the size to allocate when we control the allocation.
- * Size of the unaligned allocation.
- * mem->maxsize: the size that is used by GstMemory for mapping, to map the
- * entire memory. The size of the aligned allocation
- * mem->size: represents the size of the valid data. Can be reduced with
- * gst_memory_resize()
- *
- * It holds that:
- * mem->size + mem->offset <= mem->maxsize
- * and
- * mem->maxsize + alignment offset <= gl_mem->alloc_size
- *
- * We need to add the alignment mask to the allocated size in order to have
- * the freedom to align the gl_mem->data pointer correctly which may be offset
- * by at most align bytes in the alloc_data pointer.
- *
- * maxsize is not suitable for this as it is used by GstMemory as the size
- * to map with.
- */
- mem->alloc_size = maxsize = size;
- if (params) {
- flags = params->flags;
- align |= params->align;
- offset = params->prefix;
- maxsize += params->prefix + params->padding;
-
- /* deals with any alignment */
- mem->alloc_size = maxsize + align;
- }
-
- gst_memory_init (GST_MEMORY_CAST (mem), flags, allocator, parent, maxsize,
- align, offset, size);
-
- mem->context = gst_object_ref (context);
- mem->notify = notify;
- mem->user_data = user_data;
-
- g_mutex_init (&mem->lock);
-
- data.mem = mem;
-
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _mem_create_gl, &data);
- if (!data.result) {
- GST_CAT_ERROR (GST_CAT_GL_BASE_MEMORY,
- "Could not create GL buffer with context:%p", context);
- }
-
- GST_CAT_DEBUG (GST_CAT_GL_BASE_MEMORY, "new GL buffer memory:%p size:%"
- G_GSIZE_FORMAT, mem, maxsize);
-}
-
-static gpointer
-_align_data (gpointer data, gsize align)
-{
- guint8 *ret = data;
- gsize aoffset;
-
- /* do alignment, data must have enough padding at the end to move at most
- * align bytes */
- if ((aoffset = ((guintptr) ret & align))) {
- aoffset = (align + 1) - aoffset;
- ret += aoffset;
- }
-
- return ret;
-}
-
-/* subclass usage only */
-/**
- * gst_gl_base_memory_alloc_data:
- * @gl_mem: a #GstGLBaseMemory
- *
- * Note: only intended for subclass usage to allocate the sytem memory buffer
- * on demand. If there is already a non-NULL data pointer in @gl_mem->data,
- * then this function imply returns TRUE.
- *
- * Returns: whether the system memory could be allocated
- */
-gboolean
-gst_gl_base_memory_alloc_data (GstGLBaseMemory * gl_mem)
-{
- GstMemory *mem = (GstMemory *) gl_mem;
-
- if (gl_mem->data)
- return TRUE;
-
- GST_CAT_LOG (GST_CAT_GL_BASE_MEMORY, "%p attempting allocation of data "
- "pointer of size %" G_GSIZE_FORMAT, gl_mem, gl_mem->alloc_size);
- gl_mem->alloc_data = g_try_malloc (gl_mem->alloc_size);
-
- if (gl_mem->alloc_data == NULL)
- return FALSE;
-
- gl_mem->data = _align_data (gl_mem->alloc_data, mem->align);
-
- GST_CAT_DEBUG (GST_CAT_GL_BASE_MEMORY, "%p allocated data pointer alloc %p, "
- "data %p", gl_mem, gl_mem->alloc_data, gl_mem->data);
-
- return TRUE;
-}
-
-struct map_data
-{
- GstGLBaseMemory *mem;
- GstMapInfo *info;
- gsize size;
- gpointer data;
-};
-
-static void
-_map_data_gl (GstGLContext * context, struct map_data *transfer)
-{
- GstGLBaseMemoryAllocatorClass *alloc_class;
- GstGLBaseMemory *mem = transfer->mem;
- GstMapInfo *info = transfer->info;
- guint prev_map_flags;
- guint prev_gl_map_count;
-
- alloc_class =
- GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS (transfer->mem->mem.allocator);
-
- g_return_if_fail (alloc_class->map != NULL);
-
- g_mutex_lock (&mem->lock);
-
- prev_map_flags = mem->map_flags;
- prev_gl_map_count = mem->gl_map_count;
-
- GST_CAT_LOG (GST_CAT_GL_BASE_MEMORY, "mapping mem %p flags %04x", mem,
- info->flags);
-
- /* FIXME: validate map flags based on the memory domain */
- if (mem->map_count++ == 0)
- mem->map_flags = info->flags;
- else {
- /* assert that the flags are a subset of the first map flags */
- g_assert ((((GST_MAP_GL - 1) & info->flags) & mem->map_flags) != 0);
- GST_CAT_LOG (GST_CAT_GL_BASE_MEMORY, "multiple map no %d flags %04x "
- "all flags %04x", mem->map_count, info->flags, mem->map_flags);
- }
-
- if ((info->flags & GST_MAP_GL) != (mem->map_flags & GST_MAP_GL))
- mem->map_flags |= GST_MAP_GL;
-
- if (info->flags & GST_MAP_GL)
- mem->gl_map_count++;
-
- transfer->data = alloc_class->map (transfer->mem, transfer->info,
- transfer->size);
-
- if (transfer->data) {
- if (info->flags & GST_MAP_GL) {
- if (info->flags & GST_MAP_WRITE)
- GST_MINI_OBJECT_FLAG_SET (mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
- GST_MEMORY_FLAG_UNSET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);
- } else {
- if (info->flags & GST_MAP_WRITE)
- GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);
- GST_MEMORY_FLAG_UNSET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
- }
- } else {
- /* undo state tracking on error */
- mem->map_flags = prev_map_flags;
- mem->gl_map_count = prev_gl_map_count;
- mem->map_count--;
- }
-
- g_mutex_unlock (&mem->lock);
-}
-
-static gpointer
-_mem_map_full (GstGLBaseMemory * mem, GstMapInfo * info, gsize size)
-{
- struct map_data transfer;
-
- transfer.mem = mem;
- transfer.info = info;
- transfer.size = size;
- transfer.data = NULL;
-
- gst_gl_context_thread_add (mem->context,
- (GstGLContextThreadFunc) _map_data_gl, &transfer);
-
- return transfer.data;
-}
-
-struct unmap_data
-{
- GstGLBaseMemory *mem;
- GstMapInfo *info;
-};
-
-static void
-_unmap_data_gl (GstGLContext * context, struct unmap_data *transfer)
-{
- GstGLBaseMemoryAllocatorClass *alloc_class;
- GstGLBaseMemory *mem = transfer->mem;
- GstMapInfo *info = transfer->info;
-
- alloc_class =
- GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS (transfer->mem->mem.allocator);
-
- g_return_if_fail (alloc_class->unmap != NULL);
-
- g_mutex_lock (&mem->lock);
-
- GST_CAT_LOG (GST_CAT_GL_BASE_MEMORY, "unmapping mem %p flags %04x", mem,
- info->flags);
-
- alloc_class->unmap (transfer->mem, transfer->info);
-
- if (info->flags & GST_MAP_GL && --mem->gl_map_count)
- /* unset the gl flag */
- mem->map_flags &= ~GST_MAP_GL;
-
- if (--mem->map_count <= 0) {
- mem->map_flags = 0;
- }
-
- if (info->flags & GST_MAP_GL) {
- if (info->flags & GST_MAP_WRITE)
- GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
- } else {
- if (info->flags & GST_MAP_WRITE)
- GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);
- }
-
- g_mutex_unlock (&mem->lock);
-}
-
-static void
-_mem_unmap_full (GstGLBaseMemory * mem, GstMapInfo * info)
-{
- struct unmap_data transfer;
-
- transfer.mem = mem;
- transfer.info = info;
-
- gst_gl_context_thread_add (mem->context,
- (GstGLContextThreadFunc) _unmap_data_gl, &transfer);
-}
-
-static GstGLBaseMemory *
-_default_copy (GstGLBaseMemory * src, gssize offset, gssize size)
-{
- return NULL;
-}
-
-struct copy_params
-{
- GstGLBaseMemory *src;
- GstGLBaseMemory *dest;
- gssize offset;
- gssize size;
- gboolean result;
-};
-
-static void
-_mem_copy_gl (GstGLContext * context, struct copy_params *transfer)
-{
- GstGLBaseMemoryAllocatorClass *alloc_class;
-
- alloc_class =
- GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS (transfer->src->mem.allocator);
-
- g_return_if_fail (alloc_class->copy != NULL);
-
- transfer->dest =
- alloc_class->copy (transfer->src, transfer->offset, transfer->size);
-}
-
-static GstMemory *
-_mem_copy (GstGLBaseMemory * src, gssize offset, gssize size)
-{
- struct copy_params transfer;
-
- transfer.dest = NULL;
- transfer.src = src;
- transfer.offset = offset;
- transfer.size = size;
- if (size == -1 || size > 0)
- gst_gl_context_thread_add (src->context,
- (GstGLContextThreadFunc) _mem_copy_gl, &transfer);
-
- return (GstMemory *) transfer.dest;
-}
-
-static GstMemory *
-_mem_share (GstGLBaseMemory * mem, gssize offset, gssize size)
-{
- return NULL;
-}
-
-static gboolean
-_mem_is_span (GstGLBaseMemory * mem1, GstGLBaseMemory * mem2, gsize * offset)
-{
- return FALSE;
-}
-
-static GstMemory *
-_mem_alloc (GstAllocator * allocator, gsize size, GstAllocationParams * params)
-{
- g_critical ("Subclass should override GstAllocatorClass::alloc() function");
-
- return NULL;
-}
-
-static void
-_default_destroy (GstGLBaseMemory * mem)
-{
-}
-
-static void
-_destroy_gl_objects (GstGLContext * context, GstGLBaseMemory * mem)
-{
- GstGLBaseMemoryAllocatorClass *alloc_class;
-
- alloc_class = GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS (mem->mem.allocator);
-
- g_return_if_fail (alloc_class->destroy != NULL);
-
- alloc_class->destroy (mem);
-
- if (mem->query)
- gst_gl_query_free (mem->query);
-}
-
-static void
-_mem_free (GstAllocator * allocator, GstMemory * memory)
-{
- GstGLBaseMemory *mem = (GstGLBaseMemory *) memory;
-
- GST_CAT_TRACE (GST_CAT_GL_BASE_MEMORY, "freeing buffer memory:%p", mem);
-
- gst_gl_context_thread_add (mem->context,
- (GstGLContextThreadFunc) _destroy_gl_objects, mem);
-
- g_mutex_clear (&mem->lock);
-
- if (mem->alloc_data) {
- g_free (mem->alloc_data);
- mem->alloc_data = NULL;
- }
- mem->data = NULL;
-
- if (mem->notify)
- mem->notify (mem->user_data);
-
- gst_object_unref (mem->context);
-
- g_free (memory);
-}
-
-/**
- * gst_gl_base_memory_init_once:
- *
- * Initializes the GL Base Memory allocator. It is safe to call this function
- * multiple times. This must be called before any other GstGLBaseMemory operation.
- *
- * Since: 1.8
- */
-void
-gst_gl_base_memory_init_once (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_BASE_MEMORY, "glbasememory", 0,
- "OpenGL BaseMemory");
-
- g_once_init_leave (&_init, 1);
- }
-}
-
-G_DEFINE_ABSTRACT_TYPE (GstGLBaseMemoryAllocator, gst_gl_base_memory_allocator,
- GST_TYPE_ALLOCATOR);
-
-static void
-gst_gl_base_memory_allocator_class_init (GstGLBaseMemoryAllocatorClass * klass)
-{
- GstAllocatorClass *allocator_class = (GstAllocatorClass *) klass;
-
- allocator_class->alloc = _mem_alloc;
- allocator_class->free = _mem_free;
-
- klass->create = _default_create;
- klass->copy = _default_copy;
- klass->destroy = _default_destroy;
-}
-
-static void
-gst_gl_base_memory_allocator_init (GstGLBaseMemoryAllocator * allocator)
-{
- GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
-
- /* Keep the fallback copy function around, we will need it when copying with
- * at an offset or smaller size */
- allocator->fallback_mem_copy = alloc->mem_copy;
-
- alloc->mem_map_full = (GstMemoryMapFullFunction) _mem_map_full;
- alloc->mem_unmap_full = (GstMemoryUnmapFullFunction) _mem_unmap_full;
- alloc->mem_copy = (GstMemoryCopyFunction) _mem_copy;
- alloc->mem_share = (GstMemoryShareFunction) _mem_share;
- alloc->mem_is_span = (GstMemoryIsSpanFunction) _mem_is_span;
-}
-
-/**
- * gst_is_gl_base_memory:
- * @mem:a #GstMemory
- *
- * Returns: whether the memory at @mem is a #GstGLBaseMemory
- *
- * Since: 1.8
- */
-gboolean
-gst_is_gl_base_memory (GstMemory * mem)
-{
- return mem != NULL && mem->allocator != NULL &&
- g_type_is_a (G_OBJECT_TYPE (mem->allocator),
- GST_TYPE_GL_BASE_MEMORY_ALLOCATOR);
-}
-
-/**
- * gst_gl_base_memory_memcpy:
- * @src: the source #GstGLBaseMemory
- * @dest: the destination #GstGLBaseMemory
- * @offset: the offset to start at
- * @size: the number of bytes to copy
- *
- * Returns: whether the copy suceeded.
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_base_memory_memcpy (GstGLBaseMemory * src, GstGLBaseMemory * dest,
- gssize offset, gssize size)
-{
- GstMapInfo sinfo, dinfo;
-
- if (!gst_gl_base_memory_alloc_data (GST_GL_BASE_MEMORY_CAST (dest)))
- return FALSE;
-
- if (!gst_memory_map ((GstMemory *) src, &sinfo, GST_MAP_READ)) {
- GST_CAT_WARNING (GST_CAT_GL_BASE_MEMORY,
- "could not read map source memory %p", src);
- return FALSE;
- }
-
- if (!gst_memory_map ((GstMemory *) dest, &dinfo, GST_MAP_WRITE)) {
- GST_CAT_WARNING (GST_CAT_GL_BASE_MEMORY,
- "could not write map dest memory %p", dest);
- gst_memory_unmap ((GstMemory *) src, &sinfo);
- return FALSE;
- }
-
- if (size == -1)
- size = sinfo.size > offset ? sinfo.size - offset : 0;
-
- GST_CAT_DEBUG (GST_CAT_GL_BASE_MEMORY,
- "memcpy %" G_GSSIZE_FORMAT " memory %p -> %p", size, src, dest);
- memcpy (dinfo.data, sinfo.data + offset, size);
- gst_memory_unmap ((GstMemory *) dest, &dinfo);
- gst_memory_unmap ((GstMemory *) src, &sinfo);
-
- return TRUE;
-}
-
-/**
- * gst_gl_allocation_params_init:
- * @params: the #GstGLAllocationParams to initialize
- * @struct_size: the struct size of the implementation
- * @alloc_flags: some alloc flags
- * @copy: a copy function
- * @free: a free function
- * @context: (transfer none): a #GstGLContext
- * @alloc_size: the number of bytes to allocate.
- * @alloc_params: (transfer none) (allow-none): a #GstAllocationParams to apply
- * @wrapped_data: (transfer none) (allow-none): a sysmem data pointer to initialize the allocation with
- * @gl_handle: (transfer none): a GL handle to initialize the allocation with
- * @user_data: (transfer none) (allow-none): user data to call @notify with
- * @notify: (allow-none): a #GDestroyNotify
- *
- * @notify will be called once for each allocated memory using these @params
- * when freeing the memory.
- *
- * Returns: whether the paramaters could be initialized
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_allocation_params_init (GstGLAllocationParams * params,
- gsize struct_size, guint alloc_flags, GstGLAllocationParamsCopyFunc copy,
- GstGLAllocationParamsFreeFunc free, GstGLContext * context,
- gsize alloc_size, GstAllocationParams * alloc_params,
- gpointer wrapped_data, gpointer gl_handle, gpointer user_data,
- GDestroyNotify notify)
-{
- memset (params, 0, sizeof (*params));
-
- g_return_val_if_fail (struct_size > 0, FALSE);
- g_return_val_if_fail (copy != NULL, FALSE);
- g_return_val_if_fail (free != NULL, FALSE);
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
-
- params->struct_size = struct_size;
- params->alloc_size = alloc_size;
- params->copy = copy;
- params->free = free;
- params->alloc_flags = alloc_flags;
- params->context = gst_object_ref (context);
- if (alloc_params)
- params->alloc_params = gst_allocation_params_copy (alloc_params);
- params->notify = notify;
- params->user_data = user_data;
- params->wrapped_data = wrapped_data;
- params->gl_handle = gl_handle;
-
- return TRUE;
-}
-
-/**
- * gst_gl_allocation_params_copy:
- * @src: the #GstGLAllocationParams to initialize
- *
- * Returns: (transfer full): a copy of the #GstGLAllocationParams specified by
- * @src or %NULL on failure
- *
- * Since: 1.8
- */
-GstGLAllocationParams *
-gst_gl_allocation_params_copy (GstGLAllocationParams * src)
-{
- GstGLAllocationParams *dest;
-
- g_return_val_if_fail (src != NULL, NULL);
-
- dest = g_malloc0 (src->struct_size);
-
- if (src->copy)
- src->copy (src, dest);
-
- return dest;
-}
-
-/**
- * gst_gl_allocation_params_free:
- * @params: the #GstGLAllocationParams to initialize
- *
- * Frees the #GstGLAllocationParams and all associated data.
- *
- * Since: 1.8
- */
-void
-gst_gl_allocation_params_free (GstGLAllocationParams * params)
-{
- if (params->free)
- params->free (params);
-
- g_free (params);
-}
-
-/**
- * gst_gl_allocation_params_free_data:
- * @params: the source #GstGLAllocationParams
- *
- * Frees the dynamically allocated data in @params. Direct subclasses
- * should call this function in their own overriden free function.
- *
- * Since: 1.8
- */
-void
-gst_gl_allocation_params_free_data (GstGLAllocationParams * params)
-{
- if (params->context)
- gst_object_unref (params->context);
- if (params->alloc_params)
- gst_allocation_params_free (params->alloc_params);
-}
-
-/**
- * gst_gl_allocation_params_copy_data:
- * @src: the source #GstGLAllocationParams
- * @dest: the destination #GstGLAllocationParams
- *
- * Copies the dynamically allocated data from @src to @dest. Direct subclasses
- * should call this function in their own overriden copy function.
- *
- * Since: 1.8
- */
-void
-gst_gl_allocation_params_copy_data (GstGLAllocationParams * src,
- GstGLAllocationParams * dest)
-{
- gst_gl_allocation_params_init (dest, src->struct_size, src->alloc_flags,
- src->copy, src->free, src->context, src->alloc_size, NULL,
- src->wrapped_data, src->gl_handle, src->user_data, src->notify);
-
- if (src->alloc_params)
- dest->alloc_params = gst_allocation_params_copy (src->alloc_params);
-}
-
-G_DEFINE_BOXED_TYPE (GstGLAllocationParams, gst_gl_allocation_params,
- (GBoxedCopyFunc) gst_gl_allocation_params_copy,
- (GBoxedFreeFunc) gst_gl_allocation_params_free);
-
-/**
- * gst_gl_base_memory_alloc:
- * @allocator: a #GstGLBaseMemoryAllocator
- * @params: the #GstGLAllocationParams to allocate the memory with
- *
- * Returns: a new #GstGLBaseMemory from @allocator with the requested @params.
- *
- * Since: 1.8
- */
-GstGLBaseMemory *
-gst_gl_base_memory_alloc (GstGLBaseMemoryAllocator * allocator,
- GstGLAllocationParams * params)
-{
- GstGLBaseMemoryAllocatorClass *alloc_class;
-
- g_return_val_if_fail (GST_IS_GL_BASE_MEMORY_ALLOCATOR (allocator), NULL);
-
- alloc_class = GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS (allocator);
-
- g_return_val_if_fail (alloc_class != NULL, NULL);
- g_return_val_if_fail (alloc_class->alloc != NULL, NULL);
-
- return alloc_class->alloc (allocator, params);
-}
diff --git a/gst-libs/gst/gl/gstglbasememory.h b/gst-libs/gst/gl/gstglbasememory.h
deleted file mode 100644
index 175fbf610..000000000
--- a/gst-libs/gst/gl/gstglbasememory.h
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * 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_BASE_MEMORY_H_
-#define _GST_GL_BASE_MEMORY_H_
-
-#include <gst/gst.h>
-#include <gst/gstallocator.h>
-#include <gst/gstmemory.h>
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-/**
- * GST_GL_BASE_MEMORY_ERROR:
- *
- * Error domain for GStreamer's GL memory module. Errors in this domain will be
- * from the #GstGLBaseMemoryError enumeration
- */
-#define GST_TYPE_GL_BASE_MEMORY (gst_gl_base_memory_get_type())
-GST_EXPORT
-GType gst_gl_base_memory_get_type(void);
-
-#define GST_TYPE_GL_BASE_MEMORY_ALLOCATOR (gst_gl_base_memory_allocator_get_type())
-GST_EXPORT
-GType gst_gl_base_memory_allocator_get_type(void);
-
-#define GST_IS_GL_BASE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR))
-#define GST_IS_GL_BASE_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR))
-#define GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR, GstGLBaseMemoryAllocatorClass))
-#define GST_GL_BASE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR, GstGLBaseMemoryAllocator))
-#define GST_GL_BASE_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR, GstGLBaseMemoryAllocatorClass))
-#define GST_GL_BASE_MEMORY_ALLOCATOR_CAST(obj) ((GstGLBaseMemoryAllocator *)(obj))
-
-#define GST_GL_BASE_MEMORY_CAST(mem) ((GstGLBaseMemory *)mem)
-
-GST_EXPORT
-GQuark gst_gl_base_memory_error_quark (void);
-#define GST_GL_BASE_MEMORY_ERROR (gst_gl_base_memory_error_quark ())
-
-/**
- * GstGLBaseMemoryError:
- * @GST_GL_BASE_MEMORY_ERROR_FAILED: generic faliure
- * @GST_GL_BASE_MEMORY_ERROR_OLD_LIBS: the implementation is too old and doesn't
- * implement enough features
- * @GST_GL_BASE_MEMORY_ERROR_RESOURCE_UNAVAILABLE: a resource could not be found
- */
-typedef enum
-{
- GST_GL_BASE_MEMORY_ERROR_FAILED,
- GST_GL_BASE_MEMORY_ERROR_OLD_LIBS,
- GST_GL_BASE_MEMORY_ERROR_RESOURCE_UNAVAILABLE,
-} GstGLBaseMemoryError;
-
-/**
- * GstGLBaseMemoryTransfer:
- * @GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD: the texture needs downloading
- * to the data pointer
- * @GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD: the data pointer needs uploading
- * to the texture
- */
-typedef enum
-{
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD = (GST_MEMORY_FLAG_LAST << 0),
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD = (GST_MEMORY_FLAG_LAST << 1)
-} GstGLBaseMemoryTransfer;
-
-/**
- * GST_MAP_GL:
- *
- * Flag indicating that we should map the GL object instead of to system memory.
- *
- * Combining #GST_MAP_GL with #GST_MAP_WRITE has the same semantics as though
- * you are writing to OpenGL. Conversely, combining #GST_MAP_GL with
- * #GST_MAP_READ has the same semantics as though you are reading from OpenGL.
- */
-#define GST_MAP_GL (GST_MAP_FLAG_LAST << 1)
-
-/**
- * GstGLBaseMemory:
- * @mem: the parent object
- * @context: the #GstGLContext to use for GL operations
- *
- * Represents information about a GL memory object
- */
-struct _GstGLBaseMemory
-{
- GstMemory mem;
-
- GstGLContext *context;
-
- /* <protected> */
- GMutex lock;
-
- GstMapFlags map_flags; /* cumulative map flags */
- gint map_count;
- gint gl_map_count;
-
- gpointer data;
-
- GstGLQuery *query;
-
- /* <private> */
- gsize alloc_size; /* because maxsize is used for mapping */
- gpointer alloc_data;
-
- GDestroyNotify notify;
- gpointer user_data;
-
- gpointer _padding[GST_PADDING];
-};
-
-typedef struct _GstGLAllocationParams GstGLAllocationParams;
-/**
- * GstGLAllocationParamsCopyFunc:
- * @src: the source #GstGLAllocationParams to copy from
- * @dest: the source #GstGLAllocationParams to copy
- *
- * Copies the parameters from @src into @dest. The subclass must compose copy
- * functions from the superclass.
- */
-typedef void (*GstGLAllocationParamsCopyFunc) (GstGLAllocationParams * src, GstGLAllocationParams * dest);
-/**
- * GstGLAllocationParamsFreeFunc:
- * @params: a #GstGLAllocationParams
- *
- * Free any dynamically allocated data. The subclass must call the superclass'
- * free.
- */
-typedef void (*GstGLAllocationParamsFreeFunc) (gpointer params);
-
-#define GST_TYPE_GL_ALLOCATION_PARAMS (gst_gl_allocation_params_get_type())
-GST_EXPORT
-GType gst_gl_allocation_params_get_type (void);
-
-/**
- * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_ALLOC:
- *
- * GL Allocation flag indicating that the implementation should allocate the
- * necessary resources.
- */
-#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_ALLOC (1 << 0)
-
-/**
- * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM:
- *
- * GL Allocation flag for using the provided system memory data as storage.
- */
-#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM (1 << 1)
-
-/**
- * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE:
- *
- * GL Allocation flag for using the provided GPU handle as storage.
- */
-#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE (1 << 2)
-
-/**
- * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_USER:
- *
- * Values >= than #GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_USER can be used for
- * user-defined purposes.
- */
-#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_USER (1 << 16)
-
-/**
- * GstGLAllocationParams:
- * @struct_size: the size of the struct (including and subclass data)
- * @copy: a #GstGLAllocationParamsCopyFunc
- * @free: a #GstGLAllocationParamsFreeFunc
- * @alloc_flags: allocation flags
- * @alloc_size: the allocation size
- * @alloc_params: the #GstAllocationParams
- * @context: a #GstGLContext
- * @notify: a #GDestroyNotify
- * @user_data: argument to call @notify with
- * @wrapped_data: the wrapped data pointer
- * @gl_handle: the wrapped OpenGL handle
- */
-/* Because GstAllocationParams is not subclassable, start our own subclass
- * chain. FIXME: 2.0 make GstAllocationParams subclassable */
-struct _GstGLAllocationParams
-{
- gsize struct_size;
- GstGLAllocationParamsCopyFunc copy;
- GstGLAllocationParamsFreeFunc free;
-
- guint alloc_flags;
- gsize alloc_size;
- GstAllocationParams *alloc_params;
- GstGLContext *context;
- GDestroyNotify notify;
- gpointer user_data;
-
- /* GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM only */
- gpointer wrapped_data;
- /* GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE only */
- gpointer gl_handle;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-gboolean gst_gl_allocation_params_init (GstGLAllocationParams * params,
- gsize struct_size,
- guint alloc_flags,
- GstGLAllocationParamsCopyFunc copy,
- GstGLAllocationParamsFreeFunc free,
- GstGLContext * context,
- gsize alloc_size,
- GstAllocationParams * alloc_params,
- gpointer wrapped_data,
- gpointer gl_handle,
- gpointer user_data,
- GDestroyNotify notify);
-
-/* free with gst_gl_allocation_params_free */
-GST_EXPORT
-GstGLAllocationParams * gst_gl_allocation_params_copy (GstGLAllocationParams * src);
-
-GST_EXPORT
-void gst_gl_allocation_params_free (GstGLAllocationParams * params);
-
-/* subclass usage */
-GST_EXPORT
-void gst_gl_allocation_params_free_data (GstGLAllocationParams * params);
-
-/* subclass usage */
-GST_EXPORT
-void gst_gl_allocation_params_copy_data (GstGLAllocationParams * src,
- GstGLAllocationParams * dest);
-
-/**
- * GstGLBaseMemoryAllocatorAllocFunction:
- * @allocator: a #GstGLBaseMemoryAllocator
- * @params: the #GstGLAllocationParams to allocate the memory with
- *
- * Note: not called with a GL context current
- *
- * Returns: a newly allocated #GstGLBaseMemory from @allocator and @params
- *
- * Since: 1.8
- */
-typedef GstGLBaseMemory * (*GstGLBaseMemoryAllocatorAllocFunction) (GstGLBaseMemoryAllocator * allocator,
- GstGLAllocationParams * params);
-
-/**
- * GstGLBaseMemoryAllocatorCreateFunction:
- * @mem: a #GstGLBaseMemory
- * @error: a #GError to use on failure
- *
- * As this virtual method is called with an OpenGL context current, use this
- * function to allocate and OpenGL resources needed for your application
- *
- * Returns: whether the creation succeeded
- *
- * Since: 1.8
- */
-typedef gboolean (*GstGLBaseMemoryAllocatorCreateFunction) (GstGLBaseMemory * mem,
- GError ** error);
-
-/**
- * GstGLBaseMemoryAllocatorMapFunction:
- * @mem: a #GstGLBaseMemory
- * @info: a #GstMapInfo to map with
- * @maxsize: the size to map
- *
- * Also see gst_memory_map();
- *
- * Returns: the mapped pointer
- *
- * Since: 1.8
- */
-typedef gpointer (*GstGLBaseMemoryAllocatorMapFunction) (GstGLBaseMemory * mem,
- GstMapInfo * info,
- gsize maxsize);
-/**
- * GstGLBaseMemoryAllocatorUnmapFunction:
- * @mem: a #GstGLBaseMemory
- * @info: a #GstMapInfo to map with
- *
- * Also see gst_memory_unmap();
- *
- * Since: 1.8
- */
-typedef void (*GstGLBaseMemoryAllocatorUnmapFunction) (GstGLBaseMemory * mem,
- GstMapInfo * info);
-
-/**
- * GstGLBaseMemoryAllocatorCopyFunction:
- * @mem: a #GstGLBaseMemory
- * @offset: the offset to copy from
- * @size: the number of bytes to copy
- *
- * Also see gst_memory_copy();
- *
- * Returns: the newly copied #GstGLMemory or %NULL
- *
- * Since: 1.8
- */
-typedef GstGLBaseMemory * (*GstGLBaseMemoryAllocatorCopyFunction) (GstGLBaseMemory * mem,
- gssize offset,
- gssize size);
-
-/**
- * GstGLBaseMemoryAllocatorDestroyFunction:
- * @mem: a #GstGLBaseMemory
- *
- * Destroy any resources allocated throughout the lifetime of @mem
- *
- * Since: 1.8
- */
-typedef void (*GstGLBaseMemoryAllocatorDestroyFunction) (GstGLBaseMemory * mem);
-
-/**
- * GstGLBaseMemoryAllocator
- *
- * Opaque #GstGLBaseMemoryAllocator struct
- *
- * Since: 1.8
- */
-struct _GstGLBaseMemoryAllocator
-{
- /*< private >*/
- GstAllocator parent;
- GstMemoryCopyFunction fallback_mem_copy;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLBaseMemoryAllocatorClass:
- * @parent_class: the parent class
- * @alloc: a #GstGLBaseMemoryAllocatorAllocFunction
- * @create: a #GstGLBaseMemoryAllocatorCreateFunction
- * @map: a #GstGLBaseMemoryAllocatorMapFunction
- * @unmap: a #GstGLBaseMemoryAllocatorUnmapFunction
- * @copy: a #GstGLBaseMemoryAllocatorCopyFunction
- * @destroy: a #GstGLBaseMemoryAllocatorDestroyFunction
- *
- * Since: 1.8
- */
-struct _GstGLBaseMemoryAllocatorClass
-{
- GstAllocatorClass parent_class;
-
- GstGLBaseMemoryAllocatorAllocFunction alloc;
-
- GstGLBaseMemoryAllocatorCreateFunction create;
- GstGLBaseMemoryAllocatorMapFunction map;
- GstGLBaseMemoryAllocatorUnmapFunction unmap;
- GstGLBaseMemoryAllocatorCopyFunction copy;
- GstGLBaseMemoryAllocatorDestroyFunction destroy;
- /* <private> */
-
- gpointer _padding[GST_PADDING];
-};
-
-#include <gst/gl/gstglconfig.h>
-#include <gst/gl/gstglformat.h>
-
-/**
- * GST_GL_BASE_MEMORY_ALLOCATOR_NAME:
- *
- * The name of the GL buffer allocator
- *
- * Since: 1.8
- */
-#define GST_GL_BASE_MEMORY_ALLOCATOR_NAME "GLBaseMemory"
-
-GST_EXPORT
-void gst_gl_base_memory_init_once (void);
-
-GST_EXPORT
-gboolean gst_is_gl_base_memory (GstMemory * mem);
-
-GST_EXPORT
-void gst_gl_base_memory_init (GstGLBaseMemory * mem,
- GstAllocator * allocator,
- GstMemory * parent,
- GstGLContext * context,
- GstAllocationParams * params,
- gsize size,
- gpointer user_data,
- GDestroyNotify notify);
-
-GST_EXPORT
-gboolean gst_gl_base_memory_alloc_data (GstGLBaseMemory * gl_mem);
-
-GST_EXPORT
-gboolean gst_gl_base_memory_memcpy (GstGLBaseMemory * src,
- GstGLBaseMemory * dest,
- gssize offset,
- gssize size);
-
-GST_EXPORT
-GstGLBaseMemory * gst_gl_base_memory_alloc (GstGLBaseMemoryAllocator * allocator,
- GstGLAllocationParams * params);
-
-G_END_DECLS
-
-#endif /* _GST_GL_BUFFER_H_ */
diff --git a/gst-libs/gst/gl/gstglbuffer.c b/gst-libs/gst/gl/gstglbuffer.c
deleted file mode 100644
index 5a4500757..000000000
--- a/gst-libs/gst/gl/gstglbuffer.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstglbuffer.h"
-
-#include "gstglcontext.h"
-#include "gstglfuncs.h"
-#include "gstglutils.h"
-
-/**
- * SECTION:gstglbuffer
- * @title: GstGLBuffer
- * @short_description: memory subclass for GL buffers
- * @see_also: #GstMemory, #GstAllocator
- *
- * GstGLBuffer is a #GstMemory subclass providing support for the mapping of
- * GL buffers.
- *
- * Data is uploaded or downloaded from the GPU as is necessary.
- */
-
-/* Implementation notes:
- *
- * Currently does not take into account GLES2 differences (no mapbuffer)
- */
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-/* compatibility definitions... */
-#ifndef GL_MAP_READ_BIT
-#define GL_MAP_READ_BIT 0x0001
-#endif
-#ifndef GL_MAP_WRITE_BIT
-#define GL_MAP_WRITE_BIT 0x0002
-#endif
-#ifndef GL_COPY_READ_BUFFER
-#define GL_COPY_READ_BUFFER 0x8F36
-#endif
-#ifndef GL_COPY_WRITE_BUFFER
-#define GL_COPY_WRITE_BUFFER 0x8F37
-#endif
-
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_BUFFER);
-#define GST_CAT_DEFUALT GST_CAT_GL_BUFFER
-
-static GstAllocator *_gl_buffer_allocator;
-
-static gboolean
-_gl_buffer_create (GstGLBuffer * gl_mem, GError ** error)
-{
- const GstGLFuncs *gl = gl_mem->mem.context->gl_vtable;
-
- gl->GenBuffers (1, &gl_mem->id);
- gl->BindBuffer (gl_mem->target, gl_mem->id);
- gl->BufferData (gl_mem->target, gl_mem->mem.mem.maxsize, NULL,
- gl_mem->usage_hints);
- gl->BindBuffer (gl_mem->target, 0);
-
- return TRUE;
-}
-
-struct create_data
-{
- GstGLBuffer *mem;
- gboolean result;
-};
-
-static void
-_gl_buffer_init (GstGLBuffer * mem, GstAllocator * allocator,
- GstMemory * parent, GstGLContext * context, guint gl_target, guint gl_usage,
- GstAllocationParams * params, gsize size)
-{
- mem->target = gl_target;
- mem->usage_hints = gl_usage;
-
- gst_gl_base_memory_init ((GstGLBaseMemory *) mem, allocator, parent, context,
- params, size, NULL, NULL);
-
- GST_CAT_DEBUG (GST_CAT_GL_BUFFER, "new GL buffer memory:%p size:%"
- G_GSIZE_FORMAT, mem, mem->mem.mem.maxsize);
-}
-
-static GstGLBuffer *
-_gl_buffer_new (GstAllocator * allocator, GstMemory * parent,
- GstGLContext * context, guint gl_target, guint gl_usage,
- GstAllocationParams * params, gsize size)
-{
- GstGLBuffer *ret = g_new0 (GstGLBuffer, 1);
- _gl_buffer_init (ret, allocator, parent, context, gl_target, gl_usage,
- params, size);
-
- return ret;
-}
-
-static gpointer
-gst_gl_buffer_cpu_access (GstGLBuffer * mem, GstMapInfo * info, gsize size)
-{
- const GstGLFuncs *gl = mem->mem.context->gl_vtable;
- gpointer data, ret;
-
- if (!gst_gl_base_memory_alloc_data (GST_GL_BASE_MEMORY_CAST (mem)))
- return NULL;
-
- ret = mem->mem.data;
-
- GST_CAT_LOG (GST_CAT_GL_BUFFER, "mapping id %d size %" G_GSIZE_FORMAT,
- mem->id, size);
-
- /* The extra data pointer indirection/memcpy is needed for coherent across
- * concurrent map()'s in both GL and CPU */
- if (GST_MEMORY_FLAG_IS_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD)
- && (info->flags & GST_MAP_GL) == 0 && (info->flags & GST_MAP_READ) != 0) {
- gl->BindBuffer (mem->target, mem->id);
-
- if (gl->MapBufferRange) {
- /* FIXME: optionally remove this with a flag and return the
- * glMapBufferRange pointer (requires
- * GL_ARB_buffer_storage/GL4/GL_COHERENT_BIT) */
- guint gl_map_flags = GL_MAP_READ_BIT;
-
- data = gl->MapBufferRange (mem->target, 0, size, gl_map_flags);
-
- if (data)
- memcpy (mem->mem.data, data, size);
-
- gl->UnmapBuffer (mem->target);
- ret = mem->mem.data;
- } else if (gl->GetBufferSubData) {
- gl->GetBufferSubData (mem->target, 0, size, mem->mem.data);
- ret = mem->mem.data;
- } else {
- ret = NULL;
- }
- gl->BindBuffer (mem->target, 0);
- }
-
- return ret;
-}
-
-static void
-gst_gl_buffer_upload_cpu_write (GstGLBuffer * mem, GstMapInfo * info,
- gsize size)
-{
- const GstGLFuncs *gl = mem->mem.context->gl_vtable;
- gpointer data;
-
- if (!mem->mem.data)
- /* no data pointer has been written */
- return;
-
- /* The extra data pointer indirection/memcpy is needed for coherent across
- * concurrent map()'s in both GL and CPU */
- /* FIXME: uploading potentially half-written data for libav pushing READWRITE
- * mapped buffers */
- if (GST_MEMORY_FLAG_IS_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD)
- || (mem->mem.map_flags & GST_MAP_WRITE) != 0) {
- gl->BindBuffer (mem->target, mem->id);
-
- if (gl->MapBufferRange) {
- /* FIXME: optionally remove this with a flag and return the
- * glMapBufferRange pointer (requires
- * GL_ARB_buffer_storage/GL4/GL_COHERENT_BIT) */
- guint gl_map_flags = GL_MAP_WRITE_BIT;
-
- data = gl->MapBufferRange (mem->target, 0, size, gl_map_flags);
-
- if (data)
- memcpy (data, mem->mem.data, size);
-
- gl->UnmapBuffer (mem->target);
- } else if (gl->BufferSubData) {
- gl->BufferSubData (mem->target, 0, size, mem->mem.data);
- }
- gl->BindBuffer (mem->target, 0);
- }
-}
-
-static gpointer
-_gl_buffer_map (GstGLBuffer * mem, GstMapInfo * info, gsize size)
-{
- const GstGLFuncs *gl = mem->mem.context->gl_vtable;
-
- if ((info->flags & GST_MAP_GL) != 0) {
- if (info->flags & GST_MAP_READ) {
- gst_gl_buffer_upload_cpu_write (mem, info, size);
- }
- gl->BindBuffer (mem->target, mem->id);
- return &mem->id;
- } else {
- return gst_gl_buffer_cpu_access (mem, info, size);
- }
-
- return NULL;
-}
-
-static void
-_gl_buffer_unmap (GstGLBuffer * mem, GstMapInfo * info)
-{
- const GstGLFuncs *gl = mem->mem.context->gl_vtable;
-
- if ((info->flags & GST_MAP_GL) != 0) {
- gl->BindBuffer (mem->target, 0);
- }
- /* XXX: optimistically transfer data */
-}
-
-/**
- * gst_gl_buffer_copy_buffer_sub_data:
- * @src: the source #GstGLBuffer
- * @dest: the destination #GstGLBuffer
- * @offset: the offset to copy from @src
- * @size: the size to copy from @src
- *
- * Copies @src into @dest using glCopyBufferSubData().
- *
- * Returns: whether the copy operation succeeded
- *
- * Since: 1.8
- */
-static gboolean
-gst_gl_buffer_copy_buffer_sub_data (GstGLBuffer * src,
- GstGLBuffer * dest, gssize offset, gssize size)
-{
- const GstGLFuncs *gl = src->mem.context->gl_vtable;
- GstMapInfo sinfo, dinfo;
-
- if (!gl->CopyBufferSubData)
- /* This is GL(ES) 3.0+ only */
- return FALSE;
-
- if (!gst_memory_map ((GstMemory *) src, &sinfo, GST_MAP_READ | GST_MAP_GL)) {
- GST_CAT_WARNING (GST_CAT_GL_BUFFER,
- "failed to read map source memory %p", src);
- return FALSE;
- }
-
- if (!gst_memory_map ((GstMemory *) dest, &dinfo, GST_MAP_WRITE | GST_MAP_GL)) {
- GST_CAT_WARNING (GST_CAT_GL_BUFFER,
- "failed to write map destination memory %p", dest);
- gst_memory_unmap ((GstMemory *) src, &sinfo);
- return FALSE;
- }
-
- gl->BindBuffer (GL_COPY_READ_BUFFER, src->id);
- gl->BindBuffer (GL_COPY_WRITE_BUFFER, dest->id);
- gl->CopyBufferSubData (GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER,
- offset, 0, size);
-
- gst_memory_unmap ((GstMemory *) src, &sinfo);
- gst_memory_unmap ((GstMemory *) dest, &dinfo);
-
- return TRUE;
-}
-
-static GstGLBuffer *
-_gl_buffer_copy (GstGLBuffer * src, gssize offset, gssize size)
-{
- GstAllocator *allocator = src->mem.mem.allocator;
- GstAllocationParams params = { 0, src->mem.mem.align, 0, 0 };
- GstGLBuffer *dest = NULL;
-
- dest = _gl_buffer_new (allocator, NULL, src->mem.context,
- src->target, src->usage_hints, &params, src->mem.mem.maxsize);
-
- /* If not doing a full copy, then copy to sysmem, the 2D represention of the
- * texture would become wrong */
- if (GST_MEMORY_FLAG_IS_SET (src, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD)) {
- if (!gst_gl_base_memory_memcpy (GST_GL_BASE_MEMORY_CAST (src),
- GST_GL_BASE_MEMORY_CAST (dest), offset, size)) {
- GST_CAT_WARNING (GST_CAT_GL_BUFFER, "Could not copy GL Buffer");
- gst_memory_unref (GST_MEMORY_CAST (dest));
- dest = NULL;
- }
- } else {
- if (!gst_gl_buffer_copy_buffer_sub_data (src, dest, offset, size)) {
- if (!gst_gl_base_memory_memcpy (GST_GL_BASE_MEMORY_CAST (src),
- GST_GL_BASE_MEMORY_CAST (dest), offset, size)) {
- GST_CAT_WARNING (GST_CAT_GL_BUFFER, "Could not copy GL Buffer");
- gst_memory_unref (GST_MEMORY_CAST (dest));
- dest = NULL;
- }
- }
- }
-
- return dest;
-}
-
-static GstMemory *
-_gl_buffer_alloc (GstAllocator * allocator, gsize size,
- GstAllocationParams * params)
-{
- g_critical ("Need to use gst_gl_base_memory_alloc() to allocate from "
- "this allocator");
-
- return NULL;
-}
-
-static void
-_gl_buffer_destroy (GstGLBuffer * mem)
-{
- const GstGLFuncs *gl = mem->mem.context->gl_vtable;
-
- gl->DeleteBuffers (1, &mem->id);
-}
-
-static void
-_gst_gl_buffer_allocation_params_copy_data (GstGLBufferAllocationParams * src,
- GstGLBufferAllocationParams * dest)
-{
- memset (dest, 0, sizeof (*dest));
-
- gst_gl_allocation_params_copy_data (&src->parent, &dest->parent);
-
- dest->gl_target = src->gl_target;
- dest->gl_usage = src->gl_usage;
-}
-
-static void
-_gst_gl_buffer_allocation_params_free_data (GstGLBufferAllocationParams *
- params)
-{
- gst_gl_allocation_params_free_data (&params->parent);
-}
-
-G_DEFINE_BOXED_TYPE (GstGLBufferAllocationParams,
- gst_gl_buffer_allocation_params,
- (GBoxedCopyFunc) gst_gl_allocation_params_copy,
- (GBoxedFreeFunc) gst_gl_allocation_params_free);
-
-/**
- * gst_gl_buffer_allocation_params_new:
- * @context: a #GstGLContext
- * @alloc_size: the size in bytes to allocate
- * @alloc_params: (allow-none): the #GstAllocationParams for @tex_id
- * @gl_target: the OpenGL target to allocate
- * @gl_usage: the OpenGL usage hint to allocate with
- *
- * Returns: a new #GstGLBufferAllocationParams for allocating OpenGL buffer
- * objects
- *
- * Since: 1.8
- */
-GstGLBufferAllocationParams *
-gst_gl_buffer_allocation_params_new (GstGLContext * context, gsize alloc_size,
- GstAllocationParams * alloc_params, guint gl_target, guint gl_usage)
-{
- GstGLBufferAllocationParams *params;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
- g_return_val_if_fail (alloc_size > 0, NULL);
-
- params = g_new0 (GstGLBufferAllocationParams, 1);
-
- if (!gst_gl_allocation_params_init (&params->parent, sizeof (*params),
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER |
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_ALLOC,
- (GstGLAllocationParamsCopyFunc)
- _gst_gl_buffer_allocation_params_copy_data,
- (GstGLAllocationParamsFreeFunc)
- _gst_gl_buffer_allocation_params_free_data, context, alloc_size,
- alloc_params, NULL, 0, NULL, NULL)) {
- g_free (params);
- return NULL;
- }
-
- params->gl_target = gl_target;
- params->gl_usage = gl_usage;
-
- return params;
-}
-
-static GstGLBuffer *
-_gl_buffer_alloc_mem (GstGLBufferAllocator * allocator,
- GstGLBufferAllocationParams * params)
-{
- guint alloc_flags = params->parent.alloc_flags;
-
- g_return_val_if_fail (alloc_flags &
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER, NULL);
- g_return_val_if_fail (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_ALLOC,
- NULL);
-
- return _gl_buffer_new (GST_ALLOCATOR (allocator), NULL,
- params->parent.context, params->gl_target, params->gl_usage,
- params->parent.alloc_params, params->parent.alloc_size);
-}
-
-G_DEFINE_TYPE (GstGLBufferAllocator, gst_gl_buffer_allocator,
- GST_TYPE_GL_BASE_MEMORY_ALLOCATOR);
-
-static void
-gst_gl_buffer_allocator_class_init (GstGLBufferAllocatorClass * klass)
-{
- GstAllocatorClass *allocator_class = (GstAllocatorClass *) klass;
- GstGLBaseMemoryAllocatorClass *gl_base;
-
- gl_base = (GstGLBaseMemoryAllocatorClass *) klass;
-
- gl_base->alloc = (GstGLBaseMemoryAllocatorAllocFunction) _gl_buffer_alloc_mem;
- gl_base->create = (GstGLBaseMemoryAllocatorCreateFunction) _gl_buffer_create;
- gl_base->map = (GstGLBaseMemoryAllocatorMapFunction) _gl_buffer_map;
- gl_base->unmap = (GstGLBaseMemoryAllocatorUnmapFunction) _gl_buffer_unmap;
- gl_base->copy = (GstGLBaseMemoryAllocatorCopyFunction) _gl_buffer_copy;
- gl_base->destroy =
- (GstGLBaseMemoryAllocatorDestroyFunction) _gl_buffer_destroy;
-
- allocator_class->alloc = _gl_buffer_alloc;
-}
-
-static void
-gst_gl_buffer_allocator_init (GstGLBufferAllocator * allocator)
-{
- GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
-
- alloc->mem_type = GST_GL_BUFFER_ALLOCATOR_NAME;
-
- GST_OBJECT_FLAG_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
-}
-
-/**
- * gst_gl_buffer_init_once:
- *
- * Initializes the GL Buffer allocator. It is safe to call this function
- * multiple times. This must be called before any other #GstGLBuffer operation.
- *
- * Since: 1.8
- */
-void
-gst_gl_buffer_init_once (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- gst_gl_base_memory_init_once ();
-
- GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_BUFFER, "glbuffer", 0, "OpenGL Buffer");
-
- _gl_buffer_allocator =
- g_object_new (gst_gl_buffer_allocator_get_type (), NULL);
- gst_object_ref_sink (_gl_buffer_allocator);
-
- /* The allocator is never unreffed */
- GST_OBJECT_FLAG_SET (_gl_buffer_allocator, GST_OBJECT_FLAG_MAY_BE_LEAKED);
-
- gst_allocator_register (GST_GL_BUFFER_ALLOCATOR_NAME,
- gst_object_ref (_gl_buffer_allocator));
- g_once_init_leave (&_init, 1);
- }
-}
-
-/**
- * gst_is_gl_buffer:
- * @mem:a #GstMemory
- *
- * Returns: whether the memory at @mem is a #GstGLBuffer
- *
- * Since: 1.8
- */
-gboolean
-gst_is_gl_buffer (GstMemory * mem)
-{
- return mem != NULL && mem->allocator != NULL &&
- g_type_is_a (G_OBJECT_TYPE (mem->allocator),
- GST_TYPE_GL_BUFFER_ALLOCATOR);
-}
diff --git a/gst-libs/gst/gl/gstglbuffer.h b/gst-libs/gst/gl/gstglbuffer.h
deleted file mode 100644
index 52a6576fd..000000000
--- a/gst-libs/gst/gl/gstglbuffer.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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_BUFFER_H_
-#define _GST_GL_BUFFER_H_
-
-#include <gst/gl/gstglbasememory.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_BUFFER_ALLOCATOR (gst_gl_buffer_allocator_get_type())
-GST_EXPORT
-GType gst_gl_buffer_allocator_get_type(void);
-
-#define GST_IS_GL_BUFFER_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_ALLOCATOR))
-#define GST_IS_GL_BUFFER_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_BUFFER_ALLOCATOR))
-#define GST_GL_BUFFER_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_BUFFER_ALLOCATOR, GstGLBufferAllocatorClass))
-#define GST_GL_BUFFER_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_BUFFER_ALLOCATOR, GstGLBufferAllocator))
-#define GST_GL_BUFFER_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_BUFFER_ALLOCATOR, GstGLBufferAllocatorClass))
-#define GST_GL_BUFFER_ALLOCATOR_CAST(obj) ((GstGLBufferAllocator *)(obj))
-
-/**
- * GstGLBuffer:
- * @mem: the parent object
- * @id: the buffer id for this memory
- * @target: the OpenGL target of this texture for binding purposes
- * @usage_hints: the OpenGL usage hints this buffer was created with
- *
- * Represents information about a GL buffer
- */
-struct _GstGLBuffer
-{
- GstGLBaseMemory mem;
-
- guint id;
- guint target; /* XXX: put this in the allocator? */
- guint usage_hints; /* XXX: put this in the allocator? */
-};
-
-typedef struct _GstGLBufferAllocationParams GstGLBufferAllocationParams;
-
-#define GST_TYPE_GL_BUFFER_ALLOCATION_PARAMS (gst_gl_buffer_allocation_params_get_type())
-GST_EXPORT
-GType gst_gl_buffer_allocation_params_get_type (void);
-
-/**
- * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER:
- *
- * GL allocation flag indicating the allocation of a GL buffer.
- */
-#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER (1 << 4)
-
-/**
- * GstGLBufferAllocationParams:
- * @parent: parent object
- * @gl_target: the OpenGL target to bind the buffer to
- * @gl_usage: the OpenGL usage hint to create the buffer with
- */
-struct _GstGLBufferAllocationParams
-{
- GstGLAllocationParams parent;
-
- guint gl_target;
- guint gl_usage;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstGLBufferAllocationParams * gst_gl_buffer_allocation_params_new (GstGLContext * context,
- gsize alloc_size,
- GstAllocationParams * alloc_params,
- guint gl_target,
- guint gl_usage);
-
-/**
- * GstGLBufferAllocator
- *
- * Opaque #GstGLAllocator struct
- */
-struct _GstGLBufferAllocator
-{
- GstGLBaseMemoryAllocator parent;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLBufferAllocatorClass:
- *
- * The #GstGLBufferAllocatorClass only contains private data
- */
-struct _GstGLBufferAllocatorClass
-{
- GstGLBaseMemoryAllocatorClass parent_class;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GST_CAPS_FEATURE_MEMORY_GL_BUFFER:
- *
- * Name of the caps feature indicating the use of GL buffers
- */
-#define GST_CAPS_FEATURE_MEMORY_GL_BUFFER "memory:GLBuffer"
-
-/**
- * GST_GL_BUFFER_ALLOCATOR_NAME:
- *
- * The name of the GL buffer allocator
- */
-#define GST_GL_BUFFER_ALLOCATOR_NAME "GLBuffer"
-
-GST_EXPORT
-void gst_gl_buffer_init_once (void);
-GST_EXPORT
-gboolean gst_is_gl_buffer (GstMemory * mem);
-
-G_END_DECLS
-
-#endif /* _GST_GL_BUFFER_H_ */
diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c
deleted file mode 100644
index 309bc367b..000000000
--- a/gst-libs/gst/gl/gstglbufferpool.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstglbufferpool.h"
-
-#include "gstglmemory.h"
-#include "gstglsyncmeta.h"
-#include "gstglutils.h"
-
-/**
- * SECTION:gstglbufferpool
- * @title: GstGLBufferPool
- * @short_description: buffer pool for #GstGLBaseMemory objects
- * @see_also: #GstBufferPool, #GstGLBaseMemory, #GstGLMemory
- *
- * a #GstGLBufferPool is an object that allocates buffers with #GstGLBaseMemory
- *
- * A #GstGLBufferPool is created with gst_gl_buffer_pool_new()
- *
- * #GstGLBufferPool implements the VideoMeta buffer pool option
- * %GST_BUFFER_POOL_OPTION_VIDEO_META, the VideoAligment buffer pool option
- * %GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT as well as the OpenGL specific
- * %GST_BUFFER_POOL_OPTION_GL_SYNC_META buffer pool option.
- */
-
-/* bufferpool */
-struct _GstGLBufferPoolPrivate
-{
- GstAllocator *allocator;
- GstGLVideoAllocationParams *gl_params;
- GstCaps *caps;
- gboolean add_videometa;
- gboolean add_glsyncmeta;
-};
-
-static void gst_gl_buffer_pool_finalize (GObject * object);
-
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_BUFFER_POOL);
-#define GST_CAT_DEFAULT GST_CAT_GL_BUFFER_POOL
-
-#define GST_GL_BUFFER_POOL_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_GL_BUFFER_POOL, GstGLBufferPoolPrivate))
-
-#define gst_gl_buffer_pool_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstGLBufferPool, gst_gl_buffer_pool,
- GST_TYPE_BUFFER_POOL, GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_BUFFER_POOL,
- "glbufferpool", 0, "GL Buffer Pool"));
-
-static const gchar **
-gst_gl_buffer_pool_get_options (GstBufferPool * pool)
-{
- static const gchar *options[] = { GST_BUFFER_POOL_OPTION_VIDEO_META,
- GST_BUFFER_POOL_OPTION_GL_SYNC_META,
- GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT,
- GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D,
- GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE,
- NULL
- };
-
- return options;
-}
-
-static gboolean
-gst_gl_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
-{
- GstGLBufferPool *glpool = GST_GL_BUFFER_POOL_CAST (pool);
- GstGLBufferPoolPrivate *priv = glpool->priv;
- GstVideoInfo info;
- GstCaps *caps = NULL;
- guint min_buffers, max_buffers;
- guint max_align, n;
- GstAllocator *allocator = NULL;
- GstAllocationParams alloc_params;
- GstGLTextureTarget tex_target;
- gboolean ret = TRUE;
- gint p;
-
- if (!gst_buffer_pool_config_get_params (config, &caps, NULL, &min_buffers,
- &max_buffers))
- goto wrong_config;
-
- if (caps == NULL)
- goto no_caps;
-
- /* now parse the caps from the config */
- if (!gst_video_info_from_caps (&info, caps))
- goto wrong_caps;
-
- GST_LOG_OBJECT (pool, "%dx%d, caps %" GST_PTR_FORMAT, info.width, info.height,
- caps);
-
- if (!gst_buffer_pool_config_get_allocator (config, &allocator, &alloc_params))
- goto wrong_config;
-
- gst_caps_replace (&priv->caps, caps);
-
- if (priv->allocator)
- gst_object_unref (priv->allocator);
-
- if (allocator) {
- if (!GST_IS_GL_MEMORY_ALLOCATOR (allocator)) {
- gst_object_unref (allocator);
- goto wrong_allocator;
- } else {
- priv->allocator = gst_object_ref (allocator);
- }
- } else {
- priv->allocator =
- GST_ALLOCATOR (gst_gl_memory_allocator_get_default (glpool->context));
- g_assert (priv->allocator);
- }
-
- priv->add_videometa = gst_buffer_pool_config_has_option (config,
- GST_BUFFER_POOL_OPTION_VIDEO_META);
- priv->add_glsyncmeta = gst_buffer_pool_config_has_option (config,
- GST_BUFFER_POOL_OPTION_GL_SYNC_META);
-
- if (priv->gl_params)
- gst_gl_allocation_params_free ((GstGLAllocationParams *) priv->gl_params);
- priv->gl_params = (GstGLVideoAllocationParams *)
- gst_buffer_pool_config_get_gl_allocation_params (config);
- if (!priv->gl_params)
- priv->gl_params = gst_gl_video_allocation_params_new (glpool->context,
- &alloc_params, &info, -1, NULL, 0, 0);
-
- max_align = alloc_params.align;
-
- if (gst_buffer_pool_config_has_option (config,
- GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT)) {
- priv->add_videometa = TRUE;
-
- gst_buffer_pool_config_get_video_alignment (config,
- priv->gl_params->valign);
-
- for (n = 0; n < GST_VIDEO_MAX_PLANES; ++n)
- max_align |= priv->gl_params->valign->stride_align[n];
-
- for (n = 0; n < GST_VIDEO_MAX_PLANES; ++n)
- priv->gl_params->valign->stride_align[n] = max_align;
-
- gst_video_info_align (priv->gl_params->v_info, priv->gl_params->valign);
-
- gst_buffer_pool_config_set_video_alignment (config,
- priv->gl_params->valign);
- }
-
- if (alloc_params.align < max_align) {
- GST_WARNING_OBJECT (pool, "allocation params alignment %u is smaller "
- "than the max specified video stride alignment %u, fixing",
- (guint) alloc_params.align, max_align);
-
- alloc_params.align = max_align;
- gst_buffer_pool_config_set_allocator (config, allocator, &alloc_params);
- if (priv->gl_params->parent.alloc_params)
- gst_allocation_params_free (priv->gl_params->parent.alloc_params);
- priv->gl_params->parent.alloc_params =
- gst_allocation_params_copy (&alloc_params);
- }
-
- {
- GstStructure *s = gst_caps_get_structure (caps, 0);
- const gchar *target_str = gst_structure_get_string (s, "texture-target");
- gboolean multiple_texture_targets = FALSE;
-
- tex_target = priv->gl_params->target;
- if (target_str)
- tex_target = gst_gl_texture_target_from_string (target_str);
-
- if (gst_buffer_pool_config_has_option (config,
- GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D)) {
- if (tex_target && tex_target != GST_GL_TEXTURE_TARGET_2D)
- multiple_texture_targets = TRUE;
- tex_target = GST_GL_TEXTURE_TARGET_2D;
- }
- if (gst_buffer_pool_config_has_option (config,
- GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE)) {
- if (tex_target && tex_target != GST_GL_TEXTURE_TARGET_RECTANGLE)
- multiple_texture_targets = TRUE;
- tex_target = GST_GL_TEXTURE_TARGET_RECTANGLE;
- }
- if (gst_buffer_pool_config_has_option (config,
- GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES)) {
- if (tex_target && tex_target != GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
- multiple_texture_targets = TRUE;
- tex_target = GST_GL_TEXTURE_TARGET_EXTERNAL_OES;
- }
-
- if (!tex_target)
- tex_target = GST_GL_TEXTURE_TARGET_2D;
-
- if (multiple_texture_targets) {
- GST_WARNING_OBJECT (pool, "Multiple texture targets configured either "
- "through caps or buffer pool options");
- ret = FALSE;
- }
-
- priv->gl_params->target = tex_target;
- }
-
- /* Recalulate the size and offset as we don't add padding between planes. */
- priv->gl_params->v_info->size = 0;
- for (p = 0; p < GST_VIDEO_INFO_N_PLANES (priv->gl_params->v_info); p++) {
- priv->gl_params->v_info->offset[p] = priv->gl_params->v_info->size;
- priv->gl_params->v_info->size +=
- gst_gl_get_plane_data_size (priv->gl_params->v_info,
- priv->gl_params->valign, p);
- }
-
- gst_buffer_pool_config_set_params (config, caps,
- priv->gl_params->v_info->size, min_buffers, max_buffers);
-
- return GST_BUFFER_POOL_CLASS (parent_class)->set_config (pool, config) && ret;
-
- /* ERRORS */
-wrong_config:
- {
- GST_WARNING_OBJECT (pool, "invalid config");
- return FALSE;
- }
-no_caps:
- {
- GST_WARNING_OBJECT (pool, "no caps in config");
- return FALSE;
- }
-wrong_caps:
- {
- GST_WARNING_OBJECT (pool,
- "failed getting geometry from caps %" GST_PTR_FORMAT, caps);
- return FALSE;
- }
-wrong_allocator:
- {
- GST_WARNING_OBJECT (pool, "Incorrect allocator type for this pool");
- return FALSE;
- }
-}
-
-static gboolean
-gst_gl_buffer_pool_start (GstBufferPool * pool)
-{
- return GST_BUFFER_POOL_CLASS (parent_class)->start (pool);
-}
-
-/* This function handles GstBuffer creation */
-static GstFlowReturn
-gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
- GstBufferPoolAcquireParams * params)
-{
- GstGLMemoryAllocator *alloc;
- GstGLBufferPool *glpool = GST_GL_BUFFER_POOL_CAST (pool);
- GstGLBufferPoolPrivate *priv = glpool->priv;
- GstBuffer *buf;
-
- if (!(buf = gst_buffer_new ())) {
- goto no_buffer;
- }
-
- alloc = GST_GL_MEMORY_ALLOCATOR (priv->allocator);
- if (!gst_gl_memory_setup_buffer (alloc, buf, priv->gl_params, NULL, NULL, 0))
- goto mem_create_failed;
-
- if (priv->add_glsyncmeta)
- gst_buffer_add_gl_sync_meta (glpool->context, buf);
-
- *buffer = buf;
-
- return GST_FLOW_OK;
-
- /* ERROR */
-no_buffer:
- {
- GST_WARNING_OBJECT (pool, "can't create image");
- return GST_FLOW_ERROR;
- }
-mem_create_failed:
- {
- GST_WARNING_OBJECT (pool, "Could not create GL Memory");
- return GST_FLOW_ERROR;
- }
-}
-
-/**
- * gst_gl_buffer_pool_new:
- * @context: the #GstGLContext to use
- *
- * Returns: a #GstBufferPool that allocates buffers with #GstGLMemory
- */
-GstBufferPool *
-gst_gl_buffer_pool_new (GstGLContext * context)
-{
- GstGLBufferPool *pool;
-
- pool = g_object_new (GST_TYPE_GL_BUFFER_POOL, NULL);
- gst_object_ref_sink (pool);
- pool->context = gst_object_ref (context);
-
- GST_LOG_OBJECT (pool, "new GL buffer pool for context %" GST_PTR_FORMAT,
- context);
-
- return GST_BUFFER_POOL_CAST (pool);
-}
-
-static void
-gst_gl_buffer_pool_class_init (GstGLBufferPoolClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstGLBufferPoolPrivate));
-
- gobject_class->finalize = gst_gl_buffer_pool_finalize;
-
- gstbufferpool_class->get_options = gst_gl_buffer_pool_get_options;
- gstbufferpool_class->set_config = gst_gl_buffer_pool_set_config;
- gstbufferpool_class->alloc_buffer = gst_gl_buffer_pool_alloc;
- gstbufferpool_class->start = gst_gl_buffer_pool_start;
-}
-
-static void
-gst_gl_buffer_pool_init (GstGLBufferPool * pool)
-{
- GstGLBufferPoolPrivate *priv = NULL;
-
- pool->priv = GST_GL_BUFFER_POOL_GET_PRIVATE (pool);
- priv = pool->priv;
-
- priv->allocator = NULL;
- priv->caps = NULL;
- priv->add_videometa = TRUE;
- priv->add_glsyncmeta = FALSE;
-}
-
-static void
-gst_gl_buffer_pool_finalize (GObject * object)
-{
- GstGLBufferPool *pool = GST_GL_BUFFER_POOL_CAST (object);
- GstGLBufferPoolPrivate *priv = pool->priv;
-
- GST_LOG_OBJECT (pool, "finalize GL buffer pool %p", pool);
-
- if (priv->caps)
- gst_caps_unref (priv->caps);
-
- G_OBJECT_CLASS (gst_gl_buffer_pool_parent_class)->finalize (object);
-
- /* only release the context once all our memory have been deleted */
- if (pool->context) {
- gst_object_unref (pool->context);
- pool->context = NULL;
- }
-
- if (priv->allocator) {
- gst_object_unref (priv->allocator);
- priv->allocator = NULL;
- }
-
- if (priv->gl_params)
- gst_gl_allocation_params_free ((GstGLAllocationParams *) priv->gl_params);
- priv->gl_params = NULL;
-}
-
-/**
- * gst_buffer_pool_config_get_gl_allocation_params:
- * @config: a buffer pool config
- *
- * Returns: (transfer full): the currently set #GstGLAllocationParams or %NULL
- */
-GstGLAllocationParams *
-gst_buffer_pool_config_get_gl_allocation_params (GstStructure * config)
-{
- GstGLAllocationParams *ret;
-
- if (!gst_structure_get (config, "gl-allocation-params",
- GST_TYPE_GL_ALLOCATION_PARAMS, &ret, NULL))
- ret = NULL;
-
- return ret;
-}
-
-/**
- * gst_buffer_pool_config_set_gl_allocation_params:
- * @config: a buffer pool config
- * @params: (transfer none): a #GstGLAllocationParams
- *
- * Sets @params on @config
- */
-void
-gst_buffer_pool_config_set_gl_allocation_params (GstStructure * config,
- GstGLAllocationParams * params)
-{
- g_return_if_fail (config != NULL);
- g_return_if_fail (params != NULL);
-
- gst_structure_set (config, "gl-allocation-params",
- GST_TYPE_GL_ALLOCATION_PARAMS, params, NULL);
-}
diff --git a/gst-libs/gst/gl/gstglbufferpool.h b/gst-libs/gst/gl/gstglbufferpool.h
deleted file mode 100644
index 0921464d5..000000000
--- a/gst-libs/gst/gl/gstglbufferpool.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_BUFFER_POOL_H_
-#define _GST_GL_BUFFER_POOL_H_
-
-#include <gst/video/gstvideometa.h>
-#include <gst/video/gstvideopool.h>
-
-#include <gst/gl/gstglbasememory.h>
-
-G_BEGIN_DECLS
-
-/* buffer pool functions */
-GST_EXPORT
-GType gst_gl_buffer_pool_get_type (void);
-#define GST_TYPE_GL_BUFFER_POOL (gst_gl_buffer_pool_get_type())
-#define GST_IS_GL_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_BUFFER_POOL))
-#define GST_GL_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_BUFFER_POOL, GstGLBufferPool))
-#define GST_GL_BUFFER_POOL_CAST(obj) ((GstGLBufferPool*)(obj))
-
-/**
- * GstGLBufferPool:
- *
- * Opaque GstGLBufferPool struct
- */
-struct _GstGLBufferPool
-{
- GstBufferPool bufferpool;
-
- GstGLContext *context;
-
- /* <private> */
- GstGLBufferPoolPrivate *priv;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLBufferPoolClass:
- *
- * The #GstGLBufferPoolClass structure contains only private data
- */
-struct _GstGLBufferPoolClass
-{
- GstBufferPoolClass parent_class;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstBufferPool *gst_gl_buffer_pool_new (GstGLContext * context);
-
-GST_EXPORT
-GstGLAllocationParams * gst_buffer_pool_config_get_gl_allocation_params (GstStructure * config);
-GST_EXPORT
-void gst_buffer_pool_config_set_gl_allocation_params (GstStructure * config,
- GstGLAllocationParams * params);
-
-G_END_DECLS
-
-#endif /* _GST_GL_BUFFER_POOL_H_ */
diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c
deleted file mode 100644
index 6bd919754..000000000
--- a/gst-libs/gst/gl/gstglcolorconvert.c
+++ /dev/null
@@ -1,2524 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012-2014 Matthew Waters <ystree00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <stdio.h>
-
-#include "gstglcolorconvert.h"
-
-#include "gl.h"
-#include "gstglfuncs.h"
-#include "gstglsl_private.h"
-
-/**
- * SECTION:gstglcolorconvert
- * @title: GstGLColorConvert
- * @short_description: convert between video color spaces and formats
- * @see_also: #GstGLUpload, #GstGLMemory, #GstGLBaseMemory
- *
- * #GstGLColorConvert is an object that converts between color spaces and/or
- * formats using OpenGL Shaders.
- *
- * A #GstGLColorConvert can be created with gst_gl_color_convert_new(), the
- * configuration negotiated with gst_gl_color_convert_transform_caps() and the
- * conversion performed with gst_gl_color_convert_perform().
- *
- * The glcolorconvertelement provides a GStreamer element that uses
- * #GstGLColorConvert to convert between video formats and color spaces.
- */
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-static void _do_convert (GstGLContext * context, GstGLColorConvert * convert);
-static gboolean _init_convert (GstGLColorConvert * convert);
-static gboolean _init_convert_fbo (GstGLColorConvert * convert);
-static GstBuffer *_gst_gl_color_convert_perform_unlocked (GstGLColorConvert *
- convert, GstBuffer * inbuf);
-
-static gboolean _do_convert_draw (GstGLContext * context,
- GstGLColorConvert * convert);
-
-/* *INDENT-OFF* */
-
-#define YUV_TO_RGB_COEFFICIENTS \
- "uniform vec3 offset;\n" \
- "uniform vec3 coeff1;\n" \
- "uniform vec3 coeff2;\n" \
- "uniform vec3 coeff3;\n"
-
-/* FIXME: use the colormatrix support from videoconvert */
-
-/* BT. 601 standard with the following ranges:
- * Y = [16..235] (of 255)
- * Cb/Cr = [16..240] (of 255)
- */
-static const gfloat from_yuv_bt601_offset[] = {-0.0625f, -0.5f, -0.5f};
-static const gfloat from_yuv_bt601_rcoeff[] = {1.164f, 0.000f, 1.596f};
-static const gfloat from_yuv_bt601_gcoeff[] = {1.164f,-0.391f,-0.813f};
-static const gfloat from_yuv_bt601_bcoeff[] = {1.164f, 2.018f, 0.000f};
-
-/* BT. 709 standard with the following ranges:
- * Y = [16..235] (of 255)
- * Cb/Cr = [16..240] (of 255)
- */
-static const gfloat from_yuv_bt709_offset[] = {-0.0625f, -0.5f, -0.5f};
-static const gfloat from_yuv_bt709_rcoeff[] = {1.164f, 0.000f, 1.787f};
-static const gfloat from_yuv_bt709_gcoeff[] = {1.164f,-0.213f,-0.531f};
-static const gfloat from_yuv_bt709_bcoeff[] = {1.164f,2.112f, 0.000f};
-
-#define RGB_TO_YUV_COEFFICIENTS \
- "uniform vec3 offset;\n" \
- "uniform vec3 coeff1;\n" \
- "uniform vec3 coeff2;\n" \
- "uniform vec3 coeff3;\n"
-
-/* Matrix inverses of the color matrices found above */
-/* BT. 601 standard with the following ranges:
- * Y = [16..235] (of 255)
- * Cb/Cr = [16..240] (of 255)
- */
-static const gfloat from_rgb_bt601_offset[] = {0.0625f, 0.5f, 0.5f};
-static const gfloat from_rgb_bt601_ycoeff[] = {0.256816f, 0.504154f, 0.0979137f};
-static const gfloat from_rgb_bt601_ucoeff[] = {-0.148246f, -0.29102f, 0.439266f};
-static const gfloat from_rgb_bt601_vcoeff[] = {0.439271f, -0.367833f, -0.071438f};
-
-/* BT. 709 standard with the following ranges:
- * Y = [16..235] (of 255)
- * Cb/Cr = [16..240] (of 255)
- */
-static const gfloat from_rgb_bt709_offset[] = {0.0625f, 0.5f, 0.5f};
-static const gfloat from_rgb_bt709_ycoeff[] = {0.182604f, 0.614526f, 0.061976f};
-static const gfloat from_rgb_bt709_ucoeff[] = {-0.100640f, -0.338688f, 0.439327f};
-static const gfloat from_rgb_bt709_vcoeff[] = {0.440654f, -0.400285f, -0.040370f};
-
-/* GRAY16 to RGB conversion
- * data transfered as GL_LUMINANCE_ALPHA then convert back to GRAY16
- * high byte weight as : 255*256/65535
- * ([0~1] denormalize to [0~255],shift to high byte,normalize to [0~1])
- * low byte weight as : 255/65535 (similar)
- * */
-#define COMPOSE_WEIGHT \
- "const vec2 compose_weight = vec2(0.996109, 0.003891);\n"
-
-#define DEFAULT_UNIFORMS \
- "#ifdef GL_ES\n" \
- "precision mediump float;\n" \
- "#endif\n" \
- "uniform vec2 tex_scale0;\n" \
- "uniform vec2 tex_scale1;\n" \
- "uniform vec2 tex_scale2;\n" \
- "uniform float width;\n" \
- "uniform float height;\n" \
- "uniform float poffset_x;\n" \
- "uniform float poffset_y;\n"
-
-#define MAX_FUNCTIONS 4
-
-#define glsl_OES_extension_string "#extension GL_OES_EGL_image_external : require \n"
-
-struct shader_templ
-{
- const gchar *extensions;
- const gchar *uniforms;
- const gchar *functions[MAX_FUNCTIONS];
- const gchar *body;
-
- GstGLTextureTarget target;
-};
-
-#define glsl_func_yuv_to_rgb \
- "vec3 yuv_to_rgb (vec3 val, vec3 offset, vec3 ycoeff, vec3 ucoeff, vec3 vcoeff) {\n" \
- " vec3 rgb;\n" \
- " val += offset;\n" \
- " rgb.r = dot(val, ycoeff);\n" \
- " rgb.g = dot(val, ucoeff);\n" \
- " rgb.b = dot(val, vcoeff);\n" \
- " return rgb;\n" \
- "}\n"
-
-#define glsl_func_rgb_to_yuv \
- "vec3 rgb_to_yuv (vec3 val, vec3 offset, vec3 rcoeff, vec3 gcoeff, vec3 bcoeff) {\n" \
- " vec3 yuv;\n" \
- " yuv.r = dot(val.rgb, rcoeff);\n" \
- " yuv.g = dot(val.rgb, gcoeff);\n" \
- " yuv.b = dot(val.rgb, bcoeff);\n" \
- " yuv += offset;\n" \
- " return yuv;\n" \
- "}\n"
-
-/* Channel reordering for XYZ <-> ZYX conversion */
-static const struct shader_templ templ_REORDER =
- { NULL,
- DEFAULT_UNIFORMS "uniform sampler2D tex;\n",
- { NULL, },
- "vec4 t = texture2D(tex, texcoord * tex_scale0);\n"
- "%s\n" /* clobber alpha channel? */
- "gl_FragColor = vec4(t.%c, t.%c, t.%c, t.%c);\n",
- GST_GL_TEXTURE_TARGET_2D
- };
-
-/* GRAY16 to RGB conversion
- * data transfered as GL_LUMINANCE_ALPHA then convert back to GRAY16
- * high byte weight as : 255*256/65535
- * ([0~1] denormalize to [0~255],shift to high byte,normalize to [0~1])
- * low byte weight as : 255/65535 (similar)
- * */
-static const struct shader_templ templ_COMPOSE =
- { NULL,
- DEFAULT_UNIFORMS COMPOSE_WEIGHT "uniform sampler2D tex;\n",
- { NULL, },
- "vec4 rgba;\n"
- "vec4 t = texture2D(tex, texcoord * tex_scale0);\n"
- "rgba.rgb = vec3 (dot(t.%c%c, compose_weight));"
- "rgba.a = 1.0;\n"
- "gl_FragColor = vec4(rgba.%c, rgba.%c, rgba.%c, rgba.%c);\n",
- GST_GL_TEXTURE_TARGET_2D
- };
-
-static const struct shader_templ templ_AYUV_to_RGB =
- { NULL,
- DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D tex;\n",
- { glsl_func_yuv_to_rgb, NULL, },
- "vec4 texel, rgba;\n"
- "texel = texture2D(tex, texcoord * tex_scale0);\n"
- "rgba.rgb = yuv_to_rgb (texel.yzw, offset, coeff1, coeff2, coeff3);\n"
- "rgba.a = texel.r;\n"
- "gl_FragColor=vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n",
- GST_GL_TEXTURE_TARGET_2D
- };
-
-static const struct shader_templ templ_RGB_to_AYUV =
- { NULL,
- DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n",
- { glsl_func_rgb_to_yuv, NULL, },
- "vec4 texel, ayuv;\n"
- "texel = texture2D(tex, texcoord).%c%c%c%c;\n"
- "ayuv.yzw = rgb_to_yuv (texel.rgb, offset, coeff1, coeff2, coeff3);\n"
- "ayuv.x = %s;\n"
- "gl_FragColor = ayuv;\n",
- GST_GL_TEXTURE_TARGET_2D
- };
-
-/* YUV to RGB conversion */
-static const struct shader_templ templ_PLANAR_YUV_to_RGB =
- { NULL,
- DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex, Utex, Vtex;\n",
- { glsl_func_yuv_to_rgb, NULL, },
- "vec4 texel, rgba;\n"
- /* FIXME: should get the sampling right... */
- "texel.x = texture2D(Ytex, texcoord * tex_scale0).r;\n"
- "texel.y = texture2D(Utex, texcoord * tex_scale1).r;\n"
- "texel.z = texture2D(Vtex, texcoord * tex_scale2).r;\n"
- "rgba.rgb = yuv_to_rgb (texel.xyz, offset, coeff1, coeff2, coeff3);\n"
- "rgba.a = 1.0;\n"
- "gl_FragColor=vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n",
- GST_GL_TEXTURE_TARGET_2D
- };
-
-static const struct shader_templ templ_RGB_to_PLANAR_YUV =
- { NULL,
- DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n"
- "uniform vec2 chroma_sampling;\n",
- { glsl_func_rgb_to_yuv, NULL, },
- "vec4 texel;\n"
- "vec3 yuv;\n"
- "texel = texture2D(tex, texcoord).%c%c%c%c;\n"
- /* FIXME: this is not quite correct yet */
- "vec4 uv_texel = vec4(0.0);\n"
- /* One u and v sample can be generated by a nxm sized block given by
- * @chroma_sampling. The result is the average of all the values in the
- * block computed with a rolling average.
- */
- "vec2 unnormalization;\n"
- "if (texcoord.x == v_texcoord.x) {\n"
- " unnormalization = vec2(width, height);\n"
- "} else {\n"
- " unnormalization = vec2 (1.0);\n"
- "}\n"
- /* scale for chroma size */
- "vec2 chroma_pos = texcoord * chroma_sampling * unnormalization;\n"
- /* offset chroma to the center of the first texel in the block */
- "chroma_pos -= clamp(chroma_sampling * 0.5 - 0.5, vec2(0.0), chroma_sampling);\n"
- "if (chroma_pos.x < width && chroma_pos.y < height) {\n"
- " for (int i = 0; i < int(chroma_sampling.x); i++) {\n"
- " vec2 delta = vec2 (float(i), 0.0);\n"
- " for (int j = 0; j < int(chroma_sampling.y); j++) {\n"
- " int n = (i+1)*(j+1);\n"
- " delta.y = float(j);\n"
- " vec4 s = texture2D(tex, (chroma_pos + delta) / unnormalization).%c%c%c%c;\n"
- /* rolling average */
- " uv_texel = (float(n-1) * uv_texel + s) / float(n);\n"
- " }\n"
- " }\n"
- "}\n"
- "yuv.x = rgb_to_yuv (texel.rgb, offset, coeff1, coeff2, coeff3).x;\n"
- "yuv.yz = rgb_to_yuv (uv_texel.rgb, offset, coeff1, coeff2, coeff3).yz;\n"
- "gl_FragData[0] = vec4(yuv.x, 0.0, 0.0, 1.0);\n"
- "gl_FragData[1] = vec4(yuv.y, 0.0, 0.0, 1.0);\n"
- "gl_FragData[2] = vec4(yuv.z, 0.0, 0.0, 1.0);\n",
- GST_GL_TEXTURE_TARGET_2D
- };
-
-/* NV12/NV21 to RGB conversion */
-static const struct shader_templ templ_NV12_NV21_to_RGB =
- { NULL,
- DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex, UVtex;\n",
- { glsl_func_yuv_to_rgb, NULL, },
- "vec4 rgba;\n"
- "vec3 yuv;\n"
- /* FIXME: should get the sampling right... */
- "yuv.x=texture2D(Ytex, texcoord * tex_scale0).r;\n"
- "yuv.yz=texture2D(UVtex, texcoord * tex_scale1).%c%c;\n"
- "rgba.rgb = yuv_to_rgb (yuv, offset, coeff1, coeff2, coeff3);\n"
- "rgba.a = 1.0;\n"
- "gl_FragColor=vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n",
- GST_GL_TEXTURE_TARGET_2D
- };
-
-/* RGB to NV12/NV21 conversion */
-/* NV12: u, v
- NV21: v, u */
-static const struct shader_templ templ_RGB_to_NV12_NV21 =
- { NULL,
- DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n",
- { glsl_func_rgb_to_yuv, NULL, },
- "vec4 texel, uv_texel;\n"
- "vec3 yuv;\n"
- "texel = texture2D(tex, texcoord).%c%c%c%c;\n"
- "uv_texel = texture2D(tex, texcoord * tex_scale0 * 2.0).%c%c%c%c;\n"
- "yuv.x = rgb_to_yuv (texel.rgb, offset, coeff1, coeff2, coeff3).x;\n"
- "yuv.yz = rgb_to_yuv (uv_texel.rgb, offset, coeff1, coeff2, coeff3).yz;\n"
- "gl_FragData[0] = vec4(yuv.x, 0.0, 0.0, 1.0);\n"
- "gl_FragData[1] = vec4(yuv.%c, yuv.%c, 0.0, 1.0);\n",
- GST_GL_TEXTURE_TARGET_2D
- };
-
-/* YUY2:r,g,a
- UYVY:a,b,r */
-static const struct shader_templ templ_YUY2_UYVY_to_RGB =
- { NULL,
- DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex;\n",
- { glsl_func_yuv_to_rgb, NULL, },
- "vec4 rgba, uv_texel;\n"
- "vec3 yuv;\n"
- /* FIXME: should get the sampling right... */
- "float dx1 = -poffset_x;\n"
- "float dx2 = 0.0;\n"
- "yuv.x = texture2D(Ytex, texcoord * tex_scale0).%c;\n"
- /* v_texcoord are normalized, texcoord may not be e.g. rectangle textures */
- "float inorder = mod (v_texcoord.x * width, 2.0);\n"
- "if (inorder < 1.0) {\n"
- " dx2 = -dx1;\n"
- " dx1 = 0.0;\n"
- "}\n"
- "uv_texel.rg = texture2D(Ytex, texcoord * tex_scale0 + vec2(dx1, 0.0)).r%c;\n"
- "uv_texel.ba = texture2D(Ytex, texcoord * tex_scale0 + vec2(dx2, 0.0)).r%c;\n"
- "yuv.yz = uv_texel.%c%c;\n"
- "rgba.rgb = yuv_to_rgb (yuv, offset, coeff1, coeff2, coeff3);\n"
- "rgba.a = 1.0;\n"
- "gl_FragColor = vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n",
- GST_GL_TEXTURE_TARGET_2D
- };
-
-static const struct shader_templ templ_RGB_to_YUY2_UYVY =
- { NULL,
- DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n",
- { glsl_func_rgb_to_yuv, NULL, },
- "vec4 texel1, texel2;\n"
- "vec3 yuv, yuv1, yuv2;\n"
- "float fx, dx, fy;\n"
- /* v_texcoord are normalized, texcoord may not be e.g. rectangle textures */
- "float inorder = mod (v_texcoord.x * width, 2.0);\n"
- "fx = texcoord.x;\n"
- "dx = poffset_x;\n"
- "if (inorder > 1.0) {\n"
- " dx = -dx;\n"
- "}\n"
- "fy = texcoord.y;\n"
- "texel1 = texture2D(tex, vec2(fx, fy)).%c%c%c%c;\n"
- "texel2 = texture2D(tex, vec2(fx + dx, fy)).%c%c%c%c;\n"
- "yuv1 = rgb_to_yuv (texel1.rgb, offset, coeff1, coeff2, coeff3);\n"
- "yuv2 = rgb_to_yuv (texel2.rgb, offset, coeff1, coeff2, coeff3);\n"
- "yuv.x = yuv1.x;\n"
- "yuv.yz = (yuv1.yz + yuv2.yz) * 0.5;\n"
- "if (inorder < 1.0) {\n"
- " gl_FragColor = vec4(yuv.%c, yuv.%c, 0.0, 0.0);\n"
- "} else {\n"
- " gl_FragColor = vec4(yuv.%c, yuv.%c, 0.0, 0.0);\n"
- "}\n",
- GST_GL_TEXTURE_TARGET_2D
- };
-
-static const gchar text_vertex_shader[] =
- "attribute vec4 a_position; \n"
- "attribute vec2 a_texcoord; \n"
- "varying vec2 v_texcoord; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = a_position; \n"
- " v_texcoord = a_texcoord; \n"
- "} \n";
-
-static const GLfloat vertices[] = {
- 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
- -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,
- -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 0.0f, 1.0f, 1.0f
-};
-
-static const GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
-/* *INDENT-ON* */
-
-struct ConvertInfo
-{
- gint in_n_textures;
- gint out_n_textures;
- const struct shader_templ *templ;
- gchar *frag_body;
- gchar *frag_prog;
- const gchar *shader_tex_names[GST_VIDEO_MAX_PLANES];
- gfloat *cms_offset;
- gfloat *cms_coeff1; /* r,y */
- gfloat *cms_coeff2; /* g,u */
- gfloat *cms_coeff3; /* b,v */
- gfloat chroma_sampling[2];
-};
-
-struct _GstGLColorConvertPrivate
-{
- gboolean result;
-
- struct ConvertInfo convert_info;
-
- GstGLTextureTarget from_texture_target;
- GstGLTextureTarget to_texture_target;
-
- GstGLMemory *in_tex[GST_VIDEO_MAX_PLANES];
- GstGLMemory *out_tex[GST_VIDEO_MAX_PLANES];
-
- GstGLFormat in_tex_formats[GST_VIDEO_MAX_PLANES];
-
- GLuint vao;
- GLuint vertex_buffer;
- GLuint vbo_indices;
- GLuint attr_position;
- GLuint attr_texture;
-
- GstCaps *in_caps;
- GstCaps *out_caps;
-
- GstBufferPool *pool;
- gboolean pool_started;
-};
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_color_convert_debug);
-#define GST_CAT_DEFAULT gst_gl_color_convert_debug
-
-#define DEBUG_INIT \
- GST_DEBUG_CATEGORY_INIT (gst_gl_color_convert_debug, "glconvert", 0, "convert");
-
-G_DEFINE_TYPE_WITH_CODE (GstGLColorConvert, gst_gl_color_convert,
- GST_TYPE_OBJECT, DEBUG_INIT);
-static void gst_gl_color_convert_finalize (GObject * object);
-static void gst_gl_color_convert_reset (GstGLColorConvert * convert);
-
-#define GST_GL_COLOR_CONVERT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- GST_TYPE_GL_COLOR_CONVERT, GstGLColorConvertPrivate))
-
-static void
-gst_gl_color_convert_class_init (GstGLColorConvertClass * klass)
-{
- g_type_class_add_private (klass, sizeof (GstGLColorConvertPrivate));
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_color_convert_finalize;
-}
-
-static void
-gst_gl_color_convert_init (GstGLColorConvert * convert)
-{
- convert->priv = GST_GL_COLOR_CONVERT_GET_PRIVATE (convert);
-
- gst_gl_color_convert_reset (convert);
-}
-
-/**
- * gst_gl_color_convert_new:
- * @context: a #GstGLContext
- *
- * Returns: (transfer full): a new #GstGLColorConvert object
- *
- * Since: 1.4
- */
-GstGLColorConvert *
-gst_gl_color_convert_new (GstGLContext * context)
-{
- GstGLColorConvert *convert;
-
- convert = g_object_new (GST_TYPE_GL_COLOR_CONVERT, NULL);
- gst_object_ref_sink (convert);
-
- convert->context = gst_object_ref (context);
-
- gst_video_info_set_format (&convert->in_info, GST_VIDEO_FORMAT_ENCODED, 0, 0);
- gst_video_info_set_format (&convert->out_info, GST_VIDEO_FORMAT_ENCODED, 0,
- 0);
-
- GST_DEBUG_OBJECT (convert,
- "Created new colorconvert for context %" GST_PTR_FORMAT, context);
-
- return convert;
-}
-
-static void
-gst_gl_color_convert_finalize (GObject * object)
-{
- GstGLColorConvert *convert;
-
- convert = GST_GL_COLOR_CONVERT (object);
-
- gst_gl_color_convert_reset (convert);
-
- if (convert->context) {
- gst_object_unref (convert->context);
- convert->context = NULL;
- }
-
- G_OBJECT_CLASS (gst_gl_color_convert_parent_class)->finalize (object);
-}
-
-static void
-_reset_gl (GstGLContext * context, GstGLColorConvert * convert)
-{
- const GstGLFuncs *gl = context->gl_vtable;
-
- if (convert->priv->vao) {
- gl->DeleteVertexArrays (1, &convert->priv->vao);
- convert->priv->vao = 0;
- }
-
- if (convert->priv->vertex_buffer) {
- gl->DeleteBuffers (1, &convert->priv->vertex_buffer);
- convert->priv->vertex_buffer = 0;
- }
-
- if (convert->priv->vbo_indices) {
- gl->DeleteBuffers (1, &convert->priv->vbo_indices);
- convert->priv->vbo_indices = 0;
- }
-}
-
-static void
-gst_gl_color_convert_reset_shader (GstGLColorConvert * convert)
-{
- convert->priv->convert_info.chroma_sampling[0] = 1.0f;
- convert->priv->convert_info.chroma_sampling[1] = 1.0f;
-
- if (convert->priv->convert_info.frag_prog) {
- g_free (convert->priv->convert_info.frag_prog);
- convert->priv->convert_info.frag_prog = NULL;
- }
- if (convert->priv->convert_info.frag_body) {
- g_free (convert->priv->convert_info.frag_body);
- convert->priv->convert_info.frag_body = NULL;
- }
- if (convert->shader) {
- gst_object_unref (convert->shader);
- convert->shader = NULL;
- }
-
- convert->initted = FALSE;
-}
-
-static void
-gst_gl_color_convert_reset (GstGLColorConvert * convert)
-{
- guint i;
-
- if (convert->fbo) {
- gst_object_unref (convert->fbo);
- convert->fbo = NULL;
- }
-
- for (i = 0; i < convert->priv->convert_info.out_n_textures; i++) {
- if (convert->priv->out_tex[i])
- gst_memory_unref ((GstMemory *) convert->priv->out_tex[i]);
- convert->priv->out_tex[i] = NULL;
- }
-
- if (convert->priv->pool) {
- convert->priv->pool_started = FALSE;
-
- gst_object_unref (convert->priv->pool);
- convert->priv->pool = NULL;
- }
-
- gst_caps_replace (&convert->priv->in_caps, NULL);
- gst_caps_replace (&convert->priv->out_caps, NULL);
-
- if (convert->context) {
- gst_gl_context_thread_add (convert->context,
- (GstGLContextThreadFunc) _reset_gl, convert);
- }
-
- gst_gl_color_convert_reset_shader (convert);
-}
-
-static gboolean
-_gst_gl_color_convert_can_passthrough_info (GstVideoInfo * in,
- GstVideoInfo * out)
-{
- gint i;
-
- if (GST_VIDEO_INFO_FORMAT (in) != GST_VIDEO_INFO_FORMAT (out))
- return FALSE;
- if (GST_VIDEO_INFO_WIDTH (in) != GST_VIDEO_INFO_WIDTH (out))
- return FALSE;
- if (GST_VIDEO_INFO_HEIGHT (in) != GST_VIDEO_INFO_HEIGHT (out))
- return FALSE;
- if (GST_VIDEO_INFO_SIZE (in) != GST_VIDEO_INFO_SIZE (out))
- return FALSE;
-
- for (i = 0; i < in->finfo->n_planes; i++) {
- if (in->stride[i] != out->stride[i])
- return FALSE;
- if (in->offset[i] != out->offset[i])
- return FALSE;
- }
-
- if (!gst_video_colorimetry_is_equal (&in->colorimetry, &out->colorimetry))
- return FALSE;
- if (in->chroma_site != out->chroma_site)
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-_gst_gl_color_convert_set_caps_unlocked (GstGLColorConvert * convert,
- GstCaps * in_caps, GstCaps * out_caps)
-{
- GstVideoInfo in_info, out_info;
- GstCapsFeatures *in_features, *out_features;
- GstGLTextureTarget from_target, to_target;
- gboolean passthrough;
-
- g_return_val_if_fail (convert != NULL, FALSE);
- g_return_val_if_fail (in_caps, FALSE);
- g_return_val_if_fail (out_caps, FALSE);
-
- GST_LOG_OBJECT (convert, "Setting caps in %" GST_PTR_FORMAT
- " out %" GST_PTR_FORMAT, in_caps, out_caps);
-
- if (!gst_video_info_from_caps (&in_info, in_caps))
- g_assert_not_reached ();
-
- if (!gst_video_info_from_caps (&out_info, out_caps))
- g_assert_not_reached ();
-
- g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&in_info) !=
- GST_VIDEO_FORMAT_UNKNOWN, FALSE);
- g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&in_info) !=
- GST_VIDEO_FORMAT_ENCODED, FALSE);
- g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&out_info) !=
- GST_VIDEO_FORMAT_UNKNOWN, FALSE);
- g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&out_info) !=
- GST_VIDEO_FORMAT_ENCODED, FALSE);
-
- in_features = gst_caps_get_features (in_caps, 0);
- out_features = gst_caps_get_features (out_caps, 0);
-
- if (!gst_caps_features_contains (in_features,
- GST_CAPS_FEATURE_MEMORY_GL_MEMORY)
- || !gst_caps_features_contains (out_features,
- GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
- return FALSE;
- }
-
- {
- GstStructure *in_s = gst_caps_get_structure (in_caps, 0);
- GstStructure *out_s = gst_caps_get_structure (out_caps, 0);
-
- if (gst_structure_has_field_typed (in_s, "texture-target", G_TYPE_STRING))
- from_target =
- gst_gl_texture_target_from_string (gst_structure_get_string (in_s,
- "texture-target"));
- else
- from_target = GST_GL_TEXTURE_TARGET_2D;
-
- if (gst_structure_has_field_typed (out_s, "texture-target", G_TYPE_STRING))
- to_target =
- gst_gl_texture_target_from_string (gst_structure_get_string (out_s,
- "texture-target"));
- else
- to_target = GST_GL_TEXTURE_TARGET_2D;
-
- if (to_target == GST_GL_TEXTURE_TARGET_NONE
- || from_target == GST_GL_TEXTURE_TARGET_NONE)
- /* invalid caps */
- return FALSE;
- }
-
- if (gst_video_info_is_equal (&convert->in_info, &in_info) &&
- gst_video_info_is_equal (&convert->out_info, &out_info) &&
- convert->priv->from_texture_target == from_target &&
- convert->priv->to_texture_target == to_target)
- return TRUE;
-
- /* If input and output are identical, pass through directly */
- passthrough =
- _gst_gl_color_convert_can_passthrough_info (&in_info, &out_info) &&
- from_target == to_target;
-
- if (!passthrough && to_target != GST_GL_TEXTURE_TARGET_2D
- && to_target != GST_GL_TEXTURE_TARGET_RECTANGLE)
- return FALSE;
-
- {
- guint yuv_gray_flags, in_flags, out_flags;
-
- in_flags = GST_VIDEO_FORMAT_INFO_FLAGS (in_info.finfo);
- out_flags = GST_VIDEO_FORMAT_INFO_FLAGS (out_info.finfo);
- yuv_gray_flags = GST_VIDEO_FORMAT_FLAG_YUV | GST_VIDEO_FORMAT_FLAG_GRAY;
-
- /* GRAY/YUV -> GRAY/YUV is not supported for non-passthrough */
- if (!passthrough && (in_flags & yuv_gray_flags) != 0
- && (out_flags & yuv_gray_flags) != 0)
- return FALSE;
- }
-
- gst_gl_color_convert_reset (convert);
- convert->in_info = in_info;
- convert->out_info = out_info;
- gst_caps_replace (&convert->priv->in_caps, in_caps);
- gst_caps_replace (&convert->priv->out_caps, out_caps);
- convert->priv->from_texture_target = from_target;
- convert->priv->to_texture_target = to_target;
- convert->initted = FALSE;
-
- convert->passthrough = passthrough;
-#ifndef GST_DISABLE_GST_DEBUG
- if (G_UNLIKELY (convert->passthrough))
- GST_DEBUG_OBJECT (convert,
- "Configuring passthrough mode for same in/out caps");
- else {
- GST_DEBUG_OBJECT (convert, "Color converting %" GST_PTR_FORMAT
- " to %" GST_PTR_FORMAT, in_caps, out_caps);
- }
-#endif
-
- return TRUE;
-}
-
-/**
- * gst_gl_color_convert_set_caps:
- * @convert: a #GstGLColorConvert
- * @in_caps: input #GstCaps
- * @out_caps: output #GstCaps
- *
- * Initializes @convert with the information required for conversion.
- *
- * Since: 1.6
- */
-gboolean
-gst_gl_color_convert_set_caps (GstGLColorConvert * convert,
- GstCaps * in_caps, GstCaps * out_caps)
-{
- gboolean ret;
-
- GST_OBJECT_LOCK (convert);
- ret = _gst_gl_color_convert_set_caps_unlocked (convert, in_caps, out_caps);
- GST_OBJECT_UNLOCK (convert);
-
- return ret;
-}
-
-/**
- * gst_gl_color_convert_decide_allocation:
- * @convert: a #GstGLColorConvert
- * @query: a completed ALLOCATION #GstQuery
- *
- * Provides an implementation of #GstBaseTransfromClass::decide_allocation()
- *
- * Returns: whether the allocation parameters were successfully chosen
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_color_convert_decide_allocation (GstGLColorConvert * convert,
- GstQuery * query)
-{
- GstBufferPool *pool = NULL;
- GstStructure *config;
- GstCaps *caps;
- guint min, max, size, n, i;
- gboolean update_pool;
- GstGLVideoAllocationParams *params;
- GstVideoInfo vinfo;
-
- gst_query_parse_allocation (query, &caps, NULL);
- if (!caps)
- return FALSE;
-
- gst_video_info_from_caps (&vinfo, caps);
-
- n = gst_query_get_n_allocation_pools (query);
- if (n > 0) {
- update_pool = TRUE;
- for (i = 0; i < n; i++) {
- gst_query_parse_nth_allocation_pool (query, i, &pool, &size, &min, &max);
-
- if (!pool || !GST_IS_GL_BUFFER_POOL (pool)) {
- if (pool)
- gst_object_unref (pool);
- pool = NULL;
- }
- }
- }
-
- if (!pool) {
- GstVideoInfo vinfo;
-
- gst_video_info_init (&vinfo);
- size = vinfo.size;
- min = max = 0;
- update_pool = FALSE;
- }
-
- if (!pool)
- pool = gst_gl_buffer_pool_new (convert->context);
-
- config = gst_buffer_pool_get_config (pool);
-
- gst_buffer_pool_config_set_params (config, caps, size, min, max);
- gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
- if (gst_query_find_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, NULL))
- gst_buffer_pool_config_add_option (config,
- GST_BUFFER_POOL_OPTION_GL_SYNC_META);
-
- params = gst_gl_video_allocation_params_new (convert->context, NULL, &vinfo,
- 0, NULL, convert->priv->to_texture_target, 0);
- gst_buffer_pool_config_set_gl_allocation_params (config,
- (GstGLAllocationParams *) params);
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
-
- if (!gst_buffer_pool_set_config (pool, config))
- GST_WARNING_OBJECT (convert, "Failed to set buffer pool config");
-
- if (update_pool)
- gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
- else
- gst_query_add_allocation_pool (query, pool, size, min, max);
-
- if (convert->priv->pool) {
- gst_object_unref (convert->priv->pool);
- convert->priv->pool_started = FALSE;
- }
- convert->priv->pool = pool;
-
- return TRUE;
-}
-
-static void
-_init_value_string_list (GValue * list, ...)
-{
- GValue item = G_VALUE_INIT;
- gchar *str;
- va_list args;
-
- g_value_init (list, GST_TYPE_LIST);
-
- va_start (args, list);
- while ((str = va_arg (args, gchar *))) {
- g_value_init (&item, G_TYPE_STRING);
- g_value_set_string (&item, str);
-
- gst_value_list_append_value (list, &item);
- g_value_unset (&item);
- }
- va_end (args);
-}
-
-/* copies the given caps */
-static GstCaps *
-gst_gl_color_convert_caps_transform_format_info (GstCaps * caps)
-{
- GstStructure *st;
- GstCapsFeatures *f;
- gint i, n;
- GstCaps *res;
- GValue rgb_formats = G_VALUE_INIT;
-
- _init_value_string_list (&rgb_formats, "RGBA", "ARGB", "BGRA", "ABGR", "RGBx",
- "xRGB", "BGRx", "xBGR", "RGB", "BGR", NULL);
-
- res = gst_caps_new_empty ();
-
- n = gst_caps_get_size (caps);
- for (i = 0; i < n; i++) {
- const GValue *format;
-
- st = gst_caps_get_structure (caps, i);
- f = gst_caps_get_features (caps, i);
-
- format = gst_structure_get_value (st, "format");
- st = gst_structure_copy (st);
- if (GST_VALUE_HOLDS_LIST (format)) {
- gboolean have_rgb_formats = FALSE;
- GValue passthrough_formats = G_VALUE_INIT;
- gint j, len;
-
- g_value_init (&passthrough_formats, GST_TYPE_LIST);
- len = gst_value_list_get_size (format);
- for (j = 0; j < len; j++) {
- const GValue *val;
-
- val = gst_value_list_get_value (format, j);
- if (G_VALUE_HOLDS_STRING (val)) {
- const gchar *format_str = g_value_get_string (val);
- GstVideoFormat v_format = gst_video_format_from_string (format_str);
- const GstVideoFormatInfo *t_info =
- gst_video_format_get_info (v_format);
- if (GST_VIDEO_FORMAT_INFO_FLAGS (t_info) & (GST_VIDEO_FORMAT_FLAG_YUV
- | GST_VIDEO_FORMAT_FLAG_GRAY)) {
- gst_value_list_append_value (&passthrough_formats, val);
- } else if (GST_VIDEO_FORMAT_INFO_FLAGS (t_info) &
- GST_VIDEO_FORMAT_FLAG_RGB) {
- have_rgb_formats = TRUE;
- break;
- }
- }
- }
- if (have_rgb_formats) {
- gst_structure_remove_fields (st, "format", NULL);
- } else {
- /* add passthrough structure, then the rgb conversion structure */
- gst_structure_set_value (st, "format", &passthrough_formats);
- gst_caps_append_structure_full (res, gst_structure_copy (st),
- gst_caps_features_copy (f));
- gst_structure_set_value (st, "format", &rgb_formats);
- }
- g_value_unset (&passthrough_formats);
- } else if (G_VALUE_HOLDS_STRING (format)) {
- const gchar *format_str = g_value_get_string (format);
- GstVideoFormat v_format = gst_video_format_from_string (format_str);
- const GstVideoFormatInfo *t_info = gst_video_format_get_info (v_format);
- if (GST_VIDEO_FORMAT_INFO_FLAGS (t_info) & (GST_VIDEO_FORMAT_FLAG_YUV |
- GST_VIDEO_FORMAT_FLAG_GRAY)) {
- /* add passthrough structure, then the rgb conversion structure */
- gst_structure_set_value (st, "format", format);
- gst_caps_append_structure_full (res, gst_structure_copy (st),
- gst_caps_features_copy (f));
- gst_structure_set_value (st, "format", &rgb_formats);
- } else { /* RGB */
- gst_structure_remove_fields (st, "format", NULL);
- }
- }
- gst_structure_remove_fields (st, "colorimetry", "chroma-site",
- "texture-target", NULL);
-
- gst_caps_append_structure_full (res, st, gst_caps_features_copy (f));
- }
-
- g_value_unset (&rgb_formats);
-
- return res;
-}
-
-/**
- * gst_gl_color_convert_transform_caps:
- * @context: a #GstGLContext to use for transforming @caps
- * @direction: a #GstPadDirection
- * @caps: (transfer none): the #GstCaps to transform
- * @filter: (transfer none): a set of filter #GstCaps
- *
- * Provides an implementation of #GstBaseTransformClass::transform_caps()
- *
- * Returns: (transfer full): the converted #GstCaps
- *
- * Since: 1.6
- */
-GstCaps *
-gst_gl_color_convert_transform_caps (GstGLContext * context,
- GstPadDirection direction, GstCaps * caps, GstCaps * filter)
-{
- caps = gst_gl_color_convert_caps_transform_format_info (caps);
-
- if (filter) {
- GstCaps *tmp;
-
- tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (caps);
- caps = tmp;
- }
-
- return caps;
-}
-
-/* fixation from videoconvert */
-#define SCORE_FORMAT_CHANGE 1
-#define SCORE_DEPTH_CHANGE 1
-#define SCORE_ALPHA_CHANGE 1
-#define SCORE_CHROMA_W_CHANGE 1
-#define SCORE_CHROMA_H_CHANGE 1
-#define SCORE_PALETTE_CHANGE 1
-
-#define SCORE_COLORSPACE_LOSS 2 /* RGB <-> YUV */
-#define SCORE_DEPTH_LOSS 4 /* change bit depth */
-#define SCORE_ALPHA_LOSS 8 /* lose the alpha channel */
-#define SCORE_CHROMA_W_LOSS 16 /* vertical subsample */
-#define SCORE_CHROMA_H_LOSS 32 /* horizontal subsample */
-#define SCORE_PALETTE_LOSS 64 /* convert to palette format */
-#define SCORE_COLOR_LOSS 128 /* convert to GRAY */
-
-#define COLORSPACE_MASK (GST_VIDEO_FORMAT_FLAG_YUV | \
- GST_VIDEO_FORMAT_FLAG_RGB | GST_VIDEO_FORMAT_FLAG_GRAY)
-#define ALPHA_MASK (GST_VIDEO_FORMAT_FLAG_ALPHA)
-#define PALETTE_MASK (GST_VIDEO_FORMAT_FLAG_PALETTE)
-
-static GstGLTextureTarget
-_texture_target_demask (guint target_mask)
-{
- if (target_mask & (1 << GST_GL_TEXTURE_TARGET_2D)) {
- return GST_GL_TEXTURE_TARGET_2D;
- }
- if (target_mask & (1 << GST_GL_TEXTURE_TARGET_RECTANGLE)) {
- return GST_GL_TEXTURE_TARGET_RECTANGLE;
- }
- if (target_mask & (1 << GST_GL_TEXTURE_TARGET_EXTERNAL_OES)) {
- return GST_GL_TEXTURE_TARGET_EXTERNAL_OES;
- }
-
- return 0;
-}
-
-/* calculate how much loss a conversion would be */
-static void
-score_format_target (const GstVideoFormatInfo * in_info, guint targets_mask,
- GstVideoFormat v_format, guint other_targets_mask, gint * min_loss,
- const GstVideoFormatInfo ** out_info, GstGLTextureTarget * result)
-{
- const GstVideoFormatInfo *t_info;
- GstVideoFormatFlags in_flags, t_flags;
- gint loss;
-
- t_info = gst_video_format_get_info (v_format);
- if (!t_info)
- return;
-
- /* accept input format immediately without loss */
- if (in_info == t_info && (targets_mask & other_targets_mask) != 0) {
- *min_loss = 0;
- *out_info = t_info;
- *result = _texture_target_demask (targets_mask & other_targets_mask);
- return;
- }
-
- /* can only passthrough external-oes textures */
- other_targets_mask &= ~(1 << GST_GL_TEXTURE_TARGET_EXTERNAL_OES);
- if (other_targets_mask == 0)
- return;
- /* try to keep the same target */
- if (targets_mask & other_targets_mask)
- other_targets_mask = targets_mask & other_targets_mask;
-
- loss = SCORE_FORMAT_CHANGE;
-
- in_flags = GST_VIDEO_FORMAT_INFO_FLAGS (in_info);
- in_flags &= ~GST_VIDEO_FORMAT_FLAG_LE;
- in_flags &= ~GST_VIDEO_FORMAT_FLAG_COMPLEX;
- in_flags &= ~GST_VIDEO_FORMAT_FLAG_UNPACK;
-
- t_flags = GST_VIDEO_FORMAT_INFO_FLAGS (t_info);
- t_flags &= ~GST_VIDEO_FORMAT_FLAG_LE;
- t_flags &= ~GST_VIDEO_FORMAT_FLAG_COMPLEX;
- t_flags &= ~GST_VIDEO_FORMAT_FLAG_UNPACK;
-
- /* GRAY/YUV -> GRAY/YUV is not supported */
- if ((in_flags & (GST_VIDEO_FORMAT_FLAG_YUV | GST_VIDEO_FORMAT_FLAG_GRAY)) != 0
- && (t_flags & (GST_VIDEO_FORMAT_FLAG_YUV | GST_VIDEO_FORMAT_FLAG_GRAY)) !=
- 0)
- return;
-
- if ((t_flags & PALETTE_MASK) != (in_flags & PALETTE_MASK)) {
- loss += SCORE_PALETTE_CHANGE;
- if (t_flags & PALETTE_MASK)
- loss += SCORE_PALETTE_LOSS;
- }
-
- if ((t_flags & COLORSPACE_MASK) != (in_flags & COLORSPACE_MASK)) {
- loss += SCORE_COLORSPACE_LOSS;
- if (t_flags & GST_VIDEO_FORMAT_FLAG_GRAY)
- loss += SCORE_COLOR_LOSS;
- }
-
- if ((t_flags & ALPHA_MASK) != (in_flags & ALPHA_MASK)) {
- loss += SCORE_ALPHA_CHANGE;
- if (in_flags & ALPHA_MASK)
- loss += SCORE_ALPHA_LOSS;
- }
-
- if ((in_info->h_sub[1]) != (t_info->h_sub[1])) {
- loss += SCORE_CHROMA_H_CHANGE;
- if ((in_info->h_sub[1]) < (t_info->h_sub[1]))
- loss += SCORE_CHROMA_H_LOSS;
- }
- if ((in_info->w_sub[1]) != (t_info->w_sub[1])) {
- loss += SCORE_CHROMA_W_CHANGE;
- if ((in_info->w_sub[1]) < (t_info->w_sub[1]))
- loss += SCORE_CHROMA_W_LOSS;
- }
-
- if ((in_info->bits) != (t_info->bits)) {
- loss += SCORE_DEPTH_CHANGE;
- if ((in_info->bits) > (t_info->bits))
- loss += SCORE_DEPTH_LOSS;
- }
-
- if (loss < *min_loss) {
- GstGLTextureTarget target = _texture_target_demask (other_targets_mask);
-
- if (target != 0) {
- *out_info = t_info;
- *min_loss = loss;
- *result = target;
- }
- }
-}
-
-static void
-gst_gl_color_convert_fixate_format_target (GstCaps * caps, GstCaps * result)
-{
- GstStructure *ins, *outs;
- const gchar *in_format;
- const GstVideoFormatInfo *in_info, *out_info = NULL;
- const GValue *targets;
- guint targets_mask = 0;
- GstGLTextureTarget target;
- gint min_loss = G_MAXINT;
- guint i, capslen;
-
- ins = gst_caps_get_structure (caps, 0);
- in_format = gst_structure_get_string (ins, "format");
- if (!in_format)
- return;
- targets = gst_structure_get_value (ins, "texture-target");
- targets_mask = gst_gl_value_get_texture_target_mask (targets);
- if (!targets_mask)
- return;
-
- in_info =
- gst_video_format_get_info (gst_video_format_from_string (in_format));
- if (!in_info)
- return;
-
- outs = gst_caps_get_structure (result, 0);
-
- capslen = gst_caps_get_size (result);
- for (i = 0; i < capslen; i++) {
- GstStructure *tests;
- const GValue *format;
- const GValue *other_targets;
- guint other_targets_mask = 0;
-
- tests = gst_caps_get_structure (result, i);
-
- format = gst_structure_get_value (tests, "format");
- other_targets = gst_structure_get_value (tests, "texture-target");
- /* should not happen */
- if (format == NULL || other_targets == NULL)
- continue;
-
- other_targets_mask = gst_gl_value_get_texture_target_mask (other_targets);
-
- if (GST_VALUE_HOLDS_LIST (format)) {
- gint j, len;
-
- len = gst_value_list_get_size (format);
- for (j = 0; j < len; j++) {
- const GValue *val;
-
- val = gst_value_list_get_value (format, j);
- if (G_VALUE_HOLDS_STRING (val)) {
- const gchar *format_str = g_value_get_string (val);
- GstVideoFormat v_format = gst_video_format_from_string (format_str);
- score_format_target (in_info, targets_mask, v_format,
- other_targets_mask, &min_loss, &out_info, &target);
- if (min_loss == 0)
- break;
- }
- }
- } else if (G_VALUE_HOLDS_STRING (format)) {
- const gchar *format_str = g_value_get_string (format);
- GstVideoFormat v_format = gst_video_format_from_string (format_str);
- score_format_target (in_info, targets_mask, v_format, other_targets_mask,
- &min_loss, &out_info, &target);
- }
- }
- if (out_info)
- gst_structure_set (outs, "format", G_TYPE_STRING,
- GST_VIDEO_FORMAT_INFO_NAME (out_info), NULL);
- if (target)
- gst_structure_set (outs, "texture-target", G_TYPE_STRING,
- gst_gl_texture_target_to_string (target), NULL);
-}
-
-/**
- * gst_gl_color_convert_fixate_caps:
- * @context: a #GstGLContext to use for transforming @caps
- * @direction: a #GstPadDirection
- * @caps: (transfer none): the #GstCaps of @direction
- * @other: (transfer full): the #GstCaps to fixate
- *
- * Provides an implementation of #GstBaseTransformClass::fixate_caps()
- *
- * Returns: (transfer full): the fixated #GstCaps
- *
- * Since: 1.8
- */
-GstCaps *
-gst_gl_color_convert_fixate_caps (GstGLContext * context,
- GstPadDirection direction, GstCaps * caps, GstCaps * other)
-{
- GstCaps *result;
-
- result = gst_caps_intersect (other, caps);
- if (gst_caps_is_empty (result)) {
- gst_caps_unref (result);
- result = other;
- } else {
- gst_caps_unref (other);
- }
-
- result = gst_caps_make_writable (result);
- gst_gl_color_convert_fixate_format_target (caps, result);
-
- result = gst_caps_fixate (result);
-
- if (direction == GST_PAD_SINK) {
- if (gst_caps_is_subset (caps, result)) {
- gst_caps_replace (&result, caps);
- }
- }
-
- return result;
-}
-
-/**
- * gst_gl_color_convert_perform:
- * @convert: a #GstGLColorConvert
- * @inbuf: (transfer none): the #GstGLMemory filled #GstBuffer to convert
- *
- * Converts the data contained by @inbuf using the formats specified by the
- * #GstCaps passed to gst_gl_color_convert_set_caps()
- *
- * Returns: (transfer full): a converted #GstBuffer or %NULL
- *
- * Since: 1.4
- */
-GstBuffer *
-gst_gl_color_convert_perform (GstGLColorConvert * convert, GstBuffer * inbuf)
-{
- GstBuffer *ret;
-
- g_return_val_if_fail (convert != NULL, FALSE);
-
- GST_OBJECT_LOCK (convert);
- ret = _gst_gl_color_convert_perform_unlocked (convert, inbuf);
- GST_OBJECT_UNLOCK (convert);
-
- return ret;
-}
-
-static GstBuffer *
-_gst_gl_color_convert_perform_unlocked (GstGLColorConvert * convert,
- GstBuffer * inbuf)
-{
- g_return_val_if_fail (convert != NULL, FALSE);
- g_return_val_if_fail (inbuf, FALSE);
-
- if (G_UNLIKELY (convert->passthrough))
- return gst_buffer_ref (inbuf);
-
- convert->inbuf = inbuf;
-
- gst_gl_context_thread_add (convert->context,
- (GstGLContextThreadFunc) _do_convert, convert);
-
- if (!convert->priv->result) {
- if (convert->outbuf)
- gst_buffer_unref (convert->outbuf);
- convert->outbuf = NULL;
- return NULL;
- }
-
- return convert->outbuf;
-}
-
-static inline gboolean
-_is_RGBx (GstVideoFormat v_format)
-{
- switch (v_format) {
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xBGR:
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-static inline gchar
-_index_to_shader_swizzle (int idx)
-{
- switch (idx) {
- case 0:
- return 'r';
- case 1:
- return 'g';
- case 2:
- return 'b';
- case 3:
- return 'a';
- default:
- return '#';
- }
-}
-
-/* attempts to transform expected to want using swizzling */
-static gchar *
-_RGB_pixel_order (const gchar * expected, const gchar * wanted)
-{
- GString *ret = g_string_sized_new (4);
- gchar *expect, *want;
- gchar *orig_want;
- int len;
- gboolean discard_output = TRUE;
-
- if (g_ascii_strcasecmp (expected, wanted) == 0) {
- g_string_free (ret, TRUE);
- return g_ascii_strdown (expected, -1);
- }
-
- expect = g_ascii_strdown (expected, -1);
- orig_want = want = g_ascii_strdown (wanted, -1);
-
- if (strcmp (expect, "rgb16") == 0 || strcmp (expect, "bgr16") == 0) {
- gchar *temp = expect;
- expect = g_strndup (temp, 3);
- g_free (temp);
- }
-
- if (strcmp (want, "rgb16") == 0 || strcmp (want, "bgr16") == 0) {
- gchar *temp = want;
- orig_want = want = g_strndup (temp, 3);
- g_free (temp);
- }
-
- /* pad want with 'a's */
- if ((len = strlen (want)) < 4) {
- gchar *new_want = g_strndup (want, 4);
- while (len < 4) {
- new_want[len] = 'a';
- len++;
- }
- g_free (want);
- orig_want = want = new_want;
- }
-
- /* pad expect with 'a's */
- if ((len = strlen (expect)) < 4) {
- gchar *new_expect = g_strndup (expect, 4);
- while (len < 4) {
- new_expect[len] = 'a';
- len++;
- }
- g_free (expect);
- expect = new_expect;
- }
-
- /* build the swizzle format */
- while (want && want[0] != '\0') {
- gchar *val;
- gint idx;
- gchar needle = want[0];
-
- if (needle == 'x')
- needle = 'a';
-
- if (!(val = strchr (expect, needle))
- && needle == 'a' && !(val = strchr (expect, 'x')))
- goto out;
-
- idx = (gint) (val - expect);
-
- ret = g_string_append_c (ret, _index_to_shader_swizzle (idx));
- want = &want[1];
- }
-
- discard_output = FALSE;
-out:
- g_free (orig_want);
- g_free (expect);
-
- return g_string_free (ret, discard_output);
-}
-
-static guint
-_get_n_textures (GstVideoFormat v_format)
-{
- switch (v_format) {
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_ABGR:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- case GST_VIDEO_FORMAT_AYUV:
- case GST_VIDEO_FORMAT_GRAY8:
- case GST_VIDEO_FORMAT_GRAY16_LE:
- case GST_VIDEO_FORMAT_GRAY16_BE:
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_UYVY:
- case GST_VIDEO_FORMAT_RGB16:
- case GST_VIDEO_FORMAT_BGR16:
- return 1;
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- return 2;
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_Y444:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_Y41B:
- case GST_VIDEO_FORMAT_YV12:
- return 3;
- default:
- g_assert_not_reached ();
- return 0;
- }
-}
-
-static void
-_RGB_to_RGB (GstGLColorConvert * convert)
-{
- struct ConvertInfo *info = &convert->priv->convert_info;
- GstVideoFormat in_format = GST_VIDEO_INFO_FORMAT (&convert->in_info);
- const gchar *in_format_str = gst_video_format_to_string (in_format);
- GstVideoFormat out_format = GST_VIDEO_INFO_FORMAT (&convert->out_info);
- const gchar *out_format_str = gst_video_format_to_string (out_format);
- gchar *pixel_order = _RGB_pixel_order (in_format_str, out_format_str);
- gchar *alpha = NULL;
-
- if (_is_RGBx (in_format)) {
- int i;
- char input_alpha_channel = 'a';
- for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
- if (in_format_str[i] == 'X' || in_format_str[i] == 'x') {
- input_alpha_channel = _index_to_shader_swizzle (i);
- break;
- }
- }
- alpha = g_strdup_printf ("t.%c = 1.0;", input_alpha_channel);
- }
- info->templ = &templ_REORDER;
- info->frag_body = g_strdup_printf (info->templ->body, alpha ? alpha : "",
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
- info->shader_tex_names[0] = "tex";
-
- g_free (alpha);
- g_free (pixel_order);
-}
-
-static void
-_YUV_to_RGB (GstGLColorConvert * convert)
-{
- struct ConvertInfo *info = &convert->priv->convert_info;
- GstVideoFormat out_format = GST_VIDEO_INFO_FORMAT (&convert->out_info);
- const gchar *out_format_str = gst_video_format_to_string (out_format);
- gchar *pixel_order = _RGB_pixel_order ("rgba", out_format_str);
- gboolean apple_ycbcr = gst_gl_context_check_feature (convert->context,
- "GL_APPLE_ycbcr_422");
- gboolean in_tex_rectangular = FALSE;
-
-#if GST_GL_HAVE_OPENGL
- GstMemory *memory = gst_buffer_peek_memory (convert->inbuf, 0);
- if (gst_is_gl_memory (memory) && (USING_OPENGL (convert->context)
- || USING_OPENGL3 (convert->context))) {
- in_tex_rectangular =
- convert->priv->from_texture_target == GST_GL_TEXTURE_TARGET_RECTANGLE;
- }
-#endif
-
- info->out_n_textures = 1;
-
- if (in_tex_rectangular && apple_ycbcr
- && gst_buffer_n_memory (convert->inbuf) == 1) {
- /* FIXME: We should probably also check if tex_target actually is using
- * the Apple YCbCr422 extension. It could also be a normal UYVY texture
- * with RB or Lum/Alpha
- */
- /* The mangling will change this to the correct texture2DRect, sampler2DRect
- * for us */
- info->templ = &templ_REORDER;
- info->frag_body =
- g_strdup_printf (info->templ->body, pixel_order[0], pixel_order[1],
- pixel_order[2], pixel_order[3]);
- info->shader_tex_names[0] = "tex";
- } else {
- switch (GST_VIDEO_INFO_FORMAT (&convert->in_info)) {
- case GST_VIDEO_FORMAT_AYUV:
- info->templ = &templ_AYUV_to_RGB;
- info->frag_body = g_strdup_printf (info->templ->body, pixel_order[0],
- pixel_order[1], pixel_order[2], pixel_order[3]);
- info->shader_tex_names[0] = "tex";
- break;
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_Y444:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_Y41B:
- info->templ = &templ_PLANAR_YUV_to_RGB;
- info->frag_body =
- g_strdup_printf (info->templ->body, pixel_order[0],
- pixel_order[1], pixel_order[2], pixel_order[3]);
- info->shader_tex_names[0] = "Ytex";
- info->shader_tex_names[1] = "Utex";
- info->shader_tex_names[2] = "Vtex";
- break;
- case GST_VIDEO_FORMAT_YV12:
- info->templ = &templ_PLANAR_YUV_to_RGB;
- info->frag_body =
- g_strdup_printf (info->templ->body, pixel_order[0],
- pixel_order[1], pixel_order[2], pixel_order[3]);
- info->shader_tex_names[0] = "Ytex";
- info->shader_tex_names[1] = "Vtex";
- info->shader_tex_names[2] = "Utex";
- break;
- case GST_VIDEO_FORMAT_YUY2:
- {
- char uv_val = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
- info->templ = &templ_YUY2_UYVY_to_RGB;
- info->frag_body = g_strdup_printf (info->templ->body, 'r', uv_val,
- uv_val, 'g', 'a', pixel_order[0], pixel_order[1], pixel_order[2],
- pixel_order[3]);
- info->shader_tex_names[0] = "Ytex";
- break;
- }
- case GST_VIDEO_FORMAT_UYVY:
- {
- char y_val = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
- info->templ = &templ_YUY2_UYVY_to_RGB;
- info->frag_body = g_strdup_printf (info->templ->body, y_val, 'g',
- 'g', 'r', 'b', pixel_order[0], pixel_order[1], pixel_order[2],
- pixel_order[3]);
- info->shader_tex_names[0] = "Ytex";
- break;
- }
- case GST_VIDEO_FORMAT_NV12:
- {
- char val2 = convert->priv->in_tex_formats[1] == GST_GL_RG ? 'g' : 'a';
- info->templ = &templ_NV12_NV21_to_RGB;
- info->frag_body = g_strdup_printf (info->templ->body, 'r', val2,
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
- info->shader_tex_names[0] = "Ytex";
- info->shader_tex_names[1] = "UVtex";
- break;
- }
- case GST_VIDEO_FORMAT_NV21:
- {
- char val2 = convert->priv->in_tex_formats[1] == GST_GL_RG ? 'g' : 'a';
- info->templ = &templ_NV12_NV21_to_RGB;
- info->frag_body = g_strdup_printf (info->templ->body, val2, 'r',
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
- info->shader_tex_names[0] = "Ytex";
- info->shader_tex_names[1] = "UVtex";
- break;
- }
- default:
- break;
- }
- }
-
- if (gst_video_colorimetry_matches (&convert->in_info.colorimetry,
- GST_VIDEO_COLORIMETRY_BT709)) {
- info->cms_offset = (gfloat *) from_yuv_bt709_offset;
- info->cms_coeff1 = (gfloat *) from_yuv_bt709_rcoeff;
- info->cms_coeff2 = (gfloat *) from_yuv_bt709_gcoeff;
- info->cms_coeff3 = (gfloat *) from_yuv_bt709_bcoeff;
- } else {
- /* defaults/bt601 */
- info->cms_offset = (gfloat *) from_yuv_bt601_offset;
- info->cms_coeff1 = (gfloat *) from_yuv_bt601_rcoeff;
- info->cms_coeff2 = (gfloat *) from_yuv_bt601_gcoeff;
- info->cms_coeff3 = (gfloat *) from_yuv_bt601_bcoeff;
- }
-
- g_free (pixel_order);
-}
-
-static void
-_RGB_to_YUV (GstGLColorConvert * convert)
-{
- struct ConvertInfo *info = &convert->priv->convert_info;
- GstVideoFormat in_format = GST_VIDEO_INFO_FORMAT (&convert->in_info);
- const gchar *in_format_str = gst_video_format_to_string (in_format);
- GstVideoFormat out_format = GST_VIDEO_INFO_FORMAT (&convert->out_info);
- gchar *pixel_order = _RGB_pixel_order (in_format_str, "rgba");
- const gchar *alpha;
-
- info->frag_prog = NULL;
-
- info->shader_tex_names[0] = "tex";
-
- switch (out_format) {
- case GST_VIDEO_FORMAT_AYUV:
- alpha = _is_RGBx (in_format) ? "1.0" : "texel.a";
- info->templ = &templ_RGB_to_AYUV;
- info->frag_body = g_strdup_printf (info->templ->body, pixel_order[0],
- pixel_order[1], pixel_order[2], pixel_order[3], alpha);
- info->out_n_textures = 1;
- break;
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- case GST_VIDEO_FORMAT_Y444:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_Y41B:
- info->templ = &templ_RGB_to_PLANAR_YUV;
- info->frag_body = g_strdup_printf (info->templ->body,
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
- info->out_n_textures = 3;
- if (out_format == GST_VIDEO_FORMAT_Y444) {
- info->chroma_sampling[0] = info->chroma_sampling[1] = 1.0f;
- } else if (out_format == GST_VIDEO_FORMAT_Y42B) {
- info->chroma_sampling[0] = 2.0f;
- info->chroma_sampling[1] = 1.0f;
- } else if (out_format == GST_VIDEO_FORMAT_Y41B) {
- info->chroma_sampling[0] = 4.0f;
- info->chroma_sampling[1] = 1.0f;
- } else {
- info->chroma_sampling[0] = info->chroma_sampling[1] = 2.0f;
- }
- break;
- case GST_VIDEO_FORMAT_YUY2:
- info->templ = &templ_RGB_to_YUY2_UYVY;
- info->frag_body = g_strdup_printf (info->templ->body,
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
- 'x', 'y', 'x', 'z');
- info->out_n_textures = 1;
- break;
- case GST_VIDEO_FORMAT_UYVY:
- info->templ = &templ_RGB_to_YUY2_UYVY,
- info->frag_body = g_strdup_printf (info->templ->body,
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
- 'y', 'x', 'z', 'x');
- info->out_n_textures = 1;
- break;
- case GST_VIDEO_FORMAT_NV12:
- info->templ = &templ_RGB_to_NV12_NV21,
- info->frag_body = g_strdup_printf (info->templ->body,
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
- 'y', 'z');
- info->out_n_textures = 2;
- break;
- case GST_VIDEO_FORMAT_NV21:
- info->templ = &templ_RGB_to_NV12_NV21,
- info->frag_body = g_strdup_printf (info->templ->body,
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
- 'z', 'y');
- info->out_n_textures = 2;
- break;
- default:
- break;
- }
-
- if (gst_video_colorimetry_matches (&convert->in_info.colorimetry,
- GST_VIDEO_COLORIMETRY_BT709)) {
- info->cms_offset = (gfloat *) from_rgb_bt709_offset;
- info->cms_coeff1 = (gfloat *) from_rgb_bt709_ycoeff;
- info->cms_coeff2 = (gfloat *) from_rgb_bt709_ucoeff;
- info->cms_coeff3 = (gfloat *) from_rgb_bt709_vcoeff;
- } else {
- /* defaults/bt601 */
- info->cms_offset = (gfloat *) from_rgb_bt601_offset;
- info->cms_coeff1 = (gfloat *) from_rgb_bt601_ycoeff;
- info->cms_coeff2 = (gfloat *) from_rgb_bt601_ucoeff;
- info->cms_coeff3 = (gfloat *) from_rgb_bt601_vcoeff;
- }
-
- g_free (pixel_order);
-}
-
-static void
-_RGB_to_GRAY (GstGLColorConvert * convert)
-{
- struct ConvertInfo *info = &convert->priv->convert_info;
- GstVideoFormat in_format = GST_VIDEO_INFO_FORMAT (&convert->in_info);
- const gchar *in_format_str = gst_video_format_to_string (in_format);
- gchar *pixel_order = _RGB_pixel_order (in_format_str, "rgba");
- gchar *alpha = NULL;
-
- info->out_n_textures = 1;
- info->shader_tex_names[0] = "tex";
-
- if (_is_RGBx (in_format))
- alpha = g_strdup_printf ("t.%c = 1.0;", pixel_order[3]);
-
- switch (GST_VIDEO_INFO_FORMAT (&convert->out_info)) {
- case GST_VIDEO_FORMAT_GRAY8:
- info->templ = &templ_REORDER;
- info->frag_body = g_strdup_printf (info->templ->body, alpha ? alpha : "",
- pixel_order[0], pixel_order[0], pixel_order[0], pixel_order[3]);
- break;
- default:
- break;
- }
-
- g_free (alpha);
- g_free (pixel_order);
-}
-
-static void
-_GRAY_to_RGB (GstGLColorConvert * convert)
-{
- struct ConvertInfo *info = &convert->priv->convert_info;
- GstVideoFormat out_format = GST_VIDEO_INFO_FORMAT (&convert->out_info);
- const gchar *out_format_str = gst_video_format_to_string (out_format);
- gchar *pixel_order = _RGB_pixel_order ("rgba", out_format_str);
-
- info->shader_tex_names[0] = "tex";
-
- switch (GST_VIDEO_INFO_FORMAT (&convert->in_info)) {
- case GST_VIDEO_FORMAT_GRAY8:
- info->templ = &templ_REORDER;
- info->frag_body = g_strdup_printf (info->templ->body, "", pixel_order[0],
- pixel_order[0], pixel_order[0], pixel_order[3]);
- break;
- case GST_VIDEO_FORMAT_GRAY16_LE:
- {
- char val2 = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
- info->templ = &templ_COMPOSE;
- info->frag_body = g_strdup_printf (info->templ->body, val2, 'r',
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
- break;
- }
- case GST_VIDEO_FORMAT_GRAY16_BE:
- {
- char val2 = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
- info->templ = &templ_COMPOSE;
- info->frag_body = g_strdup_printf (info->templ->body, 'r', val2,
- pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
- break;
- }
- default:
- break;
- }
-
- g_free (pixel_order);
-}
-
-static void
-_bind_buffer (GstGLColorConvert * convert)
-{
- const GstGLFuncs *gl = convert->context->gl_vtable;
-
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, convert->priv->vbo_indices);
- gl->BindBuffer (GL_ARRAY_BUFFER, convert->priv->vertex_buffer);
-
- /* Load the vertex position */
- gl->VertexAttribPointer (convert->priv->attr_position, 3, GL_FLOAT, GL_FALSE,
- 5 * sizeof (GLfloat), (void *) 0);
-
- /* Load the texture coordinate */
- gl->VertexAttribPointer (convert->priv->attr_texture, 2, GL_FLOAT, GL_FALSE,
- 5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
-
- gl->EnableVertexAttribArray (convert->priv->attr_position);
- gl->EnableVertexAttribArray (convert->priv->attr_texture);
-}
-
-static void
-_unbind_buffer (GstGLColorConvert * convert)
-{
- const GstGLFuncs *gl = convert->context->gl_vtable;
-
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
- gl->BindBuffer (GL_ARRAY_BUFFER, 0);
-
- gl->DisableVertexAttribArray (convert->priv->attr_position);
- gl->DisableVertexAttribArray (convert->priv->attr_texture);
-}
-
-static GstGLShader *
-_create_shader (GstGLColorConvert * convert)
-{
- struct ConvertInfo *info = &convert->priv->convert_info;
- GString *str = g_string_new (NULL);
- GstGLShader *ret = NULL;
- GstGLSLStage *stage;
- GstGLSLVersion version;
- GstGLSLProfile profile;
- gchar *version_str, *tmp, *tmp1;
- const gchar *strings[2];
- GError *error = NULL;
- int i;
-
- ret = gst_gl_shader_new (convert->context);
-
- tmp =
- _gst_glsl_mangle_shader (text_vertex_shader, GL_VERTEX_SHADER,
- info->templ->target, convert->priv->from_texture_target, convert->context,
- &version, &profile);
-
- tmp1 = gst_glsl_version_profile_to_string (version, profile);
- version_str = g_strdup_printf ("#version %s\n", tmp1);
- g_free (tmp1);
-
- strings[0] = version_str;
- strings[1] = tmp;
- if (!(stage = gst_glsl_stage_new_with_strings (convert->context,
- GL_VERTEX_SHADER, version, profile, 2, strings))) {
- GST_ERROR_OBJECT (convert, "Failed to create vertex stage");
- g_free (version_str);
- g_free (tmp);
- gst_object_unref (ret);
- return NULL;
- }
- g_free (tmp);
-
- if (!gst_gl_shader_compile_attach_stage (ret, stage, &error)) {
- GST_ERROR_OBJECT (convert, "Failed to compile vertex shader %s",
- error->message);
- g_clear_error (&error);
- g_free (version_str);
- gst_object_unref (stage);
- gst_object_unref (ret);
- return NULL;
- }
-
- if (info->templ->extensions)
- g_string_append (str, info->templ->extensions);
-
- if (convert->priv->from_texture_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES
- && info->templ->target != GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
- g_string_append (str, glsl_OES_extension_string);
-
- if (info->templ->uniforms)
- g_string_append (str, info->templ->uniforms);
-
- g_string_append_c (str, '\n');
-
- /* GL 3.3+ and GL ES 3.x */
- if ((profile == GST_GLSL_PROFILE_CORE && version >= GST_GLSL_VERSION_330)
- || (profile == GST_GLSL_PROFILE_ES && version >= GST_GLSL_VERSION_300)) {
- if (info->out_n_textures > 1) {
- gint i;
-
- for (i = 0; i < info->out_n_textures; i++) {
- g_string_append_printf (str,
- "layout(location = %d) out vec4 fragColor_%d;\n", i, i);
- }
- } else {
- g_string_append (str, "layout (location = 0) out vec4 fragColor;\n");
- }
- } else if (profile == GST_GLSL_PROFILE_CORE
- && version >= GST_GLSL_VERSION_150) {
- /* no layout specifiers, use glBindFragDataLocation instead */
- if (info->out_n_textures > 1) {
- gint i;
-
- for (i = 0; i < info->out_n_textures; i++) {
- gchar *var_name = g_strdup_printf ("fragColor_%d", i);
- g_string_append_printf (str, "out vec4 %s;\n", var_name);
- gst_gl_shader_bind_frag_data_location (ret, i, var_name);
- g_free (var_name);
- }
- } else {
- g_string_append (str, "out vec4 fragColor;\n");
- gst_gl_shader_bind_frag_data_location (ret, 0, "fragColor");
- }
- }
-
- for (i = 0; i < MAX_FUNCTIONS; i++) {
- if (info->templ->functions[i] == NULL)
- break;
-
- g_string_append_c (str, '\n');
- g_string_append (str, info->templ->functions[i]);
- g_string_append_c (str, '\n');
- }
-
- {
- const gchar *varying = NULL;
-
- if ((profile == GST_GLSL_PROFILE_ES && version >= GST_GLSL_VERSION_300)
- || (profile == GST_GLSL_PROFILE_CORE
- && version >= GST_GLSL_VERSION_150)) {
- varying = "in";
- } else {
- varying = "varying";
- }
- g_string_append_printf (str, "\n%s vec2 v_texcoord;\nvoid main (void) {\n",
- varying);
- }
- if (info->frag_body) {
- g_string_append (str, "vec2 texcoord;\n");
- if (convert->priv->from_texture_target == GST_GL_TEXTURE_TARGET_RECTANGLE
- && info->templ->target != GST_GL_TEXTURE_TARGET_RECTANGLE) {
- g_string_append (str, "texcoord = v_texcoord * vec2 (width, height);\n");
- } else {
- g_string_append (str, "texcoord = v_texcoord;\n");
- }
-
- g_string_append (str, info->frag_body);
- }
- g_string_append (str, "\n}");
- tmp = g_string_free (str, FALSE);
- info->frag_prog = _gst_glsl_mangle_shader (tmp, GL_FRAGMENT_SHADER,
- info->templ->target, convert->priv->from_texture_target, convert->context,
- &version, &profile);
- g_free (tmp);
-
- strings[1] = info->frag_prog;
- if (!(stage = gst_glsl_stage_new_with_strings (convert->context,
- GL_FRAGMENT_SHADER, version, profile, 2, strings))) {
- GST_ERROR_OBJECT (convert, "Failed to create fragment stage");
- g_free (info->frag_prog);
- info->frag_prog = NULL;
- g_free (version_str);
- gst_object_unref (ret);
- return NULL;
- }
- g_free (version_str);
- if (!gst_gl_shader_compile_attach_stage (ret, stage, &error)) {
- GST_ERROR_OBJECT (convert, "Failed to compile fragment shader %s",
- error->message);
- g_clear_error (&error);
- g_free (info->frag_prog);
- info->frag_prog = NULL;
- gst_object_unref (stage);
- gst_object_unref (ret);
- return NULL;
- }
-
- if (!gst_gl_shader_link (ret, &error)) {
- GST_ERROR_OBJECT (convert, "Failed to link shader %s", error->message);
- g_clear_error (&error);
- g_free (info->frag_prog);
- info->frag_prog = NULL;
- gst_object_unref (ret);
- return NULL;
- }
-
- return ret;
-}
-
-/* Called in the gl thread */
-static gboolean
-_init_convert (GstGLColorConvert * convert)
-{
- GstGLFuncs *gl;
- struct ConvertInfo *info = &convert->priv->convert_info;
- gint i;
-
- gl = convert->context->gl_vtable;
-
- if (convert->initted)
- return TRUE;
-
- GST_INFO ("Initializing color conversion from %s to %s",
- gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&convert->in_info)),
- gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&convert->out_info)));
-
- if (!gl->CreateProgramObject && !gl->CreateProgram) {
- GST_ERROR_OBJECT (convert, "Cannot perform color conversion without "
- "OpenGL shaders");
- goto error;
- }
-
- if (GST_VIDEO_INFO_IS_RGB (&convert->in_info)) {
- if (GST_VIDEO_INFO_IS_RGB (&convert->out_info)) {
- _RGB_to_RGB (convert);
- }
- }
-
- if (GST_VIDEO_INFO_IS_YUV (&convert->in_info)) {
- if (GST_VIDEO_INFO_IS_RGB (&convert->out_info)) {
- _YUV_to_RGB (convert);
- }
- }
-
- if (GST_VIDEO_INFO_IS_RGB (&convert->in_info)) {
- if (GST_VIDEO_INFO_IS_YUV (&convert->out_info)) {
- _RGB_to_YUV (convert);
- }
- }
-
- if (GST_VIDEO_INFO_IS_RGB (&convert->in_info)) {
- if (GST_VIDEO_INFO_IS_GRAY (&convert->out_info)) {
- _RGB_to_GRAY (convert);
- }
- }
-
- if (GST_VIDEO_INFO_IS_GRAY (&convert->in_info)) {
- if (GST_VIDEO_INFO_IS_RGB (&convert->out_info)) {
- _GRAY_to_RGB (convert);
- }
- }
-
- if (!info->frag_body || info->in_n_textures == 0 || info->out_n_textures == 0)
- goto unhandled_format;
-
- /* multiple draw targets not supported on GLES2... */
- if (info->out_n_textures > 1 && !gl->DrawBuffers) {
- GST_ERROR ("Conversion requires output to multiple draw buffers");
- goto incompatible_api;
- }
-
- /* Requires reading from a RG/LA framebuffer... */
- if (USING_GLES2 (convert->context) && !USING_GLES3 (convert->context) &&
- (GST_VIDEO_INFO_FORMAT (&convert->out_info) == GST_VIDEO_FORMAT_YUY2 ||
- GST_VIDEO_INFO_FORMAT (&convert->out_info) ==
- GST_VIDEO_FORMAT_UYVY)) {
- GST_ERROR ("Conversion requires reading with an unsupported format");
- goto incompatible_api;
- }
-
- if (!(convert->shader = _create_shader (convert)))
- goto error;
-
- convert->priv->attr_position =
- gst_gl_shader_get_attribute_location (convert->shader, "a_position");
- convert->priv->attr_texture =
- gst_gl_shader_get_attribute_location (convert->shader, "a_texcoord");
-
- gst_gl_shader_use (convert->shader);
-
- if (info->cms_offset && info->cms_coeff1
- && info->cms_coeff2 && info->cms_coeff3) {
- gst_gl_shader_set_uniform_3fv (convert->shader, "offset", 1,
- info->cms_offset);
- gst_gl_shader_set_uniform_3fv (convert->shader, "coeff1", 1,
- info->cms_coeff1);
- gst_gl_shader_set_uniform_3fv (convert->shader, "coeff2", 1,
- info->cms_coeff2);
- gst_gl_shader_set_uniform_3fv (convert->shader, "coeff3", 1,
- info->cms_coeff3);
- }
-
- for (i = info->in_n_textures; i >= 0; i--) {
- if (info->shader_tex_names[i])
- gst_gl_shader_set_uniform_1i (convert->shader, info->shader_tex_names[i],
- i);
- }
-
- gst_gl_shader_set_uniform_1f (convert->shader, "width",
- GST_VIDEO_INFO_WIDTH (&convert->in_info));
- gst_gl_shader_set_uniform_1f (convert->shader, "height",
- GST_VIDEO_INFO_HEIGHT (&convert->in_info));
-
- if (convert->priv->from_texture_target == GST_GL_TEXTURE_TARGET_RECTANGLE) {
- gst_gl_shader_set_uniform_1f (convert->shader, "poffset_x", 1.);
- gst_gl_shader_set_uniform_1f (convert->shader, "poffset_y", 1.);
- } else {
- gst_gl_shader_set_uniform_1f (convert->shader, "poffset_x",
- 1. / (gfloat) GST_VIDEO_INFO_WIDTH (&convert->in_info));
- gst_gl_shader_set_uniform_1f (convert->shader, "poffset_y",
- 1. / (gfloat) GST_VIDEO_INFO_HEIGHT (&convert->in_info));
- }
-
- if (info->chroma_sampling[0] > 0.0f && info->chroma_sampling[1] > 0.0f) {
- gst_gl_shader_set_uniform_2fv (convert->shader, "chroma_sampling", 1,
- info->chroma_sampling);
- }
-
- gst_gl_context_clear_shader (convert->context);
-
- if (convert->fbo == NULL && !_init_convert_fbo (convert)) {
- goto error;
- }
-
- if (!convert->priv->vertex_buffer) {
- if (gl->GenVertexArrays) {
- gl->GenVertexArrays (1, &convert->priv->vao);
- gl->BindVertexArray (convert->priv->vao);
- }
-
- gl->GenBuffers (1, &convert->priv->vertex_buffer);
- gl->BindBuffer (GL_ARRAY_BUFFER, convert->priv->vertex_buffer);
- gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices,
- GL_STATIC_DRAW);
-
- gl->GenBuffers (1, &convert->priv->vbo_indices);
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, convert->priv->vbo_indices);
- gl->BufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof (indices), indices,
- GL_STATIC_DRAW);
-
- if (gl->GenVertexArrays) {
- _bind_buffer (convert);
- gl->BindVertexArray (0);
- }
-
- gl->BindBuffer (GL_ARRAY_BUFFER, 0);
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
- }
-
- gl->BindTexture (GL_TEXTURE_2D, 0);
-
- convert->initted = TRUE;
-
- return TRUE;
-
-unhandled_format:
- GST_ERROR_OBJECT (convert, "Don't know how to convert from %s to %s",
- gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&convert->in_info)),
- gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&convert->out_info)));
-
-error:
- return FALSE;
-
-incompatible_api:
- {
- GST_ERROR_OBJECT (convert, "Converting from %s to %s requires "
- "functionality that the current OpenGL setup does not support",
- gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&convert->in_info)),
- gst_video_format_to_string (GST_VIDEO_INFO_FORMAT
- (&convert->out_info)));
- return FALSE;
- }
-}
-
-/* called by _init_convert (in the gl thread) */
-static gboolean
-_init_convert_fbo (GstGLColorConvert * convert)
-{
- guint out_width, out_height;
-
- out_width = GST_VIDEO_INFO_WIDTH (&convert->out_info);
- out_height = GST_VIDEO_INFO_HEIGHT (&convert->out_info);
-
- convert->fbo =
- gst_gl_framebuffer_new_with_default_depth (convert->context, out_width,
- out_height);
-
- return convert->fbo != NULL;
-}
-
-static gboolean
-_do_convert_one_view (GstGLContext * context, GstGLColorConvert * convert,
- guint view_num)
-{
- guint in_width, in_height, out_width, out_height;
- struct ConvertInfo *c_info = &convert->priv->convert_info;
- GstMapInfo out_info[GST_VIDEO_MAX_PLANES], in_info[GST_VIDEO_MAX_PLANES];
- gboolean res = TRUE;
- gint i, j = 0;
- const gint in_plane_offset = view_num * c_info->in_n_textures;
- const gint out_plane_offset = view_num * c_info->out_n_textures;
-
- out_width = GST_VIDEO_INFO_WIDTH (&convert->out_info);
- out_height = GST_VIDEO_INFO_HEIGHT (&convert->out_info);
- in_width = GST_VIDEO_INFO_WIDTH (&convert->in_info);
- in_height = GST_VIDEO_INFO_HEIGHT (&convert->in_info);
-
- for (i = 0; i < c_info->in_n_textures; i++) {
- convert->priv->in_tex[i] =
- (GstGLMemory *) gst_buffer_peek_memory (convert->inbuf,
- i + in_plane_offset);
- if (!gst_is_gl_memory ((GstMemory *) convert->priv->in_tex[i])) {
- GST_ERROR_OBJECT (convert, "input must be GstGLMemory");
- res = FALSE;
- goto out;
- }
- if (!gst_memory_map ((GstMemory *) convert->priv->in_tex[i], &in_info[i],
- GST_MAP_READ | GST_MAP_GL)) {
- GST_ERROR_OBJECT (convert, "failed to map input memory %p",
- convert->priv->in_tex[i]);
- res = FALSE;
- goto out;
- }
- }
-
- for (j = 0; j < c_info->out_n_textures; j++) {
- GstGLMemory *out_tex =
- (GstGLMemory *) gst_buffer_peek_memory (convert->outbuf,
- j + out_plane_offset);
- gint mem_width, mem_height;
-
- if (!gst_is_gl_memory ((GstMemory *) out_tex)) {
- GST_ERROR_OBJECT (convert, "output must be GstGLMemory");
- res = FALSE;
- goto out;
- }
-
- mem_width = gst_gl_memory_get_texture_width (out_tex);
- mem_height = gst_gl_memory_get_texture_height (out_tex);
-
- if (out_tex->tex_format == GST_GL_LUMINANCE
- || out_tex->tex_format == GST_GL_LUMINANCE_ALPHA
- || out_width != mem_width || out_height != mem_height) {
- /* Luminance formats are not color renderable */
- /* renderering to a framebuffer only renders the intersection of all
- * the attachments i.e. the smallest attachment size */
- if (!convert->priv->out_tex[j]) {
- GstGLVideoAllocationParams *params;
- GstGLBaseMemoryAllocator *base_mem_allocator;
- GstAllocator *allocator;
- GstVideoInfo temp_info;
-
- gst_video_info_set_format (&temp_info, GST_VIDEO_FORMAT_RGBA, out_width,
- out_height);
-
- allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME);
- base_mem_allocator = GST_GL_BASE_MEMORY_ALLOCATOR (allocator);
- params = gst_gl_video_allocation_params_new (context, NULL, &temp_info,
- 0, NULL, convert->priv->to_texture_target, GST_GL_RGBA);
-
- convert->priv->out_tex[j] =
- (GstGLMemory *) gst_gl_base_memory_alloc (base_mem_allocator,
- (GstGLAllocationParams *) params);
-
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- gst_object_unref (allocator);
- }
- } else {
- convert->priv->out_tex[j] = out_tex;
- }
-
- if (!gst_memory_map ((GstMemory *) convert->priv->out_tex[j], &out_info[j],
- GST_MAP_WRITE | GST_MAP_GL)) {
- GST_ERROR_OBJECT (convert, "failed to map output memory %p",
- convert->priv->out_tex[i]);
- res = FALSE;
- goto out;
- }
- }
-
- GST_LOG_OBJECT (convert, "converting to textures:%p,%p,%p,%p "
- "dimensions:%ux%u, from textures:%p,%p,%p,%p dimensions:%ux%u",
- convert->priv->out_tex[0], convert->priv->out_tex[1],
- convert->priv->out_tex[2], convert->priv->out_tex[3], out_width,
- out_height, convert->priv->in_tex[0], convert->priv->in_tex[1],
- convert->priv->in_tex[2], convert->priv->in_tex[3], in_width, in_height);
-
- if (!_do_convert_draw (context, convert))
- res = FALSE;
-
-out:
- for (j--; j >= 0; j--) {
- GstGLMemory *out_tex =
- (GstGLMemory *) gst_buffer_peek_memory (convert->outbuf,
- j + out_plane_offset);
- gint mem_width, mem_height;
-
- gst_memory_unmap ((GstMemory *) convert->priv->out_tex[j], &out_info[j]);
-
- mem_width = gst_gl_memory_get_texture_width (out_tex);
- mem_height = gst_gl_memory_get_texture_height (out_tex);
-
- if (out_tex->tex_format == GST_GL_LUMINANCE
- || out_tex->tex_format == GST_GL_LUMINANCE_ALPHA
- || out_width != mem_width || out_height != mem_height) {
- GstMapInfo to_info, from_info;
-
- if (!gst_memory_map ((GstMemory *) convert->priv->out_tex[j], &from_info,
- GST_MAP_READ | GST_MAP_GL)) {
- GST_ERROR_OBJECT (convert, "Failed to map intermediate memory");
- res = FALSE;
- continue;
- }
- if (!gst_memory_map ((GstMemory *) out_tex, &to_info,
- GST_MAP_WRITE | GST_MAP_GL)) {
- GST_ERROR_OBJECT (convert, "Failed to map intermediate memory");
- res = FALSE;
- continue;
- }
- gst_gl_memory_copy_into (convert->priv->out_tex[j],
- out_tex->tex_id, convert->priv->to_texture_target,
- out_tex->tex_format, mem_width, mem_height);
- gst_memory_unmap ((GstMemory *) convert->priv->out_tex[j], &from_info);
- gst_memory_unmap ((GstMemory *) out_tex, &to_info);
- } else {
- convert->priv->out_tex[j] = NULL;
- }
- }
-
- /* YV12 the same as I420 except planes 1+2 swapped */
- if (GST_VIDEO_INFO_FORMAT (&convert->out_info) == GST_VIDEO_FORMAT_YV12) {
- GstMemory *mem1 =
- gst_buffer_get_memory (convert->outbuf, 1 + out_plane_offset);
- GstMemory *mem2 =
- gst_buffer_get_memory (convert->outbuf, 2 + out_plane_offset);
-
- gst_buffer_replace_memory (convert->outbuf, 1 + out_plane_offset, mem2);
- gst_buffer_replace_memory (convert->outbuf, 2 + out_plane_offset, mem1);
- }
-
- for (i--; i >= 0; i--) {
- gst_memory_unmap ((GstMemory *) convert->priv->in_tex[i], &in_info[i]);
- }
-
- return res;
-}
-
-/* Called by the idle function in the gl thread */
-void
-_do_convert (GstGLContext * context, GstGLColorConvert * convert)
-{
- GstVideoInfo *in_info = &convert->in_info;
- struct ConvertInfo *c_info = &convert->priv->convert_info;
- gboolean res = TRUE;
- gint views, v;
- GstVideoOverlayCompositionMeta *composition_meta;
- GstGLSyncMeta *sync_meta;
- GstFlowReturn ret;
-
- convert->outbuf = NULL;
-
- if (GST_VIDEO_INFO_MULTIVIEW_MODE (in_info) ==
- GST_VIDEO_MULTIVIEW_MODE_SEPARATED)
- views = GST_VIDEO_INFO_VIEWS (in_info);
- else
- views = 1;
-
- c_info->in_n_textures =
- _get_n_textures (GST_VIDEO_INFO_FORMAT (&convert->in_info));
- c_info->out_n_textures =
- _get_n_textures (GST_VIDEO_INFO_FORMAT (&convert->out_info));
-
- {
- gboolean tex_format_change = FALSE;
- guint i, v;
-
- for (v = 0; v < views; v++) {
- for (i = 0; i < c_info->in_n_textures; i++) {
- guint j = v * c_info->in_n_textures + i;
- GstGLMemory *in_tex =
- (GstGLMemory *) gst_buffer_peek_memory (convert->inbuf, j);
- if (!gst_is_gl_memory ((GstMemory *) in_tex)) {
- GST_ERROR_OBJECT (convert, "input must be GstGLMemory");
- convert->priv->result = FALSE;
- return;
- }
-
- if (j >= GST_VIDEO_MAX_PLANES)
- /* our arrays aren't that big */
- g_assert_not_reached ();
-
- if (v > 0 && in_tex->tex_format != convert->priv->in_tex_formats[i]) {
- GST_ERROR_OBJECT (convert, "Cannot convert textures with "
- "different types");
- convert->priv->result = FALSE;
- return;
- }
-
- if (convert->priv->in_tex_formats[j] != in_tex->tex_format)
- tex_format_change = TRUE;
-
- convert->priv->in_tex_formats[j] = in_tex->tex_format;
- }
- }
-
- if (tex_format_change)
- gst_gl_color_convert_reset_shader (convert);
- }
-
- if (!_init_convert (convert)) {
- convert->priv->result = FALSE;
- return;
- }
-
- sync_meta = gst_buffer_get_gl_sync_meta (convert->inbuf);
- if (sync_meta)
- gst_gl_sync_meta_wait (sync_meta, convert->context);
-
- if (!convert->priv->pool) {
- gboolean ret;
- /* No pool! */
- GstQuery *query = gst_query_new_allocation (convert->priv->out_caps, TRUE);
- ret = gst_gl_color_convert_decide_allocation (convert, query);
- gst_query_unref (query);
-
- if (!ret) {
- GST_ERROR_OBJECT (convert, "Failed to choose allocation parameters");
- convert->priv->result = FALSE;
- return;
- }
-
- if (!convert->priv->pool) {
- GST_ERROR_OBJECT (convert, "Failed to create a buffer pool");
- convert->priv->result = FALSE;
- return;
- }
- }
-
- if (!convert->priv->pool_started) {
- if (!gst_buffer_pool_set_active (convert->priv->pool, TRUE)) {
- GST_ERROR_OBJECT (convert, "Failed to start buffer pool");
- convert->priv->result = FALSE;
- return;
- }
- convert->priv->pool_started = TRUE;
- }
-
- ret =
- gst_buffer_pool_acquire_buffer (convert->priv->pool, &convert->outbuf,
- NULL);
- if (ret != GST_FLOW_OK) {
- GST_ERROR_OBJECT (convert, "Failed to acquire buffer from pool: %s",
- gst_flow_get_name (ret));
- convert->priv->result = FALSE;
- return;
- }
-
- gst_gl_insert_debug_marker (context, "%s converting from %s to %s",
- GST_OBJECT_NAME (convert),
- gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (in_info)),
- gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&convert->out_info)));
- /* Handle all views on input and output one at a time */
- for (v = 0; res && v < views; v++)
- res = _do_convert_one_view (context, convert, v);
-
- if (!res) {
- gst_buffer_unref (convert->outbuf);
- convert->outbuf = NULL;
- }
-
- if (convert->outbuf) {
- GstGLSyncMeta *sync_meta =
- gst_buffer_add_gl_sync_meta (convert->context, convert->outbuf);
-
- if (sync_meta)
- gst_gl_sync_meta_set_sync_point (sync_meta, convert->context);
- }
-
- composition_meta =
- gst_buffer_get_video_overlay_composition_meta (convert->inbuf);
- if (composition_meta) {
- GST_DEBUG ("found video overlay composition meta, appliying on output.");
- gst_buffer_add_video_overlay_composition_meta
- (convert->outbuf, composition_meta->overlay);
- }
-
- convert->priv->result = res;
- return;
-}
-
-static gboolean
-_do_convert_draw (GstGLContext * context, GstGLColorConvert * convert)
-{
- GstGLFuncs *gl;
- struct ConvertInfo *c_info = &convert->priv->convert_info;
- guint out_width, out_height;
- gint i;
- gboolean ret = TRUE;
-
- GLint viewport_dim[4] = { 0 };
-
- GLenum multipleRT[] = {
- GL_COLOR_ATTACHMENT0,
- GL_COLOR_ATTACHMENT1,
- GL_COLOR_ATTACHMENT2
- };
-
- gl = context->gl_vtable;
-
- gst_gl_framebuffer_bind (convert->fbo);
-
- /* attach the texture to the FBO to renderer to */
- for (i = 0; i < c_info->out_n_textures; i++) {
- GstGLBaseMemory *tex = (GstGLBaseMemory *) convert->priv->out_tex[i];
-
- gst_gl_framebuffer_attach (convert->fbo, GL_COLOR_ATTACHMENT0 + i, tex);
- }
-
- if (gl->DrawBuffers)
- gl->DrawBuffers (c_info->out_n_textures, multipleRT);
- else if (gl->DrawBuffer)
- gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
-
- gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
-
- gst_gl_framebuffer_get_effective_dimensions (convert->fbo, &out_width,
- &out_height);
- gl->Viewport (0, 0, out_width, out_height);
-
- gst_gl_shader_use (convert->shader);
-
- if (gl->BindVertexArray)
- gl->BindVertexArray (convert->priv->vao);
- _bind_buffer (convert);
-
- for (i = c_info->in_n_textures - 1; i >= 0; i--) {
- gchar *scale_name = g_strdup_printf ("tex_scale%u", i);
- guint gl_target =
- gst_gl_texture_target_to_gl (convert->priv->from_texture_target);
-
- gl->ActiveTexture (GL_TEXTURE0 + i);
- gl->BindTexture (gl_target, convert->priv->in_tex[i]->tex_id);
- gl->TexParameteri (gl_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- gl->TexParameteri (gl_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- gl->TexParameteri (gl_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- gl->TexParameteri (gl_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- gst_gl_shader_set_uniform_2fv (convert->shader, scale_name, 1,
- convert->priv->in_tex[i]->tex_scaling);
-
- g_free (scale_name);
- }
-
- gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
-
- if (gl->BindVertexArray)
- gl->BindVertexArray (0);
- _unbind_buffer (convert);
-
- if (gl->DrawBuffer)
- gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
-
- /* we are done with the shader */
- gst_gl_context_clear_shader (context);
-
- gl->Viewport (viewport_dim[0], viewport_dim[1], viewport_dim[2],
- viewport_dim[3]);
-
- if (!gst_gl_context_check_framebuffer_status (context, GL_FRAMEBUFFER))
- ret = FALSE;
-
- gst_gl_context_clear_framebuffer (context);
-
- return ret;
-}
diff --git a/gst-libs/gst/gl/gstglcolorconvert.h b/gst-libs/gst/gl/gstglcolorconvert.h
deleted file mode 100644
index 76a5247cd..000000000
--- a/gst-libs/gst/gl/gstglcolorconvert.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystree00@gmail.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_COLOR_CONVERT_H__
-#define __GST_GL_COLOR_CONVERT_H__
-
-#include <gst/video/video.h>
-#include <gst/gstmemory.h>
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_color_convert_get_type (void);
-#define GST_TYPE_GL_COLOR_CONVERT (gst_gl_color_convert_get_type())
-#define GST_GL_COLOR_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_COLOR_CONVERT,GstGLColorConvert))
-#define GST_GL_COLOR_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_DISPLAY,GstGLColorConvertClass))
-#define GST_IS_GL_COLOR_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_COLOR_CONVERT))
-#define GST_IS_GL_COLOR_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_COLOR_CONVERT))
-#define GST_GL_COLOR_CONVERT_CAST(obj) ((GstGLColorConvert*)(obj))
-
-/**
- * GstGLColorConvert
- *
- * Opaque #GstGLColorConvert object
- */
-struct _GstGLColorConvert
-{
- /* <private> */
- GstObject parent;
-
- GstGLContext *context;
-
- /* input data */
- GstVideoInfo in_info;
- GstVideoInfo out_info;
-
- gboolean initted;
- gboolean passthrough;
-
- GstBuffer * inbuf;
- GstBuffer * outbuf;
-
- /* used for the conversion */
- GstGLFramebuffer *fbo;
- GstGLShader *shader;
-
- /* <private> */
- GstGLColorConvertPrivate *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-/**
- * GstGLColorConvertClass:
- *
- * The #GstGLColorConvertClass struct only contains private data
- */
-struct _GstGLColorConvertClass
-{
- /* <private> */
- GstObjectClass object_class;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GST_GL_COLOR_CONVERT_FORMATS:
- *
- * The currently supported formats that can be converted
- */
-#define GST_GL_COLOR_CONVERT_FORMATS "{ RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, " \
- "xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, " \
- "Y41B, NV12, NV21, YUY2, UYVY, AYUV, " \
- "GRAY8, GRAY16_LE, GRAY16_BE, RGB16, BGR16 }"
-
-/**
- * GST_GL_COLOR_CONVERT_VIDEO_CAPS:
- *
- * The currently supported #GstCaps that can be converted
- */
-#define GST_GL_COLOR_CONVERT_VIDEO_CAPS \
- "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), " \
- "format = (string) " GST_GL_COLOR_CONVERT_FORMATS ", " \
- "width = " GST_VIDEO_SIZE_RANGE ", " \
- "height = " GST_VIDEO_SIZE_RANGE ", " \
- "framerate = " GST_VIDEO_FPS_RANGE ", " \
- "texture-target = (string) { 2D, rectangle, external-oes } " \
- " ; " \
- "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "," \
- GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION "), " \
- "format = (string) " GST_GL_COLOR_CONVERT_FORMATS ", " \
- "width = " GST_VIDEO_SIZE_RANGE ", " \
- "height = " GST_VIDEO_SIZE_RANGE ", " \
- "framerate = " GST_VIDEO_FPS_RANGE ", " \
- "texture-target = (string) { 2D, rectangle, external-oes }"
-
-GST_EXPORT
-GstGLColorConvert * gst_gl_color_convert_new (GstGLContext * context);
-
-GST_EXPORT
-GstCaps * gst_gl_color_convert_transform_caps (GstGLContext * context,
- GstPadDirection direction,
- GstCaps * caps,
- GstCaps * filter);
-GST_EXPORT
-GstCaps * gst_gl_color_convert_fixate_caps (GstGLContext * context,
- GstPadDirection direction,
- GstCaps * caps,
- GstCaps * other);
-GST_EXPORT
-gboolean gst_gl_color_convert_set_caps (GstGLColorConvert * convert,
- GstCaps * in_caps,
- GstCaps * out_caps);
-GST_EXPORT
-gboolean gst_gl_color_convert_decide_allocation (GstGLColorConvert * convert,
- GstQuery * query);
-
-GST_EXPORT
-GstBuffer * gst_gl_color_convert_perform (GstGLColorConvert * convert, GstBuffer * inbuf);
-
-G_END_DECLS
-
-#endif /* __GST_GL_COLOR_CONVERT_H__ */
diff --git a/gst-libs/gst/gl/gstglconfig.h.meson b/gst-libs/gst/gl/gstglconfig.h.meson
deleted file mode 100644
index ea74934f7..000000000
--- a/gst-libs/gst/gl/gstglconfig.h.meson
+++ /dev/null
@@ -1,48 +0,0 @@
-/* gstglconfig.h
- *
- * This is a generated file. Please modify `configure.ac'
- */
-
-#ifndef __GST_GL_CONFIG_H__
-#define __GST_GL_CONFIG_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-
-#mesondefine GST_GL_HAVE_OPENGL
-#mesondefine GST_GL_HAVE_GLES2
-#mesondefine GST_GL_HAVE_GLES3
-#mesondefine GST_GL_HAVE_GLES3EXT3_H
-
-#mesondefine GST_GL_HAVE_WINDOW_X11
-#mesondefine GST_GL_HAVE_WINDOW_COCOA
-#mesondefine GST_GL_HAVE_WINDOW_WIN32
-#mesondefine GST_GL_HAVE_WINDOW_WAYLAND
-#mesondefine GST_GL_HAVE_WINDOW_ANDROID
-#mesondefine GST_GL_HAVE_WINDOW_DISPMANX
-#mesondefine GST_GL_HAVE_WINDOW_EAGL
-#mesondefine GST_GL_HAVE_WINDOW_VIV_FB
-
-#mesondefine GST_GL_HAVE_PLATFORM_EGL
-#mesondefine GST_GL_HAVE_PLATFORM_GLX
-#mesondefine GST_GL_HAVE_PLATFORM_WGL
-#mesondefine GST_GL_HAVE_PLATFORM_CGL
-#mesondefine GST_GL_HAVE_PLATFORM_EAGL
-
-#mesondefine GST_GL_HAVE_DMABUF
-#mesondefine GST_GL_HAVE_VIV_DIRECTVIV
-
-#mesondefine GST_GL_HAVE_GLEGLIMAGEOES
-#mesondefine GST_GL_HAVE_GLCHAR
-#mesondefine GST_GL_HAVE_GLSIZEIPTR
-#mesondefine GST_GL_HAVE_GLINTPTR
-#mesondefine GST_GL_HAVE_GLSYNC
-#mesondefine GST_GL_HAVE_GLUINT64
-#mesondefine GST_GL_HAVE_GLINT64
-#mesondefine GST_GL_HAVE_EGLATTRIB
-
-G_END_DECLS
-
-#endif /* __GST_GL_CONFIG_H__ */
diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c
deleted file mode 100644
index d89e4db43..000000000
--- a/gst-libs/gst/gl/gstglcontext.c
+++ /dev/null
@@ -1,1857 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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.
- */
-
-/**
- * SECTION:gstglcontext
- * @short_description: OpenGL context abstraction
- * @title: GstGLContext
- * @see_also: #GstGLDisplay, #GstGLWindow
- *
- * #GstGLContext wraps an OpenGL context object in a uniform API. As a result
- * of the limitation on OpenGL context, this object is not thread safe unless
- * specified and must only be activated in a single thread.
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#if defined(ANDROID) || defined(__ANDROID__)
-/* Avoid a linker error with _isoc99_sscanf() when building a shared library
- * for android
- */
-#define _GNU_SOURCE
-#endif
-
-#include "gstglcontext.h"
-#include <gst/gl/gl.h>
-
-#include <gmodule.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "gstglcontext_private.h"
-#include "gstglfeature.h"
-#include "gstglfeature_private.h"
-#include "gstglfuncs.h"
-
-#ifndef GL_NUM_EXTENSIONS
-#define GL_NUM_EXTENSIONS 0x0000821d
-#endif
-
-#if GST_GL_HAVE_PLATFORM_GLX
-#include "x11/gstglcontext_glx.h"
-#endif
-#if GST_GL_HAVE_PLATFORM_EGL
-#include "egl/gstglcontext_egl.h"
-#endif
-#if GST_GL_HAVE_PLATFORM_CGL
-#include "cocoa/gstglcontext_cocoa.h"
-#endif
-#if GST_GL_HAVE_PLATFORM_WGL
-#include "win32/gstglcontext_wgl.h"
-#endif
-#if GST_GL_HAVE_PLATFORM_EAGL
-#include "eagl/gstglcontext_eagl.h"
-#endif
-
-extern void _gst_gl_debug_enable (GstGLContext * context);
-
-static GPrivate current_context_key;
-
-static GModule *module_self;
-static GOnce module_self_gonce = G_ONCE_INIT;
-
-#if GST_GL_HAVE_OPENGL
-static GOnce module_opengl_gonce = G_ONCE_INIT;
-static GModule *module_opengl;
-
-static gpointer
-load_opengl_module (gpointer user_data)
-{
-#ifdef GST_GL_LIBGL_MODULE_NAME
- module_opengl = g_module_open (GST_GL_LIBGL_MODULE_NAME, G_MODULE_BIND_LAZY);
-#else
- /* On Linux the .so is only in -dev packages, try with a real soname
- * Proper compilers will optimize away the strcmp */
- if (g_strcmp0 (G_MODULE_SUFFIX, "so") == 0)
- module_opengl = g_module_open ("libGL.so.1", G_MODULE_BIND_LAZY);
-
- /* This automatically handles the suffix and even .la files */
- if (!module_opengl)
- module_opengl = g_module_open ("libGL", G_MODULE_BIND_LAZY);
-#endif
-
- return NULL;
-}
-#endif
-
-#if GST_GL_HAVE_GLES2
-static GOnce module_gles2_gonce = G_ONCE_INIT;
-static GModule *module_gles2;
-
-static gpointer
-load_gles2_module (gpointer user_data)
-{
-#ifdef GST_GL_LIBGLESV2_MODULE_NAME
- module_gles2 =
- g_module_open (GST_GL_LIBGLESV2_MODULE_NAME, G_MODULE_BIND_LAZY);
-#else
- /* On Linux the .so is only in -dev packages, try with a real soname
- * Proper compilers will optimize away the strcmp */
- if (g_strcmp0 (G_MODULE_SUFFIX, "so") == 0)
- module_gles2 = g_module_open ("libGLESv2.so.2", G_MODULE_BIND_LAZY);
-
- /* This automatically handles the suffix and even .la files */
- if (!module_gles2)
- module_gles2 = g_module_open ("libGLESv2", G_MODULE_BIND_LAZY);
-
-#endif
-
- return NULL;
-}
-#endif
-
-static gpointer
-load_self_module (gpointer user_data)
-{
- module_self = g_module_open (NULL, G_MODULE_BIND_LAZY);
-
- return NULL;
-}
-
-/* Context sharedness is tracked by a refcounted pointer stored in each context
- * object to track complex creation/deletion scenarios. As a result,
- * sharedness can only be successfully validated between two GstGLContext's
- * where one is not a wrapped context.
- *
- * As there is no API at the winsys level to tell whether two OpenGL contexts
- * can share GL resources, this is the next best thing.
- *
- * XXX: we may need a way to associate two wrapped GstGLContext's as being
- * shared however I have not come across a use case that requries this yet.
- */
-struct ContextShareGroup
-{
- volatile int refcount;
-};
-
-static struct ContextShareGroup *
-_context_share_group_new (void)
-{
- struct ContextShareGroup *ret = g_new0 (struct ContextShareGroup, 1);
-
- ret->refcount = 1;
-
- return ret;
-}
-
-static struct ContextShareGroup *
-_context_share_group_ref (struct ContextShareGroup *share)
-{
- g_atomic_int_inc (&share->refcount);
- return share;
-}
-
-static void
-_context_share_group_unref (struct ContextShareGroup *share)
-{
- if (g_atomic_int_dec_and_test (&share->refcount))
- g_free (share);
-}
-
-static gboolean
-_context_share_group_is_shared (struct ContextShareGroup *share)
-{
- return g_atomic_int_get (&share->refcount) > 1;
-}
-
-#define GST_CAT_DEFAULT gst_gl_context_debug
-GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
-GST_DEBUG_CATEGORY_STATIC (gst_gl_debug);
-
-#define gst_gl_context_parent_class parent_class
-G_DEFINE_ABSTRACT_TYPE (GstGLContext, gst_gl_context, GST_TYPE_OBJECT);
-
-#define GST_GL_CONTEXT_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT, GstGLContextPrivate))
-
-static void _init_debug (void);
-
-static gpointer gst_gl_context_create_thread (GstGLContext * context);
-static void gst_gl_context_finalize (GObject * object);
-static void gst_gl_context_default_get_gl_platform_version (GstGLContext *
- context, gint * major, gint * minor);
-
-struct _GstGLContextPrivate
-{
- GThread *gl_thread;
- GThread *active_thread;
-
- /* conditions */
- GMutex render_lock;
- GCond create_cond;
- GCond destroy_cond;
-
- gboolean created;
- gboolean alive;
-
- GWeakRef other_context_ref;
- struct ContextShareGroup *sharegroup;
- GError **error;
-
- gint gl_major;
- gint gl_minor;
-
- gchar *gl_exts;
-};
-
-typedef struct
-{
- GstGLContext parent;
-
- guintptr handle;
- GstGLPlatform platform;
- GstGLAPI available_apis;
-} GstGLWrappedContext;
-
-typedef struct
-{
- GstGLContextClass parent;
-} GstGLWrappedContextClass;
-
-#define GST_TYPE_GL_WRAPPED_CONTEXT (gst_gl_wrapped_context_get_type())
-static GType gst_gl_wrapped_context_get_type (void);
-G_DEFINE_TYPE (GstGLWrappedContext, gst_gl_wrapped_context,
- GST_TYPE_GL_CONTEXT);
-
-#define GST_GL_WRAPPED_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WRAPPED_CONTEXT, GstGLWrappedContext))
-#define GST_GL_WRAPPED_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_CONTEXT, GstGLContextClass))
-#define GST_IS_GL_WRAPPED_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WRAPPED_CONTEXT))
-#define GST_IS_GL_WRAPPED_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WRAPPED_CONTEXT))
-#define GST_GL_WRAPPED_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WRAPPED_CONTEXT, GstGLWrappedContextClass))
-
-GQuark
-gst_gl_context_error_quark (void)
-{
- return g_quark_from_static_string ("gst-gl-context-error-quark");
-}
-
-static void
-_ensure_window (GstGLContext * context)
-{
- GstGLWindow *window;
-
- if (context->window)
- return;
-
- window = gst_gl_display_create_window (context->display);
-
- gst_gl_context_set_window (context, window);
-
- gst_object_unref (window);
-}
-
-static void
-gst_gl_context_init (GstGLContext * context)
-{
- context->priv = GST_GL_CONTEXT_GET_PRIVATE (context);
-
- context->window = NULL;
- context->gl_vtable = g_slice_alloc0 (sizeof (GstGLFuncs));
-
- g_mutex_init (&context->priv->render_lock);
-
- g_cond_init (&context->priv->create_cond);
- g_cond_init (&context->priv->destroy_cond);
- context->priv->created = FALSE;
-
- g_weak_ref_init (&context->priv->other_context_ref, NULL);
-}
-
-static void
-gst_gl_context_class_init (GstGLContextClass * klass)
-{
- g_type_class_add_private (klass, sizeof (GstGLContextPrivate));
-
- klass->get_proc_address =
- GST_DEBUG_FUNCPTR (gst_gl_context_default_get_proc_address);
- klass->get_gl_platform_version =
- GST_DEBUG_FUNCPTR (gst_gl_context_default_get_gl_platform_version);
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_context_finalize;
-
- _init_debug ();
-}
-
-static void
-_init_debug (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_INIT (gst_gl_context_debug, "glcontext", 0,
- "glcontext element");
- GST_DEBUG_CATEGORY_INIT (gst_gl_debug, "gldebug", 0, "OpenGL Debugging");
- g_once_init_leave (&_init, 1);
- }
-}
-
-/**
- * gst_gl_context_new:
- * @display: a #GstGLDisplay
- *
- * Create a new #GstGLContext with the specified @display
- *
- * Returns: a new #GstGLContext
- *
- * Since: 1.4
- */
-GstGLContext *
-gst_gl_context_new (GstGLDisplay * display)
-{
- GstGLContext *context = NULL;
- const gchar *user_choice;
-
- _init_debug ();
-
- user_choice = g_getenv ("GST_GL_PLATFORM");
- GST_INFO ("creating a context for display %" GST_PTR_FORMAT
- ", user choice:%s", display, user_choice);
-#if GST_GL_HAVE_PLATFORM_CGL
- if (!context && (!user_choice || g_strstr_len (user_choice, 3, "cgl")))
- context = GST_GL_CONTEXT (gst_gl_context_cocoa_new (display));
-#endif
-#if GST_GL_HAVE_PLATFORM_GLX
- if (!context && (!user_choice || g_strstr_len (user_choice, 3, "glx")))
- context = GST_GL_CONTEXT (gst_gl_context_glx_new (display));
-#endif
-#if GST_GL_HAVE_PLATFORM_EGL
- if (!context && (!user_choice || g_strstr_len (user_choice, 3, "egl")))
- context = GST_GL_CONTEXT (gst_gl_context_egl_new (display));
-#endif
-#if GST_GL_HAVE_PLATFORM_WGL
- if (!context && (!user_choice || g_strstr_len (user_choice, 3, "wgl")))
- context = GST_GL_CONTEXT (gst_gl_context_wgl_new (display));
-#endif
-#if GST_GL_HAVE_PLATFORM_EAGL
- if (!context && (!user_choice || g_strstr_len (user_choice, 4, "eagl")))
- context = GST_GL_CONTEXT (gst_gl_context_eagl_new (display));
-#endif
-
- if (!context) {
- /* subclass returned a NULL context */
- GST_WARNING ("Could not create context. user specified %s",
- user_choice ? user_choice : "(null)");
-
- return NULL;
- }
-
- context->display = gst_object_ref (display);
-
- GST_DEBUG_OBJECT (context,
- "Done creating context for display %" GST_PTR_FORMAT " (user_choice:%s)",
- display, user_choice);
-
- return context;
-}
-
-/**
- * gst_gl_context_new_wrapped:
- * @display: a #GstGLDisplay
- * @handle: the OpenGL context to wrap
- * @context_type: a #GstGLPlatform specifying the type of context in @handle
- * @available_apis: a #GstGLAPI containing the available OpenGL apis in @handle
- *
- * Wraps an existing OpenGL context into a #GstGLContext.
- *
- * Note: The caller is responsible for ensuring that the OpenGL context
- * represented by @handle stays alive while the returned #GstGLContext is
- * active.
- *
- * Returns: (transfer full): a #GstGLContext wrapping @handle
- *
- * Since: 1.4
- */
-GstGLContext *
-gst_gl_context_new_wrapped (GstGLDisplay * display, guintptr handle,
- GstGLPlatform context_type, GstGLAPI available_apis)
-{
- GstGLContext *context;
- GstGLWrappedContext *context_wrap = NULL;
- GstGLContextClass *context_class;
- GstGLAPI display_api;
-
- _init_debug ();
-
- display_api = gst_gl_display_get_gl_api (display);
- g_return_val_if_fail ((display_api & available_apis) != GST_GL_API_NONE,
- NULL);
-
- context_wrap = g_object_new (GST_TYPE_GL_WRAPPED_CONTEXT, NULL);
- gst_object_ref_sink (context_wrap);
-
- if (!context_wrap) {
- /* subclass returned a NULL context */
- GST_ERROR ("Could not wrap existing context");
-
- return NULL;
- }
-
- context = (GstGLContext *) context_wrap;
-
- context->display = gst_object_ref (display);
- context->priv->sharegroup = _context_share_group_new ();
- context_wrap->handle = handle;
- context_wrap->platform = context_type;
- context_wrap->available_apis = available_apis;
-
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
-
-#if GST_GL_HAVE_PLATFORM_GLX
- if (context_type == GST_GL_PLATFORM_GLX) {
- context_class->get_current_context = gst_gl_context_glx_get_current_context;
- context_class->get_proc_address = gst_gl_context_glx_get_proc_address;
- }
-#endif
-#if GST_GL_HAVE_PLATFORM_EGL
- if (context_type == GST_GL_PLATFORM_EGL) {
- context_class->get_current_context = gst_gl_context_egl_get_current_context;
- context_class->get_proc_address = gst_gl_context_egl_get_proc_address;
- }
-#endif
-#if GST_GL_HAVE_PLATFORM_CGL
- if (context_type == GST_GL_PLATFORM_CGL) {
- context_class->get_current_context =
- gst_gl_context_cocoa_get_current_context;
- context_class->get_proc_address = gst_gl_context_default_get_proc_address;
- }
-#endif
-#if GST_GL_HAVE_PLATFORM_WGL
- if (context_type == GST_GL_PLATFORM_WGL) {
- context_class->get_current_context = gst_gl_context_wgl_get_current_context;
- context_class->get_proc_address = gst_gl_context_wgl_get_proc_address;
- }
-#endif
-#if GST_GL_HAVE_PLATFORM_EAGL
- if (context_type == GST_GL_PLATFORM_EAGL) {
- context_class->get_current_context =
- gst_gl_context_eagl_get_current_context;
- context_class->get_proc_address = gst_gl_context_default_get_proc_address;
- }
-#endif
-
- if (!context_class->get_current_context) {
- /* we don't have API support */
- gst_object_unref (context);
- return NULL;
- }
-
- return context;
-}
-
-/**
- * gst_gl_context_get_current_gl_context:
- * @context_type: a #GstGLPlatform specifying the type of context to retrieve
- *
- * Returns: The OpenGL context handle current in the calling thread or %NULL
- *
- * Since: 1.6
- */
-guintptr
-gst_gl_context_get_current_gl_context (GstGLPlatform context_type)
-{
- guintptr handle = 0;
-
- _init_debug ();
-
-#if GST_GL_HAVE_PLATFORM_GLX
- if (!handle && (context_type & GST_GL_PLATFORM_GLX) != 0)
- handle = gst_gl_context_glx_get_current_context ();
-#endif
-#if GST_GL_HAVE_PLATFORM_EGL
- if (!handle && (context_type & GST_GL_PLATFORM_EGL) != 0)
- handle = gst_gl_context_egl_get_current_context ();
-#endif
-#if GST_GL_HAVE_PLATFORM_CGL
- if (!handle && (context_type & GST_GL_PLATFORM_CGL) != 0)
- handle = gst_gl_context_cocoa_get_current_context ();
-#endif
-#if GST_GL_HAVE_PLATFORM_WGL
- if (!handle && (context_type & GST_GL_PLATFORM_WGL) != 0)
- handle = gst_gl_context_wgl_get_current_context ();
-#endif
-#if GST_GL_HAVE_PLATFORM_EAGL
- if (!handle && (context_type & GST_GL_PLATFORM_EAGL) != 0)
- handle = gst_gl_context_eagl_get_current_context ();
-#endif
-
- if (!handle)
- GST_WARNING ("Could not retrieve current context");
-
- return handle;
-}
-
-/**
- * gst_gl_context_get_proc_address_with_platform:
- * @context_type: a #GstGLPlatform
- * @gl_api: a #GstGLAPI
- * @name: the name of the function to retrieve
- *
- * Attempts to use the @context_type specific GetProcAddress implementations
- * to retreive @name.
- *
- * See also gst_gl_context_get_proc_address().
- *
- * Returns: a function pointer for @name, or %NULL
- *
- * Since: 1.6
- */
-gpointer
-gst_gl_context_get_proc_address_with_platform (GstGLPlatform context_type,
- GstGLAPI gl_api, const gchar * name)
-{
- gpointer ret = NULL;
-
-#if GST_GL_HAVE_PLATFORM_GLX
- if (!ret && (context_type & GST_GL_PLATFORM_GLX) != 0)
- ret = gst_gl_context_glx_get_proc_address (gl_api, name);
-#endif
-#if GST_GL_HAVE_PLATFORM_EGL
- if (!ret && (context_type & GST_GL_PLATFORM_EGL) != 0)
- ret = gst_gl_context_egl_get_proc_address (gl_api, name);
-#endif
-#if GST_GL_HAVE_PLATFORM_WGL
- if (!ret && (context_type & GST_GL_PLATFORM_WGL) != 0)
- ret = gst_gl_context_wgl_get_proc_address (gl_api, name);
-#endif
- /* CGL and EAGL rely on the default impl */
-
- if (!ret)
- ret = gst_gl_context_default_get_proc_address (gl_api, name);
-
- return ret;
-}
-
-/**
- * gst_gl_context_get_current_gl_api:
- * @platform: the #GstGLPlatform to retrieve the API for
- * @major: (out) (allow-none): the major version
- * @minor: (out) (allow-none): the minor version
- *
- * If an error occurs, @major and @minor are not modified and %GST_GL_API_NONE is
- * returned.
- *
- * Returns: The version supported by the OpenGL context current in the calling
- * thread or %GST_GL_API_NONE
- *
- * Since: 1.6
- */
-GstGLAPI
-gst_gl_context_get_current_gl_api (GstGLPlatform platform, guint * major,
- guint * minor)
-{
- const GLubyte *(GSTGLAPI * GetString) (GLenum name);
-#if GST_GL_HAVE_OPENGL
- void (GSTGLAPI * GetIntegerv) (GLenum name, GLuint * n);
-#endif
- const gchar *version;
- gint maj, min, n;
- GstGLAPI ret = (1U << 31);
-
- _init_debug ();
-
- while (ret != GST_GL_API_NONE) {
- /* FIXME: attempt to delve into the platform specific GetProcAddress */
- GetString =
- gst_gl_context_get_proc_address_with_platform (platform, ret,
- "glGetString");
-#if GST_GL_HAVE_OPENGL
- GetIntegerv =
- gst_gl_context_get_proc_address_with_platform (platform, ret,
- "glGetIntegerv");
-#endif
- if (!GetString) {
- goto next;
- }
-
- version = (const gchar *) GetString (GL_VERSION);
- if (!version)
- goto next;
-
- /* strlen (x.x) == 3 */
- n = strlen (version);
- if (n < 3)
- goto next;
-
- if (g_strstr_len (version, 9, "OpenGL ES")) {
- /* strlen (OpenGL ES x.x) == 13 */
- if (n < 13)
- goto next;
-
- sscanf (&version[10], "%d.%d", &maj, &min);
-
- if (maj <= 0 || min < 0)
- goto next;
-
- if (maj == 1) {
- ret = GST_GL_API_GLES1;
- break;
- } else if (maj == 2 || maj == 3) {
- ret = GST_GL_API_GLES2;
- break;
- }
-
- goto next;
- } else {
- sscanf (version, "%d.%d", &maj, &min);
-
- if (maj <= 0 || min < 0)
- goto next;
-
-#if GST_GL_HAVE_OPENGL
- if (GetIntegerv && (maj > 3 || (maj == 3 && min > 1))) {
- GLuint context_flags = 0;
-
- ret = GST_GL_API_NONE;
- GetIntegerv (GL_CONTEXT_PROFILE_MASK, &context_flags);
- if (context_flags & GL_CONTEXT_CORE_PROFILE_BIT)
- ret |= GST_GL_API_OPENGL3;
- if (context_flags & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
- ret |= GST_GL_API_OPENGL;
- break;
- }
-#endif
- ret = GST_GL_API_OPENGL;
- break;
- }
-
- next:
- /* iterate through the apis */
- ret >>= 1;
- }
-
- if (ret == GST_GL_API_NONE)
- return GST_GL_API_NONE;
-
- if (major)
- *major = maj;
- if (minor)
- *minor = min;
-
- return ret;
-}
-
-static void
-gst_gl_context_finalize (GObject * object)
-{
- GstGLContext *context = GST_GL_CONTEXT (object);
-
- if (context->window) {
- gst_gl_window_set_resize_callback (context->window, NULL, NULL, NULL);
- gst_gl_window_set_draw_callback (context->window, NULL, NULL, NULL);
-
- g_mutex_lock (&context->priv->render_lock);
- if (context->priv->alive) {
- GST_INFO_OBJECT (context, "send quit gl window loop");
- gst_gl_window_quit (context->window);
-
- GST_INFO_OBJECT (context, "joining gl thread");
- while (context->priv->alive)
- g_cond_wait (&context->priv->destroy_cond, &context->priv->render_lock);
- GST_INFO_OBJECT (context, "gl thread joined");
-
- if (context->priv->gl_thread) {
- g_thread_unref (context->priv->gl_thread);
- context->priv->gl_thread = NULL;
- }
- }
- g_mutex_unlock (&context->priv->render_lock);
-
- gst_gl_window_set_close_callback (context->window, NULL, NULL, NULL);
- gst_object_unref (context->window);
- context->window = NULL;
- }
-
- if (context->priv->active_thread) {
- g_thread_unref (context->priv->active_thread);
- context->priv->active_thread = NULL;
- }
-
- if (context->priv->gl_thread) {
- g_thread_unref (context->priv->gl_thread);
- context->priv->gl_thread = NULL;
- }
-
- if (context->priv->sharegroup) {
- _context_share_group_unref (context->priv->sharegroup);
- context->priv->sharegroup = NULL;
- }
-
- if (context->display) {
- gst_object_unref (context->display);
- context->display = NULL;
- }
-
- if (context->gl_vtable) {
- g_slice_free (GstGLFuncs, context->gl_vtable);
- context->gl_vtable = NULL;
- }
-
- g_mutex_clear (&context->priv->render_lock);
-
- g_cond_clear (&context->priv->create_cond);
- g_cond_clear (&context->priv->destroy_cond);
-
- g_free (context->priv->gl_exts);
- g_weak_ref_clear (&context->priv->other_context_ref);
-
- GST_DEBUG_OBJECT (context, "End of finalize");
- G_OBJECT_CLASS (gst_gl_context_parent_class)->finalize (object);
-}
-
-/**
- * gst_gl_context_activate:
- * @context: a #GstGLContext
- * @activate: %TRUE to activate, %FALSE to deactivate
- *
- * (De)activate the OpenGL context represented by this @context.
- *
- * In OpenGL terms, calls eglMakeCurrent or similar with this context and the
- * currently set window. See gst_gl_context_set_window() for details.
- *
- * Returns: Whether the activation succeeded
- *
- * Since: 1.4
- */
-gboolean
-gst_gl_context_activate (GstGLContext * context, gboolean activate)
-{
- GstGLContextClass *context_class;
- gboolean result;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
- g_return_val_if_fail (context_class->activate != NULL, FALSE);
-
- GST_DEBUG_OBJECT (context, "activate:%d", activate);
-
- GST_OBJECT_LOCK (context);
- result = context_class->activate (context, activate);
-
- if (result && activate) {
- GThread *old_thread = context->priv->active_thread;
- context->priv->active_thread = g_thread_ref (g_thread_self ());
- if (old_thread) {
- g_thread_unref (old_thread);
- }
-
- g_private_set (&current_context_key, context);
- } else {
- if (context->priv->active_thread) {
- g_thread_unref (context->priv->active_thread);
- context->priv->active_thread = NULL;
- }
- g_private_set (&current_context_key, NULL);
- }
- GST_OBJECT_UNLOCK (context);
-
- return result;
-}
-
-/**
- * gst_gl_context_get_thread:
- * @context: a #GstGLContext
- *
- * Returns: (transfer full): The #GThread, @context is current in or NULL
- *
- * Since: 1.6
- */
-GThread *
-gst_gl_context_get_thread (GstGLContext * context)
-{
- GThread *ret;
-
- GST_OBJECT_LOCK (context);
- ret = context->priv->active_thread;
- if (ret)
- g_thread_ref (ret);
- GST_OBJECT_UNLOCK (context);
-
- return ret;
-}
-
-/**
- * gst_gl_context_get_gl_api:
- * @context: a #GstGLContext
- *
- * Get the currently enabled OpenGL api.
- *
- * The currently available API may be limited by the #GstGLDisplay in use and/or
- * the #GstGLWindow chosen.
- *
- * Returns: the available OpenGL api
- *
- * Since: 1.4
- */
-GstGLAPI
-gst_gl_context_get_gl_api (GstGLContext * context)
-{
- GstGLContextClass *context_class;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), GST_GL_API_NONE);
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
- g_return_val_if_fail (context_class->get_gl_api != NULL, GST_GL_API_NONE);
-
- return context_class->get_gl_api (context);
-}
-
-/**
- * gst_gl_context_get_proc_address:
- * @context: a #GstGLContext
- * @name: an opengl function name
- *
- * Get a function pointer to a specified opengl function, @name. If the the
- * specific function does not exist, NULL is returned instead.
- *
- * Platform specfic functions (names starting 'egl', 'glX', 'wgl', etc) can also
- * be retrieved using this method.
- *
- * Note: This function may return valid function pointers that may not be valid
- * to call in @context. The caller is responsible for ensuring that the
- * returned function is a valid function to call in @context by either checking
- * the OpenGL API and version or for an appropriate OpenGL extension.
- *
- * Note: On success, you need to cast the returned function pointer to the
- * correct type to be able to call it correctly. On 32-bit Windows, this will
- * include the %GSTGLAPI identifier to use the correct calling convention.
- * e.g.
- *
- * |[<!-- language="C" -->
- * void (GSTGLAPI *PFN_glGetIntegerv) (GLenum name, GLint * ret)
- * ]|
- *
- * Returns: a function pointer or %NULL
- *
- * Since: 1.4
- */
-gpointer
-gst_gl_context_get_proc_address (GstGLContext * context, const gchar * name)
-{
- gpointer ret;
- GstGLContextClass *context_class;
- GstGLAPI gl_api;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
- g_return_val_if_fail (context_class->get_proc_address != NULL, NULL);
-
- gl_api = gst_gl_context_get_gl_api (context);
- ret = context_class->get_proc_address (gl_api, name);
-
- return ret;
-}
-
-/**
- * gst_gl_context_default_get_proc_address:
- * @gl_api: a #GstGLAPI
- * @name: then function to get the address of
- *
- * A default implementation of the various GetProcAddress functions that looks
- * for @name in the OpenGL shared libraries or in the current process.
- *
- * See also: gst_gl_context_get_proc_address()
- *
- * Returns: an address pointing to @name or %NULL
- *
- * Since: 1.4
- */
-gpointer
-gst_gl_context_default_get_proc_address (GstGLAPI gl_api, const gchar * name)
-{
- gpointer ret = NULL;
-
- /* First try to load symbol from the selected GL API for this context */
-#if GST_GL_HAVE_GLES2
- if (!ret && (gl_api & GST_GL_API_GLES2)) {
- g_once (&module_gles2_gonce, load_gles2_module, NULL);
- if (module_gles2)
- g_module_symbol (module_gles2, name, &ret);
- }
-#endif
-
-#if GST_GL_HAVE_OPENGL
- if (!ret && (gl_api & (GST_GL_API_OPENGL | GST_GL_API_OPENGL3))) {
- g_once (&module_opengl_gonce, load_opengl_module, NULL);
- if (module_opengl)
- g_module_symbol (module_opengl, name, &ret);
- }
-#endif
-
- /* Otherwise fall back to the current module */
- g_once (&module_self_gonce, load_self_module, NULL);
- if (!ret)
- g_module_symbol (module_self, name, &ret);
-
- return ret;
-}
-
-/**
- * gst_gl_context_set_window:
- * @context: a #GstGLContext
- * @window: (transfer full): a #GstGLWindow
- *
- * Set's the current window on @context to @window. The window can only be
- * changed before gst_gl_context_create() has been called and the @window is not
- * already running.
- *
- * Returns: Whether the window was successfully updated
- *
- * Since: 1.4
- */
-gboolean
-gst_gl_context_set_window (GstGLContext * context, GstGLWindow * window)
-{
- g_return_val_if_fail (!GST_IS_GL_WRAPPED_CONTEXT (context), FALSE);
-
- GST_DEBUG_OBJECT (context, "window:%" GST_PTR_FORMAT, window);
-
- /* we can't change the window while we are running */
- if (context->priv->alive)
- return FALSE;
-
- if (window)
- g_weak_ref_set (&window->context_ref, context);
-
- if (context->window)
- gst_object_unref (context->window);
-
- context->window = window ? gst_object_ref (window) : NULL;
-
- return TRUE;
-}
-
-/**
- * gst_gl_context_get_window:
- * @context: a #GstGLContext
- *
- * Returns: (transfer full) (nullable): the currently set window
- *
- * Since: 1.4
- */
-GstGLWindow *
-gst_gl_context_get_window (GstGLContext * context)
-{
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
-
- if (GST_IS_GL_WRAPPED_CONTEXT (context)) {
- GST_WARNING_OBJECT (context, "context is not toplevel, returning NULL");
- return NULL;
- }
-
- _ensure_window (context);
-
- return gst_object_ref (context->window);
-}
-
-/**
- * gst_gl_context_can_share:
- * @context: a #GstGLContext
- * @other_context: another #GstGLContext
- *
- * Note: This will always fail for two wrapped #GstGLContext's
- *
- * Returns: whether @context and @other_context are able to share OpenGL
- * resources.
- *
- * Since: 1.6
- */
-gboolean
-gst_gl_context_can_share (GstGLContext * context, GstGLContext * other_context)
-{
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
- g_return_val_if_fail (GST_IS_GL_CONTEXT (other_context), FALSE);
-
- /* check if the contexts are descendants or the root nodes are the same */
- return context->priv->sharegroup != NULL
- && context->priv->sharegroup == other_context->priv->sharegroup;
-}
-
-/**
- * gst_gl_context_create:
- * @context: a #GstGLContext:
- * @other_context: (allow-none): a #GstGLContext to share OpenGL objects with
- * @error: (allow-none): a #GError
- *
- * Creates an OpenGL context with the specified @other_context as a context
- * to share shareable OpenGL objects with. See the OpenGL specification for
- * what is shared between OpenGL contexts.
- *
- * If an error occurs, and @error is not %NULL, then error will contain details
- * of the error and %FALSE will be returned.
- *
- * Should only be called once.
- *
- * Returns: whether the context could successfully be created
- *
- * Since: 1.4
- */
-gboolean
-gst_gl_context_create (GstGLContext * context,
- GstGLContext * other_context, GError ** error)
-{
- gboolean alive = FALSE;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
- g_return_val_if_fail (!GST_IS_GL_WRAPPED_CONTEXT (context), FALSE);
-
- GST_DEBUG_OBJECT (context, " other_context:%" GST_PTR_FORMAT, other_context);
-
- _ensure_window (context);
-
- g_mutex_lock (&context->priv->render_lock);
-
- if (!context->priv->created) {
- g_weak_ref_set (&context->priv->other_context_ref, other_context);
- context->priv->error = error;
- if (other_context == NULL)
- context->priv->sharegroup = _context_share_group_new ();
- else
- context->priv->sharegroup =
- _context_share_group_ref (other_context->priv->sharegroup);
-
- context->priv->gl_thread = g_thread_new ("gstglcontext",
- (GThreadFunc) gst_gl_context_create_thread, context);
-
- while (!context->priv->created)
- g_cond_wait (&context->priv->create_cond, &context->priv->render_lock);
-
- GST_INFO_OBJECT (context, "gl thread created");
- }
-
- alive = context->priv->alive;
-
- g_mutex_unlock (&context->priv->render_lock);
-
- return alive;
-}
-
-static gboolean
-_create_context_info (GstGLContext * context, GstGLAPI gl_api, gint * gl_major,
- gint * gl_minor, GError ** error)
-{
- const GstGLFuncs *gl;
- guint maj = 0, min = 0;
- GLenum gl_err = GL_NO_ERROR;
- const gchar *opengl_version = NULL;
-
- gl = context->gl_vtable;
-
- if (!gl->GetString || !gl->GetString (GL_VERSION)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "glGetString not defined or returned invalid value");
- return FALSE;
- }
-
- if (!gl->GetString (GL_SHADING_LANGUAGE_VERSION)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "No GL shader support available");
- return FALSE;
- }
-
- GST_INFO_OBJECT (context, "GL_VERSION: %s",
- GST_STR_NULL ((const gchar *) gl->GetString (GL_VERSION)));
- GST_INFO_OBJECT (context, "GL_SHADING_LANGUAGE_VERSION: %s",
- GST_STR_NULL ((const gchar *)
- gl->GetString (GL_SHADING_LANGUAGE_VERSION)));
- GST_INFO_OBJECT (context, "GL_VENDOR: %s",
- GST_STR_NULL ((const gchar *) gl->GetString (GL_VENDOR)));
- GST_INFO_OBJECT (context, "GL_RENDERER: %s",
- GST_STR_NULL ((const gchar *) gl->GetString (GL_RENDERER)));
-
- gl_err = gl->GetError ();
- if (gl_err != GL_NO_ERROR) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "glGetString error: 0x%x", gl_err);
- return FALSE;
- }
-
- opengl_version = (const gchar *) gl->GetString (GL_VERSION);
- if (opengl_version && gl_api & GST_GL_API_GLES2)
- /* gles starts with "OpenGL ES " */
- opengl_version = &opengl_version[10];
-
- if (opengl_version)
- sscanf (opengl_version, "%d.%d", &maj, &min);
-
- /* OpenGL > 1.2.0 */
- if (gl_api & GST_GL_API_OPENGL || gl_api & GST_GL_API_OPENGL3) {
- if ((maj < 1) || (maj < 2 && maj >= 1 && min < 2)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_OLD_LIBS,
- "OpenGL >= 1.2.0 required, found %u.%u", maj, min);
- return FALSE;
- }
- }
-
- if (gl_major)
- *gl_major = maj;
- if (gl_minor)
- *gl_minor = min;
-
- return TRUE;
-}
-
-static GstGLAPI
-_compiled_api (void)
-{
- GstGLAPI ret = GST_GL_API_NONE;
-
-#if GST_GL_HAVE_OPENGL
- ret |= GST_GL_API_OPENGL | GST_GL_API_OPENGL3;
-#endif
-#if GST_GL_HAVE_GLES2
- ret |= GST_GL_API_GLES2;
-#endif
-
- return ret;
-}
-
-static void
-_unlock_create_thread (GstGLContext * context)
-{
- context->priv->created = TRUE;
- GST_INFO_OBJECT (context, "gl thread running");
- g_cond_signal (&context->priv->create_cond);
- g_mutex_unlock (&context->priv->render_lock);
-}
-
-static GString *
-_build_extension_string (GstGLContext * context)
-{
- const GstGLFuncs *gl = context->gl_vtable;
- GString *ext_g_str = g_string_sized_new (1024);
- const gchar *ext_const_c_str = NULL;
- GLint i = 0;
- GLint n = 0;
-
- gl->GetIntegerv (GL_NUM_EXTENSIONS, &n);
-
- for (i = 0; i < n; i++) {
- ext_const_c_str = (const gchar *) gl->GetStringi (GL_EXTENSIONS, i);
- if (ext_const_c_str)
- g_string_append_printf (ext_g_str, "%s ", ext_const_c_str);
- }
-
- return ext_g_str;
-}
-
-//gboolean
-//gst_gl_context_create (GstGLContext * context, GstGLContext * other_context, GError ** error)
-static gpointer
-gst_gl_context_create_thread (GstGLContext * context)
-{
- GstGLContextClass *context_class;
- GstGLWindowClass *window_class;
- GstGLAPI compiled_api, user_api, gl_api, display_api;
- gchar *api_string;
- gchar *compiled_api_s;
- gchar *user_api_s;
- gchar *display_api_s;
- const gchar *user_choice;
- GError **error;
- GstGLContext *other_context;
-
- g_mutex_lock (&context->priv->render_lock);
-
- GST_DEBUG_OBJECT (context, "Creating thread");
-
- error = context->priv->error;
- other_context = g_weak_ref_get (&context->priv->other_context_ref);
-
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
- window_class = GST_GL_WINDOW_GET_CLASS (context->window);
-
- display_api = gst_gl_display_get_gl_api_unlocked (context->display);
- if (display_api == GST_GL_API_NONE) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
- "Cannot create context with satisfying requested apis "
- "(display has no GL api!)");
- goto failure;
- }
-
- if (window_class->open) {
- if (!window_class->open (context->window, error)) {
- GST_WARNING_OBJECT (context, "Failed to open window");
- g_assert (error == NULL || *error != NULL);
- goto failure;
- }
- }
-
- compiled_api = _compiled_api ();
- compiled_api_s = gst_gl_api_to_string (compiled_api);
-
- user_choice = g_getenv ("GST_GL_API");
- user_api = gst_gl_api_from_string (user_choice);
- user_api_s = gst_gl_api_to_string (user_api);
-
- display_api_s = gst_gl_api_to_string (display_api);
-
- if ((user_api & compiled_api & display_api) == GST_GL_API_NONE) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
- "Cannot create context with the user requested api (%s). "
- "We have support for (%s), display api (%s)", user_api_s,
- compiled_api_s, display_api_s);
- g_free (user_api_s);
- g_free (compiled_api_s);
- g_free (display_api_s);
- goto failure;
- }
-
- if (context_class->choose_format &&
- !context_class->choose_format (context, error)) {
- GST_WARNING_OBJECT (context, "Failed to choose format");
- g_assert (error == NULL || *error != NULL);
- g_free (compiled_api_s);
- g_free (user_api_s);
- g_free (display_api_s);
- goto failure;
- }
-
- GST_INFO_OBJECT (context,
- "Attempting to create opengl context. user chosen api(s) (%s), "
- "compiled api support (%s) display api (%s)", user_api_s, compiled_api_s,
- display_api_s);
-
- if (!context_class->create_context (context,
- compiled_api & user_api & display_api, other_context, error)) {
- GST_WARNING_OBJECT (context, "Failed to create context");
- g_assert (error == NULL || *error != NULL);
- g_free (compiled_api_s);
- g_free (user_api_s);
- g_free (display_api_s);
- goto failure;
- }
- GST_INFO_OBJECT (context, "created context");
-
- if (!gst_gl_context_activate (context, TRUE)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
- "Failed to activate the GL Context");
- g_free (compiled_api_s);
- g_free (user_api_s);
- g_free (display_api_s);
- goto failure;
- }
-
- gl_api = gst_gl_context_get_gl_api (context);
- g_assert (gl_api != GST_GL_API_NONE && gl_api != GST_GL_API_ANY);
-
- api_string = gst_gl_api_to_string (gl_api);
- GST_INFO_OBJECT (context, "available GL APIs: %s", api_string);
-
- if (((compiled_api & gl_api & display_api) & user_api) == GST_GL_API_NONE) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API,
- "failed to create context, context "
- "could not provide correct api. user (%s), compiled (%s), context (%s)",
- user_api_s, compiled_api_s, api_string);
- g_free (api_string);
- g_free (compiled_api_s);
- g_free (user_api_s);
- g_free (display_api_s);
- goto failure;
- }
-
- g_free (api_string);
- g_free (compiled_api_s);
- g_free (user_api_s);
- g_free (display_api_s);
-
- GST_DEBUG_OBJECT (context, "Filling info");
- if (!gst_gl_context_fill_info (context, error)) {
- g_assert (error == NULL || *error != NULL);
- goto failure;
- }
-
- context->priv->alive = TRUE;
-
-#if !defined(GST_DISABLE_GST_DEBUG)
- _gst_gl_debug_enable (context);
-#endif
-
- if (other_context) {
- GST_DEBUG_OBJECT (context, "Unreffing other_context %" GST_PTR_FORMAT,
- other_context);
- gst_object_unref (other_context);
- }
-
- /* unlocking of the render_lock happens when the
- * context's loop is running from inside that loop */
- gst_gl_window_send_message_async (context->window,
- (GstGLWindowCB) _unlock_create_thread, context, NULL);
-
- gst_gl_window_run (context->window);
-
- GST_INFO_OBJECT (context, "loop exited");
-
- g_mutex_lock (&context->priv->render_lock);
- context->priv->alive = FALSE;
-
- gst_gl_context_activate (context, FALSE);
-
- context_class->destroy_context (context);
-
- /* User supplied callback */
- if (context->window->close)
- context->window->close (context->window->close_data);
-
- /* window specific shutdown */
- if (window_class->close) {
- window_class->close (context->window);
- }
-
- context->priv->created = FALSE;
- g_cond_signal (&context->priv->destroy_cond);
- g_mutex_unlock (&context->priv->render_lock);
-
- return NULL;
-
-failure:
- {
- if (other_context)
- gst_object_unref (other_context);
-
- /* A context that fails to be created is considered created but not alive
- * and will never be able to be alive as creation can't happen */
- context->priv->created = TRUE;
- g_cond_signal (&context->priv->create_cond);
- g_mutex_unlock (&context->priv->render_lock);
- return NULL;
- }
-}
-
-/**
- * gst_gl_context_destroy:
- * @context: a #GstGLContext:
- *
- * Destroys an OpenGL context.
- *
- * Should only be called after gst_gl_context_create() has been successfully
- * called for this context.
- *
- * Since: 1.6
- */
-void
-gst_gl_context_destroy (GstGLContext * context)
-{
- GstGLContextClass *context_class;
-
- g_return_if_fail (GST_IS_GL_CONTEXT (context));
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
- g_return_if_fail (context_class->destroy_context != NULL);
-
- context_class->destroy_context (context);
-}
-
-/**
- * gst_gl_context_fill_info:
- * @context: a #GstGLContext:
- * @error: (allow-none): a #GError to fill on failure
- *
- * Fills @context's info (version, extensions, vtable, etc) from the GL
- * context in the current thread. Typically used with wrapped contexts to
- * allow wrapped contexts to be used as regular #GstGLContext's.
- *
- * Since: 1.6
- */
-gboolean
-gst_gl_context_fill_info (GstGLContext * context, GError ** error)
-{
- GstGLFuncs *gl;
- GString *ext_g_str = NULL;
- const gchar *ext_const_c_str = NULL;
- GstGLAPI gl_api;
- gboolean ret;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
- g_return_val_if_fail (context->priv->active_thread == g_thread_self (),
- FALSE);
-
- gl = context->gl_vtable;
- gl_api = gst_gl_context_get_gl_api (context);
-
- gl->GetError = gst_gl_context_get_proc_address (context, "glGetError");
- gl->GetString = gst_gl_context_get_proc_address (context, "glGetString");
- gl->GetStringi = gst_gl_context_get_proc_address (context, "glGetStringi");
- gl->GetIntegerv = gst_gl_context_get_proc_address (context, "glGetIntegerv");
-
- if (!gl->GetError || !gl->GetString) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "could not GetProcAddress core opengl functions");
- goto failure;
- }
-
- /* gl api specific code */
- ret = _create_context_info (context, gl_api, &context->priv->gl_major,
- &context->priv->gl_minor, error);
-
- if (!ret) {
- g_assert (error == NULL || *error != NULL);
- goto failure;
- }
-
- /* GL core contexts and GLES3 */
- if (gl->GetIntegerv && gl->GetStringi && context->priv->gl_major >= 3)
- ext_g_str = _build_extension_string (context);
-
- if (ext_g_str && ext_g_str->len) {
- GST_DEBUG_OBJECT (context, "GL_EXTENSIONS: %s", ext_g_str->str);
- _gst_gl_feature_check_ext_functions (context, context->priv->gl_major,
- context->priv->gl_minor, ext_g_str->str);
-
- context->priv->gl_exts = g_string_free (ext_g_str, FALSE);
- } else {
- ext_const_c_str = (const gchar *) gl->GetString (GL_EXTENSIONS);
- if (!ext_const_c_str)
- ext_const_c_str = "";
-
- GST_DEBUG_OBJECT (context, "GL_EXTENSIONS: %s", ext_const_c_str);
- _gst_gl_feature_check_ext_functions (context, context->priv->gl_major,
- context->priv->gl_minor, ext_const_c_str);
-
- context->priv->gl_exts = g_strdup (ext_const_c_str);
- }
-
- if (gl_api & GST_GL_API_OPENGL3
- && !gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 4, 1)
- && !gst_gl_check_extension ("GL_ARB_ES2_compatibility",
- context->priv->gl_exts)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "An opengl3 context created but the required ES2 compatibility was not found");
- goto failure;
- }
-
- /* Does not implement OES_vertex_array_object properly, see
- * https://bugzilla.gnome.org/show_bug.cgi?id=750185 */
- if (g_strcmp0 ((const gchar *) gl->GetString (GL_VENDOR),
- "Imagination Technologies") == 0
- && g_strcmp0 ((const gchar *) gl->GetString (GL_RENDERER),
- "PowerVR SGX 544MP") == 0) {
- gl->GenVertexArrays = NULL;
- gl->DeleteVertexArrays = NULL;
- gl->BindVertexArray = NULL;
- gl->IsVertexArray = NULL;
- }
-
- return TRUE;
-
-failure:
- return FALSE;
-}
-
-/**
- * gst_gl_context_get_gl_context:
- * @context: a #GstGLContext:
- *
- * Gets the backing OpenGL context used by @context.
- *
- * Returns: The platform specific backing OpenGL context
- *
- * Since: 1.4
- */
-guintptr
-gst_gl_context_get_gl_context (GstGLContext * context)
-{
- GstGLContextClass *context_class;
- guintptr result;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), 0);
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
- g_return_val_if_fail (context_class->get_gl_context != NULL, 0);
-
- result = context_class->get_gl_context (context);
-
- return result;
-}
-
-/**
- * gst_gl_context_get_gl_platform:
- * @context: a #GstGLContext:
- *
- * Gets the OpenGL platform that used by @context.
- *
- * Returns: The platform specific backing OpenGL context
- *
- * Since: 1.4
- */
-GstGLPlatform
-gst_gl_context_get_gl_platform (GstGLContext * context)
-{
- GstGLContextClass *context_class;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), 0);
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
- g_return_val_if_fail (context_class->get_gl_platform != NULL, 0);
-
- return context_class->get_gl_platform (context);
-}
-
-/**
- * gst_gl_context_get_display:
- * @context: a #GstGLContext:
- *
- * Returns: (transfer full): the #GstGLDisplay associated with this @context
- *
- * Since: 1.4
- */
-GstGLDisplay *
-gst_gl_context_get_display (GstGLContext * context)
-{
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
-
- return gst_object_ref (context->display);
-}
-
-typedef struct
-{
- GstGLContext *context;
- GstGLContextThreadFunc func;
- gpointer data;
-} RunGenericData;
-
-static void
-_gst_gl_context_thread_run_generic (RunGenericData * data)
-{
- GST_TRACE_OBJECT (data->context, "running function:%p data:%p", data->func,
- data->data);
-
- data->func (data->context, data->data);
-}
-
-/**
- * gst_gl_context_thread_add:
- * @context: a #GstGLContext
- * @func: (scope call): a #GstGLContextThreadFunc
- * @data: (closure): user data to call @func with
- *
- * Execute @func in the OpenGL thread of @context with @data
- *
- * MT-safe
- *
- * Since: 1.4
- */
-void
-gst_gl_context_thread_add (GstGLContext * context,
- GstGLContextThreadFunc func, gpointer data)
-{
- GstGLWindow *window;
- RunGenericData rdata;
-
- g_return_if_fail (GST_IS_GL_CONTEXT (context));
- g_return_if_fail (func != NULL);
-
- if (GST_IS_GL_WRAPPED_CONTEXT (context))
- g_return_if_fail (context->priv->active_thread == g_thread_self ());
-
- if (context->priv->active_thread == g_thread_self ()) {
- func (context, data);
- return;
- }
-
- rdata.context = context;
- rdata.data = data;
- rdata.func = func;
-
- window = gst_gl_context_get_window (context);
-
- gst_gl_window_send_message (window,
- GST_GL_WINDOW_CB (_gst_gl_context_thread_run_generic), &rdata);
-
- gst_object_unref (window);
-}
-
-/**
- * gst_gl_context_get_gl_version:
- * @context: a #GstGLContext
- * @maj: (out): resulting major version
- * @min: (out): resulting minor version
- *
- * Returns the OpenGL version implemented by @context. See
- * gst_gl_context_get_gl_api() for retreiving the OpenGL api implemented by
- * @context.
- *
- * Since: 1.4
- */
-void
-gst_gl_context_get_gl_version (GstGLContext * context, gint * maj, gint * min)
-{
- g_return_if_fail (GST_IS_GL_CONTEXT (context));
- g_return_if_fail (!(maj == NULL && min == NULL));
-
- if (maj)
- *maj = context->priv->gl_major;
-
- if (min)
- *min = context->priv->gl_minor;
-}
-
-/**
- * gst_gl_context_check_gl_version:
- * @context: a #GstGLContext
- * @api: api type required
- * @maj: major version required
- * @min: minor version required
- *
- * Returns: whether OpenGL context implements the required api and specified
- * version.
- *
- * Since: 1.4
- */
-gboolean
-gst_gl_context_check_gl_version (GstGLContext * context, GstGLAPI api,
- gint maj, gint min)
-{
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
-
- if (maj > context->priv->gl_major)
- return FALSE;
-
- if ((gst_gl_context_get_gl_api (context) & api) == GST_GL_API_NONE)
- return FALSE;
-
- if (maj < context->priv->gl_major)
- return TRUE;
-
- if (min > context->priv->gl_minor)
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * gst_gl_context_check_feature:
- * @context: a #GstGLContext
- * @feature: a platform specific feature
- *
- * Check for an OpenGL @feature being supported.
- *
- * Note: Most features require that the context be created before it is
- * possible to determine their existence and so will fail if that is not the
- * case.
- *
- * Returns: Whether @feature is supported by @context
- *
- * Since: 1.4
- */
-gboolean
-gst_gl_context_check_feature (GstGLContext * context, const gchar * feature)
-{
- GstGLContextClass *context_class;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
- g_return_val_if_fail (feature != NULL, FALSE);
-
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
-
- if (g_strstr_len (feature, 3, "GL_"))
- return gst_gl_check_extension (feature, context->priv->gl_exts);
-
- if (!context_class->check_feature)
- return FALSE;
-
- return context_class->check_feature (context, feature);
-}
-
-/**
- * gst_gl_context_get_current:
- *
- * See also gst_gl_context_activate().
- *
- * Returns: (transfer none): the #GstGLContext active in the current thread or %NULL
- *
- * Since: 1.6
- */
-GstGLContext *
-gst_gl_context_get_current (void)
-{
- return g_private_get (&current_context_key);
-}
-
-/**
- * gst_gl_context_is_shared:
- * @context: a #GstGLContext
- *
- * Returns: Whether the #GstGLContext has been shared with another #GstGLContext
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_context_is_shared (GstGLContext * context)
-{
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
-
- if (!context->priv->sharegroup)
- return FALSE;
-
- if (GST_IS_GL_WRAPPED_CONTEXT (context))
- g_return_val_if_fail (context->priv->active_thread, FALSE);
- else
- g_return_val_if_fail (context->priv->alive, FALSE);
-
- return _context_share_group_is_shared (context->priv->sharegroup);
-}
-
-/**
- * gst_gl_context_set_shared_with:
- * @context: a wrapped #GstGLContext
- * @share: another #GstGLContext
- *
- * Will internally set @context as shared with @share
- *
- * Since: 1.8
- */
-void
-gst_gl_context_set_shared_with (GstGLContext * context, GstGLContext * share)
-{
- g_return_if_fail (GST_IS_GL_CONTEXT (context));
- g_return_if_fail (GST_IS_GL_CONTEXT (share));
- g_return_if_fail (!gst_gl_context_is_shared (context));
- /* XXX: may be a little too strict */
- g_return_if_fail (GST_IS_GL_WRAPPED_CONTEXT (context));
-
- if (context->priv->sharegroup)
- _context_share_group_unref (context->priv->sharegroup);
- context->priv->sharegroup =
- _context_share_group_ref (share->priv->sharegroup);
-}
-
-static void
-gst_gl_context_default_get_gl_platform_version (GstGLContext * context,
- gint * major, gint * minor)
-{
- if (major)
- *major = 0;
- if (minor)
- *minor = 0;
-}
-
-/**
- * gst_gl_context_get_gl_platform_version:
- * @context: a #GstGLContext
- * @major: (out): return for the major version
- * @minor: (out): return for the minor version
- *
- * Get the version of the OpenGL platform (GLX, EGL, etc) used. Only valid
- * after a call to gst_gl_context_create_context().
- */
-void
-gst_gl_context_get_gl_platform_version (GstGLContext * context, gint * major,
- gint * minor)
-{
- GstGLContextClass *context_class;
-
- g_return_if_fail (GST_IS_GL_CONTEXT (context));
- g_return_if_fail (major != NULL);
- g_return_if_fail (minor != NULL);
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
- g_return_if_fail (context_class->get_gl_platform_version != NULL);
-
- context_class->get_gl_platform_version (context, major, minor);
-}
-
-/**
- * gst_gl_context_swap_buffers:
- * @context: a #GstGLContext
- *
- * Swap the front and back buffers on the window attached to @context.
- * This will display the frame on the next refresh cycle.
- */
-void
-gst_gl_context_swap_buffers (GstGLContext * context)
-{
- GstGLContextClass *context_class;
-
- g_return_if_fail (GST_IS_GL_CONTEXT (context));
- context_class = GST_GL_CONTEXT_GET_CLASS (context);
- g_return_if_fail (context_class->swap_buffers != NULL);
-
- context_class->swap_buffers (context);
-}
-
-static GstGLAPI
-gst_gl_wrapped_context_get_gl_api (GstGLContext * context)
-{
- GstGLWrappedContext *context_wrap = GST_GL_WRAPPED_CONTEXT (context);
-
- return context_wrap->available_apis;
-}
-
-static guintptr
-gst_gl_wrapped_context_get_gl_context (GstGLContext * context)
-{
- GstGLWrappedContext *context_wrap = GST_GL_WRAPPED_CONTEXT (context);
-
- return context_wrap->handle;
-}
-
-static GstGLPlatform
-gst_gl_wrapped_context_get_gl_platform (GstGLContext * context)
-{
- GstGLWrappedContext *context_wrap = GST_GL_WRAPPED_CONTEXT (context);
-
- return context_wrap->platform;
-}
-
-static gboolean
-gst_gl_wrapped_context_activate (GstGLContext * context, gboolean activate)
-{
- if (activate) {
- GThread *old_thread = context->priv->gl_thread;
- context->priv->gl_thread = g_thread_ref (g_thread_self ());
- if (old_thread) {
- g_thread_unref (old_thread);
- }
- } else {
- if (context->priv->gl_thread) {
- g_thread_unref (context->priv->gl_thread);
- context->priv->gl_thread = NULL;
- }
- }
-
- return TRUE;
-}
-
-static void
-gst_gl_wrapped_context_class_init (GstGLWrappedContextClass * klass)
-{
- GstGLContextClass *context_class = (GstGLContextClass *) klass;
-
- context_class->get_gl_context =
- GST_DEBUG_FUNCPTR (gst_gl_wrapped_context_get_gl_context);
- context_class->get_gl_api =
- GST_DEBUG_FUNCPTR (gst_gl_wrapped_context_get_gl_api);
- context_class->get_gl_platform =
- GST_DEBUG_FUNCPTR (gst_gl_wrapped_context_get_gl_platform);
- context_class->activate = GST_DEBUG_FUNCPTR (gst_gl_wrapped_context_activate);
-}
-
-static void
-gst_gl_wrapped_context_init (GstGLWrappedContext * context)
-{
-}
diff --git a/gst-libs/gst/gl/gstglcontext.h b/gst-libs/gst/gl/gstglcontext.h
deleted file mode 100644
index 54383c56e..000000000
--- a/gst-libs/gst/gl/gstglcontext.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_CONTEXT_H__
-#define __GST_GL_CONTEXT_H__
-
-#include <gst/gst.h>
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_context_get_type (void);
-#define GST_TYPE_GL_CONTEXT (gst_gl_context_get_type())
-
-/* FIXME: remove this when moving to -base */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_GL_TYPE_CONTEXT GST_TYPE_GL_CONTEXT
-#endif
-#define GST_GL_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_CONTEXT, GstGLContext))
-#define GST_GL_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_GL_CONTEXT, GstGLContextClass))
-#define GST_IS_GL_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_CONTEXT))
-#define GST_IS_GL_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_CONTEXT))
-#define GST_GL_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_CONTEXT, GstGLContextClass))
-
-GST_EXPORT
-GQuark gst_gl_context_error_quark (void);
-
-/**
- * GST_GL_CONTEXT_ERROR:
- *
- * Error domain for GStreamer's GL context module. Errors in this domain will
- * be from the #GstGLContextError enumeration
- */
-#define GST_GL_CONTEXT_ERROR (gst_gl_context_error_quark ())
-
-/**
- * GstGLContextThreadFunc:
- * @context: a #GstGLContext
- * @data: user data
- *
- * Represents a function to run in the GL thread with @context and @data
- */
-typedef void (*GstGLContextThreadFunc) (GstGLContext * context, gpointer data);
-
-#define GST_GL_CONTEXT_TYPE_CGL "gst.gl.context.CGL"
-#define GST_GL_CONTEXT_TYPE_GLX "gst.gl.context.GLX"
-#define GST_GL_CONTEXT_TYPE_EGL "gst.gl.context.EGL"
-#define GST_GL_CONTEXT_TYPE_WGL "gst.gl.context.WGL"
-#define GST_GL_CONTEXT_TYPE_EAGL "gst.gl.context.EAGL"
-
-/**
- * GstGLContextError:
- * @GST_GL_CONTEXT_ERROR_FAILED: Failed for an unspecified reason
- * @GST_GL_CONTEXT_ERROR_WRONG_CONFIG: The configuration requested is not correct
- * @GST_GL_CONTEXT_ERROR_WRONG_API: The OpenGL API requested is not correct
- * @GST_GL_CONTEXT_ERROR_OLD_LIBS: The OpenGL libraries are too old
- * @GST_GL_CONTEXT_ERROR_CREATE_CONTEXT: glXCreateContext (or similar) failed
- * @GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE: A resource is not available
- *
- * OpenGL context errors.
- */
-typedef enum
-{
- GST_GL_CONTEXT_ERROR_FAILED,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
- GST_GL_CONTEXT_ERROR_WRONG_API,
- GST_GL_CONTEXT_ERROR_OLD_LIBS,
- GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
- GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
-} GstGLContextError;
-
-/**
- * GstGLContext:
- * @gl_vtable: a list of OpenGL function pointers
- *
- * Opaque #GstGLContext object
- */
-struct _GstGLContext {
- /*< private >*/
- GstObject parent;
-
- GstGLDisplay *display;
- GstGLWindow *window;
-
- /*< public >*/
- GstGLFuncs *gl_vtable;
-
- /*< private >*/
- GstGLContextPrivate *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-/**
- * GstGLContextClass:
- * @get_gl_context: get the backing platform specific OpenGL context
- * @get_gl_api: get the available OpenGL api's that this context can work with
- * @get_proc_address: get an function pointer to an OpenGL function
- * @activate: call eglMakeCurrent or similar
- * @choose_format: choose a format for the framebuffer
- * @create_context: create the OpenGL context
- * @destroy_context: destroy the OpenGL context
- * @swap_buffers: swap the default framebuffer's front/back buffers
- */
-struct _GstGLContextClass {
- GstObjectClass parent_class;
-
- guintptr (*get_current_context) (void);
- guintptr (*get_gl_context) (GstGLContext *context);
- GstGLAPI (*get_gl_api) (GstGLContext *context);
- GstGLPlatform (*get_gl_platform) (GstGLContext *context);
- gpointer (*get_proc_address) (GstGLAPI gl_api, const gchar *name);
- gboolean (*activate) (GstGLContext *context, gboolean activate);
- gboolean (*choose_format) (GstGLContext *context, GError **error);
- gboolean (*create_context) (GstGLContext *context, GstGLAPI gl_api,
- GstGLContext *other_context, GError ** error);
- void (*destroy_context) (GstGLContext *context);
- void (*swap_buffers) (GstGLContext *context);
- gboolean (*check_feature) (GstGLContext *context, const gchar *feature);
- void (*get_gl_platform_version) (GstGLContext *context, gint *major, gint *minor);
-
- /*< private >*/
- gpointer _reserved[GST_PADDING];
-};
-
-/* methods */
-
-GST_EXPORT
-GstGLContext * gst_gl_context_new (GstGLDisplay *display);
-GST_EXPORT
-GstGLContext * gst_gl_context_new_wrapped (GstGLDisplay *display,
- guintptr handle,
- GstGLPlatform context_type,
- GstGLAPI available_apis);
-
-GST_EXPORT
-gboolean gst_gl_context_activate (GstGLContext *context, gboolean activate);
-GST_EXPORT
-GThread * gst_gl_context_get_thread (GstGLContext *context);
-GST_EXPORT
-GstGLContext * gst_gl_context_get_current (void);
-
-GST_EXPORT
-GstGLDisplay * gst_gl_context_get_display (GstGLContext *context);
-GST_EXPORT
-gpointer gst_gl_context_get_proc_address (GstGLContext *context, const gchar *name);
-GST_EXPORT
-GstGLPlatform gst_gl_context_get_gl_platform (GstGLContext *context);
-GST_EXPORT
-GstGLAPI gst_gl_context_get_gl_api (GstGLContext *context);
-GST_EXPORT
-guintptr gst_gl_context_get_gl_context (GstGLContext *context);
-GST_EXPORT
-gboolean gst_gl_context_can_share (GstGLContext * context, GstGLContext *other_context);
-GST_EXPORT
-void gst_gl_context_swap_buffers (GstGLContext * context);
-
-GST_EXPORT
-gboolean gst_gl_context_create (GstGLContext *context, GstGLContext *other_context, GError ** error);
-GST_EXPORT
-void gst_gl_context_destroy (GstGLContext *context);
-
-GST_EXPORT
-gpointer gst_gl_context_default_get_proc_address (GstGLAPI gl_api, const gchar *name);
-GST_EXPORT
-gpointer gst_gl_context_get_proc_address_with_platform (GstGLPlatform context_type, GstGLAPI gl_api, const gchar *name);
-
-GST_EXPORT
-gboolean gst_gl_context_set_window (GstGLContext *context, GstGLWindow *window);
-GST_EXPORT
-GstGLWindow * gst_gl_context_get_window (GstGLContext *context);
-
-GST_EXPORT
-void gst_gl_context_get_gl_version (GstGLContext *context, gint *maj, gint *min);
-GST_EXPORT
-gboolean gst_gl_context_check_gl_version (GstGLContext * context, GstGLAPI api, gint maj, gint min);
-GST_EXPORT
-gboolean gst_gl_context_check_feature (GstGLContext *context, const gchar *feature);
-GST_EXPORT
-void gst_gl_context_get_gl_platform_version (GstGLContext * context, gint * major, gint * minor);
-
-GST_EXPORT
-guintptr gst_gl_context_get_current_gl_context (GstGLPlatform context_type);
-GST_EXPORT
-GstGLAPI gst_gl_context_get_current_gl_api (GstGLPlatform platform, guint *major, guint *minor);
-
-GST_EXPORT
-gboolean gst_gl_context_is_shared (GstGLContext * context);
-GST_EXPORT
-void gst_gl_context_set_shared_with (GstGLContext * context, GstGLContext * share);
-
-GST_EXPORT
-gboolean gst_gl_context_fill_info (GstGLContext * context, GError ** error);
-
-/* FIXME: remove */
-GST_EXPORT
-void gst_gl_context_thread_add (GstGLContext * context,
- GstGLContextThreadFunc func, gpointer data);
-
-G_END_DECLS
-
-#endif /* __GST_GL_CONTEXT_H__ */
diff --git a/gst-libs/gst/gl/gstglcontext_private.h b/gst-libs/gst/gl/gstglcontext_private.h
deleted file mode 100644
index 4d190bf33..000000000
--- a/gst-libs/gst/gl/gstglcontext_private.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_CONTEXT_PRIVATE_H__
-#define __GST_GL_CONTEXT_PRIVATE_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-G_GNUC_INTERNAL extern GstDebugCategory *gst_gl_context_debug;
-
-G_END_DECLS
-
-#endif /* __GST_GL_CONTEXT_PRIVATE_H__ */
diff --git a/gst-libs/gst/gl/gstgldebug.c b/gst-libs/gst/gl/gstgldebug.c
deleted file mode 100644
index 6f8eb4aa8..000000000
--- a/gst-libs/gst/gl/gstgldebug.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstgldebug.h"
-
-#include <glib/gprintf.h>
-#include <string.h>
-
-#include "gstglcontext.h"
-#include "gstglcontext_private.h"
-#include "gstglfuncs.h"
-
-/**
- * SECTION:gstgldebug
- * @short_description: helper routines for dealing with OpenGL debugging
- * @title: OpenGL debugging
- * @see_also: #GstGLContext
- */
-
-#define ASYNC_DEBUG_FILLED (1 << 0)
-#define ASYNC_DEBUG_FROZEN (1 << 1)
-
-/* compatibility defines */
-#ifndef GL_DEBUG_TYPE_ERROR
-#define GL_DEBUG_TYPE_ERROR 0x824C
-#endif
-#ifndef GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR
-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
-#endif
-#ifndef GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR
-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
-#endif
-#ifndef GL_DEBUG_TYPE_PORTABILITY
-#define GL_DEBUG_TYPE_PORTABILITY 0x824F
-#endif
-#ifndef GL_DEBUG_TYPE_PERFORMANCE
-#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
-#endif
-#ifndef GL_DEBUG_TYPE_MARKER
-#define GL_DEBUG_TYPE_MARKER 0x8268
-#endif
-#ifndef GL_DEBUG_TYPE_OTHER
-#define GL_DEBUG_TYPE_OTHER 0x8251
-#endif
-
-#ifndef GL_DEBUG_SEVERITY_HIGH
-#define GL_DEBUG_SEVERITY_HIGH 0x9146
-#endif
-#ifndef GL_DEBUG_SEVERITY_MEDIUM
-#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
-#endif
-#ifndef GL_DEBUG_SEVERITY_LOW
-#define GL_DEBUG_SEVERITY_LOW 0x9148
-#endif
-#ifndef GL_DEBUG_SEVERITY_NOTIFICATION
-#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
-#endif
-
-#ifndef GL_DEBUG_SOURCE_API
-#define GL_DEBUG_SOURCE_API 0x8246
-#endif
-#ifndef GL_DEBUG_SOURCE_WINDOW_SYSTEM
-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
-#endif
-#ifndef GL_DEBUG_SOURCE_SHADER_COMPILER
-#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
-#endif
-#ifndef GL_DEBUG_SOURCE_THIRD_PARTY
-#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
-#endif
-#ifndef GL_DEBUG_SOURCE_APPLICATION
-#define GL_DEBUG_SOURCE_APPLICATION 0x824A
-#endif
-#ifndef GL_DEBUG_SOURCE_OTHER
-#define GL_DEBUG_SOURCE_OTHER 0x824B
-#endif
-
-GST_DEBUG_CATEGORY_STATIC (gst_performance);
-#define GST_CAT_DEFAULT gst_gl_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-GST_DEBUG_CATEGORY_STATIC (default_debug);
-GST_DEBUG_CATEGORY_STATIC (gst_gl_marker_debug);
-
-static void
-_init_debug (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_GET (gst_performance, "GST_PERFORMANCE");
- GST_DEBUG_CATEGORY_GET (gst_gl_debug, "gldebug");
- GST_DEBUG_CATEGORY_GET (default_debug, "default");
- GST_DEBUG_CATEGORY_INIT (gst_gl_marker_debug, "gldebugmarker", 0,
- "OpenGL Markers");
- g_once_init_leave (&_init, 1);
- }
-}
-
-static void
-_free_async_debug_data (GstGLAsyncDebug * ad)
-{
- if (ad->debug_msg) {
- g_free (ad->debug_msg);
- ad->debug_msg = NULL;
- if (ad->object)
- g_object_unref (ad->object);
- ad->object = NULL;
- ad->state_flags &= ~ASYNC_DEBUG_FILLED;
- }
-}
-
-/**
- * gst_gl_async_debug_init:
- * @ad: a #GstGLAsyncDebug
- *
- * Initialize @ad. Intended for use with #GstGLAsyncDebug's that are embedded
- * in other structs.
- *
- * Since: 1.8
- */
-void
-gst_gl_async_debug_init (GstGLAsyncDebug * ad)
-{
- _init_debug ();
-
- memset (ad, 0, sizeof (*ad));
-}
-
-/**
- * gst_gl_async_debug_unset:
- * @ad: a #GstGLAsyncDebug
- *
- * Unset any dynamically allocated data. Intended for use with
- * #GstGLAsyncDebug's that are embedded in other structs.
- */
-void
-gst_gl_async_debug_unset (GstGLAsyncDebug * ad)
-{
- gst_gl_async_debug_output_log_msg (ad);
-
- _free_async_debug_data (ad);
-
- if (ad->notify)
- ad->notify (ad->user_data);
-}
-
-/**
- * gst_gl_async_debug_new: (skip)
- *
- * Free with gst_gl_async_debug_free()
- *
- * Returns: a new #GstGLAsyncDebug
- *
- * Since: 1.8
- */
-GstGLAsyncDebug *
-gst_gl_async_debug_new (void)
-{
- return g_new0 (GstGLAsyncDebug, 1);
-}
-
-/**
- * gst_gl_async_debug_free:
- * @ad: a #GstGLAsyncDebug
- *
- * Frees @ad
- *
- * Since: 1.8
- */
-void
-gst_gl_async_debug_free (GstGLAsyncDebug * ad)
-{
- gst_gl_async_debug_unset (ad);
- g_free (ad);
-}
-
-/**
- * gst_gl_async_debug_freeze:
- * @ad: a #GstGLAsyncDebug
- *
- * freeze the debug output. While frozen, any call to
- * gst_gl_async_debug_output_log_msg() will not output any messages but
- * subsequent calls to gst_gl_async_debug_store_log_msg() will overwrite previous
- * messages.
- *
- * Since: 1.8
- */
-void
-gst_gl_async_debug_freeze (GstGLAsyncDebug * ad)
-{
- ad->state_flags |= ASYNC_DEBUG_FROZEN;
-}
-
-/**
- * gst_gl_async_debug_thaw:
- * @ad: a #GstGLAsyncDebug
- *
- * unfreeze the debug output. See gst_gl_async_debug_freeze() for what freezing means
- *
- * Since: 1.8
- */
-void
-gst_gl_async_debug_thaw (GstGLAsyncDebug * ad)
-{
- ad->state_flags &= ~ASYNC_DEBUG_FROZEN;
-}
-
-#if !defined(GST_DISABLE_GST_DEBUG)
-
-static inline const gchar *
-_debug_severity_to_string (GLenum severity)
-{
- switch (severity) {
- case GL_DEBUG_SEVERITY_HIGH:
- return "high";
- case GL_DEBUG_SEVERITY_MEDIUM:
- return "medium";
- case GL_DEBUG_SEVERITY_LOW:
- return "low";
- case GL_DEBUG_SEVERITY_NOTIFICATION:
- return "notification";
- default:
- return "invalid";
- }
-}
-
-static inline const gchar *
-_debug_source_to_string (GLenum source)
-{
- switch (source) {
- case GL_DEBUG_SOURCE_API:
- return "API";
- case GL_DEBUG_SOURCE_WINDOW_SYSTEM:
- return "winsys";
- case GL_DEBUG_SOURCE_SHADER_COMPILER:
- return "shader compiler";
- case GL_DEBUG_SOURCE_THIRD_PARTY:
- return "third party";
- case GL_DEBUG_SOURCE_APPLICATION:
- return "application";
- case GL_DEBUG_SOURCE_OTHER:
- return "other";
- default:
- return "invalid";
- }
-}
-
-static inline const gchar *
-_debug_type_to_string (GLenum type)
-{
- switch (type) {
- case GL_DEBUG_TYPE_ERROR:
- return "error";
- case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
- return "deprecated";
- case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
- return "undefined";
- case GL_DEBUG_TYPE_PORTABILITY:
- return "portability";
- case GL_DEBUG_TYPE_PERFORMANCE:
- return "performance";
- case GL_DEBUG_TYPE_MARKER:
- return "debug marker";
- case GL_DEBUG_TYPE_OTHER:
- return "other";
- default:
- return "invalid";
- }
-}
-
-static void GSTGLAPI
-_gst_gl_debug_callback (GLenum source, GLenum type, GLuint id, GLenum severity,
- GLsizei length, const gchar * message, gpointer user_data)
-{
- GstGLContext *context = user_data;
- const gchar *severity_str = _debug_severity_to_string (severity);
- const gchar *source_str = _debug_source_to_string (source);
- const gchar *type_str = _debug_type_to_string (type);
-
- _init_debug ();
-
- switch (type) {
- case GL_DEBUG_TYPE_ERROR:
- case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
- GST_ERROR_OBJECT (context, "%s: GL %s from %s id:%u, %s", severity_str,
- type_str, source_str, id, message);
- break;
- case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
- case GL_DEBUG_TYPE_PORTABILITY:
- GST_FIXME_OBJECT (context, "%s: GL %s from %s id:%u, %s", severity_str,
- type_str, source_str, id, message);
- break;
- case GL_DEBUG_TYPE_PERFORMANCE:
- GST_CAT_DEBUG_OBJECT (gst_performance, context, "%s: GL %s from %s id:%u,"
- " %s", severity_str, type_str, source_str, id, message);
- break;
- default:
- GST_DEBUG_OBJECT (context, "%s: GL %s from %s id:%u, %s", severity_str,
- type_str, source_str, id, message);
- break;
- }
-}
-
-G_GNUC_INTERNAL void _gst_gl_debug_enable (GstGLContext * context);
-
-G_GNUC_INTERNAL void
-_gst_gl_debug_enable (GstGLContext * context)
-{
- const GstGLFuncs *gl = context->gl_vtable;
- GstDebugLevel level;
- GLenum debug_types[8];
- guint i, n = 0;
-
- _init_debug ();
-
- if (!gl->DebugMessageCallback) {
- GST_CAT_INFO_OBJECT (gst_gl_context_debug, context,
- "No debugging support available");
- return;
- }
-
- level = gst_debug_category_get_threshold (gst_gl_debug);
-
- if (level < GST_LEVEL_ERROR) {
- GST_CAT_INFO_OBJECT (gst_gl_context_debug, context,
- "Disabling GL context debugging (gldebug category debug level < error)");
- return;
- }
-
- GST_CAT_INFO_OBJECT (gst_gl_context_debug, context,
- "Enabling GL context debugging");
-
- gl->DebugMessageCallback (_gst_gl_debug_callback, context);
- if (level >= GST_LEVEL_DEBUG) {
- /* enable them all */
- gl->DebugMessageControl (GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0,
- GL_TRUE);
- } else {
- if (level >= GST_LEVEL_FIXME) {
- debug_types[n++] = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR;
- debug_types[n++] = GL_DEBUG_TYPE_PORTABILITY;
- }
- if (level >= GST_LEVEL_ERROR) {
- debug_types[n++] = GL_DEBUG_TYPE_ERROR;
- debug_types[n++] = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR;
- }
- g_assert (n < G_N_ELEMENTS (debug_types));
- for (i = 0; i < n; i++) {
- gl->DebugMessageControl (GL_DONT_CARE, debug_types[i], GL_DONT_CARE,
- 0, 0, GL_TRUE);
- }
- }
-}
-
-/**
- * gst_gl_insert_debug_marker:
- * @context: a #GstGLContext
- * @format: a printf-style format string
- * @...: arguments form @format
- *
- * Inserts a marker into a GL debug stream. Requires the 'gldebugmarker'
- * debug category to be at least %GST_LEVEL_FIXME.
- *
- * Since: 1.8
- */
-void
-gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...)
-{
- const GstGLFuncs *gl = context->gl_vtable;
- gchar *string;
- gint len;
- va_list args;
-
- _init_debug ();
-
- /* are we enabled */
- if (gst_debug_category_get_threshold (gst_gl_marker_debug) < GST_LEVEL_FIXME)
- return;
-
- va_start (args, format);
- len = gst_info_vasprintf (&string, format, args);
- va_end (args);
-
- /* gst_info_vasprintf() returns -1 on error, the various debug marker
- * functions take len=-1 to mean null terminated */
- if (len < 0 || string == NULL)
- /* no debug output */
- return;
-
- if (gl->DebugMessageInsert)
- gl->DebugMessageInsert (GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_TYPE_MARKER,
- 0, GL_DEBUG_SEVERITY_LOW, (gsize) len, string);
- else if (gl->InsertEventMarker)
- gl->InsertEventMarker (len, string);
- else if (gl->StringMarker)
- gl->StringMarker (len, string);
-
- g_free (string);
-}
-
-/**
- * gst_gl_async_debug_store_log_msg_valist:
- * @ad: the #GstGLAsyncDebug to store the message in
- * @cat: the #GstDebugCategory to output the message in
- * @level: the #GstLevel
- * @file: the file where the debug message originates from
- * @function: the function where the debug message originates from
- * @line: the line in @file where the debug message originates from
- * @object: (allow-none): a #GObject to associate with the debug message
- * @format: a printf style format string
- * @varargs: the list of arguments for @format
- *
- * Stores a debug message for later output by gst_gl_async_debug_output_log_msg()
- *
- * Since: 1.8
- */
-void
-gst_gl_async_debug_store_log_msg_valist (GstGLAsyncDebug * ad,
- GstDebugCategory * cat, GstDebugLevel level, const gchar * file,
- const gchar * function, gint line, GObject * object, const gchar * format,
- va_list varargs)
-{
- gst_gl_async_debug_output_log_msg (ad);
- _free_async_debug_data (ad);
-
- if (G_UNLIKELY (level <= GST_LEVEL_MAX && level <= _gst_debug_min)) {
- if (!cat)
- cat = default_debug;
-
- ad->cat = cat;
- ad->level = level;
- ad->file = file;
- ad->function = function;
- ad->line = line;
- if (object)
- ad->object = g_object_ref (object);
- else
- ad->object = NULL;
-
- ad->debug_msg = gst_info_strdup_vprintf (format, varargs);
- ad->state_flags |= ASYNC_DEBUG_FILLED;
- }
-}
-
-/**
- * gst_gl_async_debug_output_log_msg:
- * @ad: the #GstGLAsyncDebug to store the message in
- *
- * Outputs a previously stored debug message.
- */
-void
-gst_gl_async_debug_output_log_msg (GstGLAsyncDebug * ad)
-{
- if ((ad->state_flags & ASYNC_DEBUG_FILLED) != 0
- && (ad->state_flags & ASYNC_DEBUG_FROZEN) == 0) {
- gchar *msg = NULL;
-
- if (ad->callback)
- msg = ad->callback (ad->user_data);
-
- gst_debug_log (ad->cat, ad->level, ad->file, ad->function, ad->line,
- ad->object, "%s %s", GST_STR_NULL (ad->debug_msg), msg ? msg : "");
- g_free (msg);
- _free_async_debug_data (ad);
- }
-}
-
-/**
- * gst_gl_async_debug_store_log_msg:
- * @ad: the #GstGLAsyncDebug to store the message in
- * @cat: the #GstDebugCategory to output the message in
- * @level: the #GstLevel
- * @file: the file where the debug message originates from
- * @function: the function where the debug message originates from
- * @line: the line in @file where the debug message originates from
- * @object: (allow-none): a #GObject to associate with the debug message
- * @format: a printf style format string
- * @...: the list of arguments for @format
- *
- * Stores a debug message for later output by gst_gl_async_debug_output_log_msg()
- *
- * Since: 1.8
- */
-void
-gst_gl_async_debug_store_log_msg (GstGLAsyncDebug * ad, GstDebugCategory * cat,
- GstDebugLevel level, const gchar * file, const gchar * function, gint line,
- GObject * object, const gchar * format, ...)
-{
- va_list varargs;
-
- if (G_UNLIKELY (level <= GST_LEVEL_MAX && level <= _gst_debug_min)) {
- va_start (varargs, format);
- gst_gl_async_debug_store_log_msg_valist (ad, cat, level, file, function,
- line, object, format, varargs);
- va_end (varargs);
- }
-}
-#else
-G_GNUC_INTERNAL void _gst_gl_debug_enable (GstGLContext * context);
-#endif
diff --git a/gst-libs/gst/gl/gstgldebug.h b/gst-libs/gst/gl/gstgldebug.h
deleted file mode 100644
index 503115544..000000000
--- a/gst-libs/gst/gl/gstgldebug.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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_DEBUG_H__
-#define __GST_GL_DEBUG_H__
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GstGLAsyncDebug GstGLAsyncDebug;
-
-typedef gchar * (*GstGLAsyncDebugLogGetMessage) (gpointer user_data);
-
-/**
- * GstGLAsyncDebug:
- *
- * #GstGLAsyncDebug an opaque structure and should only be accessed through the
- * provided API.
- */
-struct _GstGLAsyncDebug
-{
- /* <private> */
- guint state_flags;
- GstDebugCategory *cat;
- GstDebugLevel level;
- const gchar *file;
- const gchar *function;
- gint line;
- GObject *object;
- gchar *debug_msg;
-
- /* <protected> */
- GstGLAsyncDebugLogGetMessage callback;
- gpointer user_data;
- GDestroyNotify notify;
-
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstGLAsyncDebug * gst_gl_async_debug_new (void);
-GST_EXPORT
-void gst_gl_async_debug_free (GstGLAsyncDebug * ad);
-GST_EXPORT
-void gst_gl_async_debug_init (GstGLAsyncDebug * ad);
-GST_EXPORT
-void gst_gl_async_debug_unset (GstGLAsyncDebug * ad);
-GST_EXPORT
-void gst_gl_async_debug_freeze (GstGLAsyncDebug * ad);
-GST_EXPORT
-void gst_gl_async_debug_thaw (GstGLAsyncDebug * ad);
-
-/**
- * GST_GL_ASYNC_CAT_LEVEL_LOG_valist:
- * @ad: the #GstGLAsyncDebug to store the message in
- * @cat: the #GstDebugCategory to output the message in
- * @level: the #GstLevel
- * @object: (allow-none): a #GObject to associate with the debug message
- * @format: a printf style format string
- * @varargs: the list of arguments for @format
- *
- * Stores a debug message in @ad for later output
- */
-#define GST_GL_ASYNC_CAT_LEVEL_LOG_valist(ad,cat,level,object,format,varargs) \
- gst_gl_async_debug_store_log_msg_valist (ad, cat, level, __FILE__, \
- GST_FUNCTION, __LINE__, object, format, varargs)
-
-/**
- * GST_GL_ASYNC_CAT_LEVEL_LOG:
- * @ad: the #GstGLAsyncDebug to store the message in
- * @cat: the #GstDebugCategory to output the message in
- * @level: the #GstLevel
- * @object: (allow-none): a #GObject to associate with the debug message
- * @format: a printf style format string
- * @...: the list of arguments for @format
- *
- * Stores a debug message in @ad for later output
- */
-#if G_HAVE_ISO_VARARGS
-#define GST_GL_ASYNC_CAT_LEVEL_LOG(ad,cat,level,object,format,...) \
- gst_gl_async_debug_store_log_msg (ad, cat, level, __FILE__, GST_FUNCTION, \
- __LINE__, object, format, __VA_ARGS__)
-#else /* G_HAVE_ISO_VARARGS */
-#if G_HAVE_GNUC_VARARGS
-#define GST_GL_ASYNC_CAT_LEVEL_LOG(ad,cat,level,object,format,args...) \
- gst_gl_async_debug_store_log_msg (ad, cat, level, __FILE__, GST_FUNCTION, \
- __LINE__, object, format, ##args)
-#else /* G_HAVE_GNUC_VARARGS */
-static inline void
-GST_GL_ASYNC_CAT_LEVEL_LOG(GstGLAsyncDebug * ad, GstDebugCategory * cat,
- GstDebugLevel level, GObject * object, const gchar * format, ...)
-{
- va_list varargs;
-
- va_start (varargs, format);
- GST_GL_ASYNC_CAT_LEVEL_LOG_valist (ad, cat, level, object, format, varargs);
- va_end (varargs);
-}
-#endif /* G_HAVE_GNUC_VARARGS */
-#endif /* G_HAVE_ISO_VARARGS */
-
-#if !defined(GST_DISABLE_GST_DEBUG)
-
-GST_EXPORT
-void gst_gl_insert_debug_marker (GstGLContext * context,
- const gchar * format, ...) G_GNUC_PRINTF (2, 3);
-GST_EXPORT
-void gst_gl_async_debug_output_log_msg (GstGLAsyncDebug * ad);
-GST_EXPORT
-void gst_gl_async_debug_store_log_msg (GstGLAsyncDebug * ad,
- GstDebugCategory * cat,
- GstDebugLevel level,
- const gchar * file,
- const gchar * function,
- gint line,
- GObject * object,
- const gchar * format, ...) G_GNUC_PRINTF (8, 9);
-GST_EXPORT
-void gst_gl_async_debug_store_log_msg_valist (GstGLAsyncDebug * ad,
- GstDebugCategory * cat,
- GstDebugLevel level,
- const gchar * file,
- const gchar * function,
- gint line,
- GObject * object,
- const gchar * format,
- va_list varargs) G_GNUC_PRINTF (8, 0);
-
-#else /* GST_DISABLE_GST_DEBUG */
-
-#define gst_gl_async_debug_output_log_msg(ad) G_STMT_START{ }G_STMT_END
-#define gst_gl_async_debug_store_log_msg_valist(ad,cat,level,file,function,line,object,format,args) G_STMT_START{ }G_STMT_END
-
-#if G_HAVE_ISO_VARARGS
-
-#define gst_gl_insert_debug_marker(...) G_STMT_START{ }G_STMT_END
-#define gst_gl_async_debug_store_log_msg(...) G_STMT_START{ }G_STMT_END
-
-#else /* G_HAVE_ISO_VARARGS */
-#if G_HAVE_GNUC_VARARGS
-
-#define gst_gl_insert_debug_marker(args...) G_STMT_START{ }G_STMT_END
-#define gst_gl_async_debug_store_log_msg(args...) G_STMT_START{ }G_STMT_END
-
-#else /* G_HAVE_GNUC_VARARGS */
-
-static inline void
-gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...)
-{
-}
-
-static inline void
-gst_gl_async_debug_store_log_msg (GstGLAsyncDebug * ad,
- GstDebugCategory * cat, GstDebugLevel level, const gchar * file,
- const gchar * function, gint line, GstObject * object,
- const gchar * format, ...)
-{
-}
-
-#endif /* G_HAVE_GNUC_VARARGS */
-#endif /* G_HAVE_ISO_VARARGS */
-#endif /* GST_DISABLE_GST_DEBUG */
-
-G_END_DECLS
-
-#endif /* __GST_GL_DEBUG_H__ */
diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
deleted file mode 100644
index 459392abc..000000000
--- a/gst-libs/gst/gl/gstgldisplay.c
+++ /dev/null
@@ -1,792 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2007 David A. Schleef <ds@schleef.org>
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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.
- */
-
-/**
- * SECTION:gstgldisplay
- * @short_description: window system display connection abstraction
- * @title: GstGLDisplay
- * @see_also: #GstContext, #GstGLContext, #GstGLWindow
- *
- * #GstGLDisplay represents a connection to the underlying windowing system.
- * Elements are required to make use of #GstContext to share and propogate
- * a #GstGLDisplay.
- *
- * There are a number of environment variables that influence the choice of
- * platform and window system specific functionality.
- * - GST_GL_WINDOW influences the window system to use. Common values are
- * 'x11', 'wayland', 'win32' or 'cocoa'.
- * - GST_GL_PLATFORM influences the OpenGL platform to use. Common values are
- * 'egl', 'glx', 'wgl' or 'cgl'.
- * - GST_GL_API influences the OpenGL API requested by the OpenGL platform.
- * Common values are 'opengl', 'opengl3' and 'gles2'.
- *
- * > Certain window systems require a special function to be called to
- * > initialize threading support. As this GStreamer GL library does not preclude
- * > concurrent access to the windowing system, it is strongly advised that
- * > applications ensure that threading support has been initialized before any
- * > other toolkit/library functionality is accessed. Failure to do so could
- * > result in sudden application abortion during execution. The most notably
- * > example of such a function is X11's XInitThreads\().
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gl.h"
-#include "gstgldisplay.h"
-
-#if GST_GL_HAVE_WINDOW_COCOA
-#include <gst/gl/cocoa/gstgldisplay_cocoa.h>
-#endif
-#if GST_GL_HAVE_WINDOW_X11
-#include <gst/gl/x11/gstgldisplay_x11.h>
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND
-#include <gst/gl/wayland/gstgldisplay_wayland.h>
-#endif
-#if GST_GL_HAVE_PLATFORM_EGL
-#include <gst/gl/egl/gstgldisplay_egl.h>
-#include <gst/gl/egl/gsteglimage.h>
-#include <gst/gl/egl/gstglmemoryegl.h>
-#endif
-#if GST_GL_HAVE_WINDOW_VIV_FB
-#include <gst/gl/viv-fb/gstgldisplay_viv_fb.h>
-#endif
-
-GST_DEBUG_CATEGORY_STATIC (gst_context);
-GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
-#define GST_CAT_DEFAULT gst_gl_display_debug
-
-#define DEBUG_INIT \
- GST_DEBUG_CATEGORY_INIT (gst_gl_display_debug, "gldisplay", 0, "opengl display"); \
- GST_DEBUG_CATEGORY_GET (gst_context, "GST_CONTEXT");
-
-G_DEFINE_TYPE_WITH_CODE (GstGLDisplay, gst_gl_display, GST_TYPE_OBJECT,
- DEBUG_INIT);
-
-#define GST_GL_DISPLAY_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_DISPLAY, GstGLDisplayPrivate))
-
-enum
-{
- SIGNAL_0,
- CREATE_CONTEXT,
- LAST_SIGNAL
-};
-
-static guint gst_gl_display_signals[LAST_SIGNAL] = { 0 };
-
-
-static void gst_gl_display_dispose (GObject * object);
-static void gst_gl_display_finalize (GObject * object);
-static guintptr gst_gl_display_default_get_handle (GstGLDisplay * display);
-static GstGLWindow *gst_gl_display_default_create_window (GstGLDisplay *
- display);
-
-struct _GstGLDisplayPrivate
-{
- GstGLAPI gl_api;
-
- GList *contexts;
-
- GThread *event_thread;
-
- GMutex thread_lock;
- GCond thread_cond;
-};
-
-static gboolean
-_unlock_main_thread (GstGLDisplay * display)
-{
- g_mutex_unlock (&display->priv->thread_lock);
-
- return G_SOURCE_REMOVE;
-}
-
-static gpointer
-_event_thread_main (GstGLDisplay * display)
-{
- g_mutex_lock (&display->priv->thread_lock);
-
- display->main_context = g_main_context_new ();
- display->main_loop = g_main_loop_new (display->main_context, FALSE);
-
- g_main_context_invoke (display->main_context,
- (GSourceFunc) _unlock_main_thread, display);
-
- g_cond_broadcast (&display->priv->thread_cond);
-
- g_main_loop_run (display->main_loop);
-
- g_mutex_lock (&display->priv->thread_lock);
- g_main_loop_unref (display->main_loop);
- g_main_context_unref (display->main_context);
-
- display->main_loop = NULL;
- display->main_context = NULL;
-
- g_cond_broadcast (&display->priv->thread_cond);
- g_mutex_unlock (&display->priv->thread_lock);
-
- return NULL;
-}
-
-static void
-gst_gl_display_class_init (GstGLDisplayClass * klass)
-{
- g_type_class_add_private (klass, sizeof (GstGLDisplayPrivate));
-
- /**
- * GstGLDisplay::create-context:
- * @object: the #GstGLDisplay
- * @context: (transfer none): other context to share resources with.
- *
- * Overrides the @GstGLContext creation mechanism.
- * It can be called in any thread and it is emitted with
- * display's object lock held.
- *
- * Returns: (transfer full): the new context.
- */
- gst_gl_display_signals[CREATE_CONTEXT] =
- g_signal_new ("create-context", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
- GST_TYPE_GL_CONTEXT, 1, GST_TYPE_GL_CONTEXT);
-
- klass->get_handle = gst_gl_display_default_get_handle;
- klass->create_window = gst_gl_display_default_create_window;
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_display_finalize;
- G_OBJECT_CLASS (klass)->dispose = gst_gl_display_dispose;
-}
-
-static void
-gst_gl_display_init (GstGLDisplay * display)
-{
- display->priv = GST_GL_DISPLAY_GET_PRIVATE (display);
-
- display->type = GST_GL_DISPLAY_TYPE_ANY;
- display->priv->gl_api = GST_GL_API_ANY;
-
- g_mutex_init (&display->priv->thread_lock);
- g_cond_init (&display->priv->thread_cond);
-
- display->priv->event_thread = g_thread_new ("gldisplay-event",
- (GThreadFunc) _event_thread_main, display);
-
- g_mutex_lock (&display->priv->thread_lock);
- while (!display->main_loop)
- g_cond_wait (&display->priv->thread_cond, &display->priv->thread_lock);
- g_mutex_unlock (&display->priv->thread_lock);
-
- GST_TRACE ("init %p", display);
-
- gst_gl_buffer_init_once ();
- gst_gl_memory_pbo_init_once ();
- gst_gl_renderbuffer_init_once ();
-
-#if GST_GL_HAVE_PLATFORM_EGL
- gst_gl_memory_egl_init_once ();
-#endif
-}
-
-static void
-gst_gl_display_dispose (GObject * object)
-{
- GstGLDisplay *display = GST_GL_DISPLAY (object);
-
- if (display->main_loop)
- g_main_loop_quit (display->main_loop);
-
- if (display->priv->event_thread) {
- /* can't use g_thread_join() as we could lose the last ref from a user
- * function */
- g_mutex_lock (&display->priv->thread_lock);
- while (display->main_loop)
- g_cond_wait (&display->priv->thread_cond, &display->priv->thread_lock);
- g_mutex_unlock (&display->priv->thread_lock);
- g_thread_unref (display->priv->event_thread);
- }
- display->priv->event_thread = NULL;
-
- if (display->event_source) {
- g_source_destroy (display->event_source);
- g_source_unref (display->event_source);
- }
- display->event_source = NULL;
-
- G_OBJECT_CLASS (gst_gl_display_parent_class)->dispose (object);
-}
-
-static void
-gst_gl_display_finalize (GObject * object)
-{
- GstGLDisplay *display = GST_GL_DISPLAY (object);
- GList *l;
-
- GST_TRACE_OBJECT (object, "finalizing");
-
- for (l = display->priv->contexts; l; l = l->next) {
- g_weak_ref_clear ((GWeakRef *) l->data);
- g_free (l->data);
- }
-
- g_list_free (display->windows);
- g_list_free (display->priv->contexts);
-
- g_cond_clear (&display->priv->thread_cond);
- g_mutex_clear (&display->priv->thread_lock);
-
- G_OBJECT_CLASS (gst_gl_display_parent_class)->finalize (object);
-}
-
-/**
- * gst_gl_display_new:
- *
- * Returns: (transfer full): a new #GstGLDisplay
- *
- * Since: 1.4
- */
-GstGLDisplay *
-gst_gl_display_new (void)
-{
- GstGLDisplay *display = NULL;
- const gchar *user_choice, *platform_choice;
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_INIT (gst_gl_display_debug, "gldisplay", 0,
- "gldisplay element");
- g_once_init_leave (&_init, 1);
- }
-
- user_choice = g_getenv ("GST_GL_WINDOW");
- platform_choice = g_getenv ("GST_GL_PLATFORM");
- GST_INFO ("creating a display, user choice:%s (platform: %s)",
- GST_STR_NULL (user_choice), GST_STR_NULL (platform_choice));
-
-#if GST_GL_HAVE_WINDOW_COCOA
- if (!display && (!user_choice || g_strstr_len (user_choice, 5, "cocoa"))) {
- display = GST_GL_DISPLAY (gst_gl_display_cocoa_new ());
- if (!display)
- return NULL;
- }
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND
- if (!display && (!user_choice || g_strstr_len (user_choice, 7, "wayland")))
- display = GST_GL_DISPLAY (gst_gl_display_wayland_new (NULL));
-#endif
-#if GST_GL_HAVE_WINDOW_X11
- if (!display && (!user_choice || g_strstr_len (user_choice, 3, "x11")))
- display = GST_GL_DISPLAY (gst_gl_display_x11_new (NULL));
-#endif
-#if GST_GL_HAVE_WINDOW_VIV_FB
- if (!display && (!user_choice || g_strstr_len (user_choice, 6, "viv-fb"))) {
- const gchar *disp_idx_str = NULL;
- gint disp_idx = 0;
- disp_idx_str = g_getenv ("GST_GL_VIV_FB");
- if (disp_idx_str) {
- gint64 v = g_ascii_strtoll (disp_idx_str, NULL, 10);
- if (v >= G_MININT && v <= G_MAXINT)
- disp_idx = v;
- }
- display = GST_GL_DISPLAY (gst_gl_display_viv_fb_new (disp_idx));
- }
-#endif
-#if GST_GL_HAVE_PLATFORM_EGL
- if (!display && (!platform_choice
- || g_strstr_len (platform_choice, 3, "egl")))
- display = GST_GL_DISPLAY (gst_gl_display_egl_new ());
-#endif
- if (!display) {
- GST_INFO ("Could not create platform/winsys display. user specified %s "
- "(platform: %s), creating dummy",
- GST_STR_NULL (user_choice), GST_STR_NULL (platform_choice));
-
- display = g_object_new (GST_TYPE_GL_DISPLAY, NULL);
- gst_object_ref_sink (display);
- }
-
- return display;
-}
-
-/**
- * gst_gl_display_get_handle:
- * @display: a #GstGLDisplay
- *
- * Returns: the native handle for the display
- *
- * Since: 1.4
- */
-guintptr
-gst_gl_display_get_handle (GstGLDisplay * display)
-{
- GstGLDisplayClass *klass;
-
- g_return_val_if_fail (GST_IS_GL_DISPLAY (display), 0);
- klass = GST_GL_DISPLAY_GET_CLASS (display);
- g_return_val_if_fail (klass->get_handle != NULL, 0);
-
- return klass->get_handle (display);
-}
-
-static guintptr
-gst_gl_display_default_get_handle (GstGLDisplay * display)
-{
- return 0;
-}
-
-/**
- * gst_gl_display_filter_gl_api:
- * @display: a #GstGLDisplay
- * @gl_api: a #GstGLAPI to filter with
- *
- * limit the use of OpenGL to the requested @gl_api. This is intended to allow
- * application and elements to request a specific set of OpenGL API's based on
- * what they support. See gst_gl_context_get_gl_api() for the retreiving the
- * API supported by a #GstGLContext.
- */
-void
-gst_gl_display_filter_gl_api (GstGLDisplay * display, GstGLAPI gl_api)
-{
- gchar *gl_api_s;
-
- g_return_if_fail (GST_IS_GL_DISPLAY (display));
-
- gl_api_s = gst_gl_api_to_string (gl_api);
- GST_TRACE_OBJECT (display, "filtering with api %s", gl_api_s);
- g_free (gl_api_s);
-
- GST_OBJECT_LOCK (display);
- display->priv->gl_api &= gl_api;
- GST_OBJECT_UNLOCK (display);
-}
-
-GstGLAPI
-gst_gl_display_get_gl_api_unlocked (GstGLDisplay * display)
-{
- g_return_val_if_fail (GST_IS_GL_DISPLAY (display), GST_GL_API_NONE);
-
- return display->priv->gl_api;
-}
-
-/**
- * gst_gl_display_get_gl_api:
- * @display: a #GstGLDisplay
- *
- * see gst_gl_display_filter_gl_api() for what the returned value represents
- *
- * Returns: the #GstGLAPI configured for @display
- */
-GstGLAPI
-gst_gl_display_get_gl_api (GstGLDisplay * display)
-{
- GstGLAPI ret;
-
- g_return_val_if_fail (GST_IS_GL_DISPLAY (display), GST_GL_API_NONE);
-
- GST_OBJECT_LOCK (display);
- ret = display->priv->gl_api;
- GST_OBJECT_UNLOCK (display);
-
- return ret;
-}
-
-/**
- * gst_gl_display_get_handle_type:
- * @display: a #GstGLDisplay
- *
- * Returns: the #GstGLDisplayType of @display
- *
- * Since: 1.4
- */
-GstGLDisplayType
-gst_gl_display_get_handle_type (GstGLDisplay * display)
-{
- g_return_val_if_fail (GST_IS_GL_DISPLAY (display), GST_GL_DISPLAY_TYPE_NONE);
-
- return display->type;
-}
-
-/**
- * gst_context_set_gl_display:
- * @context: a #GstContext
- * @display: (transfer none): resulting #GstGLDisplay
- *
- * Sets @display on @context
- *
- * Since: 1.4
- */
-void
-gst_context_set_gl_display (GstContext * context, GstGLDisplay * display)
-{
- GstStructure *s;
-
- g_return_if_fail (context != NULL);
-
- if (display)
- GST_CAT_LOG (gst_context,
- "setting GstGLDisplay(%" GST_PTR_FORMAT ") on context(%" GST_PTR_FORMAT
- ")", display, context);
-
- s = gst_context_writable_structure (context);
- gst_structure_set (s, GST_GL_DISPLAY_CONTEXT_TYPE, GST_TYPE_GL_DISPLAY,
- display, NULL);
-}
-
-/**
- * gst_context_get_gl_display:
- * @context: a #GstContext
- * @display: (transfer full): resulting #GstGLDisplay
- *
- * Returns: Whether @display was in @context
- *
- * Since: 1.4
- */
-gboolean
-gst_context_get_gl_display (GstContext * context, GstGLDisplay ** display)
-{
- const GstStructure *s;
- gboolean ret;
-
- g_return_val_if_fail (display != NULL, FALSE);
- g_return_val_if_fail (context != NULL, FALSE);
-
- s = gst_context_get_structure (context);
- ret = gst_structure_get (s, GST_GL_DISPLAY_CONTEXT_TYPE,
- GST_TYPE_GL_DISPLAY, display, NULL);
-
- GST_CAT_LOG (gst_context, "got GstGLDisplay(%p) from context(%p)", *display,
- context);
-
- return ret;
-}
-
-/**
- * gst_gl_display_create_context:
- * @display: a #GstGLDisplay
- * @other_context: (transfer none): other #GstGLContext to share resources with.
- * @p_context: (transfer full) (out): resulting #GstGLContext
- * @error: (allow-none): resulting #GError
- *
- * It requires the display's object lock to be held.
- *
- * Returns: whether a new context could be created.
- *
- * Since: 1.6
- */
-gboolean
-gst_gl_display_create_context (GstGLDisplay * display,
- GstGLContext * other_context, GstGLContext ** p_context, GError ** error)
-{
- GstGLContext *context = NULL;
- gboolean ret = FALSE;
-
- g_return_val_if_fail (display != NULL, FALSE);
- g_return_val_if_fail (p_context != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- g_signal_emit (display, gst_gl_display_signals[CREATE_CONTEXT], 0,
- other_context, &context);
-
- if (context) {
- *p_context = context;
- return TRUE;
- }
-
- context = gst_gl_context_new (display);
- if (!context) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "Failed to create GL context");
- return FALSE;
- }
-
- GST_DEBUG_OBJECT (display,
- "creating context %" GST_PTR_FORMAT " from other context %"
- GST_PTR_FORMAT, context, other_context);
-
- ret = gst_gl_context_create (context, other_context, error);
-
- if (ret)
- *p_context = context;
-
- return ret;
-}
-
-/**
- * gst_gl_display_create_window:
- * @display: a #GstGLDisplay
- *
- * It requires the display's object lock to be held.
- *
- * Returns: (transfer full): a new #GstGLWindow for @display or %NULL.
- */
-GstGLWindow *
-gst_gl_display_create_window (GstGLDisplay * display)
-{
- GstGLDisplayClass *klass;
- GstGLWindow *window;
-
- g_return_val_if_fail (GST_IS_GL_DISPLAY (display), NULL);
- klass = GST_GL_DISPLAY_GET_CLASS (display);
- g_return_val_if_fail (klass->create_window != NULL, NULL);
-
- window = klass->create_window (display);
-
- if (window)
- display->windows = g_list_prepend (display->windows, window);
-
- return window;
-}
-
-static GstGLWindow *
-gst_gl_display_default_create_window (GstGLDisplay * display)
-{
- return gst_gl_window_new (display);
-}
-
-/**
- * gst_gl_display_remove_window:
- * @display: a #GstGLDisplay
- * @window: a #GstGLWindow to remove
- *
- * Returns: if @window could be removed from @display
- *
- * Since: 1.12
- */
-gboolean
-gst_gl_display_remove_window (GstGLDisplay * display, GstGLWindow * window)
-{
- gboolean ret = FALSE;
- GList *l;
-
- GST_OBJECT_LOCK (display);
- l = g_list_find (display->windows, window);
- if (l) {
- display->windows = g_list_delete_link (display->windows, l);
- ret = TRUE;
- }
- GST_OBJECT_UNLOCK (display);
-
- return ret;
-}
-
-/**
- * gst_gl_display_find_window:
- * @display: a #GstGLDisplay
- * @data: (closure): some data to pass to @compare_func
- * @compare_func: (scope call): a comparison function to run
- *
- * Execute @compare_func over the list of windows stored by @display. The
- * first argment to @compare_func is the #GstGLWindow being checked and the
- * second argument is @data.
- *
- * Returns: (transfer none): The first #GstGLWindow that causes a match
- * from @compare_func
- *
- * Since: 1.12
- */
-GstGLWindow *
-gst_gl_display_find_window (GstGLDisplay * display, gpointer data,
- GCompareFunc compare_func)
-{
- GstGLWindow *ret = NULL;
- GList *l;
-
- GST_OBJECT_LOCK (display);
- l = g_list_find_custom (display->windows, data, compare_func);
- if (l)
- ret = l->data;
- GST_OBJECT_UNLOCK (display);
-
- return ret;
-}
-
-static GstGLContext *
-_get_gl_context_for_thread_unlocked (GstGLDisplay * display, GThread * thread)
-{
- GstGLContext *context = NULL;
- GList *prev = NULL, *l = display->priv->contexts;
-
- while (l) {
- GWeakRef *ref = l->data;
- GThread *context_thread;
-
- context = g_weak_ref_get (ref);
- if (!context) {
- /* remove dead contexts */
- g_weak_ref_clear (l->data);
- g_free (l->data);
- display->priv->contexts = g_list_delete_link (display->priv->contexts, l);
- l = prev ? prev->next : display->priv->contexts;
- continue;
- }
-
- if (thread == NULL) {
- GST_DEBUG_OBJECT (display, "Returning GL context %" GST_PTR_FORMAT " for "
- "NULL thread", context);
- return context;
- }
-
- context_thread = gst_gl_context_get_thread (context);
- if (thread != context_thread) {
- g_thread_unref (context_thread);
- gst_object_unref (context);
- prev = l;
- l = l->next;
- continue;
- }
-
- if (context_thread)
- g_thread_unref (context_thread);
-
- GST_DEBUG_OBJECT (display, "Returning GL context %" GST_PTR_FORMAT " for "
- "thread %p", context, thread);
- return context;
- }
-
- GST_DEBUG_OBJECT (display, "No GL context for thread %p", thread);
- return NULL;
-}
-
-/**
- * gst_gl_display_get_gl_context_for_thread:
- * @display: a #GstGLDisplay
- * @thread: a #GThread
- *
- * Returns: (transfer full): the #GstGLContext current on @thread or %NULL
- *
- * Must be called with the object lock held.
- *
- * Since: 1.6
- */
-GstGLContext *
-gst_gl_display_get_gl_context_for_thread (GstGLDisplay * display,
- GThread * thread)
-{
- GstGLContext *context;
-
- g_return_val_if_fail (GST_IS_GL_DISPLAY (display), NULL);
-
- context = _get_gl_context_for_thread_unlocked (display, thread);
- GST_DEBUG_OBJECT (display, "returning context %" GST_PTR_FORMAT " for thread "
- "%p", context, thread);
-
- return context;
-}
-
-static gboolean
-_check_collision (GstGLContext * context, GstGLContext * collision)
-{
- GThread *thread, *collision_thread;
- gboolean ret = FALSE;
-
- if (!context || !collision)
- return FALSE;
-
- thread = gst_gl_context_get_thread (context);
- collision_thread = gst_gl_context_get_thread (collision);
-
- if (!thread || !collision_thread) {
- ret = FALSE;
- goto out;
- }
-
- if (thread == collision_thread) {
- ret = TRUE;
- goto out;
- }
-
-out:
- if (thread)
- g_thread_unref (thread);
- if (collision_thread)
- g_thread_unref (collision_thread);
-
- return ret;
-}
-
-/**
- * gst_gl_display_add_context:
- * @display: a #GstGLDisplay
- * @context: (transfer none): a #GstGLContext
- *
- * Returns: whether @context was successfully added. %FALSE may be returned
- * if there already exists another context for @context's active thread.
- *
- * Must be called with the object lock held.
- *
- * Since: 1.6
- */
-gboolean
-gst_gl_display_add_context (GstGLDisplay * display, GstGLContext * context)
-{
- GstGLContext *collision = NULL;
- GstGLDisplay *context_display;
- gboolean ret = TRUE;
- GThread *thread;
- GWeakRef *ref;
-
- g_return_val_if_fail (GST_IS_GL_DISPLAY (display), FALSE);
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
-
- context_display = gst_gl_context_get_display (context);
- g_assert (context_display == display);
- gst_object_unref (context_display);
-
- thread = gst_gl_context_get_thread (context);
- if (thread) {
- collision = _get_gl_context_for_thread_unlocked (display, thread);
- g_thread_unref (thread);
-
- /* adding the same context is a no-op */
- if (context == collision) {
- GST_LOG_OBJECT (display, "Attempting to add the same GL context %"
- GST_PTR_FORMAT ". Ignoring", context);
- ret = TRUE;
- goto out;
- }
-
- if (_check_collision (context, collision)) {
- GST_DEBUG_OBJECT (display, "Collision detected adding GL context "
- "%" GST_PTR_FORMAT, context);
- ret = FALSE;
- goto out;
- }
- }
-
- ref = g_new0 (GWeakRef, 1);
- g_weak_ref_init (ref, context);
-
- GST_DEBUG_OBJECT (display, "Adding GL context %" GST_PTR_FORMAT, context);
- display->priv->contexts = g_list_prepend (display->priv->contexts, ref);
-
-out:
- if (collision)
- gst_object_unref (collision);
-
- GST_DEBUG_OBJECT (display, "%ssuccessfully inserted context %" GST_PTR_FORMAT,
- ret ? "" : "un", context);
-
- return ret;
-}
diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h
deleted file mode 100644
index 7e8fe68a7..000000000
--- a/gst-libs/gst/gl/gstgldisplay.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2007 David A. Schleef <ds@schleef.org>
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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_DISPLAY_H__
-#define __GST_GL_DISPLAY_H__
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_display_get_type (void);
-
-#define GST_TYPE_GL_DISPLAY (gst_gl_display_get_type())
-#define GST_GL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY,GstGLDisplay))
-#define GST_GL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY,GstGLDisplayClass))
-#define GST_IS_GL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY))
-#define GST_IS_GL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY))
-#define GST_GL_DISPLAY_CAST(obj) ((GstGLDisplay*)(obj))
-#define GST_GL_DISPLAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_DISPLAY, GstGLDisplayClass))
-
-/**
- * GstGLDisplayType:
- * @GST_GL_DISPLAY_TYPE_NONE: no display type
- * @GST_GL_DISPLAY_TYPE_X11: X11 display
- * @GST_GL_DISPLAY_TYPE_WAYLAND: Wayland display
- * @GST_GL_DISPLAY_TYPE_COCOA: Cocoa display
- * @GST_GL_DISPLAY_TYPE_WIN32: Win32 display
- * @GST_GL_DISPLAY_TYPE_DISPMANX: Dispmanx display
- * @GST_GL_DISPLAY_TYPE_EGL: EGL display
- * @GST_GL_DISPLAY_TYPE_VIV_FB: Vivante Framebuffer display
- * @GST_GL_DISPLAY_TYPE_ANY: any display type
- */
-typedef enum
-{
- GST_GL_DISPLAY_TYPE_NONE = 0,
- GST_GL_DISPLAY_TYPE_X11 = (1 << 0),
- GST_GL_DISPLAY_TYPE_WAYLAND = (1 << 1),
- GST_GL_DISPLAY_TYPE_COCOA = (1 << 2),
- GST_GL_DISPLAY_TYPE_WIN32 = (1 << 3),
- GST_GL_DISPLAY_TYPE_DISPMANX = (1 << 4),
- GST_GL_DISPLAY_TYPE_EGL = (1 << 5),
- GST_GL_DISPLAY_TYPE_VIV_FB = (1 << 6),
-
- GST_GL_DISPLAY_TYPE_ANY = G_MAXUINT32
-} GstGLDisplayType;
-
-/**
- * GstGLDisplay:
- *
- * The contents of a #GstGLDisplay are private and should only be accessed
- * through the provided API
- */
-struct _GstGLDisplay
-{
- /* <private> */
- GstObject object;
-
- GstGLDisplayType type;
-
- /* <protected> */
- GList *windows; /* OBJECT lock */
- GMainContext *main_context;
- GMainLoop *main_loop;
- GSource *event_source;
-
- GstGLDisplayPrivate *priv;
-};
-
-struct _GstGLDisplayClass
-{
- GstObjectClass object_class;
-
- guintptr (*get_handle) (GstGLDisplay * display);
- GstGLWindow * (*create_window) (GstGLDisplay * display);
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstGLDisplay *gst_gl_display_new (void);
-
-#define gst_gl_display_lock(display) GST_OBJECT_LOCK (display)
-#define gst_gl_display_unlock(display) GST_OBJECT_UNLOCK (display)
-
-GST_EXPORT
-guintptr gst_gl_display_get_handle (GstGLDisplay * display);
-GST_EXPORT
-GstGLDisplayType gst_gl_display_get_handle_type (GstGLDisplay * display);
-GST_EXPORT
-void gst_gl_display_filter_gl_api (GstGLDisplay * display,
- GstGLAPI gl_api);
-GST_EXPORT
-GstGLAPI gst_gl_display_get_gl_api (GstGLDisplay * display);
-GST_EXPORT
-GstGLAPI gst_gl_display_get_gl_api_unlocked (GstGLDisplay * display);
-
-/**
- * GST_GL_DISPLAY_CONTEXT_TYPE:
- *
- * The name used in #GstContext queries for requesting a #GstGLDisplay
- */
-#define GST_GL_DISPLAY_CONTEXT_TYPE "gst.gl.GLDisplay"
-GST_EXPORT
-void gst_context_set_gl_display (GstContext * context, GstGLDisplay * display);
-GST_EXPORT
-gboolean gst_context_get_gl_display (GstContext * context, GstGLDisplay ** display);
-
-GST_EXPORT
-gboolean gst_gl_display_create_context (GstGLDisplay * display,
- GstGLContext * other_context, GstGLContext ** p_context, GError **error);
-GST_EXPORT
-GstGLContext * gst_gl_display_get_gl_context_for_thread (GstGLDisplay * display,
- GThread * thread);
-GST_EXPORT
-gboolean gst_gl_display_add_context (GstGLDisplay * display,
- GstGLContext * context);
-
-GST_EXPORT
-GstGLWindow * gst_gl_display_create_window (GstGLDisplay * display);
-GST_EXPORT
-gboolean gst_gl_display_remove_window (GstGLDisplay * display, GstGLWindow * window);
-GST_EXPORT
-GstGLWindow * gst_gl_display_find_window (GstGLDisplay * display, gpointer data, GCompareFunc compare_func);
-
-G_END_DECLS
-
-#endif /* __GST_GL_DISPLAY_H__ */
diff --git a/gst-libs/gst/gl/gstglfeature.c b/gst-libs/gst/gl/gstglfeature.c
deleted file mode 100644
index a1cadc277..000000000
--- a/gst-libs/gst/gl/gstglfeature.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstglfeature.h"
-
-#include "gstglcontext.h"
-#include "gstglfeature_private.h"
-#include "gstglfuncs.h"
-
-#define GST_CAT_DEFAULT gl_feature
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-static void
-_init_debug (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glfeature", 0,
- "OpenGL feature detection");
- g_once_init_leave (&_init, 1);
- }
-}
-
-/**
- * gst_gl_check_extension:
- * @name: the extension to search for
- * @ext: the list of possible extensions
- *
- * Returns: whether @name is in the space seperated list of @ext
- */
-gboolean
-gst_gl_check_extension (const char *name, const gchar * ext)
-{
- char *end;
- int name_len, n;
-
- if (name == NULL || ext == NULL)
- return FALSE;
-
- end = (char *) (ext + strlen (ext));
-
- name_len = strlen (name);
-
- while (ext < end) {
- n = strcspn (ext, " ");
-
- if ((name_len == n) && (!strncmp (name, ext, n)))
- return TRUE;
- ext += (n + 1);
- }
-
- return FALSE;
-}
-
-/* Define a set of arrays containing the functions required from GL
- for each feature */
-#define GST_GL_EXT_BEGIN(name, \
- gl_availability, \
- min_gl_major, min_gl_minor, \
- min_gles_major, min_gles_minor, \
- namespaces, extension_names) \
- static const GstGLFeatureFunction gst_gl_ext_ ## name ## _funcs[] = {
-#define GST_GL_EXT_FUNCTION(ret, name, args) \
- { G_STRINGIFY (name), G_STRUCT_OFFSET (GstGLFuncs, name) },
-#define GST_GL_EXT_END() \
- { NULL, 0 }, \
- };
-#include "glprototypes/all_functions.h"
-
-#undef GST_GL_EXT_BEGIN
-#undef GST_GL_EXT_FUNCTION
-#undef GST_GL_EXT_END
-
-#define GST_GL_EXT_BEGIN(name, \
- gl_availability, \
- min_gl_major, min_gl_minor, \
- min_gles_major, min_gles_minor, \
- namespaces, extension_names) \
- { G_STRINGIFY (name), gl_availability, min_gl_major, min_gl_minor, min_gles_major, \
- min_gles_minor, namespaces, extension_names, \
- gst_gl_ext_ ## name ## _funcs },
-#define GST_GL_EXT_FUNCTION(ret, name, args)
-#define GST_GL_EXT_END()
-
-static const GstGLFeatureData gst_gl_feature_ext_functions_data[] = {
-#include "glprototypes/all_functions.h"
-};
-
-#undef GST_GL_EXT_BEGIN
-#undef GST_GL_EXT_FUNCTION
-#undef GST_GL_EXT_END
-
-static gboolean
-_gst_gl_feature_check_for_extension (const GstGLFeatureData * data,
- const char *driver_prefix, const char *extensions_string,
- const char **suffix)
-{
- const char *namespace, *namespace_suffix;
- unsigned int namespace_len;
-
- g_return_val_if_fail (suffix != NULL, FALSE);
-
- for (namespace = data->namespaces; *namespace;
- namespace += strlen (namespace) + 1) {
- const char *extension;
- GString *full_extension_name = g_string_new ("");
-
- /* If the namespace part contains a ':' then the suffix for
- the function names is different from the name space */
- if ((namespace_suffix = strchr (namespace, ':'))) {
- namespace_len = namespace_suffix - namespace;
- namespace_suffix++;
- } else {
- namespace_len = strlen (namespace);
- namespace_suffix = namespace;
- }
-
- for (extension = data->extension_names; *extension;
- extension += strlen (extension) + 1) {
- g_string_assign (full_extension_name, driver_prefix);
- g_string_append_c (full_extension_name, '_');
- g_string_append_len (full_extension_name, namespace, namespace_len);
- g_string_append_c (full_extension_name, '_');
- g_string_append (full_extension_name, extension);
-
- if (gst_gl_check_extension (full_extension_name->str, extensions_string)) {
- GST_TRACE ("found %s in extension string", full_extension_name->str);
- break;
- }
- }
-
- g_string_free (full_extension_name, TRUE);
-
- /* If we found an extension with this namespace then use it
- as the suffix */
- if (*extension) {
- *suffix = namespace_suffix;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-gboolean
-_gst_gl_feature_check (GstGLContext * context,
- const char *driver_prefix,
- const GstGLFeatureData * data,
- int gl_major, int gl_minor, const char *extensions_string)
-{
- char *full_function_name = NULL;
- gboolean in_core = FALSE;
- const char *suffix = NULL;
- int func_num;
- GstGLFuncs *gst_gl = context->gl_vtable;
- guint gl_min = 0, gl_maj = 0;
- GstGLAPI gl_api = gst_gl_context_get_gl_api (context);
-
- if (gl_api & (GST_GL_API_OPENGL | GST_GL_API_OPENGL3)) {
- gl_maj = data->min_gl_major;
- gl_min = data->min_gl_minor;
- } else if (gl_api & (GST_GL_API_GLES1 | GST_GL_API_GLES2)) {
- gl_maj = data->min_gles_major;
- gl_min = data->min_gles_minor;
- }
-
- GST_DEBUG ("%s, 0x%x, %d.%d vs 0x%x, %d.%d", data->feature_name,
- data->gl_availability, gl_maj, gl_min,
- gst_gl_context_get_gl_api (context), gl_major, gl_minor);
-
- /* First check whether the functions should be directly provided by
- GL */
- if (gst_gl_context_check_gl_version (context, data->gl_availability, gl_maj,
- gl_min)) {
- in_core = TRUE;
- suffix = "";
- } else {
- /* Otherwise try all of the extensions */
- if (!_gst_gl_feature_check_for_extension (data, driver_prefix,
- extensions_string, &suffix))
- goto error;
- }
-
- /* If we couldn't find anything that provides the functions then
- give up */
- if (suffix == NULL)
- goto error;
-
- /* Try to get all of the entry points */
- for (func_num = 0; data->functions[func_num].name; func_num++) {
- void *func;
-
- g_free (full_function_name);
-
- full_function_name = g_strconcat ("gl", data->functions[func_num].name,
- suffix, NULL);
- GST_TRACE ("%s should %sbe in core", full_function_name,
- in_core ? "" : "not ");
- func = gst_gl_context_get_proc_address (context, full_function_name);
-
- if (func == NULL && in_core) {
- GST_TRACE ("%s was not found in core, trying the extension version",
- full_function_name);
- if (!_gst_gl_feature_check_for_extension (data, driver_prefix,
- extensions_string, &suffix)) {
- goto error;
- } else {
- g_free (full_function_name);
- full_function_name = g_strconcat ("gl", data->functions[func_num].name,
- suffix, NULL);
- func = gst_gl_context_get_proc_address (context, full_function_name);
- }
- }
-
- if (func == NULL) {
- goto error;
- }
-
- /* Set the function pointer in the context */
- *(void **) ((guint8 *) gst_gl +
- data->functions[func_num].pointer_offset) = func;
-
- }
-
- g_free (full_function_name);
-
- return TRUE;
-
- /* If the extension isn't found or one of the functions wasn't found
- * then set all of the functions pointers to NULL so we can safely
- * do feature testing by just looking at the function pointers */
-error:
- GST_DEBUG ("failed to find feature %s", data->feature_name);
-
- for (func_num = 0; data->functions[func_num].name; func_num++) {
- *(void **) ((guint8 *) gst_gl +
- data->functions[func_num].pointer_offset) = NULL;
- }
-
- if (full_function_name) {
- GST_DEBUG ("failed to find function %s", full_function_name);
- g_free (full_function_name);
- }
-
- return FALSE;
-}
-
-void
-_gst_gl_feature_check_ext_functions (GstGLContext * context,
- int gl_major, int gl_minor, const char *gl_extensions)
-{
- int i;
-
- _init_debug ();
-
- for (i = 0; i < G_N_ELEMENTS (gst_gl_feature_ext_functions_data); i++) {
- _gst_gl_feature_check (context, "GL",
- gst_gl_feature_ext_functions_data + i, gl_major, gl_minor,
- gl_extensions);
- }
-}
diff --git a/gst-libs/gst/gl/gstglfeature.h b/gst-libs/gst/gl/gstglfeature.h
deleted file mode 100644
index 201712257..000000000
--- a/gst-libs/gst/gl/gstglfeature.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- */
-
-#ifndef __GST_GL_FEATURE_H__
-#define __GST_GL_FEATURE_H__
-
-#include <gst/gst.h>
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-#define GST_GL_CHECK_GL_VERSION(driver_major, driver_minor, \
- target_major, target_minor) \
- ((driver_major) > (target_major) || \
- ((driver_major) == (target_major) && (driver_minor) >= (target_minor)))
-
-GST_EXPORT
-gboolean gst_gl_check_extension (const char *name, const gchar * ext);
-
-G_END_DECLS
-
-#endif /* __GST_GL_FEATURE_H__ */
diff --git a/gst-libs/gst/gl/gstglfeature_private.h b/gst-libs/gst/gl/gstglfeature_private.h
deleted file mode 100644
index db4a6ea78..000000000
--- a/gst-libs/gst/gl/gstglfeature_private.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-/*
- * Cogl
- *
- * An object oriented GL/GLES Abstraction/Utility Layer
- *
- * Copyright (C) 2009 Intel Corporation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- */
-
-#ifndef __GST_GL_FEATURE_PRIVATE_H__
-#define __GST_GL_FEATURE_PRIVATE_H__
-
-#include <gst/gst.h>
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GstGLFeatureFunction GstGLFeatureFunction;
-
-struct _GstGLFeatureFunction
-{
- /* The name of the function without the "EXT" or "ARB" suffix */
- const char *name;
- /* The offset in the context of where to store the function pointer */
- unsigned int pointer_offset;
-};
-
-typedef struct _GstGLFeatureData GstGLFeatureData;
-
-struct _GstGLFeatureData
-{
- /* name of the feature */
- const char *feature_name;
- /* Flags specifying which versions of GL the feature is available
- in core in */
- GstGLAPI gl_availability;
- /* A minimum GL version which the functions should be defined in
- without needing an extension. Set to 255, 255 if it's only
- provided in an extension */
- int min_gl_major, min_gl_minor;
- /* A minimum GLES version which the functions should be defined in
- without needing an extension. Set to 255, 255 if it's only
- provided in an extension */
- int min_gles_major, min_gles_minor;
- /* \0 separated list of namespaces to try. Eg "EXT\0ARB\0" */
- const char *namespaces;
- /* \0 separated list of required extension names without the GL_EXT
- or GL_ARB prefix. Any of the extensions must be available for the
- feature to be considered available. If the suffix for an
- extension is different from the namespace, you can specify it
- with a ':' after the namespace */
- const char *extension_names;
- /* A list of functions required for this feature. Terminated with a
- NULL name */
- const GstGLFeatureFunction *functions;
-};
-
-G_GNUC_INTERNAL gboolean
-_gst_gl_feature_check (GstGLContext *context,
- const char *driver_prefix,
- const GstGLFeatureData *data,
- int gl_major,
- int gl_minor,
- const char *extensions_string);
-
-G_GNUC_INTERNAL void
-_gst_gl_feature_check_ext_functions (GstGLContext *context,
- int gl_major,
- int gl_minor,
- const char *gl_extensions);
-
-G_END_DECLS
-
-#endif /* __GST_GL_FEATURE_PRIVATE_H__ */
diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c
deleted file mode 100644
index 5c9e140fd..000000000
--- a/gst-libs/gst/gl/gstglfilter.c
+++ /dev/null
@@ -1,1223 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2007 David Schleef <ds@schleef.org>
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.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.
- */
-
-/**
- * SECTION:gstglfilter
- * @title: GstGLFilter
- * @short_description: GstBaseTransform subclass for dealing with RGBA textures
- * @see_also: #GstBaseTransform, #GstGLContext, #GstGLFramebuffer
- *
- * #GstGLFilter helps to implement simple OpenGL filter elements taking a
- * single input and producing a single output with a #GstGLFramebuffer
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/video/gstvideometa.h>
-
-#include "gstglfilter.h"
-
-#include "gstglfuncs.h"
-
-#define GST_CAT_DEFAULT gst_gl_filter_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-/* *INDENT-OFF* */
-static GstStaticPadTemplate gst_gl_filter_src_pad_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
- "format = (string) RGBA, "
- "width = " GST_VIDEO_SIZE_RANGE ", "
- "height = " GST_VIDEO_SIZE_RANGE ", "
- "framerate = " GST_VIDEO_FPS_RANGE ","
- "texture-target = (string) 2D ; "
- "video/x-raw(ANY), "
- "format = (string) RGBA, "
- "width = " GST_VIDEO_SIZE_RANGE ", "
- "height = " GST_VIDEO_SIZE_RANGE ", "
- "framerate = " GST_VIDEO_FPS_RANGE ","
- "texture-target = (string) 2D"
- ));
-
-static GstStaticPadTemplate gst_gl_filter_sink_pad_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw(ANY), "
- "format = (string) RGBA, "
- "width = " GST_VIDEO_SIZE_RANGE ", "
- "height = " GST_VIDEO_SIZE_RANGE ", "
- "framerate = " GST_VIDEO_FPS_RANGE ","
- "texture-target = (string) 2D ; "
- "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
- "format = (string) RGBA, "
- "width = " GST_VIDEO_SIZE_RANGE ", "
- "height = " GST_VIDEO_SIZE_RANGE ", "
- "framerate = " GST_VIDEO_FPS_RANGE ","
- "texture-target = (string) 2D"
- ));
-/* *INDENT-ON* */
-
-/* Properties */
-enum
-{
- PROP_0,
-};
-
-#define gst_gl_filter_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstGLFilter, gst_gl_filter, GST_TYPE_GL_BASE_FILTER,
- GST_DEBUG_CATEGORY_INIT (gst_gl_filter_debug, "glfilter", 0,
- "glfilter element");
- );
-
-static void gst_gl_filter_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_gl_filter_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstCaps *gst_gl_filter_transform_caps (GstBaseTransform * bt,
- GstPadDirection direction, GstCaps * caps, GstCaps * filter);
-static GstCaps *default_transform_internal_caps (GstGLFilter * filter,
- GstPadDirection direction, GstCaps * caps, GstCaps * filter_caps);
-static GstCaps *gst_gl_filter_fixate_caps (GstBaseTransform * bt,
- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
-static void gst_gl_filter_reset (GstGLFilter * filter);
-static gboolean gst_gl_filter_stop (GstBaseTransform * bt);
-static gboolean gst_gl_filter_get_unit_size (GstBaseTransform * trans,
- GstCaps * caps, gsize * size);
-static GstFlowReturn gst_gl_filter_transform (GstBaseTransform * bt,
- GstBuffer * inbuf, GstBuffer * outbuf);
-static gboolean gst_gl_filter_propose_allocation (GstBaseTransform * trans,
- GstQuery * decide_query, GstQuery * query);
-static gboolean gst_gl_filter_decide_allocation (GstBaseTransform * trans,
- GstQuery * query);
-static gboolean gst_gl_filter_set_caps (GstBaseTransform * bt, GstCaps * incaps,
- GstCaps * outcaps);
-static void gst_gl_filter_gl_stop (GstGLBaseFilter * filter);
-static gboolean gst_gl_filter_gl_set_caps (GstGLBaseFilter * bt,
- GstCaps * incaps, GstCaps * outcaps);
-
-void
-gst_gl_filter_add_rgba_pad_templates (GstGLFilterClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- gst_element_class_add_static_pad_template (element_class,
- &gst_gl_filter_src_pad_template);
- gst_element_class_add_static_pad_template (element_class,
- &gst_gl_filter_sink_pad_template);
-}
-
-static void
-gst_gl_filter_class_init (GstGLFilterClass * klass)
-{
- GObjectClass *gobject_class;
-
- gobject_class = (GObjectClass *) klass;
-
- gobject_class->set_property = gst_gl_filter_set_property;
- gobject_class->get_property = gst_gl_filter_get_property;
-
- GST_BASE_TRANSFORM_CLASS (klass)->transform_caps =
- gst_gl_filter_transform_caps;
- GST_BASE_TRANSFORM_CLASS (klass)->fixate_caps = gst_gl_filter_fixate_caps;
- GST_BASE_TRANSFORM_CLASS (klass)->transform = gst_gl_filter_transform;
- GST_BASE_TRANSFORM_CLASS (klass)->stop = gst_gl_filter_stop;
- GST_BASE_TRANSFORM_CLASS (klass)->set_caps = gst_gl_filter_set_caps;
- GST_BASE_TRANSFORM_CLASS (klass)->propose_allocation =
- gst_gl_filter_propose_allocation;
- GST_BASE_TRANSFORM_CLASS (klass)->decide_allocation =
- gst_gl_filter_decide_allocation;
- GST_BASE_TRANSFORM_CLASS (klass)->get_unit_size = gst_gl_filter_get_unit_size;
-
- GST_GL_BASE_FILTER_CLASS (klass)->gl_stop = gst_gl_filter_gl_stop;
- GST_GL_BASE_FILTER_CLASS (klass)->gl_set_caps = gst_gl_filter_gl_set_caps;
-
- klass->transform_internal_caps = default_transform_internal_caps;
-}
-
-static void
-gst_gl_filter_init (GstGLFilter * filter)
-{
- filter->draw_attr_position_loc = -1;
- filter->draw_attr_texture_loc = -1;
-}
-
-static void
-gst_gl_filter_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gl_filter_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gl_filter_reset (GstGLFilter * filter)
-{
- gst_caps_replace (&filter->out_caps, NULL);
-}
-
-static gboolean
-gst_gl_filter_stop (GstBaseTransform * bt)
-{
- GstGLFilter *filter = GST_GL_FILTER (bt);
-
- gst_gl_filter_reset (filter);
-
- return GST_BASE_TRANSFORM_CLASS (parent_class)->stop (bt);
-}
-
-static void
-gst_gl_filter_gl_stop (GstGLBaseFilter * base_filter)
-{
- GstGLFilter *filter = GST_GL_FILTER (base_filter);
- GstGLContext *context = base_filter->context;
- const GstGLFuncs *gl = context->gl_vtable;
-
- if (filter->vao) {
- gl->DeleteVertexArrays (1, &filter->vao);
- filter->vao = 0;
- }
-
- if (filter->vertex_buffer) {
- gl->DeleteBuffers (1, &filter->vertex_buffer);
- filter->vertex_buffer = 0;
- }
-
- if (filter->vbo_indices) {
- gl->DeleteBuffers (1, &filter->vbo_indices);
- filter->vbo_indices = 0;
- }
-
- if (filter->fbo != NULL) {
- gst_object_unref (filter->fbo);
- filter->fbo = NULL;
- }
-
- filter->default_shader = NULL;
- filter->draw_attr_position_loc = -1;
- filter->draw_attr_texture_loc = -1;
-
- GST_GL_BASE_FILTER_CLASS (parent_class)->gl_stop (base_filter);
-}
-
-static GstCaps *
-gst_gl_filter_fixate_caps (GstBaseTransform * bt,
- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
-{
- GstStructure *ins, *outs;
- const GValue *from_par, *to_par;
- GValue fpar = { 0, }, tpar = {
- 0,};
-
- othercaps = gst_caps_make_writable (othercaps);
- othercaps = gst_caps_truncate (othercaps);
-
- GST_DEBUG_OBJECT (bt, "trying to fixate othercaps %" GST_PTR_FORMAT
- " based on caps %" GST_PTR_FORMAT, othercaps, caps);
-
- ins = gst_caps_get_structure (caps, 0);
- outs = gst_caps_get_structure (othercaps, 0);
-
- from_par = gst_structure_get_value (ins, "pixel-aspect-ratio");
- to_par = gst_structure_get_value (outs, "pixel-aspect-ratio");
-
- /* If we're fixating from the sinkpad we always set the PAR and
- * assume that missing PAR on the sinkpad means 1/1 and
- * missing PAR on the srcpad means undefined
- */
- if (direction == GST_PAD_SINK) {
- if (!from_par) {
- g_value_init (&fpar, GST_TYPE_FRACTION);
- gst_value_set_fraction (&fpar, 1, 1);
- from_par = &fpar;
- }
- if (!to_par) {
- g_value_init (&tpar, GST_TYPE_FRACTION);
- gst_value_set_fraction (&tpar, 1, 1);
- to_par = &tpar;
- }
- } else {
- if (!to_par) {
- g_value_init (&tpar, GST_TYPE_FRACTION);
- gst_value_set_fraction (&tpar, 1, 1);
- to_par = &tpar;
-
- gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
- NULL);
- }
- if (!from_par) {
- g_value_init (&fpar, GST_TYPE_FRACTION);
- gst_value_set_fraction (&fpar, 1, 1);
- from_par = &fpar;
- }
- }
-
- /* we have both PAR but they might not be fixated */
- {
- gint from_w, from_h, from_par_n, from_par_d, to_par_n, to_par_d;
- gint w = 0, h = 0;
- gint from_dar_n, from_dar_d;
- gint num, den;
-
- /* from_par should be fixed */
- g_return_val_if_fail (gst_value_is_fixed (from_par), othercaps);
-
- from_par_n = gst_value_get_fraction_numerator (from_par);
- from_par_d = gst_value_get_fraction_denominator (from_par);
-
- gst_structure_get_int (ins, "width", &from_w);
- gst_structure_get_int (ins, "height", &from_h);
-
- gst_structure_get_int (outs, "width", &w);
- gst_structure_get_int (outs, "height", &h);
-
- /* if both width and height are already fixed, we can't do anything
- * about it anymore */
- if (w && h) {
- GST_DEBUG_OBJECT (bt, "dimensions already set to %dx%d, not fixating",
- w, h);
- if (!gst_value_is_fixed (to_par)) {
- GST_DEBUG_OBJECT (bt, "fixating to_par to %dx%d", 1, 1);
- if (gst_structure_has_field (outs, "pixel-aspect-ratio"))
- gst_structure_fixate_field_nearest_fraction (outs,
- "pixel-aspect-ratio", 1, 1);
- }
- goto done;
- }
-
- /* Calculate input DAR */
- if (!gst_util_fraction_multiply (from_w, from_h, from_par_n, from_par_d,
- &from_dar_n, &from_dar_d)) {
- GST_ELEMENT_ERROR (bt, CORE, NEGOTIATION, (NULL),
- ("Error calculating the output scaled size - integer overflow"));
- goto done;
- }
-
- GST_DEBUG_OBJECT (bt, "Input DAR is %d/%d", from_dar_n, from_dar_d);
-
- /* If either width or height are fixed there's not much we
- * can do either except choosing a height or width and PAR
- * that matches the DAR as good as possible
- */
- if (h) {
- gint num, den;
-
- GST_DEBUG_OBJECT (bt, "height is fixed (%d)", h);
-
- if (!gst_value_is_fixed (to_par)) {
- /* (shortcut) copy-paste (??) of videoscale seems to aim for 1/1,
- * so let's make it so ...
- * especially if following code assumes fixed */
- GST_DEBUG_OBJECT (bt, "fixating to_par to 1x1");
- gst_structure_fixate_field_nearest_fraction (outs,
- "pixel-aspect-ratio", 1, 1);
- to_par = gst_structure_get_value (outs, "pixel-aspect-ratio");
- }
-
- /* PAR is fixed, choose the height that is nearest to the
- * height with the same DAR */
- to_par_n = gst_value_get_fraction_numerator (to_par);
- to_par_d = gst_value_get_fraction_denominator (to_par);
-
- GST_DEBUG_OBJECT (bt, "PAR is fixed %d/%d", to_par_n, to_par_d);
-
- if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, to_par_d,
- to_par_n, &num, &den)) {
- GST_ELEMENT_ERROR (bt, CORE, NEGOTIATION, (NULL),
- ("Error calculating the output scaled size - integer overflow"));
- goto done;
- }
-
- w = (guint) gst_util_uint64_scale_int (h, num, den);
- gst_structure_fixate_field_nearest_int (outs, "width", w);
-
- goto done;
- } else if (w) {
- gint num, den;
-
- GST_DEBUG_OBJECT (bt, "width is fixed (%d)", w);
-
- if (!gst_value_is_fixed (to_par)) {
- /* (shortcut) copy-paste (??) of videoscale seems to aim for 1/1,
- * so let's make it so ...
- * especially if following code assumes fixed */
- GST_DEBUG_OBJECT (bt, "fixating to_par to 1x1");
- gst_structure_fixate_field_nearest_fraction (outs,
- "pixel-aspect-ratio", 1, 1);
- to_par = gst_structure_get_value (outs, "pixel-aspect-ratio");
- }
-
- /* PAR is fixed, choose the height that is nearest to the
- * height with the same DAR */
- to_par_n = gst_value_get_fraction_numerator (to_par);
- to_par_d = gst_value_get_fraction_denominator (to_par);
-
- GST_DEBUG_OBJECT (bt, "PAR is fixed %d/%d", to_par_n, to_par_d);
-
- if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, to_par_d,
- to_par_n, &num, &den)) {
- GST_ELEMENT_ERROR (bt, CORE, NEGOTIATION, (NULL),
- ("Error calculating the output scaled size - integer overflow"));
- goto done;
- }
-
- h = (guint) gst_util_uint64_scale_int (w, den, num);
- gst_structure_fixate_field_nearest_int (outs, "height", h);
-
- goto done;
- } else if (gst_value_is_fixed (to_par)) {
- GstStructure *tmp;
- gint set_h, set_w, f_h, f_w;
-
- to_par_n = gst_value_get_fraction_numerator (to_par);
- to_par_d = gst_value_get_fraction_denominator (to_par);
-
- /* Calculate scale factor for the PAR change */
- if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, to_par_n,
- to_par_d, &num, &den)) {
- GST_ELEMENT_ERROR (bt, CORE, NEGOTIATION, (NULL),
- ("Error calculating the output scaled size - integer overflow"));
- goto done;
- }
-
- /* Try to keep the input height */
- tmp = gst_structure_copy (outs);
- gst_structure_fixate_field_nearest_int (tmp, "height", from_h);
- gst_structure_get_int (tmp, "height", &set_h);
-
- /* This might have failed but try to scale the width
- * to keep the DAR nonetheless */
- w = (guint) gst_util_uint64_scale_int (set_h, num, den);
- gst_structure_fixate_field_nearest_int (tmp, "width", w);
- gst_structure_get_int (tmp, "width", &set_w);
- gst_structure_free (tmp);
-
- /* We kept the DAR and the height is nearest to the original height */
- if (set_w == w) {
- gst_structure_set (outs, "width", G_TYPE_INT, set_w, "height",
- G_TYPE_INT, set_h, NULL);
- goto done;
- }
-
- f_h = set_h;
- f_w = set_w;
-
- /* If the former failed, try to keep the input width at least */
- tmp = gst_structure_copy (outs);
- gst_structure_fixate_field_nearest_int (tmp, "width", from_w);
- gst_structure_get_int (tmp, "width", &set_w);
-
- /* This might have failed but try to scale the width
- * to keep the DAR nonetheless */
- h = (guint) gst_util_uint64_scale_int (set_w, den, num);
- gst_structure_fixate_field_nearest_int (tmp, "height", h);
- gst_structure_get_int (tmp, "height", &set_h);
- gst_structure_free (tmp);
-
- /* We kept the DAR and the width is nearest to the original width */
- if (set_h == h) {
- gst_structure_set (outs, "width", G_TYPE_INT, set_w, "height",
- G_TYPE_INT, set_h, NULL);
- goto done;
- }
-
- /* If all this failed, keep the height that was nearest to the orignal
- * height and the nearest possible width. This changes the DAR but
- * there's not much else to do here.
- */
- gst_structure_set (outs, "width", G_TYPE_INT, f_w, "height", G_TYPE_INT,
- f_h, NULL);
- goto done;
- } else {
- GstStructure *tmp;
- gint set_h, set_w, set_par_n, set_par_d, tmp2;
-
- /* width, height and PAR are not fixed */
-
- /* First try to keep the height and width as good as possible
- * and scale PAR */
- tmp = gst_structure_copy (outs);
- gst_structure_fixate_field_nearest_int (tmp, "height", from_h);
- gst_structure_get_int (tmp, "height", &set_h);
- gst_structure_fixate_field_nearest_int (tmp, "width", from_w);
- gst_structure_get_int (tmp, "width", &set_w);
-
- if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, set_h, set_w,
- &to_par_n, &to_par_d)) {
- GST_ELEMENT_ERROR (bt, CORE, NEGOTIATION, (NULL),
- ("Error calculating the output scaled size - integer overflow"));
- gst_structure_free (tmp);
- goto done;
- }
-
- if (!gst_structure_has_field (tmp, "pixel-aspect-ratio"))
- gst_structure_set_value (tmp, "pixel-aspect-ratio", to_par);
- gst_structure_fixate_field_nearest_fraction (tmp, "pixel-aspect-ratio",
- to_par_n, to_par_d);
- gst_structure_get_fraction (tmp, "pixel-aspect-ratio", &set_par_n,
- &set_par_d);
- gst_structure_free (tmp);
-
- if (set_par_n == to_par_n && set_par_d == to_par_d) {
- gst_structure_set (outs, "width", G_TYPE_INT, set_w, "height",
- G_TYPE_INT, set_h, NULL);
-
- if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
- set_par_n != set_par_d)
- gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
- set_par_n, set_par_d, NULL);
- goto done;
- }
-
- /* Otherwise try to scale width to keep the DAR with the set
- * PAR and height */
- if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, set_par_d,
- set_par_n, &num, &den)) {
- GST_ELEMENT_ERROR (bt, CORE, NEGOTIATION, (NULL),
- ("Error calculating the output scaled size - integer overflow"));
- goto done;
- }
-
- w = (guint) gst_util_uint64_scale_int (set_h, num, den);
- tmp = gst_structure_copy (outs);
- gst_structure_fixate_field_nearest_int (tmp, "width", w);
- gst_structure_get_int (tmp, "width", &tmp2);
- gst_structure_free (tmp);
-
- if (tmp2 == w) {
- gst_structure_set (outs, "width", G_TYPE_INT, tmp2, "height",
- G_TYPE_INT, set_h, NULL);
- if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
- set_par_n != set_par_d)
- gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
- set_par_n, set_par_d, NULL);
- goto done;
- }
-
- /* ... or try the same with the height */
- h = (guint) gst_util_uint64_scale_int (set_w, den, num);
- tmp = gst_structure_copy (outs);
- gst_structure_fixate_field_nearest_int (tmp, "height", h);
- gst_structure_get_int (tmp, "height", &tmp2);
- gst_structure_free (tmp);
-
- if (tmp2 == h) {
- gst_structure_set (outs, "width", G_TYPE_INT, set_w, "height",
- G_TYPE_INT, tmp2, NULL);
- if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
- set_par_n != set_par_d)
- gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
- set_par_n, set_par_d, NULL);
- goto done;
- }
-
- /* If all fails we can't keep the DAR and take the nearest values
- * for everything from the first try */
- gst_structure_set (outs, "width", G_TYPE_INT, set_w, "height",
- G_TYPE_INT, set_h, NULL);
- if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
- set_par_n != set_par_d)
- gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
- set_par_n, set_par_d, NULL);
- }
- }
-
-
-done:
- othercaps = gst_caps_fixate (othercaps);
-
- GST_DEBUG_OBJECT (bt, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
-
- if (from_par == &fpar)
- g_value_unset (&fpar);
- if (to_par == &tpar)
- g_value_unset (&tpar);
-
- return othercaps;
-}
-
-/* copies the given caps */
-static GstCaps *
-gst_gl_filter_caps_remove_size (GstCaps * caps)
-{
- GstStructure *st;
- GstCapsFeatures *f;
- gint i, n;
- GstCaps *res;
-
- res = gst_caps_new_empty ();
-
- n = gst_caps_get_size (caps);
- for (i = 0; i < n; i++) {
- st = gst_caps_get_structure (caps, i);
- f = gst_caps_get_features (caps, i);
-
- /* If this is already expressed by the existing caps
- * skip this structure */
- if (i > 0 && gst_caps_is_subset_structure_full (res, st, f))
- continue;
-
- st = gst_structure_copy (st);
- gst_structure_set (st, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-
- /* if pixel aspect ratio, make a range of it */
- if (gst_structure_has_field (st, "pixel-aspect-ratio")) {
- gst_structure_set (st, "pixel-aspect-ratio",
- GST_TYPE_FRACTION_RANGE, 1, G_MAXINT, G_MAXINT, 1, NULL);
- }
-
- gst_caps_append_structure_full (res, st, gst_caps_features_copy (f));
- }
-
- return res;
-}
-
-static GstCaps *
-gst_gl_filter_set_caps_features (const GstCaps * caps,
- const gchar * feature_name)
-{
- GstCaps *ret = gst_caps_copy (caps);
- guint n = gst_caps_get_size (ret);
- guint i = 0;
-
- for (i = 0; i < n; i++) {
- gst_caps_set_features (ret, i,
- gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY));
- }
-
- return ret;
-}
-
-static GstCaps *
-default_transform_internal_caps (GstGLFilter * filter,
- GstPadDirection direction, GstCaps * caps, GstCaps * filter_caps)
-{
- GstCaps *tmp = gst_gl_filter_caps_remove_size (caps);
-
- GST_DEBUG_OBJECT (filter, "size removal returned caps %" GST_PTR_FORMAT, tmp);
- return tmp;
-}
-
-static GstCaps *
-gst_gl_filter_transform_caps (GstBaseTransform * bt,
- GstPadDirection direction, GstCaps * caps, GstCaps * filter_caps)
-{
- GstGLFilter *filter = GST_GL_FILTER (bt);
- GstCaps *tmp = NULL;
- GstCaps *result = NULL;
-
- if (gst_base_transform_is_passthrough (bt)) {
- tmp = gst_caps_ref (caps);
- } else {
- tmp = GST_GL_FILTER_GET_CLASS (filter)->transform_internal_caps (filter,
- direction, caps, NULL);
-
- result =
- gst_gl_filter_set_caps_features (tmp,
- GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
- gst_caps_unref (tmp);
- tmp = result;
- }
-
- if (filter_caps) {
- result =
- gst_caps_intersect_full (filter_caps, tmp, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (tmp);
- } else {
- result = tmp;
- }
-
- GST_DEBUG_OBJECT (bt, "returning caps: %" GST_PTR_FORMAT, result);
-
- return result;
-}
-
-static gboolean
-gst_gl_filter_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
- gsize * size)
-{
- gboolean ret = FALSE;
- GstVideoInfo info;
-
- ret = gst_video_info_from_caps (&info, caps);
- if (ret)
- *size = GST_VIDEO_INFO_SIZE (&info);
-
- return TRUE;
-}
-
-static gboolean
-gst_gl_filter_gl_set_caps (GstGLBaseFilter * bt, GstCaps * incaps,
- GstCaps * outcaps)
-{
- GstGLFilter *filter = GST_GL_FILTER (bt);
- GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
- GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
- gint out_width, out_height;
-
- out_width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
- out_height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
-
- if (filter->fbo)
- gst_object_unref (filter->fbo);
-
- if (!(filter->fbo =
- gst_gl_framebuffer_new_with_default_depth (context, out_width,
- out_height)))
- goto context_error;
-
- if (filter_class->init_fbo) {
- if (!filter_class->init_fbo (filter))
- goto error;
- }
-
- return TRUE;
-
-context_error:
- {
- GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND, ("Could not generate FBO"),
- (NULL));
- return FALSE;
- }
-error:
- {
- GST_ELEMENT_ERROR (filter, LIBRARY, INIT,
- ("Subclass failed to initialize."), (NULL));
- return FALSE;
- }
-}
-
-static gboolean
-gst_gl_filter_set_caps (GstBaseTransform * bt, GstCaps * incaps,
- GstCaps * outcaps)
-{
- GstGLFilter *filter;
- GstGLFilterClass *filter_class;
-
- filter = GST_GL_FILTER (bt);
- filter_class = GST_GL_FILTER_GET_CLASS (filter);
-
- if (!gst_video_info_from_caps (&filter->in_info, incaps))
- goto wrong_caps;
- if (!gst_video_info_from_caps (&filter->out_info, outcaps))
- goto wrong_caps;
-
- if (filter_class->set_caps) {
- if (!filter_class->set_caps (filter, incaps, outcaps))
- goto error;
- }
-
- gst_caps_replace (&filter->out_caps, outcaps);
-
- GST_DEBUG_OBJECT (filter, "set_caps %dx%d in %" GST_PTR_FORMAT
- " out %" GST_PTR_FORMAT,
- GST_VIDEO_INFO_WIDTH (&filter->out_info),
- GST_VIDEO_INFO_HEIGHT (&filter->out_info), incaps, outcaps);
-
- return GST_BASE_TRANSFORM_CLASS (parent_class)->set_caps (bt, incaps,
- outcaps);
-
-/* ERRORS */
-wrong_caps:
- {
- GST_WARNING ("Wrong caps");
- return FALSE;
- }
-error:
- {
- return FALSE;
- }
-}
-
-static gboolean
-gst_gl_filter_propose_allocation (GstBaseTransform * trans,
- GstQuery * decide_query, GstQuery * query)
-{
- GstGLFilter *filter = GST_GL_FILTER (trans);
- GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
- GstCaps *caps;
- GstVideoInfo info;
- guint size;
- GstBufferPool *pool = NULL;
- gboolean need_pool;
-
- gst_query_parse_allocation (query, &caps, &need_pool);
-
- if (caps == NULL)
- goto no_caps;
-
- if (!gst_video_info_from_caps (&info, caps))
- goto invalid_caps;
-
- /* the normal size of a frame */
- size = info.size;
-
- if (need_pool) {
- GstStructure *config;
-
- GST_DEBUG_OBJECT (filter, "create new pool");
- pool = gst_gl_buffer_pool_new (context);
-
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
-
- if (!gst_buffer_pool_set_config (pool, config)) {
- g_object_unref (pool);
- goto config_failed;
- }
- }
-
- gst_query_add_allocation_pool (query, pool, size, 1, 0);
- if (pool)
- g_object_unref (pool);
-
- if (context->gl_vtable->FenceSync)
- gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);
-
- return TRUE;
-
- /* ERRORS */
-no_caps:
- {
- GST_DEBUG_OBJECT (trans, "no caps specified");
- return FALSE;
- }
-invalid_caps:
- {
- GST_DEBUG_OBJECT (trans, "invalid caps specified");
- return FALSE;
- }
-config_failed:
- {
- GST_DEBUG_OBJECT (trans, "failed setting config");
- return FALSE;
- }
-}
-
-static gboolean
-gst_gl_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query)
-{
- GstGLContext *context;
- GstBufferPool *pool = NULL;
- GstStructure *config;
- GstCaps *caps;
- guint min, max, size;
- gboolean update_pool;
-
- gst_query_parse_allocation (query, &caps, NULL);
- if (!caps)
- return FALSE;
-
- /* get gl context */
- if (!GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans,
- query))
- return FALSE;
-
- context = GST_GL_BASE_FILTER (trans)->context;
-
- if (gst_query_get_n_allocation_pools (query) > 0) {
- gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
-
- update_pool = TRUE;
- } else {
- GstVideoInfo vinfo;
-
- gst_video_info_init (&vinfo);
- gst_video_info_from_caps (&vinfo, caps);
- size = vinfo.size;
- min = max = 0;
- update_pool = FALSE;
- }
-
- if (!pool || !GST_IS_GL_BUFFER_POOL (pool)) {
- if (pool)
- gst_object_unref (pool);
- pool = gst_gl_buffer_pool_new (context);
- }
-
- config = gst_buffer_pool_get_config (pool);
-
- gst_buffer_pool_config_set_params (config, caps, size, min, max);
- gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
- if (gst_query_find_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, NULL))
- gst_buffer_pool_config_add_option (config,
- GST_BUFFER_POOL_OPTION_GL_SYNC_META);
-
- gst_buffer_pool_set_config (pool, config);
-
- if (update_pool)
- gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
- else
- gst_query_add_allocation_pool (query, pool, size, min, max);
-
- gst_object_unref (pool);
-
- return TRUE;
-}
-
-/**
- * gst_gl_filter_filter_texture:
- * @filter: a #GstGLFilter
- * @inbuf: an input buffer
- * @outbuf: an output buffer
- *
- * Calls filter_texture vfunc with correctly mapped #GstGLMemorys
- *
- * Returns: whether the transformation succeeded
- *
- * Since: 1.4
- */
-gboolean
-gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf,
- GstBuffer * outbuf)
-{
- GstGLFilterClass *filter_class;
- GstMemory *in_tex, *out_tex;
- GstVideoFrame gl_frame, out_frame;
- gboolean ret;
-
- filter_class = GST_GL_FILTER_GET_CLASS (filter);
-
- if (!gst_video_frame_map (&gl_frame, &filter->in_info, inbuf,
- GST_MAP_READ | GST_MAP_GL)) {
- ret = FALSE;
- goto inbuf_error;
- }
-
- in_tex = gl_frame.map[0].memory;
- if (!gst_is_gl_memory (in_tex)) {
- ret = FALSE;
- GST_ERROR_OBJECT (filter, "Input memory must be GstGLMemory");
- goto unmap_out_error;
- }
-
- if (!gst_video_frame_map (&out_frame, &filter->out_info, outbuf,
- GST_MAP_WRITE | GST_MAP_GL)) {
- ret = FALSE;
- goto unmap_out_error;
- }
-
- out_tex = out_frame.map[0].memory;
- g_return_val_if_fail (gst_is_gl_memory (out_tex), FALSE);
-
- GST_DEBUG ("calling filter_texture with textures in:%i out:%i",
- GST_GL_MEMORY_CAST (in_tex)->tex_id,
- GST_GL_MEMORY_CAST (out_tex)->tex_id);
-
- g_assert (filter_class->filter_texture);
-
- ret = filter_class->filter_texture (filter, GST_GL_MEMORY_CAST (in_tex),
- GST_GL_MEMORY_CAST (out_tex));
-
- gst_video_frame_unmap (&out_frame);
-unmap_out_error:
- gst_video_frame_unmap (&gl_frame);
-inbuf_error:
-
- return ret;
-}
-
-static void
-_filter_gl (GstGLContext * context, GstGLFilter * filter)
-{
- GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
-
- gst_gl_insert_debug_marker (context,
- "processing in element %s", GST_OBJECT_NAME (filter));
-
- if (filter_class->filter)
- filter->gl_result =
- filter_class->filter (filter, filter->inbuf, filter->outbuf);
- else
- filter->gl_result =
- gst_gl_filter_filter_texture (filter, filter->inbuf, filter->outbuf);
-}
-
-static GstFlowReturn
-gst_gl_filter_transform (GstBaseTransform * bt, GstBuffer * inbuf,
- GstBuffer * outbuf)
-{
- GstGLFilter *filter = GST_GL_FILTER (bt);
- GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (bt);
- GstGLDisplay *display = GST_GL_BASE_FILTER (bt)->display;
- GstGLContext *context = GST_GL_BASE_FILTER (bt)->context;
- GstGLSyncMeta *out_sync_meta, *in_sync_meta;
- gboolean ret;
-
- if (!display)
- return GST_FLOW_NOT_NEGOTIATED;
-
- g_assert (filter_class->filter || filter_class->filter_texture);
-
- in_sync_meta = gst_buffer_get_gl_sync_meta (inbuf);
- if (in_sync_meta)
- gst_gl_sync_meta_wait (in_sync_meta, context);
-
- filter->inbuf = inbuf;
- filter->outbuf = outbuf;
- gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _filter_gl,
- filter);
- ret = filter->gl_result;
-
- out_sync_meta = gst_buffer_get_gl_sync_meta (outbuf);
- if (out_sync_meta)
- gst_gl_sync_meta_set_sync_point (out_sync_meta, context);
-
- return ret ? GST_FLOW_OK : GST_FLOW_ERROR;
-}
-
-struct glcb
-{
- GstGLFilter *filter;
- GstGLFilterRenderFunc func;
- GstGLMemory *in_tex;
- gpointer data;
-};
-
-static gboolean
-_glcb (gpointer data)
-{
- struct glcb *cb = data;
-
- return cb->func (cb->filter, cb->in_tex, cb->data);
-}
-
-/**
- * gst_gl_filter_render_to_target:
- * @filter: a #GstGLFilter
- * @input: the input texture
- * @output: the output texture
- * @func: (scope call): the function to transform @input into @output. called with @data
- * @data: (allow-none): the data associated with @func
- *
- * Transforms @input into @output using @func on through FBO.
- *
- * Returns: the return value of @func
- *
- * Since: 1.10
- */
-gboolean
-gst_gl_filter_render_to_target (GstGLFilter * filter, GstGLMemory * input,
- GstGLMemory * output, GstGLFilterRenderFunc func, gpointer data)
-{
- struct glcb cb;
-
- cb.filter = filter;
- cb.func = func;
- cb.in_tex = input;
- cb.data = data;
-
- return gst_gl_framebuffer_draw_to_texture (filter->fbo, output, _glcb, &cb);
-}
-
-static void
-_get_attributes (GstGLFilter * filter)
-{
- if (!filter->default_shader)
- return;
-
- if (filter->valid_attributes)
- return;
-
- if (filter->draw_attr_position_loc == -1)
- filter->draw_attr_position_loc =
- gst_gl_shader_get_attribute_location (filter->default_shader,
- "a_position");
-
- if (filter->draw_attr_texture_loc == -1)
- filter->draw_attr_texture_loc =
- gst_gl_shader_get_attribute_location (filter->default_shader,
- "a_texcoord");
-
- filter->valid_attributes = TRUE;
-}
-
-static gboolean
-_draw_with_shader_cb (GstGLFilter * filter, GstGLMemory * in_tex,
- gpointer unused)
-{
- GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
- GstGLFuncs *gl = context->gl_vtable;
-
-#if GST_GL_HAVE_OPENGL
- if (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL) {
- gl->MatrixMode (GL_PROJECTION);
- gl->LoadIdentity ();
- }
-#endif
-
- _get_attributes (filter);
- gst_gl_shader_use (filter->default_shader);
-
- gl->ActiveTexture (GL_TEXTURE1);
- gl->BindTexture (GL_TEXTURE_2D, gst_gl_memory_get_texture_id (in_tex));
-
- gst_gl_shader_set_uniform_1i (filter->default_shader, "tex", 1);
- gst_gl_shader_set_uniform_1f (filter->default_shader, "width",
- GST_VIDEO_INFO_WIDTH (&filter->out_info));
- gst_gl_shader_set_uniform_1f (filter->default_shader, "height",
- GST_VIDEO_INFO_HEIGHT (&filter->out_info));
-
- gst_gl_filter_draw_fullscreen_quad (filter);
-
- return TRUE;
-}
-
-/**
- * gst_gl_filter_render_to_target_with_shader:
- * @filter: a #GstGLFilter
- * @input: the input texture
- * @output: the output texture
- * @shader: the shader to use.
- *
- * Transforms @input into @output using @shader with a FBO.
- *
- * See also: gst_gl_filter_render_to_target()
- *
- * Since: 1.4
- */
-/* attach target to a FBO, use shader, pass input as "tex" uniform to
- * the shader, render input to a quad */
-void
-gst_gl_filter_render_to_target_with_shader (GstGLFilter * filter,
- GstGLMemory * input, GstGLMemory * output, GstGLShader * shader)
-{
- if (filter->default_shader != shader)
- filter->valid_attributes = FALSE;
- filter->default_shader = shader;
-
- gst_gl_filter_render_to_target (filter, input, output, _draw_with_shader_cb,
- NULL);
-}
-
-/* *INDENT-OFF* */
-static const GLfloat vertices[] = {
- -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,
- 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
- 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
- -1.0f, 1.0f, 0.0f, 0.0f, 1.0f
-};
-
-static const GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-/* *INDENT-ON* */
-
-static void
-_bind_buffer (GstGLFilter * filter)
-{
- GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
- const GstGLFuncs *gl = context->gl_vtable;
-
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, filter->vbo_indices);
- gl->BindBuffer (GL_ARRAY_BUFFER, filter->vertex_buffer);
-
- _get_attributes (filter);
- /* Load the vertex position */
- gl->VertexAttribPointer (filter->draw_attr_position_loc, 3, GL_FLOAT,
- GL_FALSE, 5 * sizeof (GLfloat), (void *) 0);
-
- /* Load the texture coordinate */
- gl->VertexAttribPointer (filter->draw_attr_texture_loc, 2, GL_FLOAT, GL_FALSE,
- 5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
-
-
- gl->EnableVertexAttribArray (filter->draw_attr_position_loc);
- gl->EnableVertexAttribArray (filter->draw_attr_texture_loc);
-}
-
-static void
-_unbind_buffer (GstGLFilter * filter)
-{
- GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
- const GstGLFuncs *gl = context->gl_vtable;
-
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
- gl->BindBuffer (GL_ARRAY_BUFFER, 0);
-
- gl->DisableVertexAttribArray (filter->draw_attr_position_loc);
- gl->DisableVertexAttribArray (filter->draw_attr_texture_loc);
-}
-
-/**
- * gst_gl_filter_draw_fullscreen_quad:
- * @filter: a #GstGLFilter
- *
- * Render a fullscreen quad using the current GL state. The only GL state this
- * modifies is the necessary vertex/index buffers and, if necessary, a
- * Vertex Array Object for drawing a fullscreen quad. Framebuffer state,
- * any shaders, viewport state, etc must be setup by the caller.
- *
- * Since: 1.10
- */
-void
-gst_gl_filter_draw_fullscreen_quad (GstGLFilter * filter)
-{
- GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
- GstGLFuncs *gl = context->gl_vtable;
-
- {
- if (!filter->vertex_buffer) {
- if (gl->GenVertexArrays) {
- gl->GenVertexArrays (1, &filter->vao);
- gl->BindVertexArray (filter->vao);
- }
-
- gl->GenBuffers (1, &filter->vertex_buffer);
- gl->BindBuffer (GL_ARRAY_BUFFER, filter->vertex_buffer);
- gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices,
- GL_STATIC_DRAW);
-
- gl->GenBuffers (1, &filter->vbo_indices);
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, filter->vbo_indices);
- gl->BufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof (indices), indices,
- GL_STATIC_DRAW);
- }
-
- if (gl->GenVertexArrays)
- gl->BindVertexArray (filter->vao);
- _bind_buffer (filter);
-
- gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
-
- if (gl->GenVertexArrays)
- gl->BindVertexArray (0);
- _unbind_buffer (filter);
- }
-}
diff --git a/gst-libs/gst/gl/gstglfilter.h b/gst-libs/gst/gl/gstglfilter.h
deleted file mode 100644
index fc1928b9d..000000000
--- a/gst-libs/gst/gl/gstglfilter.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2007 David Schleef <ds@schleef.org>
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.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_FILTER_H_
-#define _GST_GL_FILTER_H_
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-
-#include <gst/gl/gl.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_filter_get_type(void);
-#define GST_TYPE_GL_FILTER (gst_gl_filter_get_type())
-#define GST_GL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_FILTER,GstGLFilter))
-#define GST_IS_GL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_FILTER))
-#define GST_GL_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_FILTER,GstGLFilterClass))
-#define GST_IS_GL_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_FILTER))
-#define GST_GL_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_FILTER,GstGLFilterClass))
-
-/**
- * GstGLFilterRenderFunc:
- * @filter: the #GstGLFIlter
- * @in_tex: the input #GstGLMemory to render
- * @user_data: user data
- *
- * Returns: whether the render succeeded
- *
- * Since: 1.10
- */
-typedef gboolean (*GstGLFilterRenderFunc) (GstGLFilter * filter, GstGLMemory * in_tex, gpointer user_data);
-
-/**
- * GstGLFilter:
- * @parent: parent #GstGLBaseFilter
- * @in_info: the video info for input buffers
- * @out_info: the video info for output buffers
- * @out_caps: the output #GstCaps
- * @fbo: #GstGLFramebuffer object used for transformations
- */
-struct _GstGLFilter
-{
- GstGLBaseFilter parent;
-
- GstVideoInfo in_info;
- GstVideoInfo out_info;
-
- GstCaps *out_caps;
-
- /* <protected> */
- GstGLFramebuffer *fbo;
-
- /* <private> */
- gboolean gl_result;
- GstBuffer *inbuf;
- GstBuffer *outbuf;
-
- GstGLShader *default_shader;
- gboolean valid_attributes;
-
- guint vao;
- guint vbo_indices;
- guint vertex_buffer;
- gint draw_attr_position_loc;
- gint draw_attr_texture_loc;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLFilterClass:
- * @parent_class: parent #GstGLBaseFilterClass
- * @set_caps: mirror from #GstBaseTransform
- * @filter: perform operations on the input and output buffers. In general,
- * you should avoid using this method if at all possible. One valid
- * use-case for using this is keeping previous buffers for future calculations.
- * Note: If @filter exists, then @filter_texture is not run
- * @filter_texture: given @in_tex, transform it into @out_tex. Not used
- * if @filter exists
- * @init_fbo: perform initialization when the Framebuffer object is created
- * @transform_internal_caps: Perform sub-class specific modifications of the
- * caps to be processed between upload on input and before download for output.
- */
-struct _GstGLFilterClass
-{
- GstGLBaseFilterClass parent_class;
-
- gboolean (*set_caps) (GstGLFilter* filter, GstCaps* incaps, GstCaps* outcaps);
- gboolean (*filter) (GstGLFilter *filter, GstBuffer *inbuf, GstBuffer *outbuf);
- gboolean (*filter_texture) (GstGLFilter *filter, GstGLMemory *in_tex, GstGLMemory *out_tex);
- gboolean (*init_fbo) (GstGLFilter *filter);
-
- GstCaps *(*transform_internal_caps) (GstGLFilter *filter,
- GstPadDirection direction, GstCaps * caps, GstCaps * filter_caps);
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-void gst_gl_filter_add_rgba_pad_templates (GstGLFilterClass *klass);
-
-GST_EXPORT
-gboolean gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf,
- GstBuffer * outbuf);
-
-GST_EXPORT
-gboolean gst_gl_filter_render_to_target (GstGLFilter *filter,
- GstGLMemory * input,
- GstGLMemory * output,
- GstGLFilterRenderFunc func,
- gpointer data);
-
-GST_EXPORT
-void gst_gl_filter_draw_fullscreen_quad (GstGLFilter *filter);
-GST_EXPORT
-void gst_gl_filter_render_to_target_with_shader (GstGLFilter * filter,
- GstGLMemory * input,
- GstGLMemory * output,
- GstGLShader *shader);
-
-G_END_DECLS
-
-#endif /* _GST_GL_FILTER_H_ */
diff --git a/gst-libs/gst/gl/gstglformat.c b/gst-libs/gst/gl/gstglformat.c
deleted file mode 100644
index 8427be43f..000000000
--- a/gst-libs/gst/gl/gstglformat.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * SECTION:gstglformat
- * @title: GstGLFormat
- * @short_description: utilities for dealing with OpenGL formats
- * @see_also: #GstGLBaseMemory, #GstGLMemory, #GstGLFramebuffer, #GstGLBuffer
- *
- * Some useful utilities for converting between various formats and OpenGL
- * formats.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstglformat.h"
-
-#include "gstglcontext.h"
-#include "gstglfuncs.h"
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-#ifndef GL_TEXTURE_RECTANGLE
-#define GL_TEXTURE_RECTANGLE 0x84F5
-#endif
-#ifndef GL_TEXTURE_EXTERNAL_OES
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#endif
-
-static inline guint
-_gl_format_n_components (guint format)
-{
- switch (format) {
- case GST_VIDEO_GL_TEXTURE_TYPE_RGBA:
- case GST_GL_RGBA:
- return 4;
- case GST_VIDEO_GL_TEXTURE_TYPE_RGB:
- case GST_VIDEO_GL_TEXTURE_TYPE_RGB16:
- case GST_GL_RGB:
- case GST_GL_RGB565:
- return 3;
- case GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA:
- case GST_VIDEO_GL_TEXTURE_TYPE_RG:
- case GST_GL_LUMINANCE_ALPHA:
- case GST_GL_RG:
- return 2;
- case GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE:
- case GST_VIDEO_GL_TEXTURE_TYPE_R:
- case GST_GL_LUMINANCE:
- case GST_GL_RED:
- return 1;
- default:
- return 0;
- }
-}
-
-static inline guint
-_gl_type_n_components (guint type)
-{
- switch (type) {
- case GL_UNSIGNED_BYTE:
- return 1;
- case GL_UNSIGNED_SHORT_5_6_5:
- return 3;
- default:
- g_assert_not_reached ();
- return 0;
- }
-}
-
-static inline guint
-_gl_type_n_bytes (guint type)
-{
- switch (type) {
- case GL_UNSIGNED_BYTE:
- return 1;
- case GL_UNSIGNED_SHORT_5_6_5:
- return 2;
- default:
- g_assert_not_reached ();
- return 0;
- }
-}
-
-/**
- * gst_gl_format_type_n_bytes:
- * @format: the OpenGL format, %GL_RGBA, %GL_LUMINANCE, etc
- * @type: the OpenGL type, %GL_UNSIGNED_BYTE, %GL_FLOAT, etc
- *
- * Returns: the number of bytes the specified @format, @type combination takes
- * per pixel
- */
-guint
-gst_gl_format_type_n_bytes (guint format, guint type)
-{
- return _gl_format_n_components (format) / _gl_type_n_components (type) *
- _gl_type_n_bytes (type);
-}
-
-/**
- * gst_gl_format_from_video_info:
- * @context: a #GstGLContext
- * @vinfo: a #GstVideoInfo
- * @plane: the plane number in @vinfo
- *
- * Returns: the #GstGLFormat necessary for holding the data in @plane of @vinfo
- */
-GstGLFormat
-gst_gl_format_from_video_info (GstGLContext * context, GstVideoInfo * vinfo,
- guint plane)
-{
- gboolean texture_rg =
- gst_gl_context_check_feature (context, "GL_EXT_texture_rg")
- || gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0)
- || gst_gl_context_check_feature (context, "GL_ARB_texture_rg")
- || gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 0);
- GstVideoFormat v_format = GST_VIDEO_INFO_FORMAT (vinfo);
- guint n_plane_components;
-
- switch (v_format) {
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- case GST_VIDEO_FORMAT_AYUV:
- n_plane_components = 4;
- break;
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- n_plane_components = 3;
- break;
- case GST_VIDEO_FORMAT_RGB16:
- case GST_VIDEO_FORMAT_BGR16:
- return GST_GL_RGB565;
- case GST_VIDEO_FORMAT_GRAY16_BE:
- case GST_VIDEO_FORMAT_GRAY16_LE:
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_UYVY:
- n_plane_components = 2;
- break;
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- n_plane_components = plane == 0 ? 1 : 2;
- break;
- case GST_VIDEO_FORMAT_GRAY8:
- case GST_VIDEO_FORMAT_Y444:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_Y41B:
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- n_plane_components = 1;
- break;
- default:
- n_plane_components = 4;
- g_assert_not_reached ();
- break;
- }
-
- switch (n_plane_components) {
- case 4:
- return GST_GL_RGBA;
- break;
- case 3:
- return GST_GL_RGB;
- break;
- case 2:
- return texture_rg ? GST_GL_RG : GST_GL_LUMINANCE_ALPHA;
- break;
- case 1:
- return texture_rg ? GST_GL_RED : GST_GL_LUMINANCE;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- return GST_GL_RGBA;
-}
-
-/**
- * gst_gl_sized_gl_format_from_gl_format_type:
- * @context: a #GstGLContext
- * @format: an OpenGL format, %GL_RGBA, %GL_LUMINANCE, etc
- * @type: an OpenGL type, %GL_UNSIGNED_BYTE, %GL_FLOAT, etc
- *
- * Returns: the sized internal format specified by @format and @type that can
- * be used in @context
- */
-guint
-gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context,
- guint format, guint type)
-{
- gboolean ext_texture_rg =
- gst_gl_context_check_feature (context, "GL_EXT_texture_rg");
-
- switch (format) {
- case GST_GL_RGBA:
- switch (type) {
- case GL_UNSIGNED_BYTE:
- return USING_GLES2 (context)
- && !USING_GLES3 (context) ? GST_GL_RGBA : GST_GL_RGBA8;
- break;
- }
- break;
- case GST_GL_RGB:
- switch (type) {
- case GL_UNSIGNED_BYTE:
- return USING_GLES2 (context)
- && !USING_GLES3 (context) ? GST_GL_RGB : GST_GL_RGB8;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- return GST_GL_RGB565;
- break;
- }
- break;
- case GST_GL_RG:
- switch (type) {
- case GL_UNSIGNED_BYTE:
- if (!USING_GLES3 (context) && USING_GLES2 (context) && ext_texture_rg)
- return GST_GL_RG;
- return GST_GL_RG8;
- break;
- }
- break;
- case GST_GL_RED:
- switch (type) {
- case GL_UNSIGNED_BYTE:
- if (!USING_GLES3 (context) && USING_GLES2 (context) && ext_texture_rg)
- return GST_GL_RED;
- return GST_GL_R8;
- break;
- }
- break;
- case GST_GL_RGBA8:
- case GST_GL_RGB8:
- case GST_GL_RGB565:
- case GST_GL_RG8:
- case GST_GL_R8:
- case GST_GL_LUMINANCE:
- case GST_GL_LUMINANCE_ALPHA:
- case GST_GL_ALPHA:
- case GST_GL_DEPTH_COMPONENT16:
- case GST_GL_DEPTH24_STENCIL8:
- return format;
- default:
- break;
- }
-
- g_assert_not_reached ();
- return 0;
-}
-
-/**
- * gst_gl_texture_target_to_string:
- * @target: a #GstGLTextureTarget
- *
- * Returns: the stringified version of @target or %NULL
- */
-const gchar *
-gst_gl_texture_target_to_string (GstGLTextureTarget target)
-{
- switch (target) {
- case GST_GL_TEXTURE_TARGET_2D:
- return GST_GL_TEXTURE_TARGET_2D_STR;
- case GST_GL_TEXTURE_TARGET_RECTANGLE:
- return GST_GL_TEXTURE_TARGET_RECTANGLE_STR;
- case GST_GL_TEXTURE_TARGET_EXTERNAL_OES:
- return GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR;
- default:
- return NULL;
- }
-}
-
-/**
- * gst_gl_texture_target_from_string:
- * @str: a string equivalant to one of the GST_GL_TEXTURE_TARGET_*_STR values
- *
- * Returns: the #GstGLTextureTarget represented by @str or
- * %GST_GL_TEXTURE_TARGET_NONE
- */
-GstGLTextureTarget
-gst_gl_texture_target_from_string (const gchar * str)
-{
- if (!str)
- return GST_GL_TEXTURE_TARGET_NONE;
-
- if (g_strcmp0 (str, GST_GL_TEXTURE_TARGET_2D_STR) == 0)
- return GST_GL_TEXTURE_TARGET_2D;
- if (g_strcmp0 (str, GST_GL_TEXTURE_TARGET_RECTANGLE_STR) == 0)
- return GST_GL_TEXTURE_TARGET_RECTANGLE;
- if (g_strcmp0 (str, GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR) == 0)
- return GST_GL_TEXTURE_TARGET_EXTERNAL_OES;
-
- return GST_GL_TEXTURE_TARGET_NONE;
-}
-
-/**
- * gst_gl_texture_target_to_gl:
- * @target: a #GstGLTextureTarget
- *
- * Returns: the OpenGL value for binding the @target with glBindTexture() and
- * similar functions or 0
- */
-guint
-gst_gl_texture_target_to_gl (GstGLTextureTarget target)
-{
- switch (target) {
- case GST_GL_TEXTURE_TARGET_2D:
- return GL_TEXTURE_2D;
- case GST_GL_TEXTURE_TARGET_RECTANGLE:
- return GL_TEXTURE_RECTANGLE;
- case GST_GL_TEXTURE_TARGET_EXTERNAL_OES:
- return GL_TEXTURE_EXTERNAL_OES;
- default:
- return 0;
- }
-}
-
-/**
- * gst_gl_texture_target_from_gl:
- * @target: an OpenGL texture binding target
- *
- * Returns: the #GstGLTextureTarget that's equiavalant to @target or
- * %GST_GL_TEXTURE_TARGET_NONE
- */
-GstGLTextureTarget
-gst_gl_texture_target_from_gl (guint target)
-{
- switch (target) {
- case GL_TEXTURE_2D:
- return GST_GL_TEXTURE_TARGET_2D;
- case GL_TEXTURE_RECTANGLE:
- return GST_GL_TEXTURE_TARGET_RECTANGLE;
- case GL_TEXTURE_EXTERNAL_OES:
- return GST_GL_TEXTURE_TARGET_EXTERNAL_OES;
- default:
- return GST_GL_TEXTURE_TARGET_NONE;
- }
-}
-
-/**
- * gst_gl_texture_target_to_buffer_pool_option:
- * @target: a #GstGLTextureTarget
- *
- * Returns: a string representing the @GstBufferPoolOption specified by @target
- */
-const gchar *
-gst_gl_texture_target_to_buffer_pool_option (GstGLTextureTarget target)
-{
- switch (target) {
- case GST_GL_TEXTURE_TARGET_2D:
- return GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D;
- case GST_GL_TEXTURE_TARGET_RECTANGLE:
- return GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE;
- case GST_GL_TEXTURE_TARGET_EXTERNAL_OES:
- return GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES;
- default:
- return NULL;
- }
-}
diff --git a/gst-libs/gst/gl/gstglformat.h b/gst-libs/gst/gl/gstglformat.h
deleted file mode 100644
index 2bd667da6..000000000
--- a/gst-libs/gst/gl/gstglformat.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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>
-
-/**
- * GST_GL_TEXTURE_TARGET_2D_STR:
- *
- * String used for %GST_GL_TEXTURE_TARGET_2D in things like caps values
- */
-#define GST_GL_TEXTURE_TARGET_2D_STR "2D"
-
-/**
- * GST_GL_TEXTURE_TARGET_RECTANGLE_STR:
- *
- * String used for %GST_GL_TEXTURE_TARGET_RECTANGLE in things like caps values
- */
-#define GST_GL_TEXTURE_TARGET_RECTANGLE_STR "rectangle"
-
-/**
- * GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR:
- *
- * String used for %GST_GL_TEXTURE_TARGET_EXTERNAL_OES in things like caps values
- */
-#define GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR "external-oes"
-
-/**
- * GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D:
- *
- * String used for %GST_GL_TEXTURE_TARGET_2D as a #GstBufferPool pool option
- */
-#define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D "GstBufferPoolOptionGLTextureTarget2D"
-
-/**
- * GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE:
- *
- * String used for %GST_GL_TEXTURE_TARGET_RECTANGLE as a #GstBufferPool pool option
- */
-#define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE "GstBufferPoolOptionGLTextureTargetRectangle"
-
-/**
- * GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES:
- *
- * String used for %GST_GL_TEXTURE_TARGET_EXTERNAL_OES as a #GstBufferPool pool option
- */
-#define GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES "GstBufferPoolOptionGLTextureTargetExternalOES"
-
-G_BEGIN_DECLS
-
-/**
- * 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.
- * @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.
- * @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.
- */
-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,
-
- GST_GL_RGBA = 0x1908,
- GST_GL_RGBA8 = 0x8058,
-
- GST_GL_DEPTH_COMPONENT16 = 0x81A5,
-
- GST_GL_DEPTH24_STENCIL8 = 0x88F0,
-} GstGLFormat;
-
-GST_EXPORT
-guint gst_gl_format_type_n_bytes (guint format,
- guint type);
-GST_EXPORT
-GstGLFormat gst_gl_format_from_video_info (GstGLContext * context,
- GstVideoInfo * vinfo,
- guint plane);
-GST_EXPORT
-guint gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context,
- guint format,
- guint type);
-
-GST_EXPORT
-GstGLTextureTarget gst_gl_texture_target_from_string (const gchar * str);
-GST_EXPORT
-const gchar * gst_gl_texture_target_to_string (GstGLTextureTarget target);
-GST_EXPORT
-guint gst_gl_texture_target_to_gl (GstGLTextureTarget target);
-GST_EXPORT
-GstGLTextureTarget gst_gl_texture_target_from_gl (guint target);
-GST_EXPORT
-const gchar * gst_gl_texture_target_to_buffer_pool_option (GstGLTextureTarget target);
-
-G_END_DECLS
-
-#endif /* _GST_GL_FORMAT_H_ */
diff --git a/gst-libs/gst/gl/gstglframebuffer.c b/gst-libs/gst/gl/gstglframebuffer.c
deleted file mode 100644
index b1d64b288..000000000
--- a/gst-libs/gst/gl/gstglframebuffer.c
+++ /dev/null
@@ -1,579 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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.
- */
-
-/**
- * SECTION:gstglframebuffer
- * @short_description: OpenGL framebuffer abstraction
- * @title: GstGLFramebuffer
- * @see_also: #GstGLBaseMemory, #GstGLMemory, #GstGLContext
- *
- * A #GstGLFramebuffer represents and holds an OpenGL framebuffer object with
- * it's associated attachments.
- *
- * A #GstGLFramebuffer can be created with gst_gl_framebuffer_new() or
- * gst_gl_framebuffer_new_with_default_depth() and bound with
- * gst_gl_framebuffer_bind(). Other resources can be bound with
- * gst_gl_framebuffer_attach()
- *
- * Note: OpenGL framebuffers are not shareable resources so cannot be used
- * between multiple OpenGL contexts.
- *
- * Since: 1.10
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstglframebuffer.h"
-
-#include "gstglcontext.h"
-#include "gstglfuncs.h"
-#include "gstglmemory.h"
-#include "gstglrenderbuffer.h"
-
-#ifndef GL_FRAMEBUFFER_UNDEFINED
-#define GL_FRAMEBUFFER_UNDEFINED 0x8219
-#endif
-#ifndef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
-#endif
-#ifndef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
-#endif
-#ifndef GL_FRAMEBUFFER_UNSUPPORTED
-#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
-#endif
-#ifndef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
-#endif
-
-#ifndef GL_DEPTH_STENCIL_ATTACHMENT
-#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
-#endif
-
-#ifndef GL_READ_FRAMEBUFFER
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#endif
-#ifndef GL_DRAW_FRAMEBUFFER
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#endif
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_framebuffer_debug);
-#define GST_CAT_DEFAULT gst_gl_framebuffer_debug
-
-#define DEBUG_INIT \
- GST_DEBUG_CATEGORY_INIT (gst_gl_framebuffer_debug, "glframebuffer", 0, "GL Framebuffer");
-
-G_DEFINE_TYPE_WITH_CODE (GstGLFramebuffer, gst_gl_framebuffer, GST_TYPE_OBJECT,
- DEBUG_INIT);
-
-#define GST_GL_FRAMEBUFFER_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_FRAMEBUFFER, GstGLFramebufferPrivate))
-
-static void gst_gl_framebuffer_finalize (GObject * object);
-
-struct _GstGLFramebufferPrivate
-{
- guint effective_width;
- guint effective_height;
-};
-
-struct fbo_attachment
-{
- guint attachment_point;
- GstGLBaseMemory *mem;
-};
-
-static void
-_fbo_attachment_init (struct fbo_attachment *attach, guint point,
- GstGLBaseMemory * mem)
-{
- attach->attachment_point = point;
- attach->mem = (GstGLBaseMemory *) gst_memory_ref (GST_MEMORY_CAST (mem));
-}
-
-static void
-_fbo_attachment_unset (struct fbo_attachment *attach)
-{
- if (!attach)
- return;
-
- if (attach->mem)
- gst_memory_unref (GST_MEMORY_CAST (attach->mem));
- attach->mem = NULL;
-}
-
-static void
-gst_gl_framebuffer_class_init (GstGLFramebufferClass * klass)
-{
- g_type_class_add_private (klass, sizeof (GstGLFramebufferPrivate));
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_framebuffer_finalize;
-}
-
-static void
-gst_gl_framebuffer_init (GstGLFramebuffer * fb)
-{
- fb->priv = GST_GL_FRAMEBUFFER_GET_PRIVATE (fb);
-
- fb->attachments =
- g_array_new (FALSE, FALSE, (sizeof (struct fbo_attachment)));
- g_array_set_clear_func (fb->attachments,
- (GDestroyNotify) _fbo_attachment_unset);
-}
-
-static void
-_delete_fbo_gl (GstGLContext * context, GstGLFramebuffer * fb)
-{
- const GstGLFuncs *gl = context->gl_vtable;
-
- if (fb->fbo_id)
- gl->DeleteFramebuffers (1, &fb->fbo_id);
- fb->fbo_id = 0;
-}
-
-static void
-gst_gl_framebuffer_finalize (GObject * object)
-{
- GstGLFramebuffer *fb = GST_GL_FRAMEBUFFER (object);
-
- if (fb->context) {
- if (fb->fbo_id)
- gst_gl_context_thread_add (fb->context,
- (GstGLContextThreadFunc) _delete_fbo_gl, fb);
-
- gst_object_unref (fb->context);
- fb->context = NULL;
- }
-
- if (fb->attachments)
- g_array_free (fb->attachments, TRUE);
- fb->attachments = NULL;
-
- G_OBJECT_CLASS (gst_gl_framebuffer_parent_class)->finalize (object);
-}
-
-/**
- * gst_gl_framebuffer_new:
- * @context: a #GstGLContext
- *
- * Returns: (transfer full): a new #GstGLFramebuffer
- *
- * Since: 1.10
- */
-GstGLFramebuffer *
-gst_gl_framebuffer_new (GstGLContext * context)
-{
- GstGLFramebuffer *fb;
- const GstGLFuncs *gl;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
- g_return_val_if_fail (gst_gl_context_get_current () == context, NULL);
-
- gl = context->gl_vtable;
-
- if (!gl->GenFramebuffers) {
- GST_ERROR_OBJECT (context, "Framebuffers are not supported!");
- return NULL;
- }
-
- fb = g_object_new (GST_TYPE_GL_FRAMEBUFFER, NULL);
- fb->context = gst_object_ref (context);
- gl->GenFramebuffers (1, &fb->fbo_id);
- gst_object_ref_sink (fb);
-
- return fb;
-}
-
-/**
- * gst_gl_framebuffer_new_with_default_depth:
- * @context: a #GstGLContext
- * @width: width for the depth buffer
- * @height: for the depth buffer
- *
- * Returns: a new #GstGLFramebuffer with a depth buffer of @width and @height
- *
- * Since: 1.10
- */
-GstGLFramebuffer *
-gst_gl_framebuffer_new_with_default_depth (GstGLContext * context, guint width,
- guint height)
-{
- GstGLFramebuffer *fb = gst_gl_framebuffer_new (context);
- GstGLBaseMemoryAllocator *render_alloc;
- GstGLAllocationParams *params;
- GstGLBaseMemory *renderbuffer;
- guint attach_point, attach_type;
-
- if (!fb)
- return NULL;
-
- if (gst_gl_context_get_gl_api (fb->context) & (GST_GL_API_OPENGL |
- GST_GL_API_OPENGL3)) {
- attach_point = GL_DEPTH_STENCIL_ATTACHMENT;
- attach_type = GST_GL_DEPTH24_STENCIL8;
- } else if (gst_gl_context_get_gl_api (fb->context) & GST_GL_API_GLES2) {
- attach_point = GL_DEPTH_ATTACHMENT;
- attach_type = GST_GL_DEPTH_COMPONENT16;
- } else {
- g_assert_not_reached ();
- return NULL;
- }
-
- render_alloc = (GstGLBaseMemoryAllocator *)
- gst_allocator_find (GST_GL_RENDERBUFFER_ALLOCATOR_NAME);
- params = (GstGLAllocationParams *)
- gst_gl_renderbuffer_allocation_params_new (context, NULL, attach_type,
- width, height);
-
- renderbuffer = gst_gl_base_memory_alloc (render_alloc, params);
- gst_gl_allocation_params_free (params);
- gst_object_unref (render_alloc);
-
- gst_gl_framebuffer_bind (fb);
- gst_gl_framebuffer_attach (fb, attach_point, renderbuffer);
- gst_gl_context_clear_framebuffer (fb->context);
- gst_memory_unref (GST_MEMORY_CAST (renderbuffer));
-
- return fb;
-}
-
-/**
- * gst_gl_framebuffer_draw_to_texture:
- * @fb: a #GstGLFramebuffer
- * @mem: the #GstGLMemory to draw to
- * @func: (scope call): the function to run
- * @user_data: data to pass to @func
- *
- * Perform the steps necessary to have the output of a glDraw* command in
- * @func update the contents of @mem.
- *
- * Returns: the result of executing @func
- *
- * Since: 1.10
- */
-gboolean
-gst_gl_framebuffer_draw_to_texture (GstGLFramebuffer * fb, GstGLMemory * mem,
- GstGLFramebufferFunc func, gpointer user_data)
-{
- GLint viewport_dim[4] = { 0 };
- const GstGLFuncs *gl;
- gboolean ret;
-
- g_return_val_if_fail (GST_IS_GL_FRAMEBUFFER (fb), FALSE);
- g_return_val_if_fail (gst_is_gl_memory (GST_MEMORY_CAST (mem)), FALSE);
-
- gl = fb->context->gl_vtable;
-
- GST_TRACE_OBJECT (fb, "drawing to texture %u, dimensions %ix%i", mem->tex_id,
- gst_gl_memory_get_texture_width (mem),
- gst_gl_memory_get_texture_height (mem));
-
- gst_gl_framebuffer_bind (fb);
- gst_gl_framebuffer_attach (fb, GL_COLOR_ATTACHMENT0, (GstGLBaseMemory *) mem);
-
- gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
- gl->Viewport (0, 0, fb->priv->effective_width, fb->priv->effective_height);
- if (gst_gl_context_get_gl_api (fb->context) & (GST_GL_API_OPENGL |
- GST_GL_API_OPENGL3))
- gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
-
- ret = func (user_data);
-
- if (gst_gl_context_get_gl_api (fb->context) & (GST_GL_API_OPENGL |
- GST_GL_API_OPENGL3))
- gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
- gl->Viewport (viewport_dim[0], viewport_dim[1], viewport_dim[2],
- viewport_dim[3]);
- gst_gl_context_clear_framebuffer (fb->context);
-
- return ret;
-}
-
-/**
- * gst_gl_framebuffer_bind:
- * @fb: a #GstGLFramebuffer
- *
- * Bind @fb into the current thread
- *
- * Since: 1.10
- */
-void
-gst_gl_framebuffer_bind (GstGLFramebuffer * fb)
-{
- const GstGLFuncs *gl;
-
- g_return_if_fail (GST_IS_GL_FRAMEBUFFER (fb));
- g_return_if_fail (gst_gl_context_get_current () == fb->context);
- g_return_if_fail (fb->fbo_id != 0);
-
- gl = fb->context->gl_vtable;
-
- gl->BindFramebuffer (GL_FRAMEBUFFER, fb->fbo_id);
-}
-
-/**
- * gst_gl_context_clear_framebuffer:
- * @context: a #GstGLContext
- *
- * Unbind the current framebuffer
- *
- * Since: 1.10
- */
-void
-gst_gl_context_clear_framebuffer (GstGLContext * context)
-{
- const GstGLFuncs *gl;
-
- g_return_if_fail (GST_IS_GL_CONTEXT (context));
-
- gl = context->gl_vtable;
-
- gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
-}
-
-static void
-_update_effective_dimensions (GstGLFramebuffer * fb)
-{
- int i;
- guint min_width = -1, min_height = -1;
-
- /* remove the previous attachment */
- for (i = 0; i < fb->attachments->len; i++) {
- struct fbo_attachment *attach;
- int width, height;
-
- attach = &g_array_index (fb->attachments, struct fbo_attachment, i);
-
- if (gst_is_gl_memory (GST_MEMORY_CAST (attach->mem))) {
- GstGLMemory *mem = (GstGLMemory *) attach->mem;
-
- width = gst_gl_memory_get_texture_width (mem);
- height = gst_gl_memory_get_texture_height (mem);
- } else if (gst_is_gl_renderbuffer (GST_MEMORY_CAST (attach->mem))) {
- GstGLRenderbuffer *mem = (GstGLRenderbuffer *) attach->mem;
-
- width = mem->width;
- height = mem->height;
- } else {
- g_assert_not_reached ();
- }
-
- if (width < min_width)
- min_width = width;
- if (height < min_height)
- min_height = height;
- }
-
- fb->priv->effective_width = min_width;
- fb->priv->effective_height = min_height;
-}
-
-static gboolean
-_is_valid_attachment_point (guint attachment_point)
-{
- /* all 31 possible color attachments */
- if (attachment_point >= 0x8CE0 && attachment_point <= 0x8CFF)
- return TRUE;
-
- /* depth-stencil attachment */
- if (attachment_point == 0x821A)
- return TRUE;
-
- /* depth attachment */
- if (attachment_point == 0x8D00)
- return TRUE;
-
- /* stencil attachment */
- if (attachment_point == 0x8D20)
- return TRUE;
-
- return FALSE;
-}
-
-static void
-_attach_gl_memory (GstGLFramebuffer * fb, guint attachment_point,
- GstGLMemory * mem)
-{
- struct fbo_attachment attach;
- const GstGLFuncs *gl = fb->context->gl_vtable;
- guint gl_target = gst_gl_texture_target_to_gl (mem->tex_target);
-
- gst_gl_framebuffer_bind (fb);
-
- gl->FramebufferTexture2D (GL_FRAMEBUFFER, attachment_point, gl_target,
- mem->tex_id, 0);
-
- _fbo_attachment_init (&attach, attachment_point, (GstGLBaseMemory *) mem);
- fb->attachments = g_array_append_val (fb->attachments, attach);
-}
-
-static void
-_attach_renderbuffer (GstGLFramebuffer * fb, guint attachment_point,
- GstGLRenderbuffer * rb)
-{
- struct fbo_attachment attach;
- const GstGLFuncs *gl = fb->context->gl_vtable;
-
- gst_gl_framebuffer_bind (fb);
- gl->BindRenderbuffer (GL_RENDERBUFFER, rb->renderbuffer_id);
-
- gl->FramebufferRenderbuffer (GL_FRAMEBUFFER, attachment_point,
- GL_RENDERBUFFER, rb->renderbuffer_id);
-
- _fbo_attachment_init (&attach, attachment_point, (GstGLBaseMemory *) rb);
- fb->attachments = g_array_append_val (fb->attachments, attach);
-}
-
-/**
- * gst_gl_framebuffer_attach:
- * @fb: a #GstGLFramebuffer
- * @attachment_point: the OpenGL attachment point to bind @mem to
- * @mem: the memory object to bind to @attachment_point
- *
- * attach @mem to @attachment_point
- *
- * Since: 1.10
- */
-void
-gst_gl_framebuffer_attach (GstGLFramebuffer * fb, guint attachment_point,
- GstGLBaseMemory * mem)
-{
- int i;
-
- g_return_if_fail (GST_IS_GL_FRAMEBUFFER (fb));
- g_return_if_fail (gst_gl_context_get_current () == fb->context);
- g_return_if_fail (_is_valid_attachment_point (attachment_point));
-
- /* remove the previous attachment */
- for (i = 0; i < fb->attachments->len; i++) {
- struct fbo_attachment *attach;
-
- attach = &g_array_index (fb->attachments, struct fbo_attachment, i);
-
- if (attach->attachment_point == attachment_point) {
- g_array_remove_index_fast (fb->attachments, i);
- break;
- }
- }
-
- if (gst_is_gl_memory (GST_MEMORY_CAST (mem))) {
- _attach_gl_memory (fb, attachment_point, (GstGLMemory *) mem);
- } else if (gst_is_gl_renderbuffer (GST_MEMORY_CAST (mem))) {
- _attach_renderbuffer (fb, attachment_point, (GstGLRenderbuffer *) mem);
- } else {
- g_assert_not_reached ();
- return;
- }
-
- _update_effective_dimensions (fb);
-}
-
-/**
- * gst_gl_framebuffer_get_effective_dimensions:
- * @fb: a #GstGLFramebuffer
- * @width: (out) (allow-none): output width
- * @height: (out) (allow-none): output height
- *
- * Retreive the effective dimensions from the current attachments attached to
- * @fb.
- *
- * Since: 1.10
- */
-void
-gst_gl_framebuffer_get_effective_dimensions (GstGLFramebuffer * fb,
- guint * width, guint * height)
-{
- g_return_if_fail (GST_IS_GL_FRAMEBUFFER (fb));
-
- if (width)
- *width = fb->priv->effective_width;
- if (height)
- *height = fb->priv->effective_height;
-}
-
-/**
- * gst_gl_context_check_framebuffer_status:
- * @context: a #GstGLContext
- * @fbo_target: the GL value of the framebuffer target, GL_FRAMEBUFFER,
- * GL_READ_FRAMEBUFFER, GL_DRAW_FRAMEBUFFER
- *
- * Returns: whether whether the current framebuffer is complete
- *
- * Since: 1.10
- */
-gboolean
-gst_gl_context_check_framebuffer_status (GstGLContext * context,
- guint fbo_target)
-{
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
-
- if (fbo_target != GL_FRAMEBUFFER && fbo_target != GL_READ_FRAMEBUFFER
- && fbo_target != GL_DRAW_FRAMEBUFFER) {
- GST_ERROR_OBJECT (context, "fbo target is invalid");
- return FALSE;
- }
-
- switch (context->gl_vtable->CheckFramebufferStatus (fbo_target)) {
- case GL_FRAMEBUFFER_COMPLETE:
- return TRUE;
- break;
- case GL_FRAMEBUFFER_UNSUPPORTED:
- GST_WARNING_OBJECT (context, "GL_FRAMEBUFFER_UNSUPPORTED");
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
- GST_WARNING_OBJECT (context, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
- GST_WARNING_OBJECT (context,
- "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
- GST_WARNING_OBJECT (context, "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS");
- break;
-#if GST_GL_HAVE_OPENGL
- case GL_FRAMEBUFFER_UNDEFINED:
- GST_WARNING_OBJECT (context, "GL_FRAMEBUFFER_UNDEFINED");
- break;
-#endif
- default:
- GST_WARNING_OBJECT (context, "Unknown FBO error");
- break;
- }
-
- return FALSE;
-}
-
-/**
- * gst_gl_framebuffer_get_id:
- * @fb: a #GstGLFramebuffer
- *
- * Returns: the OpenGL id for @fb
- *
- * Since: 1.10
- */
-guint
-gst_gl_framebuffer_get_id (GstGLFramebuffer * fb)
-{
- g_return_val_if_fail (GST_IS_GL_FRAMEBUFFER (fb), 0);
-
- return fb->fbo_id;
-}
diff --git a/gst-libs/gst/gl/gstglframebuffer.h b/gst-libs/gst/gl/gstglframebuffer.h
deleted file mode 100644
index aaf60ec8a..000000000
--- a/gst-libs/gst/gl/gstglframebuffer.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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_FRAMEBUFFER_H__
-#define __GST_GL_FRAMEBUFFER_H__
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_framebuffer_get_type (void);
-
-#define GST_TYPE_GL_FRAMEBUFFER (gst_gl_framebuffer_get_type())
-#define GST_GL_FRAMEBUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_FRAMEBUFFER,GstGLFramebuffer))
-#define GST_GL_FRAMEBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_FRAMEBUFFER,GstGLFramebufferClass))
-#define GST_IS_GL_FRAMEBUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_FRAMEBUFFER))
-#define GST_IS_GL_FRAMEBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_FRAMEBUFFER))
-#define GST_GL_FRAMEBUFFER_CAST(obj) ((GstGLFramebuffer*)(obj))
-
-typedef struct _GstGLFramebufferPrivate GstGLFramebufferPrivate;
-
-/**
- * GstGLFramebufferFunc:
- * @stuff: user data
- *
- * callback definition for operating through a #GstGLFramebuffer object
- */
-typedef gboolean (*GstGLFramebufferFunc) (gpointer stuff);
-
-/**
- * GstGLFramebuffer:
- *
- * Opaque #GstGLFramebuffer struct
- */
-struct _GstGLFramebuffer
-{
- /* <private> */
- GstObject object;
-
- GstGLContext *context;
-
- guint fbo_id;
- GArray *attachments;
-
- gpointer _padding[GST_PADDING];
-
- GstGLFramebufferPrivate *priv;
-};
-
-/**
- * GstGLFramebufferClass:
- *
- * Opaque #GstGLFramebufferClass struct
- */
-struct _GstGLFramebufferClass
-{
- /* <private> */
- GstObjectClass object_class;
-
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstGLFramebuffer * gst_gl_framebuffer_new (GstGLContext *context);
-GST_EXPORT
-GstGLFramebuffer * gst_gl_framebuffer_new_with_default_depth (GstGLContext *context,
- guint width,
- guint height);
-
-GST_EXPORT
-guint gst_gl_framebuffer_get_id (GstGLFramebuffer * fb);
-
-GST_EXPORT
-void gst_gl_framebuffer_attach (GstGLFramebuffer * fb,
- guint attachment_point,
- GstGLBaseMemory * mem);
-GST_EXPORT
-void gst_gl_framebuffer_bind (GstGLFramebuffer * fb);
-GST_EXPORT
-void gst_gl_context_clear_framebuffer (GstGLContext * context);
-
-GST_EXPORT
-void gst_gl_framebuffer_get_effective_dimensions (GstGLFramebuffer * fb,
- guint * width,
- guint * height);
-
-GST_EXPORT
-gboolean gst_gl_context_check_framebuffer_status (GstGLContext * context,
- guint fbo_target);
-
-GST_EXPORT
-gboolean gst_gl_framebuffer_draw_to_texture (GstGLFramebuffer * fb,
- GstGLMemory * mem,
- GstGLFramebufferFunc func,
- gpointer user_data);
-
-#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLFramebuffer, gst_object_unref)
-#endif
-
-G_END_DECLS
-
-#endif
diff --git a/gst-libs/gst/gl/gstglfuncs.h b/gst-libs/gst/gl/gstglfuncs.h
deleted file mode 100644
index 805abcf3d..000000000
--- a/gst-libs/gst/gl/gstglfuncs.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_FUNCS_H__
-#define __GST_GL_FUNCS_H__
-
-#include <gst/gl/gstglconfig.h>
-
-/* This mimic GCC behaviour with system headers files even if GL headers may
- * not be in the system header path. */
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wredundant-decls"
-#endif
-
-/* OpenGL 2.0 for Embedded Systems */
-#if GST_GL_HAVE_GLES2
-# if GST_GL_HAVE_PLATFORM_EAGL
-# include <OpenGLES/ES2/gl.h>
-# include <OpenGLES/ES2/glext.h>
-# else
-# if GST_GL_HAVE_GLES3
-# include <GLES3/gl3.h>
-# if GST_GL_HAVE_GLES3EXT3_H
-# include <GLES3/gl3ext.h>
-# endif
-# include <GLES2/gl2ext.h>
-# else
-# include <GLES2/gl2.h>
-# include <GLES2/gl2ext.h>
-# endif
-# endif
-# if !GST_GL_HAVE_OPENGL
-# include <gst/gl/glprototypes/gstgl_gles2compat.h>
-# endif
-#endif
-
-/* OpenGL for desktop systems */
-#if GST_GL_HAVE_OPENGL
-# ifdef __APPLE__
-# include <OpenGL/OpenGL.h>
-# include <OpenGL/gl.h>
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
-# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
-# include <OpenGL/gl3.h>
-# endif
-# else
-# if defined(_MSC_VER)
-# include <windows.h>
-# endif
-# include <GL/gl.h>
-# if defined(__WIN32__) || defined(_WIN32)
-# include <GL/glext.h>
-# endif
-# endif
-#endif
-
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
-#endif
-
-#if defined(WINAPI)
-#define GSTGLAPI WINAPI
-#else
-#define GSTGLAPI
-#endif
-#include <gst/gl/glprototypes/gstgl_compat.h>
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_GL_EXT_BEGIN(name, gl_availability, min_gl, maj_gl, gles_maj, \
- gles_min, ext_suf, ext_name)
-#define GST_GL_EXT_FUNCTION(ret, name, args) \
- ret (GSTGLAPI *name) args;
-#define GST_GL_EXT_END()
-
-typedef struct _GstGLFuncs
-{
-#include <gst/gl/glprototypes/all_functions.h>
- gpointer padding[GST_PADDING_LARGE*6];
-} GstGLFuncs;
-
-#undef GST_GL_EXT_BEGIN
-#undef GST_GL_EXT_FUNCTION
-#undef GST_GL_EXT_END
-
-G_END_DECLS
-
-#endif /* __GST_GL_API_H__ */
diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c
deleted file mode 100644
index a4a137233..000000000
--- a/gst-libs/gst/gl/gstglmemory.c
+++ /dev/null
@@ -1,1526 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstglmemory.h"
-
-#include "gl.h"
-#include "gstglfuncs.h"
-
-/**
- * SECTION:gstglmemory
- * @title: GstGLMemory
- * @short_description: memory subclass for GL textures
- * @see_also: #GstMemory, #GstAllocator, #GstGLBufferPool
- *
- * GstGLMemory is a #GstGLBaseMemory subclass providing support for the mapping of
- * OpenGL textures.
- *
- * #GstGLMemory is created or wrapped through gst_gl_base_memory_alloc()
- * with #GstGLVideoAllocationParams.
- *
- * Data is uploaded or downloaded from the GPU as is necessary.
- */
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-#define GL_MEM_WIDTH(gl_mem) _get_plane_width (&gl_mem->info, gl_mem->plane)
-#define GL_MEM_HEIGHT(gl_mem) _get_plane_height (&gl_mem->info, gl_mem->plane)
-#define GL_MEM_STRIDE(gl_mem) GST_VIDEO_INFO_PLANE_STRIDE (&gl_mem->info, gl_mem->plane)
-
-static GstAllocator *_gl_memory_allocator;
-
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
-#define GST_CAT_DEFAULT GST_CAT_GL_MEMORY
-
-/* compatability definitions... */
-#ifndef GL_UNPACK_ROW_LENGTH
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#endif
-
-#ifndef GL_TEXTURE_RECTANGLE
-#define GL_TEXTURE_RECTANGLE 0x84F5
-#endif
-#ifndef GL_TEXTURE_EXTERNAL_OES
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#endif
-
-#ifndef GL_READ_FRAMEBUFFER
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#endif
-#ifndef GL_DRAW_FRAMEBUFFER
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#endif
-
-G_DEFINE_TYPE (GstGLMemoryAllocator, gst_gl_memory_allocator,
- GST_TYPE_GL_BASE_MEMORY_ALLOCATOR);
-
-typedef struct
-{
- /* in */
- GstGLMemory *src;
- GstGLFormat out_format;
- guint out_width, out_height;
- GstGLTextureTarget tex_target;
- GstGLFormat tex_format;
- /* inout */
- guint tex_id;
- /* out */
- gboolean result;
-} GstGLMemoryCopyParams;
-
-static inline guint
-_get_plane_width (GstVideoInfo * info, guint plane)
-{
- if (GST_VIDEO_INFO_IS_YUV (info))
- /* For now component width and plane width are the same and the
- * plane-component mapping matches
- */
- return GST_VIDEO_INFO_COMP_WIDTH (info, plane);
- else /* RGB, GRAY */
- return GST_VIDEO_INFO_WIDTH (info);
-}
-
-static inline guint
-_get_plane_height (GstVideoInfo * info, guint plane)
-{
- if (GST_VIDEO_INFO_IS_YUV (info))
- /* For now component width and plane width are the same and the
- * plane-component mapping matches
- */
- return GST_VIDEO_INFO_COMP_HEIGHT (info, plane);
- else /* RGB, GRAY */
- return GST_VIDEO_INFO_HEIGHT (info);
-}
-
-static inline void
-_calculate_unpack_length (GstGLMemory * gl_mem, GstGLContext * context)
-{
- guint n_gl_bytes;
- guint tex_type;
-
- gl_mem->tex_scaling[0] = 1.0f;
- gl_mem->tex_scaling[1] = 1.0f;
- gl_mem->unpack_length = 1;
- gl_mem->tex_width = GL_MEM_WIDTH (gl_mem);
-
- tex_type = GL_UNSIGNED_BYTE;
- if (gl_mem->tex_format == GST_GL_RGB565)
- tex_type = GL_UNSIGNED_SHORT_5_6_5;
-
- n_gl_bytes = gst_gl_format_type_n_bytes (gl_mem->tex_format, tex_type);
- if (n_gl_bytes == 0) {
- GST_ERROR ("Unsupported texture type %d", gl_mem->tex_format);
- return;
- }
-
- if (USING_OPENGL (context) || USING_GLES3 (context)
- || USING_OPENGL3 (context)) {
- gl_mem->unpack_length = GL_MEM_STRIDE (gl_mem) / n_gl_bytes;
- } else if (USING_GLES2 (context)) {
- guint j = 8;
-
- while (j >= n_gl_bytes) {
- /* GST_ROUND_UP_j(GL_MEM_WIDTH (gl_mem) * n_gl_bytes) */
- guint round_up_j =
- ((GL_MEM_WIDTH (gl_mem) * n_gl_bytes) + j - 1) & ~(j - 1);
-
- if (round_up_j == GL_MEM_STRIDE (gl_mem)) {
- GST_CAT_LOG (GST_CAT_GL_MEMORY, "Found alignment of %u based on "
- "width (with plane width:%u, plane stride:%u and pixel stride:%u. "
- "RU%u(%u*%u) = %u)", j, GL_MEM_WIDTH (gl_mem),
- GL_MEM_STRIDE (gl_mem), n_gl_bytes, j, GL_MEM_WIDTH (gl_mem),
- n_gl_bytes, round_up_j);
-
- gl_mem->unpack_length = j;
- break;
- }
- j >>= 1;
- }
-
- if (j < n_gl_bytes) {
- /* Failed to find a suitable alignment, try based on plane_stride and
- * scale in the shader. Useful for alignments that are greater than 8.
- */
- j = 8;
-
- while (j >= n_gl_bytes) {
- /* GST_ROUND_UP_j((GL_MEM_STRIDE (gl_mem)) */
- guint round_up_j = ((GL_MEM_STRIDE (gl_mem)) + j - 1) & ~(j - 1);
-
- if (round_up_j == (GL_MEM_STRIDE (gl_mem))) {
- GST_CAT_LOG (GST_CAT_GL_MEMORY, "Found alignment of %u based "
- "on stride (with plane stride:%u and pixel stride:%u. "
- "RU%u(%u) = %u)", j, GL_MEM_STRIDE (gl_mem), n_gl_bytes, j,
- GL_MEM_STRIDE (gl_mem), round_up_j);
-
- gl_mem->unpack_length = j;
- gl_mem->tex_scaling[0] =
- (gfloat) (GL_MEM_WIDTH (gl_mem) * n_gl_bytes) /
- (gfloat) GL_MEM_STRIDE (gl_mem);
- gl_mem->tex_width = GL_MEM_STRIDE (gl_mem) / n_gl_bytes;
- break;
- }
- j >>= 1;
- }
-
- if (j < n_gl_bytes) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Failed to find matching "
- "alignment. Image may look corrupted. plane width:%u, "
- "plane stride:%u and pixel stride:%u", GL_MEM_WIDTH (gl_mem),
- GL_MEM_STRIDE (gl_mem), n_gl_bytes);
- }
- }
- }
-
- if (gl_mem->tex_target == GST_GL_TEXTURE_TARGET_RECTANGLE) {
- guint w_sub =
- GST_VIDEO_FORMAT_INFO_W_SUB (gl_mem->info.finfo, gl_mem->plane);
- guint h_sub =
- GST_VIDEO_FORMAT_INFO_H_SUB (gl_mem->info.finfo, gl_mem->plane);
-
- if (w_sub)
- gl_mem->tex_scaling[0] /= (1 << w_sub);
- if (h_sub)
- gl_mem->tex_scaling[1] /= (1 << h_sub);
- }
-}
-
-static guint
-_new_texture (GstGLContext * context, guint target, guint internal_format,
- guint format, guint type, guint width, guint height)
-{
- const GstGLFuncs *gl = context->gl_vtable;
- guint tex_id;
-
- gl->GenTextures (1, &tex_id);
- gl->BindTexture (target, tex_id);
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE)
- gl->TexImage2D (target, 0, internal_format, width, height, 0, format, type,
- NULL);
-
- gl->TexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- gl->TexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- gl->TexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- gl->TexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- gl->BindTexture (target, 0);
-
- return tex_id;
-}
-
-static gboolean
-_gl_tex_create (GstGLMemory * gl_mem, GError ** error)
-{
- GstGLContext *context = gl_mem->mem.context;
- GLenum internal_format;
- GLenum tex_format;
- GLenum tex_type;
-
- tex_format = gl_mem->tex_format;
- tex_type = GL_UNSIGNED_BYTE;
- if (gl_mem->tex_format == GST_GL_RGB565) {
- tex_format = GST_GL_RGB;
- tex_type = GL_UNSIGNED_SHORT_5_6_5;
- }
-
- internal_format =
- gst_gl_sized_gl_format_from_gl_format_type (context, tex_format,
- tex_type);
-
- if (!gl_mem->texture_wrapped) {
- gl_mem->tex_id =
- _new_texture (context, gst_gl_texture_target_to_gl (gl_mem->tex_target),
- internal_format, tex_format, tex_type, gl_mem->tex_width,
- GL_MEM_HEIGHT (gl_mem));
-
- GST_TRACE ("Generating texture id:%u format:%u type:%u dimensions:%ux%u",
- gl_mem->tex_id, tex_format, tex_type, gl_mem->tex_width,
- GL_MEM_HEIGHT (gl_mem));
- }
-
- return TRUE;
-}
-
-/**
- * gst_gl_memory_init:
- * @mem: the #GstGLBaseMemory to initialize
- * @allocator: the #GstAllocator to initialize with
- * @parent: (allow-none): the parent #GstMemory to initialize with
- * @context: the #GstGLContext to initialize with
- * @target: the #GstGLTextureTarget for this #GstGLMemory
- * @tex_format: the #GstGLFormat for this #GstGLMemory
- * @params: (allow-none): the @GstAllocationParams to initialize with
- * @info: the #GstVideoInfo for this #GstGLMemory
- * @plane: the plane number (starting from 0) for this #GstGLMemory
- * @valign: (allow-none): optional #GstVideoAlignment parameters
- * @notify: (allow-none): a #GDestroyNotify
- * @user_data: (allow-none): user data to call @notify with
- *
- * Initializes @mem with the required parameters. @info is assumed to have
- * already have been modified with gst_video_info_align().
- *
- * Since: 1.8
- */
-void
-gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator,
- GstMemory * parent, GstGLContext * context, GstGLTextureTarget target,
- GstGLFormat tex_format, GstAllocationParams * params,
- GstVideoInfo * info, guint plane, GstVideoAlignment * valign,
- gpointer user_data, GDestroyNotify notify)
-{
- const gchar *target_str;
- gsize size;
-
- g_return_if_fail (plane < GST_VIDEO_INFO_N_PLANES (info));
-
- mem->info = *info;
- if (valign)
- mem->valign = *valign;
- else
- gst_video_alignment_reset (&mem->valign);
-
- /* double-check alignment requirements (caller should've taken care of this) */
- if (params) {
- guint max_align, n;
-
- max_align = gst_memory_alignment;
- max_align |= params->align;
- for (n = 0; n < GST_VIDEO_MAX_PLANES; ++n)
- max_align |= mem->valign.stride_align[n];
-
- if (params->align < max_align && max_align > gst_memory_alignment) {
- GST_WARNING ("allocation params alignment %" G_GSIZE_FORMAT " is smaller "
- "than the max required video alignment %u", params->align, max_align);
- }
- }
-
- size = gst_gl_get_plane_data_size (info, valign, plane);
-
- mem->tex_target = target;
- mem->tex_format = tex_format;
- mem->plane = plane;
-
- _calculate_unpack_length (mem, context);
-
- gst_gl_base_memory_init ((GstGLBaseMemory *) mem, allocator, parent, context,
- params, size, user_data, notify);
-
- target_str = gst_gl_texture_target_to_string (target);
- GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "new GL texture context:%"
- GST_PTR_FORMAT " memory:%p target:%s format:%u dimensions:%ux%u "
- "stride:%u size:%" G_GSIZE_FORMAT, context, mem, target_str,
- mem->tex_format, mem->tex_width, GL_MEM_HEIGHT (mem), GL_MEM_STRIDE (mem),
- mem->mem.mem.size);
-}
-
-/**
- * gst_gl_memory_read_pixels:
- * @gl_mem: a #GstGLMemory
- * @read_pointer: the data pointer to pass to glReadPixels
- *
- * Reads the texture in #GstGLMemory into @read_pointer if no buffer is bound
- * to %GL_PIXEL_PACK_BUFFER. Otherwise @read_pointer is the byte offset into
- * the currently bound %GL_PIXEL_PACK_BUFFER buffer to store the result of
- * glReadPixels. See the OpenGL specification for glReadPixels for more
- * details.
- *
- * Returns: whether theread operation succeeded
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_memory_read_pixels (GstGLMemory * gl_mem, gpointer read_pointer)
-{
- GstGLContext *context = gl_mem->mem.context;
- const GstGLFuncs *gl = context->gl_vtable;
- guint format, type;
- guint fbo;
-
- format = gl_mem->tex_format;
- type = GL_UNSIGNED_BYTE;
- if (gl_mem->tex_format == GST_GL_RGB565)
- type = GL_UNSIGNED_SHORT_5_6_5;
-
- /* FIXME: avoid creating a framebuffer every download/copy */
- gl->GenFramebuffers (1, &fbo);
- gl->BindFramebuffer (GL_FRAMEBUFFER, fbo);
-
- gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- gst_gl_texture_target_to_gl (gl_mem->tex_target), gl_mem->tex_id, 0);
-
- if (!gst_gl_context_check_framebuffer_status (context, GL_FRAMEBUFFER)) {
- GST_CAT_WARNING (GST_CAT_GL_MEMORY,
- "Could not create framebuffer to read pixels for memory %p", gl_mem);
- gl->DeleteFramebuffers (1, &fbo);
- return FALSE;
- }
-
- if (USING_GLES2 (context) || USING_GLES3 (context)) {
- if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
- /* explicitly supported */
- } else {
- gint supported_format, supported_type;
-
- gl->GetIntegerv (GL_IMPLEMENTATION_COLOR_READ_FORMAT, &supported_format);
- gl->GetIntegerv (GL_IMPLEMENTATION_COLOR_READ_TYPE, &supported_type);
-
- if (supported_format != format || supported_type != type) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "cannot read pixels with "
- "unsupported format and type. Supported format 0x%x type 0x%x",
- supported_format, supported_type);
- gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
- gl->DeleteFramebuffers (1, &fbo);
- return FALSE;
- }
- }
- }
-
- gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (gl_mem)->query,
- GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "glReadPixels took");
- gl->ReadPixels (0, 0, gl_mem->tex_width, GL_MEM_HEIGHT (gl_mem), format,
- type, read_pointer);
- gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (gl_mem)->query);
-
- gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
- gl->DeleteFramebuffers (1, &fbo);
-
- return TRUE;
-}
-
-static gpointer
-_gl_tex_download_get_tex_image (GstGLMemory * gl_mem, GstMapInfo * info,
- gsize size)
-{
- GstGLContext *context = gl_mem->mem.context;
- const GstGLFuncs *gl = context->gl_vtable;
-
- if (size != -1 && size != ((GstMemory *) gl_mem)->maxsize)
- return NULL;
-
- if (USING_GLES2 (context) || USING_GLES3 (context))
- return NULL;
-
- /* taken care of by read pixels */
- if (gl_mem->tex_format != GST_GL_LUMINANCE
- && gl_mem->tex_format != GST_GL_LUMINANCE_ALPHA)
- return NULL;
-
- if (info->flags & GST_MAP_READ
- && GST_MEMORY_FLAG_IS_SET (gl_mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD)) {
- guint format, type;
- guint target;
-
- GST_CAT_TRACE (GST_CAT_GL_MEMORY, "attempting download of texture %u "
- "using glGetTexImage", gl_mem->tex_id);
-
- format = gl_mem->tex_format;
- type = GL_UNSIGNED_BYTE;
- if (gl_mem->tex_format == GST_GL_RGB565)
- type = GL_UNSIGNED_SHORT_5_6_5;
-
- target = gst_gl_texture_target_to_gl (gl_mem->tex_target);
- gl->BindTexture (target, gl_mem->tex_id);
- gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (gl_mem)->query,
- GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "glGetTexImage took");
- gl->GetTexImage (target, 0, format, type, gl_mem->mem.data);
- gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (gl_mem)->query);
- gl->BindTexture (target, 0);
- }
-
- return gl_mem->mem.data;
-}
-
-static gpointer
-_gl_tex_download_read_pixels (GstGLMemory * gl_mem, GstMapInfo * info,
- gsize size)
-{
- if (size != -1 && size != ((GstMemory *) gl_mem)->maxsize)
- return NULL;
-
- if (info->flags & GST_MAP_READ
- && GST_MEMORY_FLAG_IS_SET (gl_mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD)) {
- GST_CAT_TRACE (GST_CAT_GL_MEMORY,
- "attempting download of texture %u " "using glReadPixels",
- gl_mem->tex_id);
- if (!gst_gl_memory_read_pixels (gl_mem, gl_mem->mem.data))
- return NULL;
- }
-
- return gl_mem->mem.data;
-}
-
-static gpointer
-_gl_tex_map_cpu_access (GstGLMemory * gl_mem, GstMapInfo * info, gsize size)
-{
- gpointer data = NULL;
-
- if (!gst_gl_base_memory_alloc_data (GST_GL_BASE_MEMORY_CAST (gl_mem)))
- return NULL;
-
- if (!data)
- data = _gl_tex_download_get_tex_image (gl_mem, info, size);
-
- if (!data)
- data = _gl_tex_download_read_pixels (gl_mem, info, size);
-
- return data;
-}
-
-static void
-_upload_cpu_write (GstGLMemory * gl_mem, GstMapInfo * info, gsize maxsize)
-{
- gst_gl_memory_texsubimage (gl_mem, gl_mem->mem.data);
-}
-
-/**
- * gst_gl_memory_texsubimage:
- * @gl_mem: a #GstGLMemory
- * @read_pointer: the data pointer to pass to glTexSubImage
- *
- * See gst_gl_memory_read_pixels() for what @read_pointer signifies.
- *
- * Since: 1.8
- */
-void
-gst_gl_memory_texsubimage (GstGLMemory * gl_mem, gpointer read_pointer)
-{
- GstGLContext *context = gl_mem->mem.context;
- const GstGLFuncs *gl;
- GLenum gl_format, gl_type, gl_target;
- gpointer data;
- gsize plane_start;
-
- if (!GST_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD))
- return;
-
- gl = context->gl_vtable;
-
- gl_type = GL_UNSIGNED_BYTE;
- if (gl_mem->tex_format == GST_GL_RGB565)
- gl_type = GL_UNSIGNED_SHORT_5_6_5;
-
- gl_format = gl_mem->tex_format;
- gl_target = gst_gl_texture_target_to_gl (gl_mem->tex_target);
-
- if (USING_OPENGL (context) || USING_GLES3 (context)
- || USING_OPENGL3 (context)) {
- gl->PixelStorei (GL_UNPACK_ROW_LENGTH, gl_mem->unpack_length);
- } else if (USING_GLES2 (context)) {
- gl->PixelStorei (GL_UNPACK_ALIGNMENT, gl_mem->unpack_length);
- }
-
- GST_CAT_LOG (GST_CAT_GL_MEMORY, "upload for texture id:%u, %ux%u",
- gl_mem->tex_id, gl_mem->tex_width, GL_MEM_HEIGHT (gl_mem));
-
- /* find the start of the plane data including padding */
- plane_start =
- gst_gl_get_plane_start (&gl_mem->info, &gl_mem->valign,
- gl_mem->plane) + gl_mem->mem.mem.offset;
-
- data = (gpointer) ((gintptr) plane_start + (gintptr) read_pointer);
-
- gl->BindTexture (gl_target, gl_mem->tex_id);
- gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (gl_mem)->query,
- GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "glTexSubImage took");
- gl->TexSubImage2D (gl_target, 0, 0, 0, gl_mem->tex_width,
- GL_MEM_HEIGHT (gl_mem), gl_format, gl_type, data);
- gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (gl_mem)->query);
-
- /* Reset to default values */
- if (USING_OPENGL (context) || USING_GLES3 (context)
- || USING_OPENGL3 (context)) {
- gl->PixelStorei (GL_UNPACK_ROW_LENGTH, 0);
- } else if (USING_GLES2 (context)) {
- gl->PixelStorei (GL_UNPACK_ALIGNMENT, 4);
- }
-
- gl->BindTexture (gl_target, 0);
-}
-
-static gpointer
-_default_gl_tex_map (GstGLMemory * gl_mem, GstMapInfo * info, gsize size)
-{
- if ((info->flags & GST_MAP_GL) == GST_MAP_GL) {
- _upload_cpu_write (gl_mem, info, size);
- return &gl_mem->tex_id;
- } else {
- return _gl_tex_map_cpu_access (gl_mem, info, size);
- }
-}
-
-static gpointer
-_gl_tex_map (GstGLMemory * gl_mem, GstMapInfo * info, gsize maxsize)
-{
- GstGLMemoryAllocatorClass *alloc_class;
- gpointer data;
-
- alloc_class = GST_GL_MEMORY_ALLOCATOR_GET_CLASS (gl_mem->mem.mem.allocator);
-
- if ((info->flags & GST_MAP_GL) == GST_MAP_GL) {
- if (gl_mem->tex_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
- return &gl_mem->tex_id;
- } else { /* not GL */
- if (gl_mem->tex_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot map External OES textures");
- return NULL;
- }
- }
-
- g_return_val_if_fail (alloc_class->map != NULL, NULL);
- data = alloc_class->map (GST_GL_BASE_MEMORY_CAST (gl_mem), info, maxsize);
-
- return data;
-}
-
-static void
-_default_gl_tex_unmap (GstGLMemory * gl_mem, GstMapInfo * info)
-{
-}
-
-static void
-_gl_tex_unmap (GstGLMemory * gl_mem, GstMapInfo * info)
-{
- GstGLMemoryAllocatorClass *alloc_class;
-
- alloc_class = GST_GL_MEMORY_ALLOCATOR_GET_CLASS (gl_mem->mem.mem.allocator);
- g_return_if_fail (alloc_class->unmap != NULL);
-
- alloc_class->unmap (GST_GL_BASE_MEMORY_CAST (gl_mem), info);
-}
-
-/**
- * gst_gl_memory_copy_teximage:
- * @gl_mem: the source #GstGLMemory
- * @tex_id: the destination texture id
- * @out_target: the destination #GstGLTextureTarget
- * @out_tex_format: the destination #GstGLFormat
- * @out_width: the destination width
- * @out_height: the destination height
- *
- * Copies the texture in #GstGLMemory into the texture specified by @tex_id,
- * @out_target, @out_tex_format, @out_width and @out_height.
- *
- * Returns: whether the copy succeeded.
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
- GstGLTextureTarget out_target, GstGLFormat out_tex_format,
- gint out_width, gint out_height)
-{
- const GstGLFuncs *gl;
- guint out_tex_target;
- GstMapInfo sinfo;
- guint src_tex_id;
- guint fbo[2];
- guint n_fbos;
-
- gl = src->mem.context->gl_vtable;
- out_tex_target = gst_gl_texture_target_to_gl (out_target);
-
- if (!gl->GenFramebuffers) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Framebuffer objects not supported");
- goto error;
- }
-
- if (USING_GLES2 (src->mem.context)
- && (src->tex_format == GST_GL_LUMINANCE
- || src->tex_format == GST_GL_LUMINANCE_ALPHA)) {
- GST_CAT_FIXME (GST_CAT_GL_MEMORY,
- "Cannot copy Luminance/Luminance Alpha textures in GLES");
- goto error;
- }
-
- if (!gst_memory_map (GST_MEMORY_CAST (src), &sinfo,
- GST_MAP_READ | GST_MAP_GL)) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY,
- "Failed to map source memory for copying");
- goto error;
- }
-
- src_tex_id = *(guint *) sinfo.data;
-
- GST_CAT_LOG (GST_CAT_GL_MEMORY, "copying memory %p, tex %u into "
- "texture %i", src, src_tex_id, tex_id);
-
- /* FIXME: try and avoid creating and destroying fbo's every copy... */
- if (!gl->BlitFramebuffer || (!gl->DrawBuffer && !gl->DrawBuffers)
- || !gl->ReadBuffer) {
- /* create a framebuffer object */
- n_fbos = 1;
- gl->GenFramebuffers (n_fbos, &fbo[0]);
- gl->BindFramebuffer (GL_FRAMEBUFFER, fbo[0]);
-
- gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- gst_gl_texture_target_to_gl (src->tex_target), src_tex_id, 0);
-
- if (!gst_gl_context_check_framebuffer_status (src->mem.context,
- GL_FRAMEBUFFER))
- goto fbo_error;
-
- gl->BindTexture (out_tex_target, tex_id);
- gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (src)->query,
- GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "CopyTexImage2D took");
- gl->CopyTexImage2D (out_tex_target, 0, out_tex_format, 0, 0, out_width,
- out_height, 0);
- gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (src)->query);
-
- gl->BindTexture (out_tex_target, 0);
- gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
-
- gl->DeleteFramebuffers (n_fbos, &fbo[0]);
- } else {
- GLenum multipleRT[] = {
- GL_COLOR_ATTACHMENT0,
- GL_COLOR_ATTACHMENT1,
- GL_COLOR_ATTACHMENT2
- };
-
- /* create a framebuffer object */
- n_fbos = 2;
- gl->GenFramebuffers (n_fbos, &fbo[0]);
-
- gl->BindFramebuffer (GL_READ_FRAMEBUFFER, fbo[0]);
- gl->FramebufferTexture2D (GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- gst_gl_texture_target_to_gl (src->tex_target), src_tex_id, 0);
-
- if (!gst_gl_context_check_framebuffer_status (src->mem.context,
- GL_READ_FRAMEBUFFER))
- goto fbo_error;
-
- gl->BindFramebuffer (GL_DRAW_FRAMEBUFFER, fbo[1]);
-
- gl->FramebufferTexture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- gst_gl_texture_target_to_gl (src->tex_target), tex_id, 0);
-
- if (!gst_gl_context_check_framebuffer_status (src->mem.context,
- GL_DRAW_FRAMEBUFFER))
- goto fbo_error;
-
- gl->BindTexture (out_tex_target, tex_id);
- gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (src)->query,
- GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "BlitFramebuffer took");
- gl->ReadBuffer (GL_COLOR_ATTACHMENT0);
- if (gl->DrawBuffers)
- gl->DrawBuffers (1, multipleRT);
- else
- gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
- gl->BlitFramebuffer (0, 0, out_width, out_height,
- 0, 0, out_width, out_height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
- gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (src)->query);
-
- gl->BindTexture (out_tex_target, 0);
- gl->BindFramebuffer (GL_DRAW_FRAMEBUFFER, 0);
- gl->BindFramebuffer (GL_READ_FRAMEBUFFER, 0);
-
- gl->DeleteFramebuffers (n_fbos, &fbo[0]);
-
- if (gl->DrawBuffer)
- gl->DrawBuffer (GL_BACK);
- }
-
- gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo);
-
- return TRUE;
-
-fbo_error:
- {
- gl->BindTexture (out_tex_target, 0);
- if (!gl->BlitFramebuffer) {
- gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
- } else {
- gl->BindFramebuffer (GL_DRAW_FRAMEBUFFER, 0);
- gl->BindFramebuffer (GL_READ_FRAMEBUFFER, 0);
- }
-
- gl->DeleteFramebuffers (n_fbos, &fbo[0]);
-
- gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo);
- }
-error:
- return FALSE;
-}
-
-static void
-_gl_tex_copy_thread (GstGLContext * context, gpointer data)
-{
- GstGLMemoryCopyParams *copy_params;
-
- copy_params = (GstGLMemoryCopyParams *) data;
-
- if (!copy_params->tex_id) {
- guint internal_format, out_gl_format, out_gl_type, out_tex_target;
-
- out_tex_target = gst_gl_texture_target_to_gl (copy_params->tex_target);
- out_gl_format = copy_params->src->tex_format;
- out_gl_type = GL_UNSIGNED_BYTE;
- if (copy_params->out_format == GST_GL_RGB565) {
- out_gl_format = GST_GL_RGB;
- out_gl_type = GL_UNSIGNED_SHORT_5_6_5;
- }
-
- internal_format =
- gst_gl_sized_gl_format_from_gl_format_type (context, out_gl_format,
- out_gl_type);
-
- copy_params->tex_id =
- _new_texture (context, out_tex_target,
- internal_format, out_gl_format, out_gl_type, copy_params->out_width,
- copy_params->out_height);
- }
-
- copy_params->result = gst_gl_memory_copy_teximage (copy_params->src,
- copy_params->tex_id, copy_params->tex_target, copy_params->tex_format,
- copy_params->out_width, copy_params->out_height);
-}
-
-static GstMemory *
-_default_gl_tex_copy (GstGLMemory * src, gssize offset, gssize size)
-{
- GstAllocationParams params = { 0, GST_MEMORY_CAST (src)->align, 0, 0 };
- GstGLBaseMemoryAllocator *base_mem_allocator;
- GstAllocator *allocator;
- GstGLMemory *dest = NULL;
-
- allocator = GST_MEMORY_CAST (src)->allocator;
- base_mem_allocator = (GstGLBaseMemoryAllocator *) allocator;
-
- if (src->tex_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot copy External OES textures");
- return NULL;
- }
-
- /* If not doing a full copy, then copy to sysmem, the 2D represention of the
- * texture would become wrong */
- if (offset > 0 || size < GST_MEMORY_CAST (src)->size) {
- return base_mem_allocator->fallback_mem_copy (GST_MEMORY_CAST (src), offset,
- size);
- }
-
- dest = g_new0 (GstGLMemory, 1);
-
- gst_gl_memory_init (dest, allocator, NULL, src->mem.context, src->tex_target,
- src->tex_format, &params, &src->info, src->plane, &src->valign, NULL,
- NULL);
-
- if (!GST_MEMORY_FLAG_IS_SET (src, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD)) {
- GstMapInfo dinfo;
-
- if (!gst_memory_map (GST_MEMORY_CAST (dest), &dinfo,
- GST_MAP_WRITE | GST_MAP_GL)) {
- GST_CAT_WARNING (GST_CAT_GL_MEMORY,
- "Failed not map destination for writing");
- gst_memory_unref (GST_MEMORY_CAST (dest));
- return NULL;
- }
-
- if (!gst_gl_memory_copy_into ((GstGLMemory *) src,
- ((GstGLMemory *) dest)->tex_id, src->tex_target,
- src->tex_format, src->tex_width, GL_MEM_HEIGHT (src))) {
- GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
- gst_memory_unmap (GST_MEMORY_CAST (dest), &dinfo);
- goto memcpy;
- }
-
- gst_memory_unmap (GST_MEMORY_CAST (dest), &dinfo);
- } else {
- memcpy:
- if (!gst_gl_base_memory_memcpy ((GstGLBaseMemory *) src,
- (GstGLBaseMemory *) dest, offset, size)) {
- GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
- gst_memory_unref (GST_MEMORY_CAST (dest));
- return NULL;
- }
- }
-
- return (GstMemory *) dest;
-}
-
-static GstMemory *
-_gl_tex_copy (GstGLMemory * src, gssize offset, gssize size)
-{
- GstGLMemoryAllocatorClass *alloc_class;
-
- alloc_class = GST_GL_MEMORY_ALLOCATOR_GET_CLASS (src->mem.mem.allocator);
-
- if (src->tex_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot copy External OES textures");
- return NULL;
- }
-
- g_return_val_if_fail (alloc_class->copy, NULL);
- return (GstMemory *) alloc_class->copy (GST_GL_BASE_MEMORY_CAST (src), offset,
- size);
-}
-
-static GstMemory *
-_gl_tex_alloc (GstAllocator * allocator, gsize size,
- GstAllocationParams * params)
-{
- g_warning ("Use gst_gl_base_memory_alloc to allocate from this allocator");
-
- return NULL;
-}
-
-static void
-_gl_tex_destroy (GstGLMemory * gl_mem)
-{
- const GstGLFuncs *gl = gl_mem->mem.context->gl_vtable;
-
- if (gl_mem->tex_id && !gl_mem->texture_wrapped)
- gl->DeleteTextures (1, &gl_mem->tex_id);
-}
-
-static GstGLMemory *
-_default_gl_tex_alloc (GstGLMemoryAllocator * allocator,
- GstGLVideoAllocationParams * params)
-{
- guint alloc_flags = params->parent.alloc_flags;
- GstGLMemory *mem;
-
- g_return_val_if_fail (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
- NULL);
-
- mem = g_new0 (GstGLMemory, 1);
-
- if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
- mem->tex_id = GPOINTER_TO_UINT (params->parent.gl_handle);
- mem->texture_wrapped = TRUE;
- }
-
- gst_gl_memory_init (mem, GST_ALLOCATOR_CAST (allocator), NULL,
- params->parent.context, params->target, params->tex_format,
- params->parent.alloc_params, params->v_info, params->plane,
- params->valign, params->parent.user_data, params->parent.notify);
-
- if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
- GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
- }
- if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) {
- mem->mem.data = params->parent.wrapped_data;
- GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);
- }
-
- return mem;
-}
-
-static void
-gst_gl_memory_allocator_class_init (GstGLMemoryAllocatorClass * klass)
-{
- GstGLBaseMemoryAllocatorClass *gl_base;
- GstAllocatorClass *allocator_class;
-
- gl_base = (GstGLBaseMemoryAllocatorClass *) klass;
- allocator_class = (GstAllocatorClass *) klass;
-
- klass->map = (GstGLBaseMemoryAllocatorMapFunction) _default_gl_tex_map;
- klass->unmap = (GstGLBaseMemoryAllocatorUnmapFunction) _default_gl_tex_unmap;
- klass->copy = (GstGLBaseMemoryAllocatorCopyFunction) _default_gl_tex_copy;
-
- gl_base->alloc =
- (GstGLBaseMemoryAllocatorAllocFunction) _default_gl_tex_alloc;
- gl_base->create = (GstGLBaseMemoryAllocatorCreateFunction) _gl_tex_create;
- gl_base->map = (GstGLBaseMemoryAllocatorMapFunction) _gl_tex_map;
- gl_base->unmap = (GstGLBaseMemoryAllocatorUnmapFunction) _gl_tex_unmap;
- gl_base->copy = (GstGLBaseMemoryAllocatorCopyFunction) _gl_tex_copy;
- gl_base->destroy = (GstGLBaseMemoryAllocatorDestroyFunction) _gl_tex_destroy;
-
- allocator_class->alloc = _gl_tex_alloc;
-}
-
-static void
-gst_gl_memory_allocator_init (GstGLMemoryAllocator * allocator)
-{
- GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
-
- alloc->mem_type = GST_GL_MEMORY_ALLOCATOR_NAME;
-
- GST_OBJECT_FLAG_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
-}
-
-/**
- * gst_gl_memory_copy_into:
- * @gl_mem:a #GstGLMemory
- * @tex_id:OpenGL texture id
- * @target: the #GstGLTextureTarget
- * @tex_format: the #GstGLFormat
- * @width: width of @tex_id
- * @height: height of @tex_id
- *
- * Copies @gl_mem into the texture specfified by @tex_id. The format of @tex_id
- * is specified by @tex_format, @width and @height.
- *
- * Returns: Whether the copy suceeded
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_memory_copy_into (GstGLMemory * gl_mem, guint tex_id,
- GstGLTextureTarget target, GstGLFormat tex_format, gint width, gint height)
-{
- GstGLMemoryCopyParams copy_params;
-
- copy_params.src = gl_mem;
- copy_params.tex_id = tex_id;
- copy_params.tex_target = target;
- copy_params.tex_format = tex_format;
- copy_params.out_width = width;
- copy_params.out_height = height;
-
- gst_gl_context_thread_add (gl_mem->mem.context, _gl_tex_copy_thread,
- &copy_params);
-
- return copy_params.result;
-}
-
-/**
- * gst_gl_memory_get_texture_width:
- * @gl_mem: a #GstGLMemory
- *
- * Returns: the texture width of @gl_mem
- *
- * Since: 1.8
- */
-gint
-gst_gl_memory_get_texture_width (GstGLMemory * gl_mem)
-{
- g_return_val_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem), 0);
-
- return gl_mem->tex_width;
-}
-
-/**
- * gst_gl_memory_get_texture_height:
- * @gl_mem: a #GstGLMemory
- *
- * Returns: the texture height of @gl_mem
- *
- * Since: 1.8
- */
-gint
-gst_gl_memory_get_texture_height (GstGLMemory * gl_mem)
-{
- g_return_val_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem), 0);
-
- return _get_plane_height (&gl_mem->info, gl_mem->plane);
-}
-
-/**
- * gst_gl_memory_get_texture_format:
- * @gl_mem: a #GstGLMemory
- *
- * Returns: the #GstGLFormat of @gl_mem
- *
- * Since: 1.12
- */
-GstGLFormat
-gst_gl_memory_get_texture_format (GstGLMemory * gl_mem)
-{
- g_return_val_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem), 0);
-
- return gl_mem->tex_format;
-}
-
-/**
- * gst_gl_memory_get_texture_target:
- * @gl_mem: a #GstGLMemory
- *
- * Returns: the #GstGLTextureTarget of @gl_mem
- *
- * Since: 1.8
- */
-GstGLTextureTarget
-gst_gl_memory_get_texture_target (GstGLMemory * gl_mem)
-{
- g_return_val_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem), 0);
-
- return gl_mem->tex_target;
-}
-
-/**
- * gst_gl_memory_get_texture_id:
- * @gl_mem: a #GstGLMemory
- *
- * Returns: the OpenGL texture handle of @gl_mem
- *
- * Since: 1.8
- */
-guint
-gst_gl_memory_get_texture_id (GstGLMemory * gl_mem)
-{
- g_return_val_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem), 0);
-
- return gl_mem->tex_id;
-}
-
-/**
- * gst_gl_memory_init_once:
- *
- * Initializes the GL Base Texture allocator. It is safe to call this function
- * multiple times. This must be called before any other GstGLMemory operation.
- *
- * Since: 1.4
- */
-void
-gst_gl_memory_init_once (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- gst_gl_base_memory_init_once ();
-
- GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_MEMORY, "glbasetexture", 0,
- "OpenGL Base Texture Memory");
-
- _gl_memory_allocator = g_object_new (GST_TYPE_GL_MEMORY_ALLOCATOR, NULL);
- gst_object_ref_sink (_gl_memory_allocator);
-
- gst_allocator_register (GST_GL_MEMORY_ALLOCATOR_NAME, _gl_memory_allocator);
-
- g_once_init_leave (&_init, 1);
- }
-}
-
-/**
- * gst_is_gl_memory:
- * @mem:a #GstMemory
- *
- * Returns: whether the memory at @mem is a #GstGLMemory
- *
- * Since: 1.4
- */
-gboolean
-gst_is_gl_memory (GstMemory * mem)
-{
- return mem != NULL && mem->allocator != NULL
- && g_type_is_a (G_OBJECT_TYPE (mem->allocator),
- GST_TYPE_GL_MEMORY_ALLOCATOR);
-}
-
-G_DEFINE_BOXED_TYPE (GstGLVideoAllocationParams, gst_gl_video_allocation_params,
- (GBoxedCopyFunc) gst_gl_allocation_params_copy,
- (GBoxedFreeFunc) gst_gl_allocation_params_free);
-
-static void
-_gst_gl_video_allocation_params_set_video_alignment (GstGLVideoAllocationParams
- * params, GstVideoAlignment * valign)
-{
- g_return_if_fail (params != NULL);
-
- if (!params->valign)
- params->valign = g_new0 (GstVideoAlignment, 1);
-
- if (valign) {
- *params->valign = *valign;
- } else {
- gst_video_alignment_reset (params->valign);
- }
-}
-
-/**
- * gst_gl_video_allocation_params_init_full:
- * @params: a #GstGLVideoAllocationParams to initialize
- * @struct_size: the size of the struct in @params
- * @alloc_flags: some allocation flags
- * @copy: a copy function
- * @free: a free function
- * @context: a #GstGLContext
- * @alloc_params: (allow-none): the #GstAllocationParams for @wrapped_data
- * @v_info: the #GstVideoInfo for @wrapped_data
- * @plane: the video plane @wrapped_data represents
- * @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @wrapped_data
- * @target: the #GstGLTextureTarget
- * @tex_format: the #GstGLFormat
- * @wrapped_data: (allow-none): the optional data pointer to wrap
- * @gl_handle: the optional OpenGL handle to wrap or 0
- * @user_data: (allow-none): user data to call @notify with
- * @notify: (allow-none): a #GDestroyNotify
- *
- * Intended for subclass usage
- *
- * Returns: initializes @params with the parameters specified
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
- gsize struct_size, guint alloc_flags, GstGLAllocationParamsCopyFunc copy,
- GstGLAllocationParamsFreeFunc free, GstGLContext * context,
- GstAllocationParams * alloc_params, GstVideoInfo * v_info,
- guint plane, GstVideoAlignment * valign, GstGLTextureTarget target,
- GstGLFormat tex_format, gpointer wrapped_data, gpointer gl_handle,
- gpointer user_data, GDestroyNotify notify)
-{
- guint i;
-
- g_return_val_if_fail (params != NULL, FALSE);
- g_return_val_if_fail (copy != NULL, FALSE);
- g_return_val_if_fail (free != NULL, FALSE);
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
- g_return_val_if_fail (v_info != NULL, FALSE);
-
- memset (params, 0, sizeof (*params));
-
- if (!gst_gl_allocation_params_init ((GstGLAllocationParams *) params,
- struct_size, alloc_flags, copy, free, context, 0, alloc_params,
- wrapped_data, gl_handle, user_data, notify))
- return FALSE;
-
- params->v_info = g_new0 (GstVideoInfo, 1);
- *params->v_info = *v_info;
- for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
- params->v_info->offset[i] = v_info->offset[i];
- params->v_info->stride[i] = v_info->stride[i];
- }
- _gst_gl_video_allocation_params_set_video_alignment (params, valign);
- params->target = target;
- params->tex_format = tex_format;
- params->plane = plane;
-
- return TRUE;
-}
-
-/**
- * gst_gl_video_allocation_params_new:
- * @context: a #GstGLContext
- * @alloc_params: (allow-none): the #GstAllocationParams for sysmem mappings of the texture
- * @v_info: the #GstVideoInfo for the texture
- * @plane: the video plane of @v_info to allocate
- * @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of the texture
- * @target: the #GstGLTextureTarget for the created textures
- * @tex_format: the #GstGLFormat for the created textures
- *
- * Returns: a new #GstGLVideoAllocationParams for allocating #GstGLMemory's
- *
- * Since: 1.8
- */
-GstGLVideoAllocationParams *
-gst_gl_video_allocation_params_new (GstGLContext * context,
- GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
- GstVideoAlignment * valign, GstGLTextureTarget target,
- GstGLFormat tex_format)
-{
- GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1);
-
- if (!gst_gl_video_allocation_params_init_full (params,
- sizeof (GstGLVideoAllocationParams),
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_ALLOC |
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
- (GstGLAllocationParamsCopyFunc)
- gst_gl_video_allocation_params_copy_data,
- (GstGLAllocationParamsFreeFunc)
- gst_gl_video_allocation_params_free_data, context, alloc_params,
- v_info, plane, valign, target, tex_format, NULL, 0, NULL, NULL)) {
- g_free (params);
- return NULL;
- }
-
- return params;
-}
-
-/**
- * gst_gl_video_allocation_params_new_wrapped_data:
- * @context: a #GstGLContext
- * @alloc_params: (allow-none): the #GstAllocationParams for @wrapped_data
- * @v_info: the #GstVideoInfo for @wrapped_data
- * @plane: the video plane @wrapped_data represents
- * @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @wrapped_data
- * @target: the #GstGLTextureTarget for @wrapped_data
- * @tex_format: the #GstGLFormat for @wrapped_data
- * @wrapped_data: the data pointer to wrap
- * @user_data: (allow-none): user data to call @notify with
- * @notify: (allow-none): a #GDestroyNotify
- *
- * Returns: a new #GstGLVideoAllocationParams for wrapping @wrapped_data
- *
- * Since: 1.8
- */
-GstGLVideoAllocationParams *
-gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
- GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
- GstVideoAlignment * valign, GstGLTextureTarget target,
- GstGLFormat tex_format, gpointer wrapped_data, gpointer user_data,
- GDestroyNotify notify)
-{
- GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1);
-
- if (!gst_gl_video_allocation_params_init_full (params,
- sizeof (GstGLVideoAllocationParams),
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM |
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
- (GstGLAllocationParamsCopyFunc)
- gst_gl_video_allocation_params_copy_data,
- (GstGLAllocationParamsFreeFunc)
- gst_gl_video_allocation_params_free_data, context, alloc_params,
- v_info, plane, valign, target, tex_format, wrapped_data, 0, user_data,
- notify)) {
- g_free (params);
- return NULL;
- }
-
- return params;
-}
-
-/**
- * gst_gl_video_allocation_params_new_wrapped_gl_handle:
- * @context: a #GstGLContext
- * @alloc_params: (allow-none): the #GstAllocationParams for @tex_id
- * @v_info: the #GstVideoInfo for @tex_id
- * @plane: the video plane @tex_id represents
- * @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @tex_id
- * @target: the #GstGLTextureTarget for @tex_id
- * @tex_format: the #GstGLFormat for @tex_id
- * @gl_handle: the GL handle to wrap
- * @user_data: (allow-none): user data to call @notify with
- * @notify: (allow-none): a #GDestroyNotify
- *
- * @gl_handle is defined by the specific OpenGL handle being wrapped
- * For #GstGLMemory and #GstGLMemoryPBO it is an OpenGL texture id.
- * Other memory types may define it to require a different type of parameter.
- *
- * Returns: a new #GstGLVideoAllocationParams for wrapping @gl_handle
- *
- * Since: 1.8
- */
-GstGLVideoAllocationParams *
-gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
- GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
- GstVideoAlignment * valign, GstGLTextureTarget target,
- GstGLFormat tex_format, gpointer gl_handle, gpointer user_data,
- GDestroyNotify notify)
-{
- GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1);
-
- if (!gst_gl_video_allocation_params_init_full (params,
- sizeof (GstGLVideoAllocationParams),
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE |
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
- (GstGLAllocationParamsCopyFunc)
- gst_gl_video_allocation_params_copy_data,
- (GstGLAllocationParamsFreeFunc)
- gst_gl_video_allocation_params_free_data, context, alloc_params,
- v_info, plane, valign, target, tex_format, NULL, gl_handle, user_data,
- notify)) {
- g_free (params);
- return NULL;
- }
-
- return params;
-}
-
-/**
- * gst_gl_video_allocation_params_new_wrapped_texture:
- * @context: a #GstGLContext
- * @alloc_params: (allow-none): the #GstAllocationParams for @tex_id
- * @v_info: the #GstVideoInfo for @tex_id
- * @plane: the video plane @tex_id represents
- * @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @tex_id
- * @target: the #GstGLTextureTarget for @tex_id
- * @tex_format: the #GstGLFormat for @tex_id
- * @tex_id: the GL texture to wrap
- * @user_data: (allow-none): user data to call @notify with
- * @notify: (allow-none): a #GDestroyNotify
- *
- * Returns: a new #GstGLVideoAllocationParams for wrapping @tex_id
- *
- * Since: 1.8
- */
-GstGLVideoAllocationParams *
-gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext * context,
- GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
- GstVideoAlignment * valign, GstGLTextureTarget target,
- GstGLFormat tex_format, guint tex_id, gpointer user_data,
- GDestroyNotify notify)
-{
- return gst_gl_video_allocation_params_new_wrapped_gl_handle (context,
- alloc_params, v_info, plane, valign, target, tex_format,
- GUINT_TO_POINTER (tex_id), user_data, notify);
-}
-
-/**
- * gst_gl_video_allocation_params_free_data:
- * @params: a #GstGLVideoAllocationParams
- *
- * Unset and free any dynamically allocated resources. Intended for subclass
- * usage only to chain up at the end of a subclass free function.
- *
- * Since: 1.8
- */
-void
-gst_gl_video_allocation_params_free_data (GstGLVideoAllocationParams * params)
-{
- g_free (params->v_info);
- g_free (params->valign);
-
- gst_gl_allocation_params_free_data (&params->parent);
-}
-
-/**
- * gst_gl_video_allocation_params_copy_data:
- * @src_vid: source #GstGLVideoAllocationParams to copy from
- * @dest_vid: destination #GstGLVideoAllocationParams to copy into
- *
- * Copy and set any dynamically allocated resources in @dest_vid. Intended
- * for subclass usage only to chain up at the end of a subclass copy function.
- *
- * Since: 1.8
- */
-void
-gst_gl_video_allocation_params_copy_data (GstGLVideoAllocationParams * src_vid,
- GstGLVideoAllocationParams * dest_vid)
-{
- GstGLAllocationParams *src = (GstGLAllocationParams *) src_vid;
- GstGLAllocationParams *dest = (GstGLAllocationParams *) dest_vid;
- guint i;
-
- gst_gl_allocation_params_copy_data (src, dest);
-
- dest_vid->v_info = g_new0 (GstVideoInfo, 1);
- *dest_vid->v_info = *src_vid->v_info;
- for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
- dest_vid->v_info->offset[i] = src_vid->v_info->offset[i];
- dest_vid->v_info->stride[i] = src_vid->v_info->stride[i];
- }
- _gst_gl_video_allocation_params_set_video_alignment (dest_vid,
- src_vid->valign);
- dest_vid->target = src_vid->target;
- dest_vid->tex_format = src_vid->tex_format;
- dest_vid->plane = src_vid->plane;
-}
-
-/**
- * gst_gl_memory_setup_buffer:
- * @allocator: the @GstGLMemoryAllocator to allocate from
- * @buffer: a #GstBuffer to setup
- * @params: the #GstGLVideoAllocationParams to allocate with
- * @tex_formats: (allow-none): a list of #GstGLFormat's to allocate with.
- * @wrapped_data: a list of wrapped data pointers
- * @n_wrapped_pointers: the number of elements in @tex_formats and @wrapped_data
- *
- * Returns: whether the buffer was correctly setup
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
- GstBuffer * buffer, GstGLVideoAllocationParams * params,
- GstGLFormat * tex_formats, gpointer * wrapped_data,
- gsize n_wrapped_pointers)
-{
- GstGLBaseMemoryAllocator *base_allocator;
- guint n_mem, i, v, views;
- guint alloc_flags = params->parent.alloc_flags;
-
- g_return_val_if_fail (params != NULL, FALSE);
- g_return_val_if_fail (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
- FALSE);
-
- base_allocator = GST_GL_BASE_MEMORY_ALLOCATOR (allocator);
- n_mem = GST_VIDEO_INFO_N_PLANES (params->v_info);
-
- if (GST_VIDEO_INFO_MULTIVIEW_MODE (params->v_info) ==
- GST_VIDEO_MULTIVIEW_MODE_SEPARATED)
- views = params->v_info->views;
- else
- views = 1;
-
- g_return_val_if_fail (!wrapped_data
- || views * n_mem != n_wrapped_pointers, FALSE);
-
- for (v = 0; v < views; v++) {
- for (i = 0; i < n_mem; i++) {
- GstGLMemory *gl_mem;
-
- if (tex_formats) {
- params->tex_format = tex_formats[i];
- } else {
- params->tex_format =
- gst_gl_format_from_video_info (params->parent.context,
- params->v_info, i);
- }
-
- params->plane = i;
- if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) {
- g_return_val_if_fail (wrapped_data != NULL, FALSE);
- params->parent.wrapped_data = wrapped_data[i];
- } else if (alloc_flags &
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
- g_return_val_if_fail (wrapped_data != NULL, FALSE);
- params->parent.gl_handle = wrapped_data[i];
- }
-
- if (!(gl_mem = (GstGLMemory *) gst_gl_base_memory_alloc (base_allocator,
- (GstGLAllocationParams *) params)))
- return FALSE;
-
- gst_buffer_append_memory (buffer, (GstMemory *) gl_mem);
- }
-
- gst_buffer_add_video_meta_full (buffer, v,
- GST_VIDEO_INFO_FORMAT (params->v_info),
- GST_VIDEO_INFO_WIDTH (params->v_info),
- GST_VIDEO_INFO_HEIGHT (params->v_info), n_mem, params->v_info->offset,
- params->v_info->stride);
- }
-
- return TRUE;
-}
-
-/**
- * gst_gl_memory_allocator_get_default:
- * @context: a #GstGLContext
- *
- * Returns: (transfer full): the default #GstGLMemoryAllocator supported by
- * @context
- *
- * Since: 1.8
- */
-GstGLMemoryAllocator *
-gst_gl_memory_allocator_get_default (GstGLContext * context)
-{
- GstGLMemoryAllocator *allocator = NULL;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
-
- /* we can only use the pbo allocator with GL > 3.0 contexts */
- if (gst_gl_context_check_gl_version (context,
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2, 3, 0)) {
- allocator = (GstGLMemoryAllocator *)
- gst_allocator_find (GST_GL_MEMORY_PBO_ALLOCATOR_NAME);
- } else {
- allocator = (GstGLMemoryAllocator *)
- gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME);
- }
-
- return allocator;
-}
diff --git a/gst-libs/gst/gl/gstglmemory.h b/gst-libs/gst/gl/gstglmemory.h
deleted file mode 100644
index e7721a79f..000000000
--- a/gst-libs/gst/gl/gstglmemory.h
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * 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_MEMORY_H_
-#define _GST_GL_MEMORY_H_
-
-#include <gst/gl/gstglbasememory.h>
-#include <gst/gl/gstglformat.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_MEMORY_ALLOCATOR (gst_gl_memory_allocator_get_type())
-GST_EXPORT
-GType gst_gl_memory_allocator_get_type(void);
-
-#define GST_IS_GL_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_MEMORY_ALLOCATOR))
-#define GST_IS_GL_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_MEMORY_ALLOCATOR))
-#define GST_GL_MEMORY_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_MEMORY_ALLOCATOR, GstGLMemoryAllocatorClass))
-#define GST_GL_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_MEMORY_ALLOCATOR, GstGLMemoryAllocator))
-#define GST_GL_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_MEMORY_ALLOCATOR, GstGLMemoryAllocatorClass))
-#define GST_GL_MEMORY_ALLOCATOR_CAST(obj) ((GstGLMemoryAllocator *)(obj))
-
-#define GST_GL_MEMORY_CAST(obj) ((GstGLMemory *) obj)
-
-/**
- * GST_CAPS_FEATURE_MEMORY_GL_MEMORY:
- *
- * Name of the caps feature for indicating the use of #GstGLMemory
- */
-#define GST_CAPS_FEATURE_MEMORY_GL_MEMORY "memory:GLMemory"
-/**
- * GST_GL_MEMORY_VIDEO_FORMATS_STR:
- *
- * List of video formats that are supported by #GstGLMemory
- */
-#define GST_GL_MEMORY_VIDEO_FORMATS_STR \
- "{ RGBA, BGRA, RGBx, BGRx, ARGB, ABGR, xRGB, xBGR, RGB, BGR, RGB16, BGR16, " \
- "AYUV, I420, YV12, NV12, NV21, YUY2, UYVY, Y41B, Y42B, Y444, " \
- "GRAY8, GRAY16_LE, GRAY16_BE }"
-
-/**
- * GstGLMemory:
- * @mem: the parent #GstGLBaseMemory object
- * @tex_id: the GL texture id for this memory
- * @tex_target: the GL texture target for this memory
- * @tex_type: the texture type
- * @info: the texture's #GstVideoInfo
- * @valign: data alignment for system memory mapping
- * @plane: data plane in @info
- * @tex_scaling: GL shader scaling parameters for @valign and/or width/height
- *
- * Represents information about a GL texture
- */
-struct _GstGLMemory
-{
- GstGLBaseMemory mem;
-
- guint tex_id;
- GstGLTextureTarget tex_target;
- GstGLFormat tex_format;
- GstVideoInfo info;
- GstVideoAlignment valign;
- guint plane;
- gfloat tex_scaling[2];
-
- /* <protected> */
- gboolean texture_wrapped;
- guint unpack_length;
- guint tex_width;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-
-#define GST_TYPE_GL_VIDEO_ALLOCATION_PARAMS (gst_gl_video_allocation_params_get_type())
-GST_EXPORT
-GType gst_gl_video_allocation_params_get_type (void);
-
-typedef struct _GstGLVideoAllocationParams GstGLVideoAllocationParams;
-
-/**
- * GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO:
- *
- * GL allocation flag indicating the allocation of 2D video frames
- */
-#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO (1 << 3)
-
-/**
- * GstGLVideoAllocationParams:
- * @parent: the parent #GstGLAllocationParams structure
- * @v_info: the #GstVideoInfo to allocate
- * @plane: the video plane index to allocate
- * @valign: the #GstVideoAlignment to align the system representation to (may be %NULL for the default)
- * @target: the #GstGLTextureTarget to allocate
- * @tex_format: the #GstGLFormat to allocate
- */
-struct _GstGLVideoAllocationParams
-{
- GstGLAllocationParams parent;
-
- GstVideoInfo *v_info;
- guint plane;
- GstVideoAlignment *valign;
- GstGLTextureTarget target;
- GstGLFormat tex_format;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-gboolean gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
- gsize struct_size,
- guint alloc_flags,
- GstGLAllocationParamsCopyFunc copy,
- GstGLAllocationParamsFreeFunc free,
- GstGLContext * context,
- GstAllocationParams * alloc_params,
- GstVideoInfo * v_info,
- guint plane,
- GstVideoAlignment * valign,
- GstGLTextureTarget target,
- GstGLFormat tex_format,
- gpointer wrapped_data,
- gpointer gl_handle,
- gpointer user_data,
- GDestroyNotify notify);
-GST_EXPORT
-GstGLVideoAllocationParams * gst_gl_video_allocation_params_new (GstGLContext * context,
- GstAllocationParams * alloc_params,
- GstVideoInfo * v_info,
- guint plane,
- GstVideoAlignment * valign,
- GstGLTextureTarget target,
- GstGLFormat tex_format);
-GST_EXPORT
-GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
- GstAllocationParams * alloc_params,
- GstVideoInfo * v_info,
- guint plane,
- GstVideoAlignment * valign,
- GstGLTextureTarget target,
- GstGLFormat tex_format,
- gpointer wrapped_data,
- gpointer user_data,
- GDestroyNotify notify);
-
-GST_EXPORT
-GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext * context,
- GstAllocationParams * alloc_params,
- GstVideoInfo * v_info,
- guint plane,
- GstVideoAlignment * valign,
- GstGLTextureTarget target,
- GstGLFormat tex_format,
- guint tex_id,
- gpointer user_data,
- GDestroyNotify notify);
-
-GST_EXPORT
-GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
- GstAllocationParams * alloc_params,
- GstVideoInfo * v_info,
- guint plane,
- GstVideoAlignment * valign,
- GstGLTextureTarget target,
- GstGLFormat tex_format,
- gpointer gl_handle,
- gpointer user_data,
- GDestroyNotify notify);
-
-/* subclass usage */
-GST_EXPORT
-void gst_gl_video_allocation_params_free_data (GstGLVideoAllocationParams * params);
-/* subclass usage */
-GST_EXPORT
-void gst_gl_video_allocation_params_copy_data (GstGLVideoAllocationParams * src_vid,
- GstGLVideoAllocationParams * dest_vid);
-
-/**
- * GstGLMemoryAllocator
- *
- * Opaque #GstGLMemoryAllocator struct
- */
-struct _GstGLMemoryAllocator
-{
- /* <private> */
- GstGLBaseMemoryAllocator parent;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLMemoryAllocatorClass:
- * @map: provide a custom map implementation
- * @copy: provide a custom copy implementation
- * @unmap: provide a custom unmap implementation
- */
-struct _GstGLMemoryAllocatorClass
-{
- /* <private> */
- GstGLBaseMemoryAllocatorClass parent_class;
-
- /* <public> */
- GstGLBaseMemoryAllocatorMapFunction map;
- GstGLBaseMemoryAllocatorCopyFunction copy;
- GstGLBaseMemoryAllocatorUnmapFunction unmap;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-#include <gst/gl/gstglbasememory.h>
-
-/**
- * GST_GL_MEMORY_ALLOCATOR_NAME:
- *
- * The name of the GL memory allocator
- */
-#define GST_GL_MEMORY_ALLOCATOR_NAME "GLMemory"
-
-GST_EXPORT
-void gst_gl_memory_init_once (void);
-GST_EXPORT
-gboolean gst_is_gl_memory (GstMemory * mem);
-
-GST_EXPORT
-void gst_gl_memory_init (GstGLMemory * mem,
- GstAllocator * allocator,
- GstMemory * parent,
- GstGLContext * context,
- GstGLTextureTarget target,
- GstGLFormat tex_format,
- GstAllocationParams *params,
- GstVideoInfo * info,
- guint plane,
- GstVideoAlignment *valign,
- gpointer user_data,
- GDestroyNotify notify);
-
-GST_EXPORT
-gboolean gst_gl_memory_copy_into (GstGLMemory *gl_mem,
- guint tex_id,
- GstGLTextureTarget target,
- GstGLFormat tex_format,
- gint width,
- gint height);
-GST_EXPORT
-gboolean gst_gl_memory_copy_teximage (GstGLMemory * src,
- guint tex_id,
- GstGLTextureTarget out_target,
- GstGLFormat out_tex_format,
- gint width,
- gint height);
-
-GST_EXPORT
-gboolean gst_gl_memory_read_pixels (GstGLMemory * gl_mem,
- gpointer read_pointer);
-GST_EXPORT
-void gst_gl_memory_texsubimage (GstGLMemory * gl_mem,
- gpointer read_pointer);
-
-/* accessors */
-GST_EXPORT
-gint gst_gl_memory_get_texture_width (GstGLMemory * gl_mem);
-GST_EXPORT
-gint gst_gl_memory_get_texture_height (GstGLMemory * gl_mem);
-GST_EXPORT
-GstGLFormat gst_gl_memory_get_texture_format (GstGLMemory * gl_mem);
-GST_EXPORT
-GstGLTextureTarget gst_gl_memory_get_texture_target (GstGLMemory * gl_mem);
-GST_EXPORT
-guint gst_gl_memory_get_texture_id (GstGLMemory * gl_mem);
-
-GST_EXPORT
-gboolean gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
- GstBuffer * buffer,
- GstGLVideoAllocationParams * params,
- GstGLFormat *tex_formats,
- gpointer *wrapped_data,
- gsize n_wrapped_pointers);
-
-GST_EXPORT
-GstGLMemoryAllocator * gst_gl_memory_allocator_get_default (GstGLContext *context);
-
-G_END_DECLS
-
-#endif /* _GST_GL_MEMORY_H_ */
diff --git a/gst-libs/gst/gl/gstglmemorypbo.c b/gst-libs/gst/gl/gstglmemorypbo.c
deleted file mode 100644
index 4a62a383c..000000000
--- a/gst-libs/gst/gl/gstglmemorypbo.c
+++ /dev/null
@@ -1,867 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstglmemorypbo.h"
-
-#include "gstglbuffer.h"
-#include "gstglcontext.h"
-#include "gstglfuncs.h"
-#include "gstglutils.h"
-
-/**
- * SECTION:gstglmemorypbo
- * @title: GstGLMemoryPBO
- * @short_description: memory subclass for GL textures
- * @see_also: #GstMemory, #GstAllocator, #GstGLBufferPool
- *
- * #GstGLMemoryPBO is created or wrapped through gst_gl_base_memory_alloc()
- * with #GstGLVideoAllocationParams.
- *
- * Data is uploaded or downloaded from the GPU as is necessary.
- */
-
-/* Implementation notes
- *
- * PBO transfer's are implemented using GstGLBuffer. We just need to
- * ensure that the texture data is written/read to/from before/after calling
- * map (mem->pbo, READ) which performs the pbo buffer transfer.
- */
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-#define GL_MEM_HEIGHT(gl_mem) _get_plane_height (&gl_mem->mem.info, gl_mem->mem.plane)
-#define GL_MEM_STRIDE(gl_mem) GST_VIDEO_INFO_PLANE_STRIDE (&gl_mem->mem.info, gl_mem->mem.plane)
-
-#define CONTEXT_SUPPORTS_PBO_UPLOAD(context) \
- (gst_gl_context_check_gl_version (context, \
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3, 2, 1) \
- || gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-#define CONTEXT_SUPPORTS_PBO_DOWNLOAD(context) \
- (gst_gl_context_check_gl_version (context, \
- GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2, 3, 0))
-
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
-#define GST_CAT_DEFAULT GST_CAT_GL_MEMORY
-
-static GstAllocator *_gl_allocator;
-
-/* compatability definitions... */
-#ifndef GL_PIXEL_PACK_BUFFER
-#define GL_PIXEL_PACK_BUFFER 0x88EB
-#endif
-#ifndef GL_PIXEL_UNPACK_BUFFER
-#define GL_PIXEL_UNPACK_BUFFER 0x88EC
-#endif
-#ifndef GL_STREAM_READ
-#define GL_STREAM_READ 0x88E1
-#endif
-#ifndef GL_STREAM_DRAW
-#define GL_STREAM_DRAW 0x88E0
-#endif
-#ifndef GL_STREAM_COPY
-#define GL_STREAM_COPY 0x88E2
-#endif
-#ifndef GL_UNPACK_ROW_LENGTH
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#endif
-
-#ifndef GL_TEXTURE_RECTANGLE
-#define GL_TEXTURE_RECTANGLE 0x84F5
-#endif
-#ifndef GL_TEXTURE_EXTERNAL_OES
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#endif
-
-#define parent_class gst_gl_memory_pbo_allocator_parent_class
-G_DEFINE_TYPE (GstGLMemoryPBOAllocator, gst_gl_memory_pbo_allocator,
- GST_TYPE_GL_MEMORY_ALLOCATOR);
-
-typedef struct
-{
- /* in */
- GstGLMemoryPBO *src;
- GstGLFormat out_format;
- guint out_width, out_height;
- guint out_stride;
- gboolean respecify;
- GstGLTextureTarget tex_target;
- /* inout */
- guint tex_id;
- /* out */
- gboolean result;
-} GstGLMemoryPBOCopyParams;
-
-static inline guint
-_get_plane_height (GstVideoInfo * info, guint plane)
-{
- if (GST_VIDEO_INFO_IS_YUV (info))
- /* For now component width and plane width are the same and the
- * plane-component mapping matches
- */
- return GST_VIDEO_INFO_COMP_HEIGHT (info, plane);
- else /* RGB, GRAY */
- return GST_VIDEO_INFO_HEIGHT (info);
-}
-
-static void
-_upload_pbo_memory (GstGLMemoryPBO * gl_mem, GstMapInfo * info,
- GstGLBuffer * pbo, GstMapInfo * pbo_info)
-{
- GstGLContext *context = gl_mem->mem.mem.context;
- const GstGLFuncs *gl;
- guint pbo_id;
-
- if (!GST_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD))
- return;
-
- g_return_if_fail (CONTEXT_SUPPORTS_PBO_UPLOAD (context));
-
- gl = context->gl_vtable;
- pbo_id = *(guint *) pbo_info->data;
-
- GST_CAT_LOG (GST_CAT_GL_MEMORY, "upload for texture id:%u, with pbo %u %ux%u",
- gl_mem->mem.tex_id, pbo_id, gl_mem->mem.tex_width,
- GL_MEM_HEIGHT (gl_mem));
-
- gl->BindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo_id);
- gst_gl_memory_texsubimage (GST_GL_MEMORY_CAST (gl_mem), NULL);
- gl->BindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
-}
-
-static guint
-_new_texture (GstGLContext * context, guint target, guint internal_format,
- guint format, guint type, guint width, guint height)
-{
- const GstGLFuncs *gl = context->gl_vtable;
- guint tex_id;
-
- gl->GenTextures (1, &tex_id);
- gl->BindTexture (target, tex_id);
- if (target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE)
- gl->TexImage2D (target, 0, internal_format, width, height, 0, format, type,
- NULL);
-
- gl->TexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- gl->TexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- gl->TexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- gl->TexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- gl->BindTexture (target, 0);
-
- return tex_id;
-}
-
-static gboolean
-_gl_mem_create (GstGLMemoryPBO * gl_mem, GError ** error)
-{
- GstGLContext *context = gl_mem->mem.mem.context;
- GstGLBaseMemoryAllocatorClass *alloc_class;
-
- alloc_class = GST_GL_BASE_MEMORY_ALLOCATOR_CLASS (parent_class);
- if (!alloc_class->create ((GstGLBaseMemory *) gl_mem, error))
- return FALSE;
-
- if (CONTEXT_SUPPORTS_PBO_DOWNLOAD (context)
- || CONTEXT_SUPPORTS_PBO_UPLOAD (context)) {
- GstAllocationParams alloc_params =
- { 0, GST_MEMORY_CAST (gl_mem)->align, 0, 0 };
- GstGLBaseMemoryAllocator *buf_allocator;
- GstGLBufferAllocationParams *params;
-
- buf_allocator =
- GST_GL_BASE_MEMORY_ALLOCATOR (gst_allocator_find
- (GST_GL_BUFFER_ALLOCATOR_NAME));
- params =
- gst_gl_buffer_allocation_params_new (context,
- GST_MEMORY_CAST (gl_mem)->size, &alloc_params, GL_PIXEL_UNPACK_BUFFER,
- GL_STREAM_DRAW);
-
- /* FIXME: lazy init this for resource constrained platforms
- * Will need to fix pbo detection based on the existence of the mem.id then */
- gl_mem->pbo = (GstGLBuffer *) gst_gl_base_memory_alloc (buf_allocator,
- (GstGLAllocationParams *) params);
-
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- gst_object_unref (buf_allocator);
-
- GST_CAT_LOG (GST_CAT_GL_MEMORY, "generated pbo %u", gl_mem->pbo->id);
- }
-
- return TRUE;
-}
-
-static gboolean
-_read_pixels_to_pbo (GstGLMemoryPBO * gl_mem)
-{
- if (!gl_mem->pbo || !CONTEXT_SUPPORTS_PBO_DOWNLOAD (gl_mem->mem.mem.context)
- || gl_mem->mem.tex_format == GST_GL_LUMINANCE
- || gl_mem->mem.tex_format == GST_GL_LUMINANCE_ALPHA)
- /* unsupported */
- return FALSE;
-
- if (GST_MEMORY_FLAG_IS_SET (gl_mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD)) {
- /* copy texture data into into the pbo and map that */
- gsize plane_start;
- GstMapInfo pbo_info;
-
- plane_start =
- gst_gl_get_plane_start (&gl_mem->mem.info, &gl_mem->mem.valign,
- gl_mem->mem.plane) + GST_MEMORY_CAST (gl_mem)->offset;
-
- gl_mem->pbo->target = GL_PIXEL_PACK_BUFFER;
- if (!gst_memory_map (GST_MEMORY_CAST (gl_mem->pbo), &pbo_info,
- GST_MAP_WRITE | GST_MAP_GL)) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Failed to map pbo for writing");
- return FALSE;
- }
-
- if (!gst_gl_memory_read_pixels ((GstGLMemory *) gl_mem,
- (gpointer) plane_start)) {
- gst_memory_unmap (GST_MEMORY_CAST (gl_mem->pbo), &pbo_info);
- return FALSE;
- }
-
- gst_memory_unmap (GST_MEMORY_CAST (gl_mem->pbo), &pbo_info);
- }
-
- return TRUE;
-}
-
-static gpointer
-_pbo_download_transfer (GstGLMemoryPBO * gl_mem, GstMapInfo * info, gsize size)
-{
- GstMapInfo *pbo_info;
-
- gl_mem->pbo->target = GL_PIXEL_PACK_BUFFER;
- /* texture -> pbo */
- if (info->flags & GST_MAP_READ
- && GST_MEMORY_FLAG_IS_SET (gl_mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD)) {
- GstMapInfo info;
-
- GST_CAT_TRACE (GST_CAT_GL_MEMORY,
- "attempting download of texture %u " "using pbo %u", gl_mem->mem.tex_id,
- gl_mem->pbo->id);
-
- if (!gst_memory_map (GST_MEMORY_CAST (gl_mem->pbo), &info,
- GST_MAP_WRITE | GST_MAP_GL)) {
- GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Failed to write to PBO");
- return NULL;
- }
-
- if (!_read_pixels_to_pbo (gl_mem)) {
- gst_memory_unmap (GST_MEMORY_CAST (gl_mem->pbo), &info);
- return NULL;
- }
-
- gst_memory_unmap (GST_MEMORY_CAST (gl_mem->pbo), &info);
- }
-
- pbo_info = g_new0 (GstMapInfo, 1);
-
- /* pbo -> data */
- /* get a cpu accessible mapping from the pbo */
- if (!gst_memory_map (GST_MEMORY_CAST (gl_mem->pbo), pbo_info, info->flags)) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Failed to map pbo");
- g_free (pbo_info);
- return NULL;
- }
- info->user_data[0] = pbo_info;
-
- return pbo_info->data;
-}
-
-static gpointer
-_gl_mem_map_cpu_access (GstGLMemoryPBO * gl_mem, GstMapInfo * info, gsize size)
-{
- gpointer data = NULL;
-
- gst_gl_base_memory_alloc_data ((GstGLBaseMemory *) gl_mem);
-
- if (!data && gl_mem->pbo
- && CONTEXT_SUPPORTS_PBO_DOWNLOAD (gl_mem->mem.mem.context))
- data = _pbo_download_transfer (gl_mem, info, size);
-
- if (!data) {
- GstGLMemoryAllocatorClass *alloc_class;
-
- alloc_class = GST_GL_MEMORY_ALLOCATOR_CLASS (parent_class);
-
- data = alloc_class->map ((GstGLBaseMemory *) gl_mem, info, size);
- }
-
- return data;
-}
-
-static gpointer
-_gl_mem_map_gpu_access (GstGLMemoryPBO * gl_mem, GstMapInfo * info, gsize size)
-{
- gpointer data = &gl_mem->mem.tex_id;
-
- if ((info->flags & GST_MAP_READ) == GST_MAP_READ) {
- if (gl_mem->pbo && CONTEXT_SUPPORTS_PBO_UPLOAD (gl_mem->mem.mem.context)) {
- GstMapInfo pbo_info;
-
- /* data -> pbo */
- if (!gst_memory_map (GST_MEMORY_CAST (gl_mem->pbo), &pbo_info,
- GST_MAP_READ | GST_MAP_GL)) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Failed to map pbo");
- return NULL;
- }
-
- /* pbo -> texture */
- _upload_pbo_memory (gl_mem, info, gl_mem->pbo, &pbo_info);
-
- gst_memory_unmap (GST_MEMORY_CAST (gl_mem->pbo), &pbo_info);
- } else {
- GstGLMemoryAllocatorClass *alloc_class;
-
- alloc_class = GST_GL_MEMORY_ALLOCATOR_CLASS (parent_class);
-
- data = alloc_class->map ((GstGLBaseMemory *) gl_mem, info, size);
- }
- }
-
- return data;
-}
-
-static gpointer
-_gl_mem_map (GstGLMemoryPBO * gl_mem, GstMapInfo * info, gsize maxsize)
-{
- gpointer data;
-
- if ((info->flags & GST_MAP_GL) == GST_MAP_GL) {
- if (gl_mem->mem.tex_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
- return &gl_mem->mem.tex_id;
-
- data = _gl_mem_map_gpu_access (gl_mem, info, maxsize);
- } else { /* not GL */
- if (gl_mem->mem.tex_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot map External OES textures");
- return NULL;
- }
-
- data = _gl_mem_map_cpu_access (gl_mem, info, maxsize);
- }
-
- return data;
-}
-
-static void
-_gl_mem_unmap_cpu_access (GstGLMemoryPBO * gl_mem, GstMapInfo * info)
-{
- if (!gl_mem->pbo || !CONTEXT_SUPPORTS_PBO_DOWNLOAD (gl_mem->mem.mem.context))
- /* PBO's not supported */
- return;
-
- gl_mem->pbo->target = GL_PIXEL_PACK_BUFFER;
- gst_memory_unmap (GST_MEMORY_CAST (gl_mem->pbo),
- (GstMapInfo *) info->user_data[0]);
- g_free (info->user_data[0]);
-}
-
-static void
-_gl_mem_unmap (GstGLMemoryPBO * gl_mem, GstMapInfo * info)
-{
- if ((info->flags & GST_MAP_GL) == 0) {
- _gl_mem_unmap_cpu_access (gl_mem, info);
- }
-}
-
-static void
-_gl_mem_copy_thread (GstGLContext * context, gpointer data)
-{
- const GstGLFuncs *gl;
- GstGLMemoryPBOCopyParams *copy_params;
- GstGLMemoryPBO *src;
- guint tex_id;
- guint out_tex_target;
- GLuint fboId;
- gsize out_width, out_height, out_stride;
- GLuint out_gl_format, out_gl_type;
- GLuint in_gl_format, in_gl_type;
- gsize in_size, out_size;
-
- copy_params = (GstGLMemoryPBOCopyParams *) data;
- src = copy_params->src;
- tex_id = copy_params->tex_id;
- out_tex_target = gst_gl_texture_target_to_gl (copy_params->tex_target);
- out_width = copy_params->out_width;
- out_height = copy_params->out_height;
- out_stride = copy_params->out_stride;
-
- gl = context->gl_vtable;
- out_gl_format = copy_params->out_format;
- out_gl_type = GL_UNSIGNED_BYTE;
- if (copy_params->out_format == GST_GL_RGB565) {
- out_gl_format = GST_GL_RGB;
- out_gl_type = GL_UNSIGNED_SHORT_5_6_5;
- }
- in_gl_format = src->mem.tex_format;
- in_gl_type = GL_UNSIGNED_BYTE;
- if (src->mem.tex_format == GST_GL_RGB565)
- in_gl_type = GL_UNSIGNED_SHORT_5_6_5;
-
- if (!gl->GenFramebuffers) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY,
- "Context, EXT_framebuffer_object not supported");
- goto error;
- }
-
- in_size = GL_MEM_HEIGHT (src) * GL_MEM_STRIDE (src);
- out_size = out_height * out_stride;
-
- if (copy_params->respecify) {
- if (in_size != out_size) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot copy between textures with "
- "backing data of different sizes. input %" G_GSIZE_FORMAT " output %"
- G_GSIZE_FORMAT, in_size, out_size);
- goto error;
- }
- }
-
- if (!tex_id) {
- guint internal_format;
- guint out_gl_type;
-
- out_gl_type = GL_UNSIGNED_BYTE;
- if (copy_params->out_format == GST_GL_RGB565)
- out_gl_type = GL_UNSIGNED_SHORT_5_6_5;
-
- internal_format =
- gst_gl_sized_gl_format_from_gl_format_type (context, out_gl_format,
- out_gl_type);
-
- tex_id =
- _new_texture (context, out_tex_target,
- internal_format, out_gl_format, out_gl_type, copy_params->out_width,
- copy_params->out_height);
- }
-
- if (!tex_id) {
- GST_WARNING ("Could not create GL texture with context:%p", context);
- }
-
- GST_LOG ("copying memory %p, tex %u into texture %i",
- src, src->mem.tex_id, tex_id);
-
- /* FIXME: try and avoid creating and destroying fbo's every copy... */
- /* create a framebuffer object */
- gl->GenFramebuffers (1, &fboId);
- gl->BindFramebuffer (GL_FRAMEBUFFER, fboId);
-
- gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- gst_gl_texture_target_to_gl (src->mem.tex_target), src->mem.tex_id, 0);
-
-// if (!gst_gl_context_check_framebuffer_status (src->mem.mem.context))
-// goto fbo_error;
-
- gl->BindTexture (out_tex_target, tex_id);
- if (copy_params->respecify) {
- GstMapInfo pbo_info;
-
- if (!gl->GenBuffers || !src->pbo) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot reinterpret texture contents "
- "without pixel buffer objects");
- gl->BindTexture (out_tex_target, 0);
- goto fbo_error;
- }
-
- if (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2
- && (in_gl_format != GL_RGBA || in_gl_type != GL_UNSIGNED_BYTE)) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot copy non RGBA/UNSIGNED_BYTE "
- "textures on GLES2");
- gl->BindTexture (out_tex_target, 0);
- goto fbo_error;
- }
-
- GST_TRACE ("copying texture data with size of %u*%u*%u",
- gst_gl_format_type_n_bytes (in_gl_format, in_gl_type),
- src->mem.tex_width, GL_MEM_HEIGHT (src));
-
- /* copy tex */
- _read_pixels_to_pbo (src);
-
- src->pbo->target = GL_PIXEL_UNPACK_BUFFER;
- if (!gst_memory_map (GST_MEMORY_CAST (src->pbo), &pbo_info,
- GST_MAP_READ | GST_MAP_GL)) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Failed to map pbo for reading");
- goto fbo_error;
- }
- gl->TexSubImage2D (out_tex_target, 0, 0, 0, out_width, out_height,
- out_gl_format, out_gl_type, 0);
- gst_memory_unmap (GST_MEMORY_CAST (src->pbo), &pbo_info);
- } else { /* different sizes */
- gst_gl_memory_copy_teximage (GST_GL_MEMORY_CAST (src),
- tex_id, copy_params->tex_target, copy_params->out_format, out_width,
- out_height);
- }
-
- gl->BindTexture (out_tex_target, 0);
- gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
-
- gl->DeleteFramebuffers (1, &fboId);
-
- copy_params->tex_id = tex_id;
- copy_params->result = TRUE;
-
- return;
-
-/* ERRORS */
-fbo_error:
- {
- gl->DeleteFramebuffers (1, &fboId);
-
- copy_params->tex_id = 0;
- copy_params->result = FALSE;
- return;
- }
-
-error:
- {
- copy_params->result = FALSE;
- return;
- }
-}
-
-static GstMemory *
-_gl_mem_copy (GstGLMemoryPBO * src, gssize offset, gssize size)
-{
- GstAllocationParams params = { 0, GST_MEMORY_CAST (src)->align, 0, 0 };
- GstGLBaseMemoryAllocator *base_mem_allocator;
- GstAllocator *allocator;
- GstMemory *dest = NULL;
-
- allocator = GST_MEMORY_CAST (src)->allocator;
- base_mem_allocator = (GstGLBaseMemoryAllocator *) allocator;
-
- if (src->mem.tex_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) {
- GST_CAT_ERROR (GST_CAT_GL_MEMORY, "Cannot copy External OES textures");
- return NULL;
- }
-
- /* If not doing a full copy, then copy to sysmem, the 2D represention of the
- * texture would become wrong */
- if (offset > 0 || size < GST_MEMORY_CAST (src)->size) {
- return base_mem_allocator->fallback_mem_copy (GST_MEMORY_CAST (src), offset,
- size);
- }
-
- dest = (GstMemory *) g_new0 (GstGLMemoryPBO, 1);
- gst_gl_memory_init (GST_GL_MEMORY_CAST (dest), allocator, NULL,
- src->mem.mem.context, src->mem.tex_target, src->mem.tex_format, &params,
- &src->mem.info, src->mem.plane, &src->mem.valign, NULL, NULL);
-
- if (!GST_MEMORY_FLAG_IS_SET (src, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD)) {
- GstMapInfo dinfo;
-
- if (!gst_memory_map (GST_MEMORY_CAST (dest), &dinfo,
- GST_MAP_WRITE | GST_MAP_GL)) {
- GST_CAT_WARNING (GST_CAT_GL_MEMORY,
- "Failed not map destination " "for writing");
- gst_memory_unref (GST_MEMORY_CAST (dest));
- return NULL;
- }
-
- if (!gst_gl_memory_copy_into ((GstGLMemory *) src,
- ((GstGLMemory *) dest)->tex_id, src->mem.tex_target,
- src->mem.tex_format, src->mem.tex_width, GL_MEM_HEIGHT (src))) {
- GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
- gst_memory_unmap (GST_MEMORY_CAST (dest), &dinfo);
- goto memcpy;
- }
-
- gst_memory_unmap (GST_MEMORY_CAST (dest), &dinfo);
- } else {
- memcpy:
- if (!gst_gl_base_memory_memcpy ((GstGLBaseMemory *) src,
- (GstGLBaseMemory *) dest, offset, size)) {
- GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
- gst_memory_unref (GST_MEMORY_CAST (dest));
- return NULL;
- }
- }
-
- return dest;
-}
-
-static GstMemory *
-_gl_mem_alloc (GstAllocator * allocator, gsize size,
- GstAllocationParams * params)
-{
- g_warning ("Use gst_gl_base_memory_alloc () to allocate from this "
- "GstGLMemoryPBO allocator");
-
- return NULL;
-}
-
-static void
-_gl_mem_destroy (GstGLMemoryPBO * gl_mem)
-{
- if (gl_mem->pbo)
- gst_memory_unref (GST_MEMORY_CAST (gl_mem->pbo));
- gl_mem->pbo = NULL;
-
- GST_GL_BASE_MEMORY_ALLOCATOR_CLASS (parent_class)->destroy ((GstGLBaseMemory
- *) gl_mem);
-}
-
-static GstGLMemoryPBO *
-_gl_mem_pbo_alloc (GstGLBaseMemoryAllocator * allocator,
- GstGLVideoAllocationParams * params)
-{
- GstGLMemoryPBO *mem;
- guint alloc_flags;
-
- alloc_flags = params->parent.alloc_flags;
-
- g_return_val_if_fail (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
- NULL);
-
- mem = g_new0 (GstGLMemoryPBO, 1);
-
- if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
- mem->mem.tex_id = GPOINTER_TO_UINT (params->parent.gl_handle);
- mem->mem.texture_wrapped = TRUE;
- }
-
- gst_gl_memory_init (GST_GL_MEMORY_CAST (mem), GST_ALLOCATOR_CAST (allocator),
- NULL, params->parent.context, params->target, params->tex_format,
- params->parent.alloc_params, params->v_info, params->plane,
- params->valign, params->parent.user_data, params->parent.notify);
-
- if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
- GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
- }
- if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) {
- GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);
- if (mem->pbo) {
- GST_MINI_OBJECT_FLAG_SET (mem->pbo,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);
- mem->pbo->mem.data = params->parent.wrapped_data;
- }
- mem->mem.mem.data = params->parent.wrapped_data;
- }
-
- return mem;
-}
-
-static void
-gst_gl_memory_pbo_allocator_class_init (GstGLMemoryPBOAllocatorClass * klass)
-{
- GstGLBaseMemoryAllocatorClass *gl_base;
- GstGLMemoryAllocatorClass *gl_tex;
- GstAllocatorClass *allocator_class;
-
- gl_tex = (GstGLMemoryAllocatorClass *) klass;
- gl_base = (GstGLBaseMemoryAllocatorClass *) klass;
- allocator_class = (GstAllocatorClass *) klass;
-
- gl_base->alloc = (GstGLBaseMemoryAllocatorAllocFunction) _gl_mem_pbo_alloc;
- gl_base->create = (GstGLBaseMemoryAllocatorCreateFunction) _gl_mem_create;
- gl_tex->map = (GstGLBaseMemoryAllocatorMapFunction) _gl_mem_map;
- gl_tex->unmap = (GstGLBaseMemoryAllocatorUnmapFunction) _gl_mem_unmap;
- gl_tex->copy = (GstGLBaseMemoryAllocatorCopyFunction) _gl_mem_copy;
- gl_base->destroy = (GstGLBaseMemoryAllocatorDestroyFunction) _gl_mem_destroy;
-
- allocator_class->alloc = _gl_mem_alloc;
-}
-
-static void
-gst_gl_memory_pbo_allocator_init (GstGLMemoryPBOAllocator * allocator)
-{
- GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
-
- alloc->mem_type = GST_GL_MEMORY_PBO_ALLOCATOR_NAME;
-
- GST_OBJECT_FLAG_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
-}
-
-/**
- * gst_gl_memory_pbo_copy_into_texture:
- * @gl_mem:a #GstGLMemoryPBO
- * @tex_id: the destination texture id
- * @target: the destination #GstGLTextureTarget
- * @tex_format: the destination #GstGLFormat
- * @width: width of @tex_id
- * @height: height of @tex_id
- * @stride: stride of the backing texture data
- * @respecify: whether to copy the data or copy per texel
- *
- * Copies @gl_mem into the texture specfified by @tex_id. The format of @tex_id
- * is specified by @tex_format, @width and @height.
- *
- * If @respecify is %TRUE, then the copy is performed in terms of the texture
- * data. This is useful for splitting RGBA textures into RG or R textures or
- * vice versa. The requirement for this to succeed is that the backing texture
- * data must be the same size, i.e. say a RGBA8 texture is converted into a RG8
- * texture, then the RG texture must have twice as many pixels available for
- * output as the RGBA texture.
- *
- * Otherwise, if @respecify is %FALSE, then the copy is performed per texel
- * using glCopyTexImage. See the OpenGL specification for details on the
- * mappings between texture formats.
- *
- * Returns: Whether the copy suceeded
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_memory_pbo_copy_into_texture (GstGLMemoryPBO * gl_mem, guint tex_id,
- GstGLTextureTarget target, GstGLFormat tex_format, gint width,
- gint height, gint stride, gboolean respecify)
-{
- GstGLMemoryPBOCopyParams copy_params;
-
- copy_params.src = gl_mem;
- copy_params.tex_target = target;
- copy_params.tex_id = tex_id;
- copy_params.out_format = tex_format;
- copy_params.out_width = width;
- copy_params.out_height = height;
- copy_params.out_stride = stride;
- copy_params.respecify = respecify;
-
- gst_gl_context_thread_add (gl_mem->mem.mem.context, _gl_mem_copy_thread,
- &copy_params);
-
- return copy_params.result;
-}
-
-static void
-_download_transfer (GstGLContext * context, GstGLMemoryPBO * gl_mem)
-{
- GstGLBaseMemory *mem = (GstGLBaseMemory *) gl_mem;
-
- g_mutex_lock (&mem->lock);
- if (_read_pixels_to_pbo (gl_mem)) {
- GST_CAT_TRACE (GST_CAT_GL_MEMORY, "optimistic download of texture %u "
- "using pbo %u", gl_mem->mem.tex_id, gl_mem->pbo->id);
- GST_MEMORY_FLAG_UNSET (gl_mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
- }
- g_mutex_unlock (&mem->lock);
-}
-
-/**
- * gst_gl_memory_pbo_download_transfer:
- * @gl_mem: a #GstGLMemoryPBO
- *
- * Transfer the texture data from the texture into the PBO if necessary.
- *
- * Since: 1.8
- */
-void
-gst_gl_memory_pbo_download_transfer (GstGLMemoryPBO * gl_mem)
-{
- g_return_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem));
-
- gst_gl_context_thread_add (gl_mem->mem.mem.context,
- (GstGLContextThreadFunc) _download_transfer, gl_mem);
-}
-
-static void
-_upload_transfer (GstGLContext * context, GstGLMemoryPBO * gl_mem)
-{
- GstGLBaseMemory *mem = (GstGLBaseMemory *) gl_mem;
- GstMapInfo info;
-
- g_mutex_lock (&mem->lock);
- gl_mem->pbo->target = GL_PIXEL_UNPACK_BUFFER;
- if (!gst_memory_map (GST_MEMORY_CAST (gl_mem->pbo), &info,
- GST_MAP_READ | GST_MAP_GL)) {
- GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Failed to map pbo for reading");
- } else {
- gst_memory_unmap (GST_MEMORY_CAST (gl_mem->pbo), &info);
- }
- g_mutex_unlock (&mem->lock);
-}
-
-/**
- * gst_gl_memory_pbo_upload_transfer:
- * @gl_mem: a #GstGLMemoryPBO
- *
- * Transfer the texture data from the PBO into the texture if necessary.
- *
- * Since: 1.8
- */
-void
-gst_gl_memory_pbo_upload_transfer (GstGLMemoryPBO * gl_mem)
-{
- g_return_if_fail (gst_is_gl_memory ((GstMemory *) gl_mem));
-
- if (gl_mem->pbo && CONTEXT_SUPPORTS_PBO_UPLOAD (gl_mem->mem.mem.context))
- gst_gl_context_thread_add (gl_mem->mem.mem.context,
- (GstGLContextThreadFunc) _upload_transfer, gl_mem);
-}
-
-/**
- * gst_gl_memory_pbo_init:
- *
- * Initializes the GL Memory allocator. It is safe to call this function
- * multiple times. This must be called before any other GstGLMemoryPBO operation.
- */
-void
-gst_gl_memory_pbo_init_once (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- gst_gl_memory_init_once ();
-
- GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_MEMORY, "glmemory", 0, "OpenGL Memory");
-
- _gl_allocator = g_object_new (GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, NULL);
- gst_object_ref_sink (_gl_allocator);
- /* The allocator is never unreffed */
- GST_OBJECT_FLAG_SET (_gl_allocator, GST_OBJECT_FLAG_MAY_BE_LEAKED);
-
- gst_allocator_register (GST_GL_MEMORY_PBO_ALLOCATOR_NAME,
- gst_object_ref (_gl_allocator));
- g_once_init_leave (&_init, 1);
- }
-}
-
-/**
- * gst_is_gl_memory_pbo:
- * @mem:a #GstMemory
- *
- * Returns: whether the memory at @mem is a #GstGLMemoryPBO
- *
- * Since: 1.8
- */
-gboolean
-gst_is_gl_memory_pbo (GstMemory * mem)
-{
- return mem != NULL && mem->allocator != NULL
- && g_type_is_a (G_OBJECT_TYPE (mem->allocator),
- GST_TYPE_GL_MEMORY_PBO_ALLOCATOR);
-}
diff --git a/gst-libs/gst/gl/gstglmemorypbo.h b/gst-libs/gst/gl/gstglmemorypbo.h
deleted file mode 100644
index c57bf1734..000000000
--- a/gst-libs/gst/gl/gstglmemorypbo.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
- * 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_MEMORY_PBO_H_
-#define _GST_GL_MEMORY_PBO_H_
-
-#include <gst/gl/gstglmemory.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_MEMORY_PBO_ALLOCATOR (gst_gl_memory_pbo_allocator_get_type())
-GST_EXPORT
-GType gst_gl_memory_pbo_allocator_get_type(void);
-
-#define GST_IS_GL_MEMORY_PBO_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR))
-#define GST_IS_GL_MEMORY_PBO_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR))
-#define GST_GL_MEMORY_PBO_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, GstGLMemoryPBOAllocatorClass))
-#define GST_GL_MEMORY_PBO_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, GstGLMemoryPBOAllocator))
-#define GST_GL_MEMORY_PBO_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_MEMORY_PBO_ALLOCATOR, GstGLAllocatorClass))
-#define GST_GL_MEMORY_PBO_ALLOCATOR_CAST(obj) ((GstGLMemoryPBOAllocator *)(obj))
-
-/**
- * GstGLMemoryPBO:
- *
- * Private instance
- */
-struct _GstGLMemoryPBO
-{
- /* <private> */
- GstGLMemory mem;
-
- GstGLBuffer *pbo;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GST_GL_MEMORY_PBO_ALLOCATOR_NAME:
- *
- * The name of the GL Memory PBO allocator
- */
-#define GST_GL_MEMORY_PBO_ALLOCATOR_NAME "GLMemoryPBO"
-
-GST_EXPORT
-void gst_gl_memory_pbo_init_once (void);
-GST_EXPORT
-gboolean gst_is_gl_memory_pbo (GstMemory * mem);
-
-GST_EXPORT
-void gst_gl_memory_pbo_download_transfer (GstGLMemoryPBO * gl_mem);
-GST_EXPORT
-void gst_gl_memory_pbo_upload_transfer (GstGLMemoryPBO * gl_mem);
-
-GST_EXPORT
-gboolean gst_gl_memory_pbo_copy_into_texture (GstGLMemoryPBO *gl_mem,
- guint tex_id,
- GstGLTextureTarget target,
- GstGLFormat tex_format,
- gint width,
- gint height,
- gint stride,
- gboolean respecify);
-
-/**
- * GstGLAllocator
- *
- * Opaque #GstGLAllocator struct
- */
-struct _GstGLMemoryPBOAllocator
-{
- GstGLMemoryAllocator parent;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLAllocatorClass:
- *
- * The #GstGLAllocatorClass only contains private data
- */
-struct _GstGLMemoryPBOAllocatorClass
-{
- GstGLMemoryAllocatorClass parent_class;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-G_END_DECLS
-
-#endif /* _GST_GL_MEMORY_PBO_H_ */
diff --git a/gst-libs/gst/gl/gstgloverlaycompositor.c b/gst-libs/gst/gl/gstgloverlaycompositor.c
deleted file mode 100644
index 05575aa8b..000000000
--- a/gst-libs/gst/gl/gstgloverlaycompositor.c
+++ /dev/null
@@ -1,649 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 Lubosz Sarnecki <lubosz.sarnecki@collabora.co.uk>
- *
- * 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.
- */
-
-/**
- * SECTION:gstgloverlaycompositor
- * @title: GstGLOverlayCompositor
- * @short_description: Composite multiple overlays using OpenGL
- * @see_also: #GstGLMemory, #GstGLContext
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include "gstgloverlaycompositor.h"
-
-#include "gstglcontext.h"
-#include "gstglfuncs.h"
-#include "gstglmemory.h"
-#include "gstglshader.h"
-#include "gstglslstage.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_overlay_compositor_debug);
-#define GST_CAT_DEFAULT gst_gl_overlay_compositor_debug
-
-/*****************************************************************************
- * GstGLCompositionOverlay object is internally used by GstGLOverlayCompositor
- *****************************************************************************/
-
-#define GST_TYPE_GL_COMPOSITION_OVERLAY (gst_gl_composition_overlay_get_type())
-#define GST_GL_COMPOSITION_OVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_COMPOSITION_OVERLAY,\
- GstGLCompositionOverlay))
-
-typedef struct _GstGLCompositionOverlay GstGLCompositionOverlay;
-typedef struct _GstGLCompositionOverlayClass GstGLCompositionOverlayClass;
-
-static GType gst_gl_composition_overlay_get_type (void);
-
-/* *INDENT-OFF* */
-const gchar *fragment_shader =
- "#ifdef GL_ES\n"
- "precision mediump float;\n"
- "#endif\n"
- "varying vec2 v_texcoord;\n"
- "uniform sampler2D tex;\n"
- "void main(void)\n"
- "{\n"
- " vec4 t = texture2D(tex, v_texcoord);\n"
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- " gl_FragColor = t.bgra;\n"
-#else
- " gl_FragColor = t.gbar;\n"
-#endif
- "}";
-/* *INDENT-ON* */
-
-struct _GstGLCompositionOverlay
-{
- GstObject parent;
- GstGLContext *context;
-
- GLuint vao;
- GLuint index_buffer;
- GLuint position_buffer;
- GLuint texcoord_buffer;
- GLint position_attrib;
- GLint texcoord_attrib;
-
- GLfloat positions[16];
-
- GLuint texture_id;
- GstGLMemory *gl_memory;
- GstVideoOverlayRectangle *rectangle;
-};
-
-struct _GstGLCompositionOverlayClass
-{
- GstObjectClass object_class;
-};
-
-G_DEFINE_TYPE (GstGLCompositionOverlay, gst_gl_composition_overlay,
- GST_TYPE_OBJECT);
-
-static void
-gst_gl_composition_overlay_init_vertex_buffer (GstGLContext * context,
- gpointer overlay_pointer)
-{
- const GstGLFuncs *gl = context->gl_vtable;
- GstGLCompositionOverlay *overlay =
- (GstGLCompositionOverlay *) overlay_pointer;
-
- /* *INDENT-OFF* */
- static const GLfloat texcoords[] = {
- 1.0f, 0.0f,
- 0.0f, 0.0f,
- 0.0f, 1.0f,
- 1.0f, 1.0f
- };
-
- static const GLushort indices[] = {
- 0, 1, 2, 0, 2, 3
- };
- /* *INDENT-ON* */
-
- if (gl->GenVertexArrays) {
- gl->GenVertexArrays (1, &overlay->vao);
- gl->BindVertexArray (overlay->vao);
- }
-
- gl->GenBuffers (1, &overlay->position_buffer);
- gl->BindBuffer (GL_ARRAY_BUFFER, overlay->position_buffer);
- gl->BufferData (GL_ARRAY_BUFFER, 4 * 4 * sizeof (GLfloat), overlay->positions,
- GL_STATIC_DRAW);
-
- /* Load the vertex position */
- gl->VertexAttribPointer (overlay->position_attrib, 4, GL_FLOAT, GL_FALSE,
- 4 * sizeof (GLfloat), NULL);
-
- gl->GenBuffers (1, &overlay->texcoord_buffer);
- gl->BindBuffer (GL_ARRAY_BUFFER, overlay->texcoord_buffer);
- gl->BufferData (GL_ARRAY_BUFFER, 4 * 2 * sizeof (GLfloat), texcoords,
- GL_STATIC_DRAW);
-
- /* Load the texture coordinate */
- gl->VertexAttribPointer (overlay->texcoord_attrib, 2, GL_FLOAT, GL_FALSE,
- 2 * sizeof (GLfloat), NULL);
-
- gl->GenBuffers (1, &overlay->index_buffer);
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, overlay->index_buffer);
- gl->BufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof (indices), indices,
- GL_STATIC_DRAW);
-
- gl->EnableVertexAttribArray (overlay->position_attrib);
- gl->EnableVertexAttribArray (overlay->texcoord_attrib);
-
- if (gl->GenVertexArrays) {
- gl->BindVertexArray (0);
- }
-
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
- gl->BindBuffer (GL_ARRAY_BUFFER, 0);
-}
-
-static void
-gst_gl_composition_overlay_free_vertex_buffer (GstGLContext * context,
- gpointer overlay_pointer)
-{
- const GstGLFuncs *gl = context->gl_vtable;
- GstGLCompositionOverlay *overlay =
- (GstGLCompositionOverlay *) overlay_pointer;
- if (overlay->vao) {
- gl->DeleteVertexArrays (1, &overlay->vao);
- overlay->vao = 0;
- }
-
- if (overlay->position_buffer) {
- gl->DeleteBuffers (1, &overlay->position_buffer);
- overlay->position_buffer = 0;
- }
-
- if (overlay->texcoord_buffer) {
- gl->DeleteBuffers (1, &overlay->position_buffer);
- overlay->position_buffer = 0;
- }
-
- if (overlay->index_buffer) {
- gl->DeleteBuffers (1, &overlay->index_buffer);
- overlay->index_buffer = 0;
- }
-}
-
-static void
-gst_gl_composition_overlay_bind_vertex_buffer (GstGLCompositionOverlay *
- overlay)
-{
- const GstGLFuncs *gl = overlay->context->gl_vtable;
- gl->BindBuffer (GL_ARRAY_BUFFER, overlay->position_buffer);
- gl->VertexAttribPointer (overlay->position_attrib, 4, GL_FLOAT, GL_FALSE,
- 4 * sizeof (GLfloat), NULL);
-
- gl->BindBuffer (GL_ARRAY_BUFFER, overlay->texcoord_buffer);
- gl->VertexAttribPointer (overlay->texcoord_attrib, 2, GL_FLOAT, GL_FALSE,
- 2 * sizeof (GLfloat), NULL);
-
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, overlay->index_buffer);
-
- gl->EnableVertexAttribArray (overlay->position_attrib);
- gl->EnableVertexAttribArray (overlay->texcoord_attrib);
-}
-
-static void
-gst_gl_composition_overlay_finalize (GObject * object)
-{
- GstGLCompositionOverlay *overlay;
-
- overlay = GST_GL_COMPOSITION_OVERLAY (object);
-
- if (overlay->gl_memory)
- gst_memory_unref ((GstMemory *) overlay->gl_memory);
-
- if (overlay->context) {
- gst_gl_context_thread_add (overlay->context,
- gst_gl_composition_overlay_free_vertex_buffer, overlay);
- gst_object_unref (overlay->context);
- }
-
- G_OBJECT_CLASS (gst_gl_composition_overlay_parent_class)->finalize (object);
-}
-
-
-static void
-gst_gl_composition_overlay_class_init (GstGLCompositionOverlayClass * klass)
-{
- G_OBJECT_CLASS (klass)->finalize = gst_gl_composition_overlay_finalize;
-}
-
-static void
-gst_gl_composition_overlay_init (GstGLCompositionOverlay * overlay)
-{
-}
-
-static void
-gst_gl_composition_overlay_add_transformation (GstGLCompositionOverlay *
- overlay, GstBuffer * video_buffer)
-{
- gint comp_x, comp_y;
- guint comp_width, comp_height;
- GstVideoMeta *meta;
- guint width, height;
-
- float rel_x, rel_y, rel_w, rel_h;
-
- meta = gst_buffer_get_video_meta (video_buffer);
-
- gst_video_overlay_rectangle_get_render_rectangle (overlay->rectangle,
- &comp_x, &comp_y, &comp_width, &comp_height);
-
- width = meta->width;
- height = meta->height;
-
- /* calculate relative position */
- rel_x = (float) comp_x / (float) width;
- rel_y = (float) comp_y / (float) height;
-
- rel_w = (float) comp_width / (float) width;
- rel_h = (float) comp_height / (float) height;
-
- /* transform from [0,1] to [-1,1], invert y axis */
- rel_x = rel_x * 2.0 - 1.0;
- rel_y = (1.0 - rel_y) * 2.0 - 1.0;
- rel_w = rel_w * 2.0;
- rel_h = rel_h * 2.0;
-
- /* initialize position array */
- overlay->positions[0] = rel_x + rel_w;
- overlay->positions[1] = rel_y;
- overlay->positions[2] = 0.0;
- overlay->positions[3] = 1.0;
- overlay->positions[4] = rel_x;
- overlay->positions[5] = rel_y;
- overlay->positions[6] = 0.0;
- overlay->positions[7] = 1.0;
- overlay->positions[8] = rel_x;
- overlay->positions[9] = rel_y - rel_h;
- overlay->positions[10] = 0.0;
- overlay->positions[11] = 1.0;
- overlay->positions[12] = rel_x + rel_w;
- overlay->positions[13] = rel_y - rel_h;
- overlay->positions[14] = 0.0;
- overlay->positions[15] = 1.0;
-
- gst_gl_context_thread_add (overlay->context,
- gst_gl_composition_overlay_free_vertex_buffer, overlay);
-
- gst_gl_context_thread_add (overlay->context,
- gst_gl_composition_overlay_init_vertex_buffer, overlay);
-
- GST_DEBUG
- ("overlay position: (%d,%d) size: %dx%d video size: %dx%d",
- comp_x, comp_y, comp_width, comp_height, meta->width, meta->height);
-}
-
-/* helper object API functions */
-
-static GstGLCompositionOverlay *
-gst_gl_composition_overlay_new (GstGLContext * context,
- GstVideoOverlayRectangle * rectangle,
- GLint position_attrib, GLint texcoord_attrib)
-{
- GstGLCompositionOverlay *overlay =
- g_object_new (GST_TYPE_GL_COMPOSITION_OVERLAY, NULL);
-
- overlay->gl_memory = NULL;
- overlay->texture_id = -1;
- overlay->rectangle = rectangle;
- overlay->context = gst_object_ref (context);
- overlay->vao = 0;
- overlay->position_attrib = position_attrib;
- overlay->texcoord_attrib = texcoord_attrib;
-
- GST_DEBUG_OBJECT (overlay, "Created new GstGLCompositionOverlay");
-
- return overlay;
-}
-
-static void
-_video_frame_unmap_and_free (gpointer user_data)
-{
- GstVideoFrame *frame = user_data;
-
- gst_video_frame_unmap (frame);
- g_slice_free (GstVideoFrame, frame);
-}
-
-static void
-gst_gl_composition_overlay_upload (GstGLCompositionOverlay * overlay,
- GstBuffer * buf)
-{
- GstGLMemory *comp_gl_memory = NULL;
- GstBuffer *comp_buffer = NULL;
- GstBuffer *overlay_buffer = NULL;
- GstVideoInfo vinfo;
- GstVideoMeta *vmeta;
- GstVideoFrame *comp_frame;
- GstVideoFrame gl_frame;
-
- comp_buffer =
- gst_video_overlay_rectangle_get_pixels_unscaled_argb (overlay->rectangle,
- GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA);
-
- comp_frame = g_slice_new (GstVideoFrame);
-
- vmeta = gst_buffer_get_video_meta (comp_buffer);
- gst_video_info_set_format (&vinfo, vmeta->format, vmeta->width,
- vmeta->height);
- vinfo.stride[0] = vmeta->stride[0];
-
- if (gst_video_frame_map (comp_frame, &vinfo, comp_buffer, GST_MAP_READ)) {
- GstGLVideoAllocationParams *params;
- GstGLBaseMemoryAllocator *mem_allocator;
- GstAllocator *allocator;
-
- allocator =
- GST_ALLOCATOR (gst_gl_memory_allocator_get_default (overlay->context));
- mem_allocator = GST_GL_BASE_MEMORY_ALLOCATOR (allocator);
-
- gst_gl_composition_overlay_add_transformation (overlay, buf);
-
- params = gst_gl_video_allocation_params_new_wrapped_data (overlay->context,
- NULL, &comp_frame->info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
- GST_GL_RGBA, comp_frame->data[0], comp_frame,
- _video_frame_unmap_and_free);
-
- comp_gl_memory =
- (GstGLMemory *) gst_gl_base_memory_alloc (mem_allocator,
- (GstGLAllocationParams *) params);
-
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- gst_object_unref (allocator);
-
- overlay_buffer = gst_buffer_new ();
- gst_buffer_append_memory (overlay_buffer, (GstMemory *) comp_gl_memory);
-
- if (!gst_video_frame_map (&gl_frame, &comp_frame->info, overlay_buffer,
- GST_MAP_READ | GST_MAP_GL)) {
- gst_buffer_unref (overlay_buffer);
- _video_frame_unmap_and_free (comp_frame);
- GST_WARNING_OBJECT (overlay, "Cannot upload overlay texture");
- return;
- }
-
- gst_memory_ref ((GstMemory *) comp_gl_memory);
- overlay->gl_memory = comp_gl_memory;
- overlay->texture_id = comp_gl_memory->tex_id;
-
- gst_buffer_unref (overlay_buffer);
- gst_video_frame_unmap (&gl_frame);
-
- GST_DEBUG ("uploaded overlay texture %d", overlay->texture_id);
- } else {
- g_slice_free (GstVideoFrame, comp_frame);
- }
-}
-
-static void
-gst_gl_composition_overlay_draw (GstGLCompositionOverlay * overlay,
- GstGLShader * shader)
-{
- const GstGLFuncs *gl = overlay->context->gl_vtable;
- if (gl->GenVertexArrays)
- gl->BindVertexArray (overlay->vao);
- else
- gst_gl_composition_overlay_bind_vertex_buffer (overlay);
-
- if (overlay->texture_id != -1)
- gl->BindTexture (GL_TEXTURE_2D, overlay->texture_id);
- gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
-}
-
-
-/********************************************************************
- * GstGLOverlayCompositor object, the public helper object to render
- * GstVideoCompositionOverlayMeta
- ********************************************************************/
-
-#define DEBUG_INIT \
- GST_DEBUG_CATEGORY_INIT (gst_gl_overlay_compositor_debug, \
- "gloverlaycompositor", 0, "overlaycompositor");
-
-G_DEFINE_TYPE_WITH_CODE (GstGLOverlayCompositor, gst_gl_overlay_compositor,
- GST_TYPE_OBJECT, DEBUG_INIT);
-
-static void gst_gl_overlay_compositor_finalize (GObject * object);
-static gboolean _is_rectangle_in_overlays (GList * overlays,
- GstVideoOverlayRectangle * rectangle);
-static gboolean _is_overlay_in_rectangles (GstVideoOverlayComposition *
- composition, GstGLCompositionOverlay * overlay);
-
-static void
-gst_gl_overlay_compositor_class_init (GstGLOverlayCompositorClass * klass)
-{
- G_OBJECT_CLASS (klass)->finalize = gst_gl_overlay_compositor_finalize;
-}
-
-static void
-gst_gl_overlay_compositor_init (GstGLOverlayCompositor * compositor)
-{
-}
-
-static void
-gst_gl_overlay_compositor_init_gl (GstGLContext * context,
- gpointer compositor_pointer)
-{
- GstGLOverlayCompositor *compositor =
- (GstGLOverlayCompositor *) compositor_pointer;
- GError *error = NULL;
-
- if (!(compositor->shader =
- gst_gl_shader_new_link_with_stages (context, &error,
- gst_glsl_stage_new_default_vertex (context),
- gst_glsl_stage_new_with_string (context, GL_FRAGMENT_SHADER,
- GST_GLSL_VERSION_NONE,
- GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY,
- fragment_shader), NULL))) {
- GST_ERROR_OBJECT (compositor, "could not initialize shader: %s",
- error->message);
- return;
- }
-
- compositor->position_attrib =
- gst_gl_shader_get_attribute_location (compositor->shader, "a_position");
- compositor->texcoord_attrib =
- gst_gl_shader_get_attribute_location (compositor->shader, "a_texcoord");
-}
-
-GstGLOverlayCompositor *
-gst_gl_overlay_compositor_new (GstGLContext * context)
-{
- GstGLOverlayCompositor *compositor =
- g_object_new (GST_TYPE_GL_OVERLAY_COMPOSITOR, NULL);
-
- gst_object_ref_sink (compositor);
-
- compositor->context = gst_object_ref (context);
-
- gst_gl_context_thread_add (compositor->context,
- gst_gl_overlay_compositor_init_gl, compositor);
-
- GST_DEBUG_OBJECT (compositor, "Created new GstGLOverlayCompositor");
-
- return compositor;
-}
-
-static void
-gst_gl_overlay_compositor_finalize (GObject * object)
-{
- GstGLOverlayCompositor *compositor;
-
- compositor = GST_GL_OVERLAY_COMPOSITOR (object);
-
- gst_gl_overlay_compositor_free_overlays (compositor);
-
- if (compositor->context)
- gst_object_unref (compositor->context);
-
- if (compositor->shader) {
- gst_object_unref (compositor->shader);
- compositor->shader = NULL;
- }
-
- G_OBJECT_CLASS (gst_gl_overlay_compositor_parent_class)->finalize (object);
-}
-
-static gboolean
-_is_rectangle_in_overlays (GList * overlays,
- GstVideoOverlayRectangle * rectangle)
-{
- GList *l;
-
- for (l = overlays; l != NULL; l = l->next) {
- GstGLCompositionOverlay *overlay = (GstGLCompositionOverlay *) l->data;
- if (overlay->rectangle == rectangle)
- return TRUE;
- }
- return FALSE;
-}
-
-static gboolean
-_is_overlay_in_rectangles (GstVideoOverlayComposition * composition,
- GstGLCompositionOverlay * overlay)
-{
- guint i;
-
- for (i = 0; i < gst_video_overlay_composition_n_rectangles (composition); i++) {
- GstVideoOverlayRectangle *rectangle =
- gst_video_overlay_composition_get_rectangle (composition, i);
- if (overlay->rectangle == rectangle)
- return TRUE;
- }
- return FALSE;
-}
-
-
-void
-gst_gl_overlay_compositor_free_overlays (GstGLOverlayCompositor * compositor)
-{
- GList *l = compositor->overlays;
- while (l != NULL) {
- GList *next = l->next;
- GstGLCompositionOverlay *overlay = (GstGLCompositionOverlay *) l->data;
- compositor->overlays = g_list_delete_link (compositor->overlays, l);
- gst_object_unref (overlay);
- l = next;
- }
- g_list_free (compositor->overlays);
- compositor->overlays = NULL;
-}
-
-void
-gst_gl_overlay_compositor_upload_overlays (GstGLOverlayCompositor * compositor,
- GstBuffer * buf)
-{
- GstVideoOverlayCompositionMeta *composition_meta;
-
- composition_meta = gst_buffer_get_video_overlay_composition_meta (buf);
- if (composition_meta) {
- GstVideoOverlayComposition *composition = NULL;
- guint num_overlays, i;
- GList *l = compositor->overlays;
-
- GST_DEBUG ("GstVideoOverlayCompositionMeta found.");
-
- composition = composition_meta->overlay;
- num_overlays = gst_video_overlay_composition_n_rectangles (composition);
-
- /* add new overlays to list */
- for (i = 0; i < num_overlays; i++) {
- GstVideoOverlayRectangle *rectangle =
- gst_video_overlay_composition_get_rectangle (composition, i);
-
- if (!_is_rectangle_in_overlays (compositor->overlays, rectangle)) {
- GstGLCompositionOverlay *overlay =
- gst_gl_composition_overlay_new (compositor->context, rectangle,
- compositor->position_attrib, compositor->texcoord_attrib);
- gst_object_ref_sink (overlay);
-
- gst_gl_composition_overlay_upload (overlay, buf);
-
- compositor->overlays = g_list_append (compositor->overlays, overlay);
- }
- }
-
- /* remove old overlays from list */
- while (l != NULL) {
- GList *next = l->next;
- GstGLCompositionOverlay *overlay = (GstGLCompositionOverlay *) l->data;
- if (!_is_overlay_in_rectangles (composition, overlay)) {
- compositor->overlays = g_list_delete_link (compositor->overlays, l);
- gst_object_unref (overlay);
- }
- l = next;
- }
- } else {
- gst_gl_overlay_compositor_free_overlays (compositor);
- }
-}
-
-void
-gst_gl_overlay_compositor_draw_overlays (GstGLOverlayCompositor * compositor)
-{
- const GstGLFuncs *gl = compositor->context->gl_vtable;
- if (compositor->overlays != NULL) {
- GList *l;
-
- gl->Enable (GL_BLEND);
- gl->BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- gst_gl_shader_use (compositor->shader);
- gl->ActiveTexture (GL_TEXTURE0);
- gst_gl_shader_set_uniform_1i (compositor->shader, "tex", 0);
-
- for (l = compositor->overlays; l != NULL; l = l->next) {
- GstGLCompositionOverlay *overlay = (GstGLCompositionOverlay *) l->data;
- gst_gl_composition_overlay_draw (overlay, compositor->shader);
- }
-
- gl->BindTexture (GL_TEXTURE_2D, 0);
- gl->Disable (GL_BLEND);
- }
-}
-
-GstCaps *
-gst_gl_overlay_compositor_add_caps (GstCaps * caps)
-{
- GstCaps *composition_caps;
- int i;
-
- composition_caps = gst_caps_copy (caps);
-
- for (i = 0; i < gst_caps_get_size (composition_caps); i++) {
- GstCapsFeatures *f = gst_caps_get_features (composition_caps, i);
- gst_caps_features_add (f,
- GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
- }
-
- caps = gst_caps_merge (composition_caps, caps);
-
- return caps;
-}
diff --git a/gst-libs/gst/gl/gstgloverlaycompositor.h b/gst-libs/gst/gl/gstgloverlaycompositor.h
deleted file mode 100644
index 3bc24620d..000000000
--- a/gst-libs/gst/gl/gstgloverlaycompositor.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 Lubosz Sarnecki <lubosz.sarnecki@collabora.co.uk>
- *
- * 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_OVERLAY_COMPOSITOR_H__
-#define __GST_GL_OVERLAY_COMPOSITOR_H__
-
-#include <gst/video/video.h>
-#include <gst/gl/gstgl_fwd.h>
-
-#define GST_TYPE_GL_OVERLAY_COMPOSITOR (gst_gl_overlay_compositor_get_type())
-#define GST_GL_OVERLAY_COMPOSITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_OVERLAY_COMPOSITOR,GstGLOverlayCompositor))
-#define GST_GL_OVERLAY_COMPOSITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_OVERLAY_COMPOSITOR,GstGLOverlayCompositorClass))
-#define GST_IS_GL_OVERLAY_COMPOSITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_OVERLAY_COMPOSITOR))
-#define GST_IS_GL_OVERLAY_COMPOSITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_OVERLAY_COMPOSITOR))
-#define GST_GL_OVERLAY_COMPOSITOR_CAST(obj) ((GstGLOverlayCompositor*)(obj))
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_overlay_compositor_get_type (void);
-
-/**
- * GstGLOverlayCompositor
- *
- * Opaque #GstGLOverlayCompositor object
- */
-struct _GstGLOverlayCompositor
-{
- GstObject parent;
-
- GstGLContext *context;
-
- /* <private> */
- guint last_window_width;
- guint last_window_height;
-
- GList * overlays;
-
- GstGLShader *shader;
- gint position_attrib;
- gint texcoord_attrib;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLOverlayCompositorClass:
- *
- */
-struct _GstGLOverlayCompositorClass
-{
- GstObjectClass object_class;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstGLOverlayCompositor *gst_gl_overlay_compositor_new (GstGLContext * context);
-
-GST_EXPORT
-void gst_gl_overlay_compositor_free_overlays (GstGLOverlayCompositor * compositor);
-
-GST_EXPORT
-void gst_gl_overlay_compositor_upload_overlays (GstGLOverlayCompositor * compositor,
- GstBuffer * buf);
-
-GST_EXPORT
-void gst_gl_overlay_compositor_draw_overlays (GstGLOverlayCompositor * compositor);
-
-GST_EXPORT
-GstCaps * gst_gl_overlay_compositor_add_caps(GstCaps * caps);
-
-G_END_DECLS
-#endif /* __GST_GL_OVERLAY_COMPOSITOR_H__ */
diff --git a/gst-libs/gst/gl/gstglpixelformat.c b/gst-libs/gst/gl/gstglpixelformat.c
deleted file mode 100644
index 0a35887ea..000000000
--- a/gst-libs/gst/gl/gstglpixelformat.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
diff --git a/gst-libs/gst/gl/gstglquery.c b/gst-libs/gst/gl/gstglquery.c
deleted file mode 100644
index 3023959ae..000000000
--- a/gst-libs/gst/gl/gstglquery.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2016 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.
- */
-
-/**
- * SECTION:gstglquery
- * @short_description: OpenGL query abstraction
- * @title: GstGLQuery
- * @see_also:
- *
- * A #GstGLQuery represents and holds an OpenGL query object. Various types of
- * queries can be run or counters retrieved.
- *
- * Since: 1.10
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstglquery.h"
-
-#include "gstglcontext.h"
-#include "gstglfuncs.h"
-
-#ifndef GL_TIME_ELAPSED
-#define GL_TIME_ELAPSED 0x88BF
-#endif
-
-#ifndef GL_TIMESTAMP
-#define GL_TIMESTAMP 0x8E28
-#endif
-
-#ifndef GL_QUERY_RESULT
-#define GL_QUERY_RESULT 0x8866
-#endif
-
-#define GST_CAT_DEFAULT gst_gl_query_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-static void
-_init_debug (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glquery", 0, "glquery element");
- g_once_init_leave (&_init, 1);
- }
-}
-
-static const gchar *
-_query_type_to_string (guint query_type)
-{
- switch (query_type) {
- case GST_GL_QUERY_TIME_ELAPSED:
- case GL_TIME_ELAPSED:
- return "time elapsed";
- case GL_TIMESTAMP:
- case GST_GL_QUERY_TIMESTAMP:
- return "timestamp";
- default:
- return "unknown";
- }
-}
-
-static guint
-_gst_gl_query_type_to_gl (GstGLQueryType query_type)
-{
- if (query_type == GST_GL_QUERY_TIME_ELAPSED)
- return GL_TIME_ELAPSED;
- if (query_type == GST_GL_QUERY_TIMESTAMP)
- return GL_TIMESTAMP;
-
- return 0;
-}
-
-static gboolean
-_query_type_supports_counter (guint gl_query_type)
-{
- return gl_query_type == GL_TIMESTAMP;
-}
-
-static gboolean
-_query_type_supports_begin_end (guint gl_query_type)
-{
- return gl_query_type == GL_TIME_ELAPSED;
-}
-
-static gboolean
-_context_supports_query_type (GstGLContext * context, guint gl_query_type)
-{
- return gl_query_type != 0 && context->gl_vtable->GenQueries != NULL;
-}
-
-static gchar *
-_log_time (gpointer user_data)
-{
- GstGLQuery *query = user_data;
- gint64 result;
-
- result = gst_gl_query_result (query);
-
- return gst_info_strdup_printf ("%" GST_TIME_FORMAT, GST_TIME_ARGS (result));
-}
-
-/**
- * gst_gl_query_init:
- * @query: a #GstGLQuery
- * @context: a #GstGLContext
- * @query_type: the #GstGLQueryType
- *
- * Since: 1.10
- */
-void
-gst_gl_query_init (GstGLQuery * query, GstGLContext * context,
- GstGLQueryType query_type)
-{
- const GstGLFuncs *gl;
- GLenum gl_query_type;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (GST_IS_GL_CONTEXT (context));
- gl = context->gl_vtable;
- gl_query_type = _gst_gl_query_type_to_gl (query_type);
- g_return_if_fail (gl_query_type != GL_NONE);
-
- memset (query, 0, sizeof (*query));
-
- _init_debug ();
-
- query->query_type = gl_query_type;
- query->context = gst_object_ref (context);
- query->supported = _context_supports_query_type (context, query->query_type);
-
- if (query->supported)
- gl->GenQueries (1, &query->query_id);
-
- gst_gl_async_debug_init (&query->debug);
- query->debug.callback = _log_time;
- query->debug.user_data = query;
-}
-
-/**
- * gst_gl_query_unset:
- * @query: a #GstGLQuery
- *
- * Free any dynamically allocated resources
- *
- * Since: 1.10
- */
-void
-gst_gl_query_unset (GstGLQuery * query)
-{
- const GstGLFuncs *gl;
-
- g_return_if_fail (query != NULL);
- if (query->start_called)
- g_critical ("Unsetting a running query. This may not be what you wanted."
- "Be sure to pair calls to gst_gl_query_start() and gst_gl_query_end()");
-
- GST_TRACE ("%p unsetting query %u", query, query->query_id);
-
- gl = query->context->gl_vtable;
-
- /* unset the debug object as it may callback to print the last message */
- gst_gl_async_debug_unset (&query->debug);
-
- if (query->query_id)
- gl->DeleteQueries (1, &query->query_id);
-
- gst_object_unref (query->context);
-}
-
-/**
- * gst_gl_query_new: (skip)
- * @context: a #GstGLContext
- * @query_type: the #GstGLQueryType to create
- *
- * Free with gst_gl_query_free()
- *
- * Returns: a new #GstGLQuery
- *
- * Since: 1.10
- */
-GstGLQuery *
-gst_gl_query_new (GstGLContext * context, GstGLQueryType query_type)
-{
- GstGLQuery *query = g_new0 (GstGLQuery, 1);
-
- gst_gl_query_init (query, context, query_type);
-
- return query;
-}
-
-/**
- * gst_gl_query_free:
- * @query: a #GstGLQuery
- *
- * Frees a #GstGLQuery
- *
- * Since: 1.10
- */
-void
-gst_gl_query_free (GstGLQuery * query)
-{
- g_return_if_fail (query != NULL);
-
- gst_gl_query_unset (query);
- g_free (query);
-}
-
-/**
- * gst_gl_query_start:
- * @query: a #GstGLQuery
- *
- * Start counting the query
- *
- * Since: 1.10
- */
-void
-gst_gl_query_start (GstGLQuery * query)
-{
- const GstGLFuncs *gl;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (_query_type_supports_begin_end (query->query_type));
- g_return_if_fail (query->start_called == FALSE);
-
- query->start_called = TRUE;
-
- if (!query->supported)
- return;
-
- gst_gl_async_debug_output_log_msg (&query->debug);
-
- GST_TRACE ("%p start query type \'%s\' id %u", query,
- _query_type_to_string (query->query_type), query->query_id);
-
- gl = query->context->gl_vtable;
- gl->BeginQuery (query->query_type, query->query_id);
-}
-
-/**
- * gst_gl_query_end:
- * @query: a #GstGLQuery
- *
- * End counting the query
- *
- * Since: 1.10
- */
-void
-gst_gl_query_end (GstGLQuery * query)
-{
- const GstGLFuncs *gl;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (_query_type_supports_begin_end (query->query_type));
- g_return_if_fail (query->start_called);
-
- query->start_called = FALSE;
-
- if (!query->supported)
- return;
-
- GST_TRACE ("%p end query type \'%s\' id %u", query,
- _query_type_to_string (query->query_type), query->query_id);
-
- gl = query->context->gl_vtable;
-
- gl->EndQuery (query->query_type);
-}
-
-/**
- * gst_gl_query_counter:
- * @query: a #GstGLQuery
- *
- * Record the result of a counter
- *
- * Since: 1.10
- */
-void
-gst_gl_query_counter (GstGLQuery * query)
-{
- const GstGLFuncs *gl;
-
- g_return_if_fail (query != NULL);
- g_return_if_fail (_query_type_supports_counter (query->query_type));
-
- if (!query->supported)
- return;
-
- GST_TRACE ("%p query counter type \'%s\' id %u", query,
- _query_type_to_string (query->query_type), query->query_id);
-
- gst_gl_async_debug_output_log_msg (&query->debug);
-
- gl = query->context->gl_vtable;
- gl->QueryCounter (query->query_id, query->query_type);
-}
-
-/**
- * gst_gl_query_result:
- * @query: a #GstGLQuery
- *
- * Returns: the result of the query
- *
- * Since: 1.10
- */
-guint64
-gst_gl_query_result (GstGLQuery * query)
-{
- const GstGLFuncs *gl;
- guint64 ret;
-
- g_return_val_if_fail (query != NULL, 0);
- g_return_val_if_fail (!query->start_called, 0);
-
- if (!query->supported)
- return 0;
-
- gl = query->context->gl_vtable;
- if (gl->GetQueryObjectui64v) {
- gl->GetQueryObjectui64v (query->query_id, GL_QUERY_RESULT,
- (GLuint64 *) & ret);
- } else {
- guint tmp;
- gl->GetQueryObjectuiv (query->query_id, GL_QUERY_RESULT, &tmp);
- ret = tmp;
- }
-
- GST_TRACE ("%p get result %" G_GUINT64_FORMAT " type \'%s\' id %u", query,
- ret, _query_type_to_string (query->query_type), query->query_id);
-
- return ret;
-}
diff --git a/gst-libs/gst/gl/gstglquery.h b/gst-libs/gst/gl/gstglquery.h
deleted file mode 100644
index 48634b809..000000000
--- a/gst-libs/gst/gl/gstglquery.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2016 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_QUERY_H__
-#define __GST_GL_QUERY_H__
-
-#include <gst/gl/gstgl_fwd.h>
-#include <gst/gl/gstgldebug.h>
-
-G_BEGIN_DECLS
-
-/**
- * GstGLQueryType:
- * @GST_GL_QUERY_NONE: no query
- * @GST_GL_QUERY_TIME_ELAPSED: query the time elapsed
- * @GST_GL_QUERY_TIMESTAMP: query the current time
- */
-typedef enum
-{
- GST_GL_QUERY_NONE,
- GST_GL_QUERY_TIME_ELAPSED,
- GST_GL_QUERY_TIMESTAMP,
-} GstGLQueryType;
-
-/**
- * GstGLQuery:
- *
- * Opaque #GstGLQuery struct
- */
-struct _GstGLQuery
-{
- /* <private> */
- GstGLContext * context;
- guint query_type;
- guint query_id;
- gboolean supported;
-
- gboolean start_called;
- GstGLAsyncDebug debug;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-void gst_gl_query_init (GstGLQuery * query,
- GstGLContext * context,
- GstGLQueryType query_type);
-GST_EXPORT
-void gst_gl_query_unset (GstGLQuery * query);
-GST_EXPORT
-GstGLQuery * gst_gl_query_new (GstGLContext * context,
- GstGLQueryType query_type);
-GST_EXPORT
-void gst_gl_query_free (GstGLQuery * query);
-
-GST_EXPORT
-void gst_gl_query_start (GstGLQuery * query);
-GST_EXPORT
-void gst_gl_query_end (GstGLQuery * query);
-GST_EXPORT
-void gst_gl_query_counter (GstGLQuery * query);
-GST_EXPORT
-guint64 gst_gl_query_result (GstGLQuery * query);
-
-#define gst_gl_query_start_log_valist(query,cat,level,object,format,varargs) \
- G_STMT_START { \
- GST_GL_ASYNC_CAT_LEVEL_LOG_valist (&(query)->debug, cat, level, object, format, varargs); \
- gst_gl_async_debug_freeze (&(query)->debug); \
- gst_gl_query_start (query); \
- gst_gl_async_debug_thaw (&(query)->debug); \
- } G_STMT_END
-
-#define gst_gl_query_counter_log_valist(query,cat,level,object,format,varargs) \
- G_STMT_START { \
- GST_GL_ASYNC_CAT_LEVEL_LOG_valist (&(query)->debug, cat, level, object, format, varargs); \
- gst_gl_async_debug_freeze (&(query)->debug); \
- gst_gl_query_counter (query); \
- gst_gl_async_debug_thaw (&(query)->debug); \
- } G_STMT_END
-
-#if G_HAVE_ISO_VARARGS
-
-#define gst_gl_query_start_log(query,cat,level,object,format,...) \
- G_STMT_START { \
- GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, __VA_ARGS__); \
- gst_gl_async_debug_freeze (&(query)->debug); \
- gst_gl_query_start (query); \
- gst_gl_async_debug_thaw (&(query)->debug); \
- } G_STMT_END
-#define gst_gl_query_counter_log(query,cat,level,object,format,...) \
- G_STMT_START { \
- GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, __VA_ARGS__); \
- gst_gl_async_debug_freeze (&(query)->debug); \
- gst_gl_query_counter (query); \
- gst_gl_async_debug_thaw (&(query)->debug); \
- } G_STMT_END
-
-#else /* G_HAVE_ISO_VARARGS */
-#if G_HAVE_GNUC_VARARGS
-
-#define gst_gl_query_start_log(query,cat,level,object,format,args...) \
- G_STMT_START { \
- GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, ##args); \
- gst_gl_async_debug_freeze (&(query)->debug); \
- gst_gl_query_start (query); \
- gst_gl_async_debug_thaw (&(query)->debug); \
- } G_STMT_END
-#define gst_gl_query_counter_log(query,cat,level,object,format,args...) \
- G_STMT_START { \
- GST_GL_ASYNC_CAT_LEVEL_LOG (&(query)->debug, cat, level, object, format, ##args); \
- gst_gl_async_debug_freeze (&(query)->debug); \
- gst_gl_query_counter (query); \
- gst_gl_async_debug_thaw (&(query)->debug); \
- } G_STMT_END
-
-#else /* G_HAVE_GNUC_VARARGS */
-
-static inline void
-gst_gl_query_start_log(GstGLQuery * query, GstDebugCategory * cat,
- GstDebugLevel level, GObject * object, const gchar * format, ...)
-{
- va_list varargs;
-
- va_start (varargs, format);
- gst_gl_query_start_log_valist (query, cat, level, object, format, varargs);
- va_end (varargs);
-}
-
-static inline void
-gst_gl_query_counter_log(GstGLQuery * query, GstDebugCategory * cat,
- GstDebugLevel level, GObject * object, const gchar * format, ...)
-{
- va_list varargs;
-
- va_start (varargs, format);
- gst_gl_query_counter_log_valist (query, cat, level, object, format, varargs);
- va_end (varargs);
-}
-
-#endif /* G_HAVE_GNUC_VARARGS */
-#endif /* G_HAVE_ISO_VARARGS */
-
-G_END_DECLS
-
-#endif /* __GST_GL_QUERY_H__ */
diff --git a/gst-libs/gst/gl/gstglrenderbuffer.c b/gst-libs/gst/gl/gstglrenderbuffer.c
deleted file mode 100644
index 4399c7ef8..000000000
--- a/gst-libs/gst/gl/gstglrenderbuffer.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstglrenderbuffer.h"
-
-#include "gstglcontext.h"
-#include "gstglfuncs.h"
-#include "gstglmemory.h"
-
-/**
- * SECTION:gstglrenderbuffer
- * @title: GstGLRenderBuffer
- * @short_description: memory subclass for GL renderbuffer objects
- * @see_also: #GstMemory, #GstAllocator
- *
- * GstGLRenderbuffer is a #GstGLBaseMemory subclass providing support for
- * OpenGL renderbuffers.
- *
- * #GstGLRenderbuffer is created or wrapped through gst_gl_base_memory_alloc()
- * with #GstGLRenderbufferAllocationParams.
- *
- * Since: 1.10
- */
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-static GstAllocator *_gl_renderbuffer_allocator;
-
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_RENDERBUFFER);
-#define GST_CAT_DEFAULT GST_CAT_GL_RENDERBUFFER
-
-G_DEFINE_TYPE (GstGLRenderbufferAllocator, gst_gl_renderbuffer_allocator,
- GST_TYPE_GL_BASE_MEMORY_ALLOCATOR);
-
-static guint
-_new_renderbuffer (GstGLContext * context, guint format, guint width,
- guint height)
-{
- const GstGLFuncs *gl = context->gl_vtable;
- guint rbo_id;
-
- gl->GenRenderbuffers (1, &rbo_id);
- gl->BindRenderbuffer (GL_RENDERBUFFER, rbo_id);
-
- gl->RenderbufferStorage (GL_RENDERBUFFER, format, width, height);
-
- gl->BindRenderbuffer (GL_RENDERBUFFER, 0);
-
- return rbo_id;
-}
-
-static gboolean
-_gl_rbo_create (GstGLRenderbuffer * gl_mem, GError ** error)
-{
- if (!gl_mem->renderbuffer_wrapped) {
- GstGLContext *context = gl_mem->mem.context;
- GLenum internal_format;
- GLenum tex_format;
- GLenum renderbuffer_type;
-
- tex_format = gl_mem->renderbuffer_format;
- renderbuffer_type = GL_UNSIGNED_BYTE;
- if (gl_mem->renderbuffer_format == GST_GL_RGB565) {
- tex_format = GST_GL_RGB;
- renderbuffer_type = GL_UNSIGNED_SHORT_5_6_5;
- }
-
- internal_format =
- gst_gl_sized_gl_format_from_gl_format_type (context, tex_format,
- renderbuffer_type);
-
- gl_mem->renderbuffer_id =
- _new_renderbuffer (context, internal_format,
- gst_gl_renderbuffer_get_width (gl_mem),
- gst_gl_renderbuffer_get_height (gl_mem));
-
- GST_CAT_TRACE (GST_CAT_GL_RENDERBUFFER, "Generating renderbuffer id:%u "
- "format:%u dimensions:%ux%u", gl_mem->renderbuffer_id, internal_format,
- gst_gl_renderbuffer_get_width (gl_mem),
- gst_gl_renderbuffer_get_height (gl_mem));
- }
-
- return TRUE;
-}
-
-static void
-gst_gl_renderbuffer_init (GstGLRenderbuffer * mem, GstAllocator * allocator,
- GstMemory * parent, GstGLContext * context,
- GstGLFormat renderbuffer_format, GstAllocationParams * params,
- guint width, guint height, gpointer user_data, GDestroyNotify notify)
-{
- gsize size;
- guint tex_type;
-
- tex_type = GL_UNSIGNED_BYTE;
- if (renderbuffer_format == GST_GL_RGB565)
- tex_type = GL_UNSIGNED_SHORT_5_6_5;
- size =
- gst_gl_format_type_n_bytes (renderbuffer_format,
- tex_type) * width * height;
-
- mem->renderbuffer_format = renderbuffer_format;
- mem->width = width;
- mem->height = height;
-
- gst_gl_base_memory_init ((GstGLBaseMemory *) mem, allocator, parent, context,
- params, size, user_data, notify);
-
- GST_CAT_DEBUG (GST_CAT_GL_RENDERBUFFER, "new GL renderbuffer context:%"
- GST_PTR_FORMAT " memory:%p format:%u dimensions:%ux%u ", context, mem,
- mem->renderbuffer_format, gst_gl_renderbuffer_get_width (mem),
- gst_gl_renderbuffer_get_height (mem));
-}
-
-static gpointer
-_gl_rbo_map (GstGLRenderbuffer * gl_mem, GstMapInfo * info, gsize maxsize)
-{
- GST_CAT_WARNING (GST_CAT_GL_RENDERBUFFER, "Renderbuffer's cannot be mapped");
-
- return NULL;
-}
-
-static void
-_gl_rbo_unmap (GstGLRenderbuffer * gl_mem, GstMapInfo * info)
-{
-}
-
-static GstMemory *
-_gl_rbo_copy (GstGLRenderbuffer * src, gssize offset, gssize size)
-{
- GST_CAT_WARNING (GST_CAT_GL_RENDERBUFFER, "Renderbuffer's cannot be copied");
-
- return NULL;
-}
-
-static GstMemory *
-_gl_rbo_alloc (GstAllocator * allocator, gsize size,
- GstAllocationParams * params)
-{
- g_warning ("Use gst_gl_base_memory_alloc to allocate from this allocator");
-
- return NULL;
-}
-
-static void
-_gl_rbo_destroy (GstGLRenderbuffer * gl_mem)
-{
- const GstGLFuncs *gl = gl_mem->mem.context->gl_vtable;
-
- if (gl_mem->renderbuffer_id && !gl_mem->renderbuffer_wrapped)
- gl->DeleteRenderbuffers (1, &gl_mem->renderbuffer_id);
-}
-
-static GstGLRenderbuffer *
-_default_gl_rbo_alloc (GstGLRenderbufferAllocator * allocator,
- GstGLRenderbufferAllocationParams * params)
-{
- guint alloc_flags = params->parent.alloc_flags;
- GstGLRenderbuffer *mem;
-
- g_return_val_if_fail ((alloc_flags &
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) == 0, NULL);
-
- mem = g_new0 (GstGLRenderbuffer, 1);
-
- if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
- mem->renderbuffer_id = GPOINTER_TO_UINT (params->parent.gl_handle);
- mem->renderbuffer_wrapped = TRUE;
- }
-
- gst_gl_renderbuffer_init (mem, GST_ALLOCATOR_CAST (allocator), NULL,
- params->parent.context, params->renderbuffer_format,
- params->parent.alloc_params, params->width, params->height,
- params->parent.user_data, params->parent.notify);
-
- return mem;
-}
-
-static void
-gst_gl_renderbuffer_allocator_class_init (GstGLRenderbufferAllocatorClass *
- klass)
-{
- GstGLBaseMemoryAllocatorClass *gl_base;
- GstAllocatorClass *allocator_class;
-
- gl_base = (GstGLBaseMemoryAllocatorClass *) klass;
- allocator_class = (GstAllocatorClass *) klass;
-
- gl_base->alloc =
- (GstGLBaseMemoryAllocatorAllocFunction) _default_gl_rbo_alloc;
- gl_base->create = (GstGLBaseMemoryAllocatorCreateFunction) _gl_rbo_create;
- gl_base->destroy = (GstGLBaseMemoryAllocatorDestroyFunction) _gl_rbo_destroy;
-
- allocator_class->alloc = _gl_rbo_alloc;
-}
-
-static void
-gst_gl_renderbuffer_allocator_init (GstGLRenderbufferAllocator * allocator)
-{
- GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
-
- alloc->mem_type = GST_GL_RENDERBUFFER_ALLOCATOR_NAME;
-
- alloc->mem_map_full = (GstMemoryMapFullFunction) _gl_rbo_map;
- alloc->mem_unmap_full = (GstMemoryUnmapFullFunction) _gl_rbo_unmap;
- alloc->mem_copy = (GstMemoryCopyFunction) _gl_rbo_copy;
-
- GST_OBJECT_FLAG_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
-}
-
-/**
- * gst_gl_renderbuffer_get_width:
- * @gl_mem: a #GstGLRenderbuffer
- *
- * Returns: the configured width of @gl_mem
- *
- * Since: 1.10
- */
-gint
-gst_gl_renderbuffer_get_width (GstGLRenderbuffer * gl_mem)
-{
- g_return_val_if_fail (gst_is_gl_renderbuffer ((GstMemory *) gl_mem), 0);
-
- return gl_mem->width;
-}
-
-/**
- * gst_gl_renderbuffer_get_height:
- * @gl_mem: a #GstGLRenderbuffer
- *
- * Returns: the configured height of @gl_mem
- *
- * Since: 1.10
- */
-gint
-gst_gl_renderbuffer_get_height (GstGLRenderbuffer * gl_mem)
-{
- g_return_val_if_fail (gst_is_gl_renderbuffer ((GstMemory *) gl_mem), 0);
-
- return gl_mem->height;
-}
-
-/**
- * gst_gl_renderbuffer_get_format:
- * @gl_mem: a #GstGLRenderbuffer
- *
- * Returns: the #GstGLFormat of @gl_mem
- *
- * Since: 1.12
- */
-GstGLFormat
-gst_gl_renderbuffer_get_format (GstGLRenderbuffer * gl_mem)
-{
- g_return_val_if_fail (gst_is_gl_renderbuffer ((GstMemory *) gl_mem), 0);
-
- return gl_mem->renderbuffer_format;
-}
-
-/**
- * gst_gl_renderbuffer_get_id:
- * @gl_mem: a #GstGLRenderbuffer
- *
- * Returns: the OpenGL renderbuffer handle of @gl_mem
- *
- * Since: 1.10
- */
-guint
-gst_gl_renderbuffer_get_id (GstGLRenderbuffer * gl_mem)
-{
- g_return_val_if_fail (gst_is_gl_renderbuffer ((GstMemory *) gl_mem), 0);
-
- return gl_mem->renderbuffer_id;
-}
-
-/**
- * gst_gl_renderbuffer_init_once:
- *
- * Initializes the GL Base Texture allocator. It is safe to call this function
- * multiple times. This must be called before any other GstGLRenderbuffer operation.
- *
- * Since: 1.10
- */
-void
-gst_gl_renderbuffer_init_once (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- gst_gl_base_memory_init_once ();
-
- GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_RENDERBUFFER, "glrenderbuffermemory", 0,
- "OpenGL Renderbuffer memory");
-
- _gl_renderbuffer_allocator =
- g_object_new (GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, NULL);
- gst_object_ref_sink (_gl_renderbuffer_allocator);
- GST_OBJECT_FLAG_SET (_gl_renderbuffer_allocator,
- GST_OBJECT_FLAG_MAY_BE_LEAKED);
-
- gst_allocator_register (GST_GL_RENDERBUFFER_ALLOCATOR_NAME,
- _gl_renderbuffer_allocator);
-
- g_once_init_leave (&_init, 1);
- }
-}
-
-/**
- * gst_is_gl_renderbuffer:
- * @mem:a #GstMemory
- *
- * Returns: whether the memory at @mem is a #GstGLRenderbuffer
- *
- * Since: 1.10
- */
-gboolean
-gst_is_gl_renderbuffer (GstMemory * mem)
-{
- return mem != NULL && mem->allocator != NULL
- && g_type_is_a (G_OBJECT_TYPE (mem->allocator),
- GST_TYPE_GL_RENDERBUFFER_ALLOCATOR);
-}
-
-G_DEFINE_BOXED_TYPE (GstGLRenderbufferAllocationParams,
- gst_gl_renderbuffer_allocation_params,
- (GBoxedCopyFunc) gst_gl_allocation_params_copy,
- (GBoxedFreeFunc) gst_gl_allocation_params_free);
-
-static void
-_gst_gl_rb_alloc_params_free_data (GstGLRenderbufferAllocationParams * params)
-{
- gst_gl_allocation_params_free_data (&params->parent);
-}
-
-static void
-_gst_gl_rb_alloc_params_copy_data (GstGLRenderbufferAllocationParams * src_vid,
- GstGLRenderbufferAllocationParams * dest_vid)
-{
- GstGLAllocationParams *src = (GstGLAllocationParams *) src_vid;
- GstGLAllocationParams *dest = (GstGLAllocationParams *) dest_vid;
-
- gst_gl_allocation_params_copy_data (src, dest);
-
- dest_vid->renderbuffer_format = src_vid->renderbuffer_format;
- dest_vid->width = src_vid->width;
- dest_vid->height = src_vid->height;
-}
-
-static gboolean
- _gst_gl_renderbuffer_allocation_params_init_full
- (GstGLRenderbufferAllocationParams * params, gsize struct_size,
- guint alloc_flags, GstGLAllocationParamsCopyFunc copy,
- GstGLAllocationParamsFreeFunc free, GstGLContext * context,
- GstAllocationParams * alloc_params, guint width, guint height,
- GstGLFormat renderbuffer_format, gpointer wrapped_data,
- gpointer gl_handle, gpointer user_data, GDestroyNotify notify)
-{
- g_return_val_if_fail (params != NULL, FALSE);
- g_return_val_if_fail (copy != NULL, FALSE);
- g_return_val_if_fail (free != NULL, FALSE);
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
-
- memset (params, 0, sizeof (*params));
-
- if (!gst_gl_allocation_params_init ((GstGLAllocationParams *) params,
- struct_size, alloc_flags, copy, free, context, 0, alloc_params,
- wrapped_data, gl_handle, user_data, notify))
- return FALSE;
-
- params->renderbuffer_format = renderbuffer_format;
- params->width = width;
- params->height = height;
-
- return TRUE;
-}
-
-/**
- * gst_gl_renderbuffer_allocation_params_new:
- * @context: a #GstGLContext
- * @alloc_params: (allow-none): the #GstAllocationParams for sysmem mappings of the texture
- * @width: the width of the renderbuffer
- * @height: the height of the renderbuffer
- * @renderbuffer_format: the #GstGLFormat for the created textures
- *
- * Returns: a new #GstGLRenderbufferAllocationParams for allocating #GstGLRenderbuffer's
- *
- * Since: 1.10
- */
-GstGLRenderbufferAllocationParams *
-gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
- GstAllocationParams * alloc_params, GstGLFormat renderbuffer_format,
- guint width, guint height)
-{
- GstGLRenderbufferAllocationParams *params =
- g_new0 (GstGLRenderbufferAllocationParams, 1);
-
- if (!_gst_gl_renderbuffer_allocation_params_init_full (params,
- sizeof (GstGLRenderbufferAllocationParams),
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_ALLOC |
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
- (GstGLAllocationParamsCopyFunc) _gst_gl_rb_alloc_params_copy_data,
- (GstGLAllocationParamsFreeFunc) _gst_gl_rb_alloc_params_free_data,
- context, alloc_params, width, height, renderbuffer_format, NULL, 0,
- NULL, NULL)) {
- g_free (params);
- return NULL;
- }
-
- return params;
-}
-
-/**
- * gst_gl_renderbuffer_allocation_params_new_wrapped:
- * @context: a #GstGLContext
- * @alloc_params: (allow-none): the #GstAllocationParams for @tex_id
- * @width: the width of the renderbuffer
- * @height: the height of the renderbuffer
- * @renderbuffer_format: the #GstGLFormat for @tex_id
- * @gl_handle: the GL handle to wrap
- * @user_data: (allow-none): user data to call @notify with
- * @notify: (allow-none): a #GDestroyNotify
- *
- * Returns: a new #GstGLRenderbufferAllocationParams for wrapping @gl_handle as a
- * renderbuffer
- *
- * Since: 1.10
- */
-GstGLRenderbufferAllocationParams *
-gst_gl_renderbuffer_allocation_params_new_wrapped (GstGLContext * context,
- GstAllocationParams * alloc_params, GstGLFormat renderbuffer_format,
- guint width, guint height, gpointer gl_handle, gpointer user_data,
- GDestroyNotify notify)
-{
- GstGLRenderbufferAllocationParams *params =
- g_new0 (GstGLRenderbufferAllocationParams, 1);
-
- if (!_gst_gl_renderbuffer_allocation_params_init_full (params,
- sizeof (GstGLRenderbufferAllocationParams),
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE |
- GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
- (GstGLAllocationParamsCopyFunc) _gst_gl_rb_alloc_params_copy_data,
- (GstGLAllocationParamsFreeFunc) _gst_gl_rb_alloc_params_free_data,
- context, alloc_params, width, height, renderbuffer_format, NULL,
- gl_handle, user_data, notify)) {
- g_free (params);
- return NULL;
- }
-
- return params;
-}
diff --git a/gst-libs/gst/gl/gstglrenderbuffer.h b/gst-libs/gst/gl/gstglrenderbuffer.h
deleted file mode 100644
index 598f0ab9c..000000000
--- a/gst-libs/gst/gl/gstglrenderbuffer.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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_RENDERBUFFER_H_
-#define _GST_GL_RENDERBUFFER_H_
-
-#include <gst/gl/gstglbasememory.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_RENDERBUFFER_ALLOCATOR (gst_gl_renderbuffer_allocator_get_type())
-GST_EXPORT GType gst_gl_renderbuffer_allocator_get_type(void);
-
-#define GST_IS_GL_RENDERBUFFER_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR))
-#define GST_IS_GL_RENDERBUFFER_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR))
-#define GST_GL_RENDERBUFFER_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, GstGLRenderbufferAllocatorClass))
-#define GST_GL_RENDERBUFFER_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, GstGLRenderbufferAllocator))
-#define GST_GL_RENDERBUFFER_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_RENDERBUFFER_ALLOCATOR, GstGLRenderbufferAllocatorClass))
-#define GST_GL_RENDERBUFFER_ALLOCATOR_CAST(obj) ((GstGLRenderbufferAllocator *)(obj))
-
-#define GST_GL_RENDERBUFFER_CAST(obj) ((GstGLRenderbuffer *) obj)
-
-/**
- * GST_GL_RENDERBUFFER_ALLOCATOR_NAME:
- *
- * The name of the GL renderbuffer allocator
- */
-#define GST_GL_RENDERBUFFER_ALLOCATOR_NAME "GLRenderbuffer"
-
-/**
- * GstGLRenderbuffer:
- * @mem: the parent object
- * @renderbuffer_id: the GL texture id for this memory
- * @renderbuffer_type: the texture type
- * @width: the width
- * @height: the height
- *
- * Represents information about a GL renderbuffer
- */
-struct _GstGLRenderbuffer
-{
- GstGLBaseMemory mem;
-
- guint renderbuffer_id;
- GstGLFormat renderbuffer_format;
- guint width;
- guint height;
-
- /* <protected> */
- gboolean renderbuffer_wrapped;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLRenderbufferAllocator
- *
- * Opaque #GstGLRenderbufferAllocator struct
- */
-struct _GstGLRenderbufferAllocator
-{
- GstGLBaseMemoryAllocator parent;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLRenderbufferAllocatorClass:
- *
- * The #GstGLRenderbufferAllocatorClass only contains private data
- */
-struct _GstGLRenderbufferAllocatorClass
-{
- GstGLBaseMemoryAllocatorClass parent_class;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-#include <gst/gl/gstglbasememory.h>
-
-GST_EXPORT GType gst_gl_renderbuffer_allocation_params_get_type (void);
-#define GST_TYPE_RENDERBUFFER_ALLOCATION_PARAMS (gst_gl_renderbuffer_allocation_params_get_type)
-
-typedef struct
-{
- GstGLAllocationParams parent;
-
- GstGLFormat renderbuffer_format;
- guint width;
- guint height;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-} GstGLRenderbufferAllocationParams;
-
-GST_EXPORT
-GstGLRenderbufferAllocationParams * gst_gl_renderbuffer_allocation_params_new (GstGLContext * context,
- GstAllocationParams * alloc_params,
- GstGLFormat renderbuffer_format,
- guint width,
- guint height);
-
-GST_EXPORT
-GstGLRenderbufferAllocationParams * gst_gl_renderbuffer_allocation_params_new_wrapped (GstGLContext * context,
- GstAllocationParams * alloc_params,
- GstGLFormat renderbuffer_format,
- guint width,
- guint height,
- gpointer gl_handle,
- gpointer user_data,
- GDestroyNotify notify);
-
-GST_EXPORT
-void gst_gl_renderbuffer_init_once (void);
-
-GST_EXPORT
-gboolean gst_is_gl_renderbuffer (GstMemory * mem);
-
-/* accessors */
-GST_EXPORT
-gint gst_gl_renderbuffer_get_width (GstGLRenderbuffer * gl_mem);
-
-GST_EXPORT
-gint gst_gl_renderbuffer_get_height (GstGLRenderbuffer * gl_mem);
-
-GST_EXPORT
-GstGLFormat gst_gl_renderbuffer_get_format (GstGLRenderbuffer * gl_mem);
-
-GST_EXPORT
-guint gst_gl_renderbuffer_get_id (GstGLRenderbuffer * gl_mem);
-
-G_END_DECLS
-
-#endif /* _GST_GL_RENDERBUFFER_H_ */
diff --git a/gst-libs/gst/gl/gstglshader.c b/gst-libs/gst/gl/gstglshader.c
deleted file mode 100644
index 9e5e1f780..000000000
--- a/gst-libs/gst/gl/gstglshader.c
+++ /dev/null
@@ -1,1589 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
- * Copyright (C) 2014 Julien Isorce <julien.isorce@collabora.co.uk>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gl.h"
-#include "gstglshader.h"
-#include "gstglsl_private.h"
-
-/**
- * SECTION:gstglshader
- * @title: GstGLShader
- * @short_description: object representing an OpenGL shader program
- * @see_also: #GstGLSLStage
- */
-
-#ifndef GLhandleARB
-#define GLhandleARB GLuint
-#endif
-
-#define GST_GL_SHADER_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_SHADER, GstGLShaderPrivate))
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-typedef struct _GstGLShaderVTable
-{
- GLuint (GSTGLAPI * CreateProgram) (void);
- void (GSTGLAPI * DeleteProgram) (GLuint program);
- void (GSTGLAPI * UseProgram) (GLuint program);
- void (GSTGLAPI * GetAttachedShaders) (GLuint program, GLsizei maxcount,
- GLsizei * count, GLuint * shaders);
-
- GLuint (GSTGLAPI * CreateShader) (GLenum shaderType);
- void (GSTGLAPI * DeleteShader) (GLuint shader);
- void (GSTGLAPI * AttachShader) (GLuint program, GLuint shader);
- void (GSTGLAPI * DetachShader) (GLuint program, GLuint shader);
-
- void (GSTGLAPI * GetShaderiv) (GLuint program, GLenum pname, GLint * params);
- void (GSTGLAPI * GetProgramiv) (GLuint program, GLenum pname, GLint * params);
- void (GSTGLAPI * GetShaderInfoLog) (GLuint shader, GLsizei maxLength,
- GLsizei * length, char *log);
- void (GSTGLAPI * GetProgramInfoLog) (GLuint shader, GLsizei maxLength,
- GLsizei * length, char *log);
-} GstGLShaderVTable;
-
-enum
-{
- PROP_0,
- PROP_LINKED,
-};
-
-struct _GstGLShaderPrivate
-{
- GLhandleARB program_handle;
- GList *stages;
-
- gboolean linked;
- GHashTable *uniform_locations;
-
- GstGLSLFuncs vtable;
-};
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_shader_debug);
-#define GST_CAT_DEFAULT gst_gl_shader_debug
-
-#define DEBUG_INIT \
- GST_DEBUG_CATEGORY_INIT (gst_gl_shader_debug, "glshader", 0, "shader");
-G_DEFINE_TYPE_WITH_CODE (GstGLShader, gst_gl_shader, GST_TYPE_OBJECT,
- DEBUG_INIT);
-
-static void
-_cleanup_shader (GstGLContext * context, GstGLShader * shader)
-{
- GstGLShaderPrivate *priv = shader->priv;
-
- GST_OBJECT_LOCK (shader);
-
- /* release shader objects */
- gst_gl_shader_release_unlocked (shader);
-
- /* delete program */
- if (priv->program_handle) {
- GST_TRACE ("finalizing program shader %u", priv->program_handle);
-
- priv->vtable.DeleteProgram (priv->program_handle);
- }
-
- GST_DEBUG ("shader deleted %u", priv->program_handle);
-
- GST_OBJECT_UNLOCK (shader);
-}
-
-static void
-gst_gl_shader_finalize (GObject * object)
-{
- GstGLShader *shader;
- GstGLShaderPrivate *priv;
-
- shader = GST_GL_SHADER (object);
- priv = shader->priv;
-
- GST_TRACE_OBJECT (shader, "finalizing shader %u", priv->program_handle);
-
- gst_gl_context_thread_add (shader->context,
- (GstGLContextThreadFunc) _cleanup_shader, shader);
-
- priv->program_handle = 0;
- g_hash_table_destroy (priv->uniform_locations);
-
- if (shader->context) {
- gst_object_unref (shader->context);
- shader->context = NULL;
- }
-
- G_OBJECT_CLASS (gst_gl_shader_parent_class)->finalize (object);
-}
-
-static void
-gst_gl_shader_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gl_shader_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstGLShader *shader = GST_GL_SHADER (object);
- GstGLShaderPrivate *priv = shader->priv;
-
- switch (prop_id) {
- case PROP_LINKED:
- g_value_set_boolean (value, priv->linked);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gl_shader_class_init (GstGLShaderClass * klass)
-{
- /* bind class methods .. */
- GObjectClass *obj_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (GstGLShaderPrivate));
-
- obj_class->finalize = gst_gl_shader_finalize;
- obj_class->set_property = gst_gl_shader_set_property;
- obj_class->get_property = gst_gl_shader_get_property;
-
- /* .. and install properties */
- g_object_class_install_property (obj_class,
- PROP_LINKED,
- g_param_spec_boolean ("linked",
- "Linked",
- "Shader link status", FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_gl_shader_init (GstGLShader * self)
-{
- /* initialize sources and create program object */
- GstGLShaderPrivate *priv;
-
- priv = self->priv = GST_GL_SHADER_GET_PRIVATE (self);
-
- priv->linked = FALSE;
- priv->uniform_locations =
- g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-}
-
-static int
-_get_uniform_location (GstGLShader * shader, const gchar * name)
-{
- GstGLShaderPrivate *priv = shader->priv;
- int location;
- gpointer value;
-
- g_return_val_if_fail (priv->linked, 0);
-
- if (!g_hash_table_lookup_extended (priv->uniform_locations, name, NULL,
- &value)) {
- const GstGLFuncs *gl = shader->context->gl_vtable;
- location = gl->GetUniformLocation (priv->program_handle, name);
- g_hash_table_insert (priv->uniform_locations, g_strdup (name),
- GINT_TO_POINTER (location));
- } else {
- location = GPOINTER_TO_INT (value);
- }
-
- return location;
-}
-
-static GstGLShader *
-_new_with_stages_va_list (GstGLContext * context, GError ** error,
- va_list varargs)
-{
- GstGLShader *shader;
- GstGLSLStage *stage;
- gboolean to_unref_and_out = FALSE;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
-
- shader = g_object_new (GST_TYPE_GL_SHADER, NULL);
- gst_object_ref_sink (shader);
- shader->context = gst_object_ref (context);
-
- while ((stage = va_arg (varargs, GstGLSLStage *))) {
- if (to_unref_and_out) {
- gst_object_unref (stage);
- continue;
- }
-
- if (!gst_glsl_stage_compile (stage, error)) {
- gst_object_unref (stage);
- to_unref_and_out = TRUE;
- continue;
- }
- if (!gst_gl_shader_attach (shader, stage)) {
- g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_PROGRAM,
- "Failed to attach stage to program");
- to_unref_and_out = TRUE;
- continue;
- }
- }
-
- if (to_unref_and_out) {
- gst_object_unref (shader);
- return NULL;
- }
-
- return shader;
-}
-
-/**
- * gst_gl_shader_new_link_with_stages:
- * @context: a #GstGLContext
- * @error: a #GError
- * @...: a NULL terminated list of #GstGLSLStage's
- *
- * Each stage will attempt to be compiled and attached to @shader. Then
- * the shader will be linked. On error, %NULL will be returned and @error will
- * contain the details of the error.
- *
- * Note: must be called in the GL thread
- *
- * Returns: (transfer full): a new @shader with the specified stages.
- *
- * Since: 1.8
- */
-GstGLShader *
-gst_gl_shader_new_link_with_stages (GstGLContext * context, GError ** error,
- ...)
-{
- GstGLShader *shader;
- va_list varargs;
-
- va_start (varargs, error);
- shader = _new_with_stages_va_list (context, error, varargs);
- va_end (varargs);
-
- if (!shader)
- return NULL;
-
- if (!gst_gl_shader_link (shader, error))
- return NULL;
-
- return shader;
-}
-
-/**
- * gst_gl_shader_new_with_stages:
- * @context: a #GstGLContext
- * @error: a #GError
- * @...: a NULL terminated list of #GstGLSLStage's
- *
- * Each stage will attempt to be compiled and attached to @shader. On error,
- * %NULL will be returned and @error will contain the details of the error.
- *
- * Note: must be called in the GL thread
- *
- * Returns: (transfer full): a new @shader with the specified stages.
- *
- * Since: 1.8
- */
-GstGLShader *
-gst_gl_shader_new_with_stages (GstGLContext * context, GError ** error, ...)
-{
- GstGLShader *shader;
- va_list varargs;
-
- va_start (varargs, error);
- shader = _new_with_stages_va_list (context, error, varargs);
- va_end (varargs);
-
- return shader;
-}
-
-/**
- * gst_gl_shader_new:
- * @context: a #GstGLContext
- *
- * Note: must be called in the GL thread
- *
- * Returns: (transfer full): a new empty @shader
- */
-GstGLShader *
-gst_gl_shader_new (GstGLContext * context)
-{
- return gst_gl_shader_new_with_stages (context, NULL, NULL);
-}
-
-/**
- * gst_gl_shader_new_default:
- * @context: a #GstGLContext
- * @error: a #GError that is filled on failure
- *
- * Note: must be called in the GL thread
- *
- * Returns: (transfer full): a default @shader or %NULL on failure
- *
- * Since: 1.8
- */
-GstGLShader *
-gst_gl_shader_new_default (GstGLContext * context, GError ** error)
-{
- return gst_gl_shader_new_link_with_stages (context, error,
- gst_glsl_stage_new_default_vertex (context),
- gst_glsl_stage_new_default_fragment (context), NULL);
-}
-
-/**
- * gst_gl_shader_is_linked:
- * @shader: a #GstGLShader
- *
- * Note: must be called in the GL thread
- *
- * Returns: whether @shader has been successfully linked
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_shader_is_linked (GstGLShader * shader)
-{
- gboolean ret;
-
- g_return_val_if_fail (GST_IS_GL_SHADER (shader), FALSE);
-
- GST_OBJECT_LOCK (shader);
- ret = shader->priv->linked;
- GST_OBJECT_UNLOCK (shader);
-
- return ret;
-}
-
-static gboolean
-_ensure_program (GstGLShader * shader)
-{
- if (shader->priv->program_handle)
- return TRUE;
-
- shader->priv->program_handle = shader->priv->vtable.CreateProgram ();
- return shader->priv->program_handle != 0;
-}
-
-/**
- * gst_gl_shader_get_program_handle:
- * @shader: a #GstGLShader
- *
- * Returns: the GL program handle for this shader
- *
- * Since: 1.8
- */
-int
-gst_gl_shader_get_program_handle (GstGLShader * shader)
-{
- int ret;
-
- g_return_val_if_fail (GST_IS_GL_SHADER (shader), 0);
-
- GST_OBJECT_LOCK (shader);
- ret = (int) shader->priv->program_handle;
- GST_OBJECT_UNLOCK (shader);
-
- return ret;
-}
-
-/**
- * gst_gl_shader_detach_unlocked:
- * @shader: a #GstGLShader
- * @stage: a #GstGLSLStage to attach
- *
- * Detaches @stage from @shader. @stage must have been successfully attached
- * to @shader with gst_gl_shader_attach() or gst_gl_shader_attach_unlocked().
- *
- * Note: must be called in the GL thread
- *
- * Since: 1.8
- */
-void
-gst_gl_shader_detach_unlocked (GstGLShader * shader, GstGLSLStage * stage)
-{
- guint stage_handle;
- GList *elem;
-
- g_return_if_fail (GST_IS_GL_SHADER (shader));
- g_return_if_fail (GST_IS_GLSL_STAGE (stage));
-
- if (!_gst_glsl_funcs_fill (&shader->priv->vtable, shader->context)) {
- GST_WARNING_OBJECT (shader, "Failed to retreive required GLSL functions");
- return;
- }
-
- if (!shader->priv->program_handle)
- return;
-
- elem = g_list_find (shader->priv->stages, stage);
- if (!elem) {
- GST_FIXME_OBJECT (shader, "Could not find stage %p in shader %p", stage,
- shader);
- return;
- }
-
- stage_handle = gst_glsl_stage_get_handle (stage);
- if (!stage_handle) {
- GST_FIXME_OBJECT (shader, "Stage %p doesn't have a GL handle", stage);
- return;
- }
-
- if (shader->context->gl_vtable->IsProgram)
- g_assert (shader->context->gl_vtable->IsProgram (shader->priv->
- program_handle));
- if (shader->context->gl_vtable->IsShader)
- g_assert (shader->context->gl_vtable->IsShader (stage_handle));
-
- GST_LOG_OBJECT (shader, "detaching shader %i from program %i", stage_handle,
- (int) shader->priv->program_handle);
- shader->priv->vtable.DetachShader (shader->priv->program_handle,
- stage_handle);
-
- shader->priv->stages = g_list_delete_link (shader->priv->stages, elem);
- gst_object_unref (stage);
-}
-
-/**
- * gst_gl_shader_detach:
- * @shader: a #GstGLShader
- * @stage: a #GstGLSLStage to attach
- *
- * Detaches @stage from @shader. @stage must have been successfully attached
- * to @shader with gst_gl_shader_attach() or gst_gl_shader_attach_unlocked().
- *
- * Note: must be called in the GL thread
- *
- * Since: 1.8
- */
-void
-gst_gl_shader_detach (GstGLShader * shader, GstGLSLStage * stage)
-{
- g_return_if_fail (GST_IS_GL_SHADER (shader));
- g_return_if_fail (GST_IS_GLSL_STAGE (stage));
-
- GST_OBJECT_LOCK (shader);
- gst_gl_shader_detach_unlocked (shader, stage);
- GST_OBJECT_UNLOCK (shader);
-}
-
-/**
- * gst_gl_shader_attach_unlocked:
- * @shader: a #GstGLShader
- * @stage: (transfer floating): a #GstGLSLStage to attach
- *
- * Attaches @stage to @shader. @stage must have been successfully compiled
- * with gst_glsl_stage_compile().
- *
- * Note: must be called in the GL thread
- *
- * Returns: whether @stage could be attached to @shader
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_shader_attach_unlocked (GstGLShader * shader, GstGLSLStage * stage)
-{
- guint stage_handle;
-
- g_return_val_if_fail (GST_IS_GL_SHADER (shader), FALSE);
- g_return_val_if_fail (GST_IS_GLSL_STAGE (stage), FALSE);
-
- if (!_gst_glsl_funcs_fill (&shader->priv->vtable, shader->context)) {
- GST_WARNING_OBJECT (shader, "Failed to retreive required GLSL functions");
- gst_object_ref_sink (stage);
- gst_object_unref (stage);
- return FALSE;
- }
-
- if (!_ensure_program (shader)) {
- gst_object_ref_sink (stage);
- gst_object_unref (stage);
- return FALSE;
- }
-
- /* already attached? */
- if (g_list_find (shader->priv->stages, stage)) {
- gst_object_ref_sink (stage);
- gst_object_unref (stage);
- return TRUE;
- }
-
- stage_handle = gst_glsl_stage_get_handle (stage);
- if (!stage_handle) {
- gst_object_ref_sink (stage);
- gst_object_unref (stage);
- return FALSE;
- }
-
- if (shader->context->gl_vtable->IsProgram)
- g_assert (shader->context->gl_vtable->IsProgram (shader->priv->
- program_handle));
- if (shader->context->gl_vtable->IsShader)
- g_assert (shader->context->gl_vtable->IsShader (stage_handle));
-
- shader->priv->stages =
- g_list_prepend (shader->priv->stages, gst_object_ref_sink (stage));
- GST_LOG_OBJECT (shader, "attaching shader %i to program %i", stage_handle,
- (int) shader->priv->program_handle);
- shader->priv->vtable.AttachShader (shader->priv->program_handle,
- stage_handle);
-
- return TRUE;
-}
-
-/**
- * gst_gl_shader_attach:
- * @shader: a #GstGLShader
- * @stage: (transfer floating): a #GstGLSLStage to attach
- *
- * Attaches @stage to @shader. @stage must have been successfully compiled
- * with gst_glsl_stage_compile().
- *
- * Note: must be called in the GL thread
- *
- * Returns: whether @stage could be attached to @shader
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_shader_attach (GstGLShader * shader, GstGLSLStage * stage)
-{
- gboolean ret;
-
- g_return_val_if_fail (GST_IS_GL_SHADER (shader), FALSE);
- g_return_val_if_fail (GST_IS_GLSL_STAGE (stage), FALSE);
-
- GST_OBJECT_LOCK (shader);
- ret = gst_gl_shader_attach_unlocked (shader, stage);
- GST_OBJECT_UNLOCK (shader);
-
- return ret;
-}
-
-/**
- * gst_gl_shader_compile_attach_stage:
- * @shader: a #GstGLShader
- * @stage: a #GstGLSLStage to attach
- * @error: a #GError
- *
- * Compiles @stage and attaches it to @shader.
- *
- * Note: must be called in the GL thread
- *
- * Returns: whether @stage could be compiled and attached to @shader
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_shader_compile_attach_stage (GstGLShader * shader, GstGLSLStage * stage,
- GError ** error)
-{
- g_return_val_if_fail (GST_IS_GLSL_STAGE (stage), FALSE);
-
- if (!gst_glsl_stage_compile (stage, error)) {
- return FALSE;
- }
-
- if (!gst_gl_shader_attach (shader, stage)) {
- g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_COMPILE,
- "Failed to attach stage to shader");
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * gst_gl_shader_link:
- * @shader: a #GstGLShader
- * @error: a #GError
- *
- * Links the current list of #GstGLSLStage's in @shader.
- *
- * Note: must be called in the GL thread
- *
- * Returns: whether @shader could be linked together.
- *
- * Since: 1.8
- */
-gboolean
-gst_gl_shader_link (GstGLShader * shader, GError ** error)
-{
- GstGLShaderPrivate *priv;
- const GstGLFuncs *gl;
- gchar info_buffer[2048];
- GLint status = GL_FALSE;
- gint len = 0;
- gboolean ret;
- GList *elem;
-
- g_return_val_if_fail (GST_IS_GL_SHADER (shader), FALSE);
-
- GST_OBJECT_LOCK (shader);
-
- priv = shader->priv;
- gl = shader->context->gl_vtable;
-
- if (priv->linked) {
- GST_OBJECT_UNLOCK (shader);
- return TRUE;
- }
-
- if (!_gst_glsl_funcs_fill (&shader->priv->vtable, shader->context)) {
- g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_PROGRAM,
- "Failed to retreive required GLSL functions");
- GST_OBJECT_UNLOCK (shader);
- return FALSE;
- }
-
- if (!_ensure_program (shader)) {
- g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_PROGRAM,
- "Failed to create GL program object");
- GST_OBJECT_UNLOCK (shader);
- return FALSE;
- }
-
- GST_TRACE ("shader created %u", shader->priv->program_handle);
-
- for (elem = shader->priv->stages; elem; elem = elem->next) {
- GstGLSLStage *stage = elem->data;
-
- if (!gst_glsl_stage_compile (stage, error)) {
- GST_OBJECT_UNLOCK (shader);
- return FALSE;
- }
-
- if (!gst_gl_shader_attach_unlocked (shader, stage)) {
- g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_COMPILE,
- "Failed to attach shader %" GST_PTR_FORMAT "to program %"
- GST_PTR_FORMAT, stage, shader);
- GST_OBJECT_UNLOCK (shader);
- return FALSE;
- }
- }
-
- /* if nothing failed link shaders */
- gl->LinkProgram (priv->program_handle);
- status = GL_FALSE;
- priv->vtable.GetProgramiv (priv->program_handle, GL_LINK_STATUS, &status);
-
- priv->vtable.GetProgramInfoLog (priv->program_handle,
- sizeof (info_buffer) - 1, &len, info_buffer);
- info_buffer[len] = '\0';
-
- if (status != GL_TRUE) {
- GST_ERROR ("Shader linking failed:\n%s", info_buffer);
-
- g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_LINK,
- "Shader Linking failed:\n%s", info_buffer);
- ret = priv->linked = FALSE;
- GST_OBJECT_UNLOCK (shader);
- return ret;
- } else if (len > 1) {
- GST_FIXME ("shader link log:\n%s\n", info_buffer);
- }
-
- ret = priv->linked = TRUE;
- GST_OBJECT_UNLOCK (shader);
-
- g_object_notify (G_OBJECT (shader), "linked");
-
- return ret;
-}
-
-/**
- * gst_gl_shader_release_unlocked:
- * @shader: a #GstGLShader
- *
- * Releases the shader and stages.
- *
- * Note: must be called in the GL thread
- *
- * Since: 1.8
- */
-void
-gst_gl_shader_release_unlocked (GstGLShader * shader)
-{
- GstGLShaderPrivate *priv;
- GList *elem;
-
- g_return_if_fail (GST_IS_GL_SHADER (shader));
-
- priv = shader->priv;
-
- for (elem = shader->priv->stages; elem;) {
- GstGLSLStage *stage = elem->data;
- GList *next = elem->next;
-
- gst_gl_shader_detach_unlocked (shader, stage);
- elem = next;
- }
-
- g_list_free_full (shader->priv->stages, (GDestroyNotify) gst_object_unref);
- shader->priv->stages = NULL;
-
- priv->linked = FALSE;
- g_hash_table_remove_all (priv->uniform_locations);
-
- g_object_notify (G_OBJECT (shader), "linked");
-}
-
-/**
- * gst_gl_shader_release:
- * @shader: a #GstGLShader
- *
- * Releases the shader and stages.
- *
- * Note: must be called in the GL thread
- *
- * Since: 1.8
- */
-void
-gst_gl_shader_release (GstGLShader * shader)
-{
- g_return_if_fail (GST_IS_GL_SHADER (shader));
-
- GST_OBJECT_LOCK (shader);
- gst_gl_shader_release_unlocked (shader);
- GST_OBJECT_UNLOCK (shader);
-}
-
-/**
- * gst_gl_shader_use:
- * @shader: a #GstGLShader
- *
- * Mark's @shader as being used for the next GL draw command.
- *
- * Note: must be called in the GL thread and @shader must have been linked.
- */
-void
-gst_gl_shader_use (GstGLShader * shader)
-{
- GstGLShaderPrivate *priv;
-
- g_return_if_fail (GST_IS_GL_SHADER (shader));
-
- priv = shader->priv;
-
- g_return_if_fail (priv->program_handle);
-
- priv->vtable.UseProgram (priv->program_handle);
-
- return;
-}
-
-/**
- * gst_gl_context_clear_shader:
- * @context: a #GstGLContext
- *
- * Clear's the currently set shader from the GL state machine.
- *
- * Note: must be called in the GL thread.
- */
-void
-gst_gl_context_clear_shader (GstGLContext * context)
-{
- GstGLFuncs *gl;
-
- g_return_if_fail (GST_IS_GL_CONTEXT (context));
-
- gl = context->gl_vtable;
-
- if (gl->CreateProgram)
- gl->UseProgram (0);
- else if (gl->CreateProgramObject)
- gl->UseProgramObject (0);
-}
-
-/**
- * gst_gl_shader_set_uniform_1f:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @value: value to set
- *
- * Perform glUniform1f() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_1f (GstGLShader * shader, const gchar * name,
- gfloat value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
-
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform1f (location, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_1fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of values to set
- * @value: (array length=count): values to set
- *
- * Perform glUniform1fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_1fv (GstGLShader * shader, const gchar * name,
- guint count, gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform1fv (location, count, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_1i:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @value: value to set
- *
- * Perform glUniform1i() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_1i (GstGLShader * shader, const gchar * name,
- gint value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform1i (location, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_1iv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of values to set
- * @value: (array length=count): values to set
- *
- * Perform glUniform1iv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_1iv (GstGLShader * shader, const gchar * name,
- guint count, gint * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform1iv (location, count, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_2f:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @value: value to set
- *
- * Perform glUniform2f() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_2f (GstGLShader * shader, const gchar * name,
- gfloat value0, gfloat value1)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform2f (location, value0, value1);
-}
-
-/**
- * gst_gl_shader_set_uniform_2fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of values to set
- * @value: (array length=count): values to set
- *
- * Perform glUniform2fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_2fv (GstGLShader * shader, const gchar * name,
- guint count, gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform2fv (location, count, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_2i:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @value: value to set
- *
- * Perform glUniform2i() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_2i (GstGLShader * shader, const gchar * name,
- gint v0, gint v1)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform2i (location, v0, v1);
-}
-
-/**
- * gst_gl_shader_set_uniform_2iv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of values to set
- * @value: (array length=count): values to set
- *
- * Perform glUniform2iv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_2iv (GstGLShader * shader, const gchar * name,
- guint count, gint * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform2iv (location, count, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_3f:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @value: value to set
- *
- * Perform glUniform3f() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_3f (GstGLShader * shader, const gchar * name,
- gfloat v0, gfloat v1, gfloat v2)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform3f (location, v0, v1, v2);
-}
-
-/**
- * gst_gl_shader_set_uniform_3fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of values to set
- * @value: (array length=count): values to set
- *
- * Perform glUniform3fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_3fv (GstGLShader * shader, const gchar * name,
- guint count, gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform3fv (location, count, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_3i:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @value: value to set
- *
- * Perform glUniform3i() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_3i (GstGLShader * shader, const gchar * name,
- gint v0, gint v1, gint v2)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform3i (location, v0, v1, v2);
-}
-
-/**
- * gst_gl_shader_set_uniform_3iv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of values to set
- * @value: (array length=count): values to set
- *
- * Perform glUniform3iv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_3iv (GstGLShader * shader, const gchar * name,
- guint count, gint * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform3iv (location, count, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_4f:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @value: value to set
- *
- * Perform glUniform4f() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_4f (GstGLShader * shader, const gchar * name,
- gfloat v0, gfloat v1, gfloat v2, gfloat v3)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform4f (location, v0, v1, v2, v3);
-}
-
-/**
- * gst_gl_shader_set_uniform_4fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of values to set
- * @value: (array length=count): values to set
- *
- * Perform glUniform4fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_4fv (GstGLShader * shader, const gchar * name,
- guint count, gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform4fv (location, count, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_4i:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @value: value to set
- *
- * Perform glUniform4i() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_4i (GstGLShader * shader, const gchar * name,
- gint v0, gint v1, gint v2, gint v3)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform4i (location, v0, v1, v2, v3);
-}
-
-/**
- * gst_gl_shader_set_uniform_4iv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of values to set
- * @value: (array length=count): values to set
- *
- * Perform glUniform4iv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_4iv (GstGLShader * shader, const gchar * name,
- guint count, gint * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->Uniform4iv (location, count, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_matrix_2fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of 2x2 matrices to set
- * @transpose: transpose the matrix
- * @value: values to set
- *
- * Perform glUniformMatrix2fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_matrix_2fv (GstGLShader * shader, const gchar * name,
- gint count, gboolean transpose, const gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->UniformMatrix2fv (location, count, transpose, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_matrix_3fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of 3x3 matrices to set
- * @transpose: transpose the matrix
- * @value: values to set
- *
- * Perform glUniformMatrix3fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_matrix_3fv (GstGLShader * shader, const gchar * name,
- gint count, gboolean transpose, const gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->UniformMatrix3fv (location, count, transpose, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_matrix_4fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of 4x4 matrices to set
- * @transpose: transpose the matrix
- * @value: values to set
- *
- * Perform glUniformMatrix4fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_matrix_4fv (GstGLShader * shader, const gchar * name,
- gint count, gboolean transpose, const gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->UniformMatrix4fv (location, count, transpose, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_matrix_2x3fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of 2x3 matrices to set
- * @transpose: transpose the matrix
- * @value: values to set
- *
- * Perform glUniformMatrix2x3fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader * shader,
- const gchar * name, gint count, gboolean transpose, const gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->UniformMatrix2x3fv (location, count, transpose, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_matrix_2x4fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of 2x4 matrices to set
- * @transpose: transpose the matrix
- * @value: values to set
- *
- * Perform glUniformMatrix2x4fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader * shader,
- const gchar * name, gint count, gboolean transpose, const gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->UniformMatrix2x4fv (location, count, transpose, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_matrix_3x2fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of 3x2 matrices to set
- * @transpose: transpose the matrix
- * @value: values to set
- *
- * Perform glUniformMatrix3x2fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader * shader,
- const gchar * name, gint count, gboolean transpose, const gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->UniformMatrix3x2fv (location, count, transpose, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_matrix_3x4fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of 3x4 matrices to set
- * @transpose: transpose the matrix
- * @value: values to set
- *
- * Perform glUniformMatrix3x4fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_matrix_3x4fv (GstGLShader * shader,
- const gchar * name, gint count, gboolean transpose, const gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->UniformMatrix3x4fv (location, count, transpose, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_matrix_4x2fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of 4x2 matrices to set
- * @transpose: transpose the matrix
- * @value: values to set
- *
- * Perform glUniformMatrix4x2fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_matrix_4x2fv (GstGLShader * shader,
- const gchar * name, gint count, gboolean transpose, const gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->UniformMatrix4x2fv (location, count, transpose, value);
-}
-
-/**
- * gst_gl_shader_set_uniform_matrix_4x3fv:
- * @shader: a #GstGLShader
- * @name: name of the uniform
- * @count: number of 4x3 matrices to set
- * @transpose: transpose the matrix
- * @value: values to set
- *
- * Perform glUniformMatrix4x3fv() for @name on @shader
- */
-void
-gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader * shader,
- const gchar * name, gint count, gboolean transpose, const gfloat * value)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- GLint location = -1;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- location = _get_uniform_location (shader, name);
-
- gl->UniformMatrix4x3fv (location, count, transpose, value);
-}
-
-/**
- * gst_gl_shader_get_attribute_location:
- * @shader: a #GstGLShader
- * @name: name of the attribute
- *
- * Returns: the attribute index for @name in @shader or -1 on failure
- */
-GLint
-gst_gl_shader_get_attribute_location (GstGLShader * shader, const gchar * name)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
- gint ret;
-
- g_return_val_if_fail (shader != NULL, -1);
- priv = shader->priv;
- g_return_val_if_fail (priv->program_handle != 0, -1);
-
- gl = shader->context->gl_vtable;
-
- ret = gl->GetAttribLocation (priv->program_handle, name);
-
- GST_TRACE_OBJECT (shader, "retreived program %i attribute \'%s\' location %i",
- (int) priv->program_handle, name, ret);
-
- return ret;
-}
-
-/**
- * gst_gl_shader_bind_attribute_location:
- * @shader: a #GstGLShader
- * @index: attribute index to set
- * @name: name of the attribute
- *
- * Bind attribute @name to the specified location @index using
- * glBindAttributeLocation().
- */
-void
-gst_gl_shader_bind_attribute_location (GstGLShader * shader, GLuint index,
- const gchar * name)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
-
- g_return_if_fail (shader != NULL);
- priv = shader->priv;
- g_return_if_fail (priv->program_handle != 0);
- gl = shader->context->gl_vtable;
-
- GST_TRACE_OBJECT (shader, "binding program %i attribute \'%s\' location %i",
- (int) priv->program_handle, name, index);
-
- gl->BindAttribLocation (priv->program_handle, index, name);
-}
-
-/**
- * gst_gl_shader_bind_frag_data_location:
- * @shader: a #GstGLShader
- * @index: attribute index to set
- * @name: name of the attribute
- *
- * Bind attribute @name to the specified location @index using
- * glBindFragDataLocation().
- */
-void
-gst_gl_shader_bind_frag_data_location (GstGLShader * shader,
- guint index, const gchar * name)
-{
- GstGLShaderPrivate *priv;
- GstGLFuncs *gl;
-
- g_return_if_fail (shader != NULL);
- if (!_ensure_program (shader))
- g_return_if_fail (shader->priv->program_handle);
- priv = shader->priv;
- gl = shader->context->gl_vtable;
- g_return_if_fail (gl->BindFragDataLocation);
-
- GST_TRACE_OBJECT (shader, "binding program %i frag data \'%s\' location %i",
- (int) priv->program_handle, name, index);
-
- gl->BindFragDataLocation (priv->program_handle, index, name);
-}
diff --git a/gst-libs/gst/gl/gstglshader.h b/gst-libs/gst/gl/gstglshader.h
deleted file mode 100644
index 0e4912373..000000000
--- a/gst-libs/gst/gl/gstglshader.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
- * Copyright (C) 2014 Julien Isorce <julien.isorce@collabora.co.uk>
- *
- * 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_SHADER_H__
-#define __GST_GL_SHADER_H__
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_shader_get_type (void);
-#define GST_TYPE_GL_SHADER (gst_gl_shader_get_type())
-
-/* FIXME: remove this when moving to -base */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_GL_TYPE_SHADER GST_TYPE_GL_SHADER
-#endif
-#define GST_GL_SHADER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_SHADER, GstGLShader))
-#define GST_GL_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_SHADER, GstGLShaderClass))
-#define GST_IS_GL_SHADER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_SHADER))
-#define GST_IS_GL_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_SHADER))
-#define GST_GL_SHADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_SHADER, GstGLShaderClass))
-
-struct _GstGLShader
-{
- GstObject parent;
-
- GstGLContext *context;
-
- /*< private >*/
- GstGLShaderPrivate *priv;
-
- gpointer _padding[GST_PADDING];
-};
-
-struct _GstGLShaderClass {
- /*< private >*/
- GstObjectClass parent_class;
-};
-
-GST_EXPORT
-GstGLShader * gst_gl_shader_new (GstGLContext *context);
-GST_EXPORT
-GstGLShader * gst_gl_shader_new_with_stages (GstGLContext * context, GError ** error, ...);
-GST_EXPORT
-GstGLShader * gst_gl_shader_new_link_with_stages (GstGLContext * context, GError ** error, ...);
-GST_EXPORT
-GstGLShader * gst_gl_shader_new_default (GstGLContext * context, GError ** error);
-
-GST_EXPORT
-gboolean gst_gl_shader_attach (GstGLShader * shader, GstGLSLStage * stage);
-GST_EXPORT
-gboolean gst_gl_shader_attach_unlocked (GstGLShader * shader, GstGLSLStage * stage);
-
-GST_EXPORT
-void gst_gl_shader_detach (GstGLShader * shader, GstGLSLStage * stage);
-GST_EXPORT
-void gst_gl_shader_detach_unlocked (GstGLShader * shader, GstGLSLStage * stage);
-
-GST_EXPORT
-gboolean gst_gl_shader_compile_attach_stage (GstGLShader * shader,
- GstGLSLStage *stage,
- GError ** error);
-GST_EXPORT
-gboolean gst_gl_shader_link (GstGLShader * shader, GError ** error);
-GST_EXPORT
-gboolean gst_gl_shader_is_linked (GstGLShader *shader);
-
-GST_EXPORT
-int gst_gl_shader_get_program_handle (GstGLShader * shader);
-
-GST_EXPORT
-void gst_gl_shader_release (GstGLShader *shader);
-GST_EXPORT
-void gst_gl_shader_release_unlocked (GstGLShader * shader);
-GST_EXPORT
-void gst_gl_shader_use (GstGLShader *shader);
-GST_EXPORT
-void gst_gl_context_clear_shader (GstGLContext *context);
-
-GST_EXPORT
-void gst_gl_shader_set_uniform_1i (GstGLShader *shader, const gchar *name, gint value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_1iv (GstGLShader *shader, const gchar *name, guint count, gint *value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_1f (GstGLShader *shader, const gchar *name, gfloat value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_1fv (GstGLShader *shader, const gchar *name, guint count, gfloat *value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_2i (GstGLShader *shader, const gchar *name, gint v0, gint v1);
-GST_EXPORT
-void gst_gl_shader_set_uniform_2iv (GstGLShader *shader, const gchar *name, guint count, gint *value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_2f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1);
-GST_EXPORT
-void gst_gl_shader_set_uniform_2fv (GstGLShader *shader, const gchar *name, guint count, gfloat *value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_3i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2);
-GST_EXPORT
-void gst_gl_shader_set_uniform_3iv (GstGLShader *shader, const gchar *name, guint count, gint * value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_3f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2);
-GST_EXPORT
-void gst_gl_shader_set_uniform_3fv (GstGLShader *shader, const gchar *name, guint count, gfloat *value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_4i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2, gint v3);
-GST_EXPORT
-void gst_gl_shader_set_uniform_4iv (GstGLShader *shader, const gchar *name, guint count, gint *value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_4f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2, gfloat v3);
-GST_EXPORT
-void gst_gl_shader_set_uniform_4fv (GstGLShader *shader, const gchar *name, guint count, gfloat *value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_matrix_2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_matrix_3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_matrix_4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_matrix_3x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_matrix_4x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
-GST_EXPORT
-void gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
-
-GST_EXPORT
-gint gst_gl_shader_get_attribute_location (GstGLShader *shader, const gchar *name);
-GST_EXPORT
-void gst_gl_shader_bind_attribute_location (GstGLShader * shader, guint index, const gchar * name);
-GST_EXPORT
-void gst_gl_shader_bind_frag_data_location (GstGLShader * shader, guint index, const gchar * name);
-
-G_END_DECLS
-
-#endif /* __GST_GL_SHADER_H__ */
diff --git a/gst-libs/gst/gl/gstglshaderstrings.c b/gst-libs/gst/gl/gstglshaderstrings.c
deleted file mode 100644
index e6bf5f33c..000000000
--- a/gst-libs/gst/gl/gstglshaderstrings.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstglshaderstrings.h"
-
-/* *INDENT-OFF* */
-const gchar *gst_gl_shader_string_vertex_default =
- "attribute vec4 a_position;\n"
- "attribute vec2 a_texcoord;\n"
- "varying vec2 v_texcoord;\n"
- "void main()\n"
- "{\n"
- " gl_Position = a_position;\n"
- " v_texcoord = a_texcoord;\n"
- "}\n";
-
-const gchar *gst_gl_shader_string_vertex_mat4_texture_transform =
- "uniform mat4 u_transformation;\n"
- "attribute vec4 a_position;\n"
- "attribute vec2 a_texcoord;\n"
- "varying vec2 v_texcoord;\n"
- "void main()\n"
- "{\n"
- " gl_Position = a_position;\n"
- " v_texcoord = (u_transformation * vec4(a_texcoord, 0, 1)).xy;\n"
- "}\n";
-
-const gchar *gst_gl_shader_string_vertex_mat4_vertex_transform =
- "uniform mat4 u_transformation;\n"
- "attribute vec4 a_position;\n"
- "attribute vec2 a_texcoord;\n"
- "varying vec2 v_texcoord;\n"
- "void main()\n"
- "{\n"
- " gl_Position = u_transformation * a_position;\n"
- " v_texcoord = a_texcoord;\n"
- "}\n";
-
-const gchar *gst_gl_shader_string_fragment_default =
- "#ifdef GL_ES\n"
- "precision mediump float;\n"
- "#endif\n"
- "varying vec2 v_texcoord;\n"
- "uniform sampler2D tex;\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = texture2D(tex, v_texcoord);\n"
- "}";
-
-const gchar *gst_gl_shader_string_fragment_external_oes_default =
- "#extension GL_OES_EGL_image_external : require\n"
- "#ifdef GL_ES\n"
- "precision mediump float;\n"
- "#endif\n"
- "varying vec2 v_texcoord;\n"
- "uniform samplerExternalOES tex;\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = texture2D(tex, v_texcoord);\n"
- "}";
-/* *INDENT-ON* */
diff --git a/gst-libs/gst/gl/gstglshaderstrings.h b/gst-libs/gst/gl/gstglshaderstrings.h
deleted file mode 100644
index 48ea20085..000000000
--- a/gst-libs/gst/gl/gstglshaderstrings.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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_SHADER_STRINGS_H__
-#define __GST_GL_SHADER_STRINGS_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-const gchar *gst_gl_shader_string_vertex_default;
-GST_EXPORT
-const gchar *gst_gl_shader_string_fragment_default;
-
-GST_EXPORT
-const gchar *gst_gl_shader_string_vertex_mat4_texture_transform;
-GST_EXPORT
-const gchar *gst_gl_shader_string_vertex_mat4_vertex_transform;
-GST_EXPORT
-const gchar *gst_gl_shader_string_fragment_external_oes_default;
-
-G_END_DECLS
-
-#endif /* __GST_GL_SHADER_STRINGS_H__ */
diff --git a/gst-libs/gst/gl/gstglsl.c b/gst-libs/gst/gl/gstglsl.c
deleted file mode 100644
index 81226260f..000000000
--- a/gst-libs/gst/gl/gstglsl.c
+++ /dev/null
@@ -1,931 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gl/gl.h>
-
-#include "gstglsl.h"
-#include "gstglsl_private.h"
-
-/**
- * SECTION:gstglsl
- * @title: GstGLSL
- * @short_description: helpers for dealing with OpenGL shaders
- * @see_also: #GstGLSLStage, #GstGLShader
- */
-
-#define GST_CAT_DEFAULT gst_glsl_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-static void
-_init_debug (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glsl", 0,
- "OpenGL Shading Language");
- g_once_init_leave (&_init, 1);
- }
-}
-
-GQuark
-gst_glsl_error_quark (void)
-{
- return g_quark_from_static_string ("gst-glsl-error");
-}
-
-struct glsl_version_string
-{
- GstGLSLVersion version;
- const gchar *name;
-};
-
-static const struct glsl_version_string glsl_versions[] = {
- /* keep in sync with definition in the header */
- {GST_GLSL_VERSION_100, "100"},
- {GST_GLSL_VERSION_110, "110"},
- {GST_GLSL_VERSION_120, "120"},
- {GST_GLSL_VERSION_130, "130"},
- {GST_GLSL_VERSION_140, "140"},
- {GST_GLSL_VERSION_150, "150"},
- {GST_GLSL_VERSION_300, "300"},
- {GST_GLSL_VERSION_310, "310"},
- {GST_GLSL_VERSION_320, "320"},
- {GST_GLSL_VERSION_330, "330"},
- {GST_GLSL_VERSION_400, "400"},
- {GST_GLSL_VERSION_410, "410"},
- {GST_GLSL_VERSION_420, "420"},
- {GST_GLSL_VERSION_430, "430"},
- {GST_GLSL_VERSION_440, "440"},
- {GST_GLSL_VERSION_450, "450"},
-};
-
-struct glsl_profile_string
-{
- GstGLSLProfile profile;
- const gchar *name;
-};
-
-static const struct glsl_profile_string glsl_profiles[] = {
- /* keep in sync with definition in the header */
- {GST_GLSL_PROFILE_ES, "es"},
- {GST_GLSL_PROFILE_CORE, "core"},
- {GST_GLSL_PROFILE_COMPATIBILITY, "compatibility"},
-};
-
-/**
- * gst_glsl_version_to_string:
- * @version: a #GstGLSLVersion
- *
- * Returns: (nullable): the name of @version or %NULL on error
- */
-const gchar *
-gst_glsl_version_to_string (GstGLSLVersion version)
-{
- int i;
-
- if (version == GST_GLSL_VERSION_NONE)
- return NULL;
-
- for (i = 0; i < G_N_ELEMENTS (glsl_versions); i++) {
- if (version == glsl_versions[i].version)
- return glsl_versions[i].name;
- }
-
- return NULL;
-}
-
-/**
- * gst_glsl_version_from_string:
- * @string: a GLSL version string
- *
- * Returns: the #GstGLSLVersion of @string or %GST_GLSL_VERSION_NONE on error
- */
-GstGLSLVersion
-gst_glsl_version_from_string (const gchar * string)
-{
- gchar *str;
- int i;
-
- if (string == NULL)
- return 0;
-
- str = g_strdup (string);
- str = g_strstrip (str);
-
- for (i = 0; i < G_N_ELEMENTS (glsl_versions); i++) {
- if (g_strcmp0 (str, glsl_versions[i].name) == 0) {
- g_free (str);
- return glsl_versions[i].version;
- }
- }
-
- g_free (str);
- return 0;
-}
-
-/**
- * gst_glsl_profile_to_string:
- * @profile: a #GstGLSLProfile
- *
- * Returns: (nullable): the name for @profile or %NULL on error
- */
-const gchar *
-gst_glsl_profile_to_string (GstGLSLProfile profile)
-{
- int i;
-
- if (profile == GST_GLSL_PROFILE_NONE)
- return NULL;
-
- /* multiple profiles are not allowed */
- if ((profile & (profile - 1)) != 0)
- return NULL;
-
- for (i = 0; i < G_N_ELEMENTS (glsl_profiles); i++) {
- if (profile == glsl_profiles[i].profile)
- return glsl_profiles[i].name;
- }
-
- return NULL;
-}
-
-/**
- * gst_glsl_profile_from_string:
- * @string: a GLSL version string
- *
- * Returns: the #GstGLSLProfile of @string or %GST_GLSL_PROFILE_NONE on error
- */
-GstGLSLProfile
-gst_glsl_profile_from_string (const gchar * string)
-{
- gchar *str;
- int i;
-
- if (string == NULL)
- return GST_GLSL_PROFILE_NONE;
-
- str = g_strdup (string);
- str = g_strstrip (str);
-
- for (i = 0; i < G_N_ELEMENTS (glsl_profiles); i++) {
- if (g_strcmp0 (str, glsl_profiles[i].name) == 0) {
- g_free (str);
- return glsl_profiles[i].profile;
- }
- }
-
- g_free (str);
- return GST_GLSL_PROFILE_NONE;
-}
-
-static gboolean
-_is_valid_version_profile (GstGLSLVersion version, GstGLSLProfile profile)
-{
- if (version == GST_GLSL_VERSION_NONE)
- return TRUE;
-
- /* versions that may not need an explicit profile */
- if (version <= GST_GLSL_VERSION_150 && profile == GST_GLSL_PROFILE_NONE)
- return TRUE;
-
- /* ES versions require an ES profile */
- if (version == GST_GLSL_VERSION_100 || version == GST_GLSL_VERSION_300
- || version == GST_GLSL_VERSION_310 || version == GST_GLSL_VERSION_320)
- return profile == GST_GLSL_PROFILE_ES;
-
- /* required profile and no ES profile for normal GL contexts */
- if (version == GST_GLSL_VERSION_150 || version >= GST_GLSL_VERSION_330)
- return profile == GST_GLSL_PROFILE_NONE || profile == GST_GLSL_PROFILE_CORE
- || profile == GST_GLSL_PROFILE_COMPATIBILITY;
-
- if (version <= GST_GLSL_VERSION_140)
- return profile == GST_GLSL_PROFILE_NONE
- || profile == GST_GLSL_PROFILE_COMPATIBILITY;
-
- return FALSE;
-}
-
-/**
- * gst_glsl_version_profile_to_string:
- * @version: a #GstGLSLVersion
- * @profile: a #GstGLSLVersion
- *
- * Returns: the combined GLSL #version string for @version and @profile
- */
-gchar *
-gst_glsl_version_profile_to_string (GstGLSLVersion version,
- GstGLSLProfile profile)
-{
- const gchar *version_s, *profile_s;
-
- if (!_is_valid_version_profile (version, profile))
- return NULL;
-
- version_s = gst_glsl_version_to_string (version);
- /* no profiles in GL/ES <= 150 */
- if (version <= GST_GLSL_VERSION_140)
- profile_s = NULL;
- else
- profile_s = gst_glsl_profile_to_string (profile);
-
- if (!version_s)
- return NULL;
-
- if (profile_s)
- return g_strdup_printf ("%s %s", version_s, profile_s);
-
- return g_strdup (version_s);
-}
-
-static void
-_fixup_version_profile (GstGLSLVersion * version, GstGLSLProfile * profile)
-{
- if (*version == GST_GLSL_VERSION_100 || *version == GST_GLSL_VERSION_300
- || *version == GST_GLSL_VERSION_310 || *version == GST_GLSL_VERSION_320)
- *profile = GST_GLSL_PROFILE_ES;
- else if (*version <= GST_GLSL_VERSION_140)
- *profile = GST_GLSL_PROFILE_COMPATIBILITY;
- else if (*profile == GST_GLSL_PROFILE_NONE
- && (*version >= GST_GLSL_VERSION_150 || *version >= GST_GLSL_VERSION_330))
- *profile = GST_GLSL_PROFILE_CORE;
-}
-
-/* @str points to the start of "#version", "# version" or "#\tversion", etc */
-static const gchar *
-_check_valid_version_preprocessor_string (const gchar * str)
-{
- gint i = 0;
-
- if (!str || !str[i])
- return NULL;
-
- /* there can be whitespace between the '#' and 'version' */
- do {
- i++;
- if (str[i] == '\0' || str[i] == '\n' || str[i] == '\r')
- return NULL;
- } while (g_ascii_isspace (str[i]));
- if (g_strstr_len (&str[i], 7, "version"))
- return &str[i + 7];
-
- return NULL;
-}
-
-/**
- * gst_glsl_version_profile_from_string:
- * @string: a valid GLSL #version string
- * @version_ret: (out): resulting #GstGLSLVersion
- * @profile_ret: (out): resulting #GstGLSLVersion
- *
- * Note: this function expects either a #version GLSL preprocesser directive
- * or a valid GLSL version and/or profile.
- *
- * Returns: TRUE if a valid #version string was found, FALSE otherwise
- */
-gboolean
-gst_glsl_version_profile_from_string (const gchar * string,
- GstGLSLVersion * version_ret, GstGLSLProfile * profile_ret)
-{
- gchar *str, *version_s, *profile_s;
- GstGLSLVersion version = GST_GLSL_VERSION_NONE;
- GstGLSLProfile profile = GST_GLSL_PROFILE_NONE;
- gint i;
-
- _init_debug ();
-
- if (!string)
- goto error;
-
- str = g_strdup (string);
- version_s = g_strstrip (str);
-
- /* skip possible #version prefix */
- if (str[0] == '#') {
- if (!(version_s =
- (gchar *) _check_valid_version_preprocessor_string (version_s))) {
- GST_WARNING ("Invalid preprocesser directive detected: %s", version_s);
- g_free (str);
- goto error;
- }
- }
-
- version_s = g_strstrip (version_s);
-
- i = 0;
- while (version_s && version_s[i] != '\0' && g_ascii_isdigit (version_s[i]))
- i++;
- /* wrong version length */
- if (i != 3) {
- GST_WARNING ("version number has the wrong number of digits: %s",
- version_s);
- g_free (str);
- goto error;
- }
-
- if (version_s[i] != 0) {
- version_s[i] = '\0';
- i++;
- profile_s = &version_s[i];
- profile_s = g_strstrip (profile_s);
-
- profile = gst_glsl_profile_from_string (profile_s);
- }
- version = gst_glsl_version_from_string (version_s);
- g_free (str);
-
- /* check whether the parsed data is valid */
- if (!version) {
- GST_WARNING ("Could not map the version number to a valid GLSL version:");
- goto error;
- }
- if (!_is_valid_version_profile (version, profile)) {
- GST_WARNING ("Invalid version/profile combination specified: %s %s",
- gst_glsl_version_to_string (version),
- gst_glsl_profile_to_string (profile));
- goto error;
- }
- /* got a profile when none was expected */
- if (version <= GST_GLSL_VERSION_140 && profile != GST_GLSL_PROFILE_NONE) {
- GST_WARNING
- ("Found a profile (%s) with a version (%s) that does not support "
- "profiles", gst_glsl_version_to_string (version),
- gst_glsl_profile_to_string (profile));
- goto error;
- }
-
- _fixup_version_profile (&version, &profile);
-
- if (profile_ret)
- *profile_ret = profile;
- if (version_ret)
- *version_ret = version;
-
- return TRUE;
-
-error:
- {
- if (profile_ret)
- *profile_ret = GST_GLSL_PROFILE_NONE;
- if (version_ret)
- *version_ret = GST_GLSL_VERSION_NONE;
- return FALSE;
- }
-}
-
-/* returns the pointer in @str to the #version declaration */
-const gchar *
-_gst_glsl_shader_string_find_version (const gchar * str)
-{
- gboolean sl_comment = FALSE;
- gboolean ml_comment = FALSE;
- gboolean newline = TRUE;
- gint i = 0;
-
- _init_debug ();
-
- /* search for #version while allowing for preceeding comments/whitespace as
- * permitted by the GLSL specification */
- while (str && str[i] != '\0' && i < 1024) {
- if (str[i] == '\n' || str[i] == '\r') {
- newline = TRUE;
- sl_comment = FALSE;
- i++;
- continue;
- }
-
- if (g_ascii_isspace (str[i]))
- goto next;
-
- if (sl_comment)
- goto next;
-
- if (ml_comment) {
- if (g_strstr_len (&str[i], 2, "*/")) {
- ml_comment = FALSE;
- i++;
- }
- goto next;
- }
-
- if (g_strstr_len (&str[i], 2, "//")) {
- sl_comment = TRUE;
- i++;
- goto next;
- }
-
- if (g_strstr_len (&str[i], 2, "/*")) {
- ml_comment = TRUE;
- i++;
- goto next;
- }
-
- if (str[i] == '#') {
- if (newline && _check_valid_version_preprocessor_string (&str[i])) {
- GST_DEBUG ("found #version declaration at index %i", i);
- return &str[i];
- }
- break;
- }
-
- next:
- newline = FALSE;
- i++;
- }
-
- GST_DEBUG ("no #version declaration found in the first 1K");
-
- return NULL;
-}
-
-/**
- * gst_glsl_string_get_version_profile:
- * @s: string to search for a valid #version string
- * @version: (out): resulting #GstGLSLVersion
- * @profile: (out): resulting #GstGLSLProfile
- *
- * Note: this function first searches the first 1 kilobytes for a #version
- * preprocessor directive and then executes gst_glsl_version_profile_from_string().
- *
- * Returns: TRUE if a valid #version string was found, FALSE otherwise
- */
-gboolean
-gst_glsl_string_get_version_profile (const gchar * s, GstGLSLVersion * version,
- GstGLSLProfile * profile)
-{
- const gchar *version_profile_s;
-
- version_profile_s = _gst_glsl_shader_string_find_version (s);
- if (!version_profile_s)
- goto error;
-
- if (!gst_glsl_version_profile_from_string (version_profile_s, version,
- profile))
- goto error;
-
- return TRUE;
-
-error:
- {
- if (version)
- *version = GST_GLSL_VERSION_NONE;
- if (profile)
- *profile = GST_GLSL_PROFILE_NONE;
- return FALSE;
- }
-}
-
-/**
- * gst_gl_version_to_glsl_version:
- * @gl_api: the #GstGLAPI
- * @maj: the major GL version
- * @min: the minor GL version
- *
- * Returns: The minimum supported #GstGLSLVersion available for @gl_api, @maj and @min
- */
-GstGLSLVersion
-gst_gl_version_to_glsl_version (GstGLAPI gl_api, gint maj, gint min)
-{
- g_return_val_if_fail (gl_api != GST_GL_API_NONE, 0);
-
- _init_debug ();
-
- if (gl_api & GST_GL_API_GLES2) {
- if (maj == 2 && min == 0)
- return 100;
-
- if (maj == 3 && min >= 0 && min <= 2)
- return maj * 100 + min * 10;
-
- GST_WARNING ("unknown GLES version");
- return 0;
- }
-
- /* versions match for >= 3.3 */
- if (gl_api & (GST_GL_API_OPENGL3 | GST_GL_API_OPENGL)) {
- if (maj > 3 || (maj == 3 && min >= 3))
- return maj * 100 + min * 10;
-
- if (maj == 3 && min == 2)
- return 150;
- if (maj == 3 && min == 1)
- return 140;
- if (maj == 3 && min == 0)
- return 130;
- if (maj == 2 && min == 1)
- return 120;
- if (maj == 2 && min == 0)
- return 110;
-
- GST_WARNING ("unknown GL version");
- return 0;
- }
-
- GST_WARNING ("unknown GL API");
- return 0;
-}
-
-/**
- * gst_gl_context_supports_glsl_profile_version:
- * @context: a #GstGLContext
- * @version: a #GstGLSLVersion
- * @profile: a #GstGLSLProfile
- *
- * Returns: Whether @context supports the combination of @version with @profile
- */
-gboolean
-gst_gl_context_supports_glsl_profile_version (GstGLContext * context,
- GstGLSLVersion version, GstGLSLProfile profile)
-{
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
-
- if (!_is_valid_version_profile (version, profile))
- return FALSE;
-
- if (profile != GST_GLSL_PROFILE_NONE) {
- if (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0)) {
- if ((profile & GST_GLSL_PROFILE_ES) == 0)
- return FALSE;
- } else if ((gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL) != 0) {
- if ((profile & GST_GLSL_PROFILE_COMPATIBILITY) == 0)
- return FALSE;
- } else if ((gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL3) != 0) {
- /* GL_ARB_es2_compatibility is requried for GL3 contexts */
- if ((profile & (GST_GLSL_PROFILE_CORE | GST_GLSL_PROFILE_ES)) == 0)
- return FALSE;
- } else {
- g_assert_not_reached ();
- }
- }
-
- if (version != GST_GLSL_VERSION_NONE) {
- GstGLAPI gl_api;
- gint maj, min, glsl_version;
-
- if (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 1)) {
- if (version > GST_GLSL_VERSION_310)
- return FALSE;
- } else if (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3,
- 0)) {
- if (version > GST_GLSL_VERSION_300)
- return FALSE;
- } else if (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2,
- 0)) {
- if (version > GST_GLSL_VERSION_100)
- return FALSE;
- }
-
- gl_api = gst_gl_context_get_gl_api (context);
- gst_gl_context_get_gl_version (context, &maj, &min);
- glsl_version = gst_gl_version_to_glsl_version (gl_api, maj, min);
- if (version > glsl_version)
- return FALSE;
-
- if (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 1, 0))
- /* GL_ARB_es2_compatibility is requried for GL3 contexts */
- if (version < GST_GLSL_VERSION_150 && version != GST_GLSL_VERSION_100)
- return FALSE;
-
- if (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0)
- && version < GST_GLSL_VERSION_110)
- return FALSE;
- }
-
- return TRUE;
-}
-
-gboolean
-_gst_glsl_funcs_fill (GstGLSLFuncs * vtable, GstGLContext * context)
-{
- GstGLFuncs *gl = context->gl_vtable;
-
- if (vtable->initialized)
- return TRUE;
-
- if (gl->CreateProgram) {
- vtable->CreateProgram = gl->CreateProgram;
- vtable->DeleteProgram = gl->DeleteProgram;
- vtable->UseProgram = gl->UseProgram;
-
- vtable->CreateShader = gl->CreateShader;
- vtable->DeleteShader = gl->DeleteShader;
- vtable->AttachShader = gl->AttachShader;
- vtable->DetachShader = gl->DetachShader;
-
- vtable->GetAttachedShaders = gl->GetAttachedShaders;
-
- vtable->GetShaderInfoLog = gl->GetShaderInfoLog;
- vtable->GetShaderiv = gl->GetShaderiv;
- vtable->GetProgramInfoLog = gl->GetProgramInfoLog;
- vtable->GetProgramiv = gl->GetProgramiv;
- } else if (gl->CreateProgramObject) {
- vtable->CreateProgram = gl->CreateProgramObject;
- vtable->DeleteProgram = gl->DeleteObject;
- vtable->UseProgram = gl->UseProgramObject;
-
- vtable->CreateShader = gl->CreateShaderObject;
- vtable->DeleteShader = gl->DeleteObject;
- vtable->AttachShader = gl->AttachObject;
- vtable->DetachShader = gl->DetachObject;
-
- vtable->GetAttachedShaders = gl->GetAttachedObjects;
-
- vtable->GetShaderInfoLog = gl->GetInfoLog;
- vtable->GetShaderiv = gl->GetObjectParameteriv;
- vtable->GetProgramInfoLog = gl->GetInfoLog;
- vtable->GetProgramiv = gl->GetObjectParameteriv;
- } else {
- vtable->initialized = FALSE;
- return FALSE;
- }
-
- vtable->initialized = TRUE;
- return TRUE;
-}
-
-static gchar *
-_mangle_external_image_extension (const gchar * str, GstGLContext * context,
- GstGLTextureTarget from, GstGLTextureTarget to, GstGLSLVersion version,
- GstGLSLProfile profile)
-{
- GST_DEBUG ("is oes? %d, profile == ES? %d, version >= 300? %d, "
- "have essl3? %d", to == GST_GL_TEXTURE_TARGET_EXTERNAL_OES,
- profile == GST_GLSL_PROFILE_ES, version >= GST_GLSL_VERSION_300,
- gst_gl_context_check_feature (context,
- "GL_OES_EGL_image_external_essl3"));
-
- /* replace GL_OES_EGL_image_external with GL_OES_EGL_image_external_essl3 where supported */
- if (to == GST_GL_TEXTURE_TARGET_EXTERNAL_OES && profile == GST_GLSL_PROFILE_ES
- && version >= GST_GLSL_VERSION_300) {
- if (gst_gl_context_check_feature (context,
- "GL_OES_EGL_image_external_essl3")) {
- GRegex *regex = g_regex_new (
- /* '#extension ' with optional spacing */
- "(#[ \\t]*extension[ \\t]+)"
- /* what we're looking to replace */
- "GL_OES_EGL_image_external"
- /* ':' with optional spacing */
- "([ \\t]*:[ \\t]*"
- /* some word like require, disable, etc followed by spacing and a newline */
- "\\S+[ \\t]*\\R)",
- 0, 0, NULL);
- gchar *tmp = g_regex_replace (regex, str, -1, 0,
- "\\1GL_OES_EGL_image_external_essl3\\2", 0, NULL);
- g_regex_unref (regex);
- return tmp;
- } else {
- GST_FIXME ("Undefined situation detected. GLES3 supported but "
- "GL_OES_EGL_image_external_essl3 not supported. Falling back to the "
- "older GL_OES_EGL_image_external extension");
- return g_strdup (str);
- }
- } else {
- return g_strdup (str);
- }
-}
-
-static gchar *
-_mangle_texture_access (const gchar * str, GstGLContext * context,
- GstGLTextureTarget from, GstGLTextureTarget to, GstGLSLVersion version,
- GstGLSLProfile profile)
-{
- const gchar *from_str = NULL, *to_str = NULL;
- gchar *ret, *tmp;
- gchar *regex_find;
- GRegex *regex;
-
- if (from == GST_GL_TEXTURE_TARGET_2D)
- from_str = "texture2D";
- if (from == GST_GL_TEXTURE_TARGET_RECTANGLE)
- from_str = "texture2DRect";
- if (from == GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
- from_str = "texture2D";
-
- /* GL3 || gles3 but not when external-oes unless the image_external_essl3 extension is supported */
- if (profile == GST_GLSL_PROFILE_CORE || (profile == GST_GLSL_PROFILE_ES
- && version >= GST_GLSL_VERSION_300
- && (to != GST_GL_TEXTURE_TARGET_EXTERNAL_OES
- || gst_gl_context_check_feature (context,
- "GL_OES_EGL_image_external_essl3")))) {
- to_str = "texture";
- } else {
- if (to == GST_GL_TEXTURE_TARGET_2D)
- to_str = "texture2D";
- if (to == GST_GL_TEXTURE_TARGET_RECTANGLE)
- to_str = "texture2DRect";
- if (to == GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
- to_str = "texture2D";
- }
-
- /* followed by any amount of whitespace then a bracket */
- regex_find = g_strdup_printf ("%s(?=\\s*\\()", from_str);
- regex = g_regex_new (regex_find, 0, 0, NULL);
- tmp = g_regex_replace_literal (regex, str, -1, 0, to_str, 0, NULL);
- g_free (regex_find);
- g_regex_unref (regex);
-
- if (tmp) {
- ret = tmp;
- } else {
- GST_FIXME ("Couldn't mangle texture access successfully from %s to %s",
- from_str, to_str);
- ret = g_strdup (str);
- }
-
- return ret;
-}
-
-static gchar *
-_mangle_sampler_type (const gchar * str, GstGLTextureTarget from,
- GstGLTextureTarget to)
-{
- const gchar *from_str = NULL, *to_str = NULL;
- gchar *ret, *tmp;
- gchar *regex_find;
- GRegex *regex;
-
- if (from == GST_GL_TEXTURE_TARGET_2D)
- from_str = "sampler2D";
- if (from == GST_GL_TEXTURE_TARGET_RECTANGLE)
- from_str = "sampler2DRect";
- if (from == GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
- from_str = "samplerExternalOES";
-
- if (to == GST_GL_TEXTURE_TARGET_2D)
- to_str = "sampler2D";
- if (to == GST_GL_TEXTURE_TARGET_RECTANGLE)
- to_str = "sampler2DRect";
- if (to == GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
- to_str = "samplerExternalOES";
-
- /* followed by some whitespace */
- regex_find = g_strdup_printf ("%s(?=\\s)", from_str);
- regex = g_regex_new (regex_find, 0, 0, NULL);
- tmp = g_regex_replace_literal (regex, str, -1, 0, to_str, 0, NULL);
- g_free (regex_find);
- g_regex_unref (regex);
-
- if (tmp) {
- ret = tmp;
- } else {
- GST_FIXME ("Couldn't mangle sampler type successfully from %s to %s",
- from_str, to_str);
- ret = g_strdup (str);
- }
-
- return ret;
-}
-
-static gchar *
-_mangle_varying_attribute (const gchar * str, guint shader_type,
- GstGLSLVersion version, GstGLSLProfile profile)
-{
- if (shader_type == GL_VERTEX_SHADER) {
- if (profile == GST_GLSL_PROFILE_CORE || (profile == GST_GLSL_PROFILE_ES
- && version >= GST_GLSL_VERSION_300)) {
- gchar *tmp, *tmp2;
- GRegex *regex;
-
- /* followed by some whitespace */
- regex = g_regex_new ("varying(?=\\s)", 0, 0, NULL);
- tmp = g_regex_replace_literal (regex, str, -1, 0, "out", 0, NULL);
- g_regex_unref (regex);
-
- /* followed by some whitespace */
- regex = g_regex_new ("attribute(?=\\s)", 0, 0, NULL);
- tmp2 = g_regex_replace_literal (regex, tmp, -1, 0, "in", 0, NULL);
- g_regex_unref (regex);
-
- g_free (tmp);
- return tmp2;
- }
- } else if (shader_type == GL_FRAGMENT_SHADER) {
- if (profile == GST_GLSL_PROFILE_CORE || (profile == GST_GLSL_PROFILE_ES
- && version >= GST_GLSL_VERSION_300)) {
- gchar *tmp;
- GRegex *regex;
-
- /* followed by some whitespace */
- regex = g_regex_new ("varying(?=\\s)", 0, 0, NULL);
- tmp = g_regex_replace_literal (regex, str, -1, 0, "in", 0, NULL);
- g_regex_unref (regex);
-
- return tmp;
- }
- }
- return g_strdup (str);
-}
-
-static gchar *
-_mangle_frag_color_data (const gchar * str)
-{
- GRegex *regex;
- gchar *ret, *tmp;
-
- regex = g_regex_new ("gl_FragColor", 0, 0, NULL);
- ret = g_regex_replace_literal (regex, str, -1, 0, "fragColor", 0, NULL);
- g_regex_unref (regex);
-
- tmp = ret;
- /* search and replace 'gl_FragData[NUM]' into fragColor_NUM */
- regex = g_regex_new ("gl_FragData\\[(\\d+)\\]", 0, 0, NULL);
- ret = g_regex_replace (regex, tmp, -1, 0, "fragColor_\\1", 0, NULL);
- g_regex_unref (regex);
- g_free (tmp);
-
- return ret;
-}
-
-static void
-_mangle_version_profile_from_gl_api (GstGLContext * context,
- GstGLTextureTarget from, GstGLTextureTarget to, GstGLSLVersion * version,
- GstGLSLProfile * profile)
-{
- GstGLAPI gl_api;
- gint gl_major, gl_minor;
-
- gl_api = gst_gl_context_get_gl_api (context);
- gst_gl_context_get_gl_version (context, &gl_major, &gl_minor);
-
- *version = GST_GLSL_VERSION_NONE;
- *profile = GST_GLSL_PROFILE_NONE;
-
- if (gl_api & GST_GL_API_OPENGL3) {
- if (gl_major > 3 || gl_minor >= 3) {
- *version = GST_GLSL_VERSION_330;
- *profile = GST_GLSL_PROFILE_CORE;
- } else {
- *version = GST_GLSL_VERSION_150;
- *profile = GST_GLSL_PROFILE_NONE;
- }
- } else if (gl_api & GST_GL_API_GLES2) {
- /* We don't know which texture function to use if we have GLES3 and
- * don't have the essl3 extension */
- if (gl_major >= 3 && (to != GST_GL_TEXTURE_TARGET_EXTERNAL_OES
- || gst_gl_context_check_feature (context,
- "GL_OES_EGL_image_external_essl3"))) {
- *version = GST_GLSL_VERSION_300;
- *profile = GST_GLSL_PROFILE_ES;
- } else if (gl_major >= 2) {
- *version = GST_GLSL_VERSION_100;
- *profile = GST_GLSL_PROFILE_ES;
- }
- } else if (gl_api & GST_GL_API_OPENGL) {
- *version = GST_GLSL_VERSION_110;
- *profile = GST_GLSL_PROFILE_COMPATIBILITY;
- }
-}
-
-gchar *
-_gst_glsl_mangle_shader (const gchar * str, guint shader_type,
- GstGLTextureTarget from, GstGLTextureTarget to, GstGLContext * context,
- GstGLSLVersion * version, GstGLSLProfile * profile)
-{
- gchar *tmp, *tmp2;
-
- _init_debug ();
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
-
- _mangle_version_profile_from_gl_api (context, from, to, version, profile);
- tmp2 =
- _mangle_external_image_extension (str, context, from, to, *version,
- *profile);
- tmp = _mangle_texture_access (tmp2, context, from, to, *version, *profile);
- g_free (tmp2);
- tmp2 = _mangle_sampler_type (tmp, from, to);
- g_free (tmp);
- tmp = _mangle_varying_attribute (tmp2, shader_type, *version, *profile);
- g_free (tmp2);
- if (shader_type == GL_FRAGMENT_SHADER) {
- if ((*profile == GST_GLSL_PROFILE_ES && *version >= GST_GLSL_VERSION_300)
- || (*profile == GST_GLSL_PROFILE_CORE
- && *version >= GST_GLSL_VERSION_150)) {
- tmp2 = _mangle_frag_color_data (tmp);
- g_free (tmp);
- tmp = tmp2;
- }
- }
- return tmp;
-}
diff --git a/gst-libs/gst/gl/gstglsl.h b/gst-libs/gst/gl/gstglsl.h
deleted file mode 100644
index af837fd94..000000000
--- a/gst-libs/gst/gl/gstglsl.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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_GLSL_H__
-#define __GST_GLSL_H__
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GQuark gst_glsl_error_quark (void);
-
-/**
- * GST_GLSL_ERROR:
- *
- * Error domain for GStreamer's GLSL module. Errors in this domain will be
- * from the #GstGLSLError enumeration
- */
-#define GST_GLSL_ERROR (gst_glsl_error_quark ())
-
-/**
- * GstGLSLError:
- * @GST_GLSL_ERROR_COMPILE: Compilation error occured
- * @GST_GLSL_ERROR_LINK: Link error occured
- * @GST_GLSL_ERROR_PROGRAM: General program error occured
- *
- * Compilation stage that caused an error
- *
- * Since: 1.8
- */
-typedef enum {
- GST_GLSL_ERROR_COMPILE,
- GST_GLSL_ERROR_LINK,
- GST_GLSL_ERROR_PROGRAM,
-} GstGLSLError;
-
-/**
- * GstGLSLVersion:
- * @GST_GLSL_VERSION_NONE: no version
- * @GST_GLSL_VERSION_100: version 100 (only valid for ES)
- * @GST_GLSL_VERSION_110: version 110 (only valid for compatibility desktop GL)
- * @GST_GLSL_VERSION_120: version 120 (only valid for compatibility desktop GL)
- * @GST_GLSL_VERSION_130: version 130 (only valid for compatibility desktop GL)
- * @GST_GLSL_VERSION_140: version 140 (only valid for compatibility desktop GL)
- * @GST_GLSL_VERSION_150: version 150 (valid for compatibility/core desktop GL)
- * @GST_GLSL_VERSION_300: version 300 (only valid for ES)
- * @GST_GLSL_VERSION_310: version 310 (only valid for ES)
- * @GST_GLSL_VERSION_320: version 320 (only valid for ES)
- * @GST_GLSL_VERSION_330: version 330 (valid for compatibility/core desktop GL)
- * @GST_GLSL_VERSION_400: version 400 (valid for compatibility/core desktop GL)
- * @GST_GLSL_VERSION_410: version 410 (valid for compatibility/core desktop GL)
- * @GST_GLSL_VERSION_420: version 420 (valid for compatibility/core desktop GL)
- * @GST_GLSL_VERSION_430: version 430 (valid for compatibility/core desktop GL)
- * @GST_GLSL_VERSION_440: version 440 (valid for compatibility/core desktop GL)
- * @GST_GLSL_VERSION_450: version 450 (valid for compatibility/core desktop GL)
- *
- * GLSL version list
- *
- * Since: 1.8
- */
-typedef enum
-{
- GST_GLSL_VERSION_NONE = 0,
-
- GST_GLSL_VERSION_100 = 100, /* ES */
- GST_GLSL_VERSION_110 = 110, /* GL */
- GST_GLSL_VERSION_120 = 120, /* GL */
- GST_GLSL_VERSION_130 = 130, /* GL */
- GST_GLSL_VERSION_140 = 140, /* GL */
- GST_GLSL_VERSION_150 = 150, /* GL */
- GST_GLSL_VERSION_300 = 300, /* ES */
- GST_GLSL_VERSION_310 = 310, /* ES */
- GST_GLSL_VERSION_320 = 320, /* ES */
- GST_GLSL_VERSION_330 = 330, /* GL */
- GST_GLSL_VERSION_400 = 400, /* GL */
- GST_GLSL_VERSION_410 = 410, /* GL */
- GST_GLSL_VERSION_420 = 420, /* GL */
- GST_GLSL_VERSION_430 = 430, /* GL */
- GST_GLSL_VERSION_440 = 440, /* GL */
- GST_GLSL_VERSION_450 = 450, /* GL */
-} GstGLSLVersion;
-
-/**
- * GstGLSLProfile:
- * @GST_GLSL_PROFILE_NONE: no profile supported/available
- * @GST_GLSL_PROFILE_ES: OpenGL|ES profile
- * @GST_GLSL_PROFILE_CORE: OpenGL core profile
- * @GST_GLSL_PROFILE_COMPATIBILITY: OpenGL compatibility profile
- * @GST_GLSL_PROFILE_ANY: any OpenGL/OpenGL|ES profile
- *
- * GLSL profiles
- *
- * Since: 1.8
- */
-typedef enum
-{
- /* XXX: maybe make GstGLAPI instead */
- GST_GLSL_PROFILE_NONE = 0,
-
- GST_GLSL_PROFILE_ES = (1 << 0),
- GST_GLSL_PROFILE_CORE = (1 << 1),
- GST_GLSL_PROFILE_COMPATIBILITY = (1 << 2),
-
- GST_GLSL_PROFILE_ANY = -1,
-} GstGLSLProfile;
-
-GST_EXPORT
-GstGLSLVersion gst_glsl_version_from_string (const gchar * string);
-GST_EXPORT
-const gchar * gst_glsl_version_to_string (GstGLSLVersion version);
-
-GST_EXPORT
-GstGLSLProfile gst_glsl_profile_from_string (const gchar * string);
-GST_EXPORT
-const gchar * gst_glsl_profile_to_string (GstGLSLProfile profile);
-
-GST_EXPORT
-gchar * gst_glsl_version_profile_to_string (GstGLSLVersion version,
- GstGLSLProfile profile);
-GST_EXPORT
-gboolean gst_glsl_version_profile_from_string (const gchar * string,
- GstGLSLVersion * version,
- GstGLSLProfile * profile);
-
-GST_EXPORT
-gboolean gst_glsl_string_get_version_profile (const gchar *s,
- GstGLSLVersion * version,
- GstGLSLProfile * profile);
-
-GST_EXPORT
-GstGLSLVersion gst_gl_version_to_glsl_version (GstGLAPI gl_api, gint maj, gint min);
-GST_EXPORT
-gboolean gst_gl_context_supports_glsl_profile_version (GstGLContext * context,
- GstGLSLVersion version,
- GstGLSLProfile profile);
-
-G_END_DECLS
-
-#endif /* __GST_GLSL_H__ */
diff --git a/gst-libs/gst/gl/gstglsl_private.h b/gst-libs/gst/gl/gstglsl_private.h
deleted file mode 100644
index 992c41752..000000000
--- a/gst-libs/gst/gl/gstglsl_private.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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_GLSL_PRIVATE_H__
-#define __GST_GLSL_PRIVATE_H__
-
-#include <gst/gl/gstgl_fwd.h>
-#include <gst/gl/gstglfuncs.h>
-
-G_BEGIN_DECLS
-
-#ifndef GL_COMPILE_STATUS
-#define GL_COMPILE_STATUS 0x8B81
-#endif
-#ifndef GLhandleARB
-#define GLhandleARB GLuint
-#endif
-
-typedef struct _GstGLSLFuncs
-{
- gboolean initialized;
-
- GLuint (GSTGLAPI *CreateProgram) (void);
- void (GSTGLAPI *DeleteProgram) (GLuint program);
- void (GSTGLAPI *UseProgram) (GLuint program);
- void (GSTGLAPI *GetAttachedShaders) (GLuint program, GLsizei maxcount,
- GLsizei * count, GLuint * shaders);
-
- GLuint (GSTGLAPI *CreateShader) (GLenum shaderType);
- void (GSTGLAPI *DeleteShader) (GLuint shader);
- void (GSTGLAPI *AttachShader) (GLuint program, GLuint shader);
- void (GSTGLAPI *DetachShader) (GLuint program, GLuint shader);
-
- void (GSTGLAPI *GetShaderiv) (GLuint program, GLenum pname, GLint * params);
- void (GSTGLAPI *GetProgramiv) (GLuint program, GLenum pname, GLint * params);
- void (GSTGLAPI *GetShaderInfoLog) (GLuint shader, GLsizei maxLength,
- GLsizei * length, char *log);
- void (GSTGLAPI *GetProgramInfoLog) (GLuint shader, GLsizei maxLength,
- GLsizei * length, char *log);
-} GstGLSLFuncs;
-
-G_GNUC_INTERNAL gboolean _gst_glsl_funcs_fill (GstGLSLFuncs * vtable, GstGLContext * context);
-G_GNUC_INTERNAL const gchar * _gst_glsl_shader_string_find_version (const gchar * str);
-
-G_GNUC_INTERNAL gchar *
-_gst_glsl_mangle_shader (const gchar * str, guint shader_type, GstGLTextureTarget from,
- GstGLTextureTarget to, GstGLContext * context, GstGLSLVersion * version, GstGLSLProfile * profile);
-
-G_END_DECLS
-
-#endif /* __GST_GLSL_PRIVATE_H__ */
diff --git a/gst-libs/gst/gl/gstglslstage.c b/gst-libs/gst/gl/gstglslstage.c
deleted file mode 100644
index 0205f384f..000000000
--- a/gst-libs/gst/gl/gstglslstage.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstglslstage.h"
-
-#include "gl.h"
-#include "gstglfuncs.h"
-#include "gstglsl_private.h"
-
-#ifndef GL_GEOMETRY_SHADER
-#define GL_GEOMETRY_SHADER 0x8DD9
-#endif
-#ifndef GL_COMPUTE_SHADER
-#define GL_COMPUTE_SHADER 0x91B9
-#endif
-#ifndef GL_TESS_CONTROL_SHADER
-#define GL_TESS_CONTROL_SHADER 0x8E88
-#endif
-#ifndef GL_TESS_EVALUATION_SHADER
-#define GL_TESS_EVALUATION_SHADER 0x8E87
-#endif
-
-/**
- * SECTION:gstglslstage
- * @short_description: object for dealing with OpenGL shader stages
- * @title: GstGLSLStage
- * @see_also: #GstGLShader
- *
- * #GstGLSLStage holds and represents a single OpenGL shader stage.
- */
-
-static const gchar *es2_version_header = "#version 100\n";
-
-GST_DEBUG_CATEGORY_STATIC (gst_glsl_stage_debug);
-#define GST_CAT_DEFAULT gst_glsl_stage_debug
-
-G_DEFINE_TYPE_WITH_CODE (GstGLSLStage, gst_glsl_stage, GST_TYPE_OBJECT,
- GST_DEBUG_CATEGORY_INIT (gst_glsl_stage_debug, "glslstage", 0,
- "GLSL Stage");
- );
-
-#define GST_GLSL_STAGE_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GLSL_STAGE, GstGLSLStagePrivate))
-
-struct _GstGLSLStagePrivate
-{
- GstGLSLFuncs vtable;
-
- GLenum type;
- GLhandleARB handle;
- GstGLSLVersion version;
- GstGLSLProfile profile;
- gchar **strings;
- gint n_strings;
-
- gboolean compiled;
-};
-
-static void
-gst_glsl_stage_finalize (GObject * object)
-{
- GstGLSLStage *stage = GST_GLSL_STAGE (object);
- gint i;
-
- if (stage->context) {
- gst_object_unref (stage->context);
- stage->context = NULL;
- }
-
- for (i = 0; i < stage->priv->n_strings; i++) {
- g_free (stage->priv->strings[i]);
- }
- g_free (stage->priv->strings);
- stage->priv->strings = NULL;
-
- G_OBJECT_CLASS (gst_glsl_stage_parent_class)->finalize (object);
-}
-
-static void
-gst_glsl_stage_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_glsl_stage_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
-}
-
-static void
-gst_glsl_stage_class_init (GstGLSLStageClass * klass)
-{
- GObjectClass *obj_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (GstGLSLStagePrivate));
-
- obj_class->finalize = gst_glsl_stage_finalize;
- obj_class->set_property = gst_glsl_stage_set_property;
- obj_class->get_property = gst_glsl_stage_get_property;
-}
-
-static void
-gst_glsl_stage_init (GstGLSLStage * stage)
-{
- stage->priv = GST_GLSL_STAGE_GET_PRIVATE (stage);
-}
-
-static gboolean
-_is_valid_shader_type (GLenum type)
-{
- switch (type) {
- case GL_VERTEX_SHADER:
- case GL_FRAGMENT_SHADER:
- case GL_TESS_CONTROL_SHADER:
- case GL_TESS_EVALUATION_SHADER:
- case GL_GEOMETRY_SHADER:
- case GL_COMPUTE_SHADER:
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-static const gchar *
-_shader_type_to_string (GLenum type)
-{
- switch (type) {
- case GL_VERTEX_SHADER:
- return "vertex";
- case GL_FRAGMENT_SHADER:
- return "fragment";
- case GL_TESS_CONTROL_SHADER:
- return "tesselation control";
- case GL_TESS_EVALUATION_SHADER:
- return "tesselation evaluation";
- case GL_GEOMETRY_SHADER:
- return "geometry";
- case GL_COMPUTE_SHADER:
- return "compute";
- default:
- return "unknown";
- }
-}
-
-static gboolean
-_ensure_shader (GstGLSLStage * stage)
-{
- if (stage->priv->handle)
- return TRUE;
-
- if (!(stage->priv->handle =
- stage->priv->vtable.CreateShader (stage->priv->type)))
- return FALSE;
-
- return stage->priv->handle != 0;
-}
-
-/**
- * gst_glsl_stage_new_with_strings:
- * @context: a #GstGLContext
- * @type: the GL enum shader stage type
- * @version: the #GstGLSLVersion
- * @profile: the #GstGLSLProfile
- * @n_strings: the number of strings in @str
- * @str: an array of strings concatted together to produce a shader
- *
- * Returns: (transfer floating): a new #GstGLSLStage of the specified @type
- *
- * Since: 1.8
- */
-GstGLSLStage *
-gst_glsl_stage_new_with_strings (GstGLContext * context, guint type,
- GstGLSLVersion version, GstGLSLProfile profile, gint n_strings,
- const gchar ** str)
-{
- GstGLSLStage *stage;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
- g_return_val_if_fail (_is_valid_shader_type (type), NULL);
-
- stage = g_object_new (GST_TYPE_GLSL_STAGE, NULL);
- /* FIXME: GInittable */
- if (!_gst_glsl_funcs_fill (&stage->priv->vtable, context)) {
- gst_object_unref (stage);
- return NULL;
- }
-
- stage->context = gst_object_ref (context);
- stage->priv->type = type;
- if (!gst_glsl_stage_set_strings (stage, version, profile, n_strings, str)) {
- gst_object_unref (stage);
- return NULL;
- }
-
- return stage;
-}
-
-/**
- * gst_glsl_stage_new_with_string:
- * @context: a #GstGLContext
- * @type: the GL enum shader stage type
- * @version: the #GstGLSLVersion
- * @profile: the #GstGLSLProfile
- * @str: a shader string
- *
- * Returns: (transfer floating): a new #GstGLSLStage of the specified @type
- *
- * Since: 1.8
- */
-GstGLSLStage *
-gst_glsl_stage_new_with_string (GstGLContext * context, guint type,
- GstGLSLVersion version, GstGLSLProfile profile, const gchar * str)
-{
- return gst_glsl_stage_new_with_strings (context, type, version, profile, 1,
- &str);
-}
-
-/**
- * gst_glsl_stage_new:
- * @context: a #GstGLContext
- * @type: the GL enum shader stage type
- *
- * Returns: (transfer floating): a new #GstGLSLStage of the specified @type
- *
- * Since: 1.8
- */
-GstGLSLStage *
-gst_glsl_stage_new (GstGLContext * context, guint type)
-{
- return gst_glsl_stage_new_with_string (context, type, GST_GLSL_VERSION_NONE,
- GST_GLSL_PROFILE_NONE, NULL);
-}
-
-/**
- * gst_glsl_stage_new_with_default_vertex:
- * @context: a #GstGLContext
- *
- * Returns: (transfer floating): a new #GstGLSLStage with the default vertex shader
- *
- * Since: 1.8
- */
-GstGLSLStage *
-gst_glsl_stage_new_default_vertex (GstGLContext * context)
-{
- return gst_glsl_stage_new_with_string (context, GL_VERTEX_SHADER,
- GST_GLSL_VERSION_NONE,
- GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY,
- gst_gl_shader_string_vertex_default);
-}
-
-/**
- * gst_glsl_stage_new_with_default_fragment:
- * @context: a #GstGLContext
- *
- * Returns: (transfer floating): a new #GstGLSLStage with the default fragment shader
- *
- * Since: 1.8
- */
-GstGLSLStage *
-gst_glsl_stage_new_default_fragment (GstGLContext * context)
-{
- return gst_glsl_stage_new_with_string (context, GL_FRAGMENT_SHADER,
- GST_GLSL_VERSION_NONE,
- GST_GLSL_PROFILE_ES | GST_GLSL_PROFILE_COMPATIBILITY,
- gst_gl_shader_string_fragment_default);
-}
-
-/**
- * gst_glsl_stage_set_strings:
- * @stage: a #GstGLSLStage
- * @version: a #GstGLSLVersion
- * @profile: a #GstGLSLProfile
- * @n_strings: number of strings in @str
- * @str: (transfer none): a GLSL shader string
- *
- * Replaces the current shader string with @str.
- *
- * Since: 1.8
- */
-gboolean
-gst_glsl_stage_set_strings (GstGLSLStage * stage, GstGLSLVersion version,
- GstGLSLProfile profile, gint n_strings, const gchar ** str)
-{
- gint i;
-
- g_return_val_if_fail (GST_IS_GLSL_STAGE (stage), FALSE);
- g_return_val_if_fail (n_strings > 0, FALSE);
- g_return_val_if_fail (str != NULL, FALSE);
-
- if (!gst_gl_context_supports_glsl_profile_version (stage->context, version,
- profile)) {
- const gchar *version_str = gst_glsl_version_to_string (version);
- const gchar *profile_str = gst_glsl_profile_to_string (profile);
- GST_ERROR_OBJECT (stage, "GL context does not support version %s and "
- "profile %s", version_str, profile_str);
- return FALSE;
- }
-
- stage->priv->version = version;
- stage->priv->profile = profile;
-
- for (i = 0; i < stage->priv->n_strings; i++) {
- g_free (stage->priv->strings[i]);
- }
-
- if (stage->priv->n_strings < n_strings) {
- /* only realloc if we need more space */
- g_free (stage->priv->strings);
- stage->priv->strings = g_new0 (gchar *, n_strings);
- }
-
- for (i = 0; i < n_strings; i++)
- stage->priv->strings[i] = g_strdup (str[i]);
- stage->priv->n_strings = n_strings;
-
- return TRUE;
-}
-
-/**
- * gst_glsl_stage_get_shader_type:
- * @stage: a #GstGLSLStage
- *
- * Returns: The GL shader type for this shader stage
- *
- * Since: 1.8
- */
-guint
-gst_glsl_stage_get_shader_type (GstGLSLStage * stage)
-{
- g_return_val_if_fail (GST_IS_GLSL_STAGE (stage), 0);
-
- return stage->priv->type;
-}
-
-/**
- * gst_glsl_stage_get_handle:
- * @stage: a #GstGLSLStage
- *
- * Returns: The GL handle for this shader stage
- *
- * Since: 1.8
- */
-guint
-gst_glsl_stage_get_handle (GstGLSLStage * stage)
-{
- g_return_val_if_fail (GST_IS_GLSL_STAGE (stage), 0);
- g_return_val_if_fail (stage->priv->compiled, 0);
-
- return stage->priv->handle;
-}
-
-/**
- * gst_glsl_stage_get_version:
- * @stage: a #GstGLSLStage
- *
- * Returns: The GLSL version for the current shader stage
- *
- * Since: 1.8
- */
-GstGLSLVersion
-gst_glsl_stage_get_version (GstGLSLStage * stage)
-{
- g_return_val_if_fail (GST_IS_GLSL_STAGE (stage), 0);
-
- return stage->priv->version;
-}
-
-/**
- * gst_glsl_stage_get_profile:
- * @stage: a #GstGLSLStage
- *
- * Returns: The GLSL profile for the current shader stage
- *
- * Since: 1.8
- */
-GstGLSLProfile
-gst_glsl_stage_get_profile (GstGLSLStage * stage)
-{
- g_return_val_if_fail (GST_IS_GLSL_STAGE (stage), 0);
-
- return stage->priv->profile;
-}
-
-static void
-_maybe_prepend_version (GstGLSLStage * stage, gchar ** shader_str,
- gint * n_vertex_sources, const gchar *** vertex_sources)
-{
- gint n = *n_vertex_sources;
- gboolean add_header = FALSE;
- gint i, j;
-
- /* FIXME: this all an educated guess */
- if (gst_gl_context_check_gl_version (stage->context, GST_GL_API_OPENGL3, 3, 0)
- && (stage->priv->profile & GST_GLSL_PROFILE_ES) != 0
- && !_gst_glsl_shader_string_find_version (shader_str[0])) {
- add_header = TRUE;
- n++;
- }
-
- *vertex_sources = g_malloc0 (n * sizeof (gchar *));
-
- i = 0;
- if (add_header)
- (*vertex_sources)[i++] = es2_version_header;
-
- for (j = 0; j < stage->priv->n_strings; i++, j++)
- (*vertex_sources)[i] = shader_str[j];
- *n_vertex_sources = n;
-}
-
-struct compile
-{
- GstGLSLStage *stage;
- GError **error;
- gboolean result;
-};
-
-static void
-_compile_shader (GstGLContext * context, struct compile *data)
-{
- GstGLSLStagePrivate *priv = data->stage->priv;
- GstGLSLFuncs *vtable = &data->stage->priv->vtable;
- const GstGLFuncs *gl = context->gl_vtable;
- const gchar **vertex_sources;
- gchar info_buffer[2048];
- gint n_vertex_sources;
- GLint status;
- gint len;
- gint i;
-
- if (data->stage->priv->compiled) {
- data->result = TRUE;
- return;
- }
-
- if (!_ensure_shader (data->stage)) {
- g_set_error (data->error, GST_GLSL_ERROR, GST_GLSL_ERROR_COMPILE,
- "Failed to create shader object");
- data->result = FALSE;
- return;
- }
-
- n_vertex_sources = data->stage->priv->n_strings;
- _maybe_prepend_version (data->stage, priv->strings, &n_vertex_sources,
- &vertex_sources);
-
- GST_TRACE_OBJECT (data->stage, "compiling shader:");
- for (i = 0; i < n_vertex_sources; i++) {
- GST_TRACE_OBJECT (data->stage, "%s", vertex_sources[i]);
- }
-
- gl->ShaderSource (priv->handle, n_vertex_sources,
- (const gchar **) vertex_sources, NULL);
- gl->CompileShader (priv->handle);
- g_free (vertex_sources);
- /* FIXME: supported threaded GLSL compilers and don't destroy compilation
- * performance by getting the compilation result directly after compilation */
- status = GL_FALSE;
- vtable->GetShaderiv (priv->handle, GL_COMPILE_STATUS, &status);
-
- len = 0;
- vtable->GetShaderInfoLog (priv->handle, sizeof (info_buffer) - 1, &len,
- info_buffer);
- info_buffer[len] = '\0';
-
- if (status != GL_TRUE) {
- GST_ERROR_OBJECT (data->stage, "%s shader compilation failed:%s",
- _shader_type_to_string (priv->type), info_buffer);
-
- g_set_error (data->error, GST_GLSL_ERROR, GST_GLSL_ERROR_COMPILE,
- "%s shader compilation failed:%s",
- _shader_type_to_string (priv->type), info_buffer);
-
- vtable->DeleteShader (priv->handle);
- data->result = FALSE;
- return;
- } else if (len > 1) {
- GST_FIXME_OBJECT (data->stage, "%s shader info log:%s",
- _shader_type_to_string (priv->type), info_buffer);
- }
-
- data->result = TRUE;
-}
-
-/**
- * gst_glsl_stage_compile:
- * @stage: a #GstGLSLStage
- * @error: a #GError to use on failure
- *
- * Returns: whether the compilation suceeded
- *
- * Since: 1.8
- */
-gboolean
-gst_glsl_stage_compile (GstGLSLStage * stage, GError ** error)
-{
- struct compile data;
-
- g_return_val_if_fail (GST_IS_GLSL_STAGE (stage), FALSE);
-
- if (!stage->priv->strings) {
- g_set_error (error, GST_GLSL_ERROR, GST_GLSL_ERROR_COMPILE,
- "No shader source to compile");
- return FALSE;
- }
-
- data.stage = stage;
- data.error = error;
-
- gst_gl_context_thread_add (stage->context,
- (GstGLContextThreadFunc) _compile_shader, &data);
-
- stage->priv->compiled = TRUE;
-
- return data.result;
-}
diff --git a/gst-libs/gst/gl/gstglslstage.h b/gst-libs/gst/gl/gstglslstage.h
deleted file mode 100644
index f37e8f653..000000000
--- a/gst-libs/gst/gl/gstglslstage.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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_GLSL_STAGE_H__
-#define __GST_GLSL_STAGE_H__
-
-#include <gst/gl/gstglsl.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GLSL_STAGE (gst_glsl_stage_get_type())
-#define GST_GLSL_STAGE(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GLSL_STAGE, GstGLSLStage))
-#define GST_GLSL_STAGE_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GLSL_STAGE, GstGLSLStageClass))
-#define GST_IS_GLSL_STAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GLSL_STAGE))
-#define GST_IS_GLSL_STAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GLSL_STAGE))
-#define GST_GLSL_STAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GLSL_STAGE, GstGLSLStageClass))
-
-/**
- * GstGLSLStage:
- *
- * Opaque #GstGLSLStage struct
- */
-struct _GstGLSLStage
-{
- /*< private >*/
- GstObject parent;
-
- GstGLContext *context;
-
- GstGLSLStagePrivate *priv;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLSLStageClass:
- *
- * Opaque #GstGLSLStageClass struct
- */
-struct _GstGLSLStageClass
-{
- /* <private> */
- GstObjectClass parent;
-
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GType gst_glsl_stage_get_type (void);
-GST_EXPORT
-GstGLSLStage * gst_glsl_stage_new (GstGLContext * context, guint type);
-GST_EXPORT
-GstGLSLStage * gst_glsl_stage_new_with_string (GstGLContext * context,
- guint type,
- GstGLSLVersion version,
- GstGLSLProfile profile,
- const gchar * str);
-GST_EXPORT
-GstGLSLStage * gst_glsl_stage_new_with_strings (GstGLContext * context,
- guint type,
- GstGLSLVersion version,
- GstGLSLProfile profile,
- gint n_strings,
- const gchar ** str);
-
-GST_EXPORT
-GstGLSLStage * gst_glsl_stage_new_default_fragment (GstGLContext * context);
-GST_EXPORT
-GstGLSLStage * gst_glsl_stage_new_default_vertex (GstGLContext * context);
-
-GST_EXPORT
-guint gst_glsl_stage_get_handle (GstGLSLStage * stage);
-GST_EXPORT
-GstGLSLProfile gst_glsl_stage_get_profile (GstGLSLStage * stage);
-GST_EXPORT
-GstGLSLVersion gst_glsl_stage_get_version (GstGLSLStage * stage);
-GST_EXPORT
-guint gst_glsl_stage_get_shader_type (GstGLSLStage * stage);
-GST_EXPORT
-gboolean gst_glsl_stage_set_strings (GstGLSLStage * stage,
- GstGLSLVersion version,
- GstGLSLProfile profile,
- gint n_strings,
- const gchar ** str);
-GST_EXPORT
-gboolean gst_glsl_stage_compile (GstGLSLStage * stage,
- GError ** error);
-
-G_END_DECLS
-
-#endif /* __GST_GLSL_STAGE_H__ */
diff --git a/gst-libs/gst/gl/gstglsyncmeta.c b/gst-libs/gst/gl/gstglsyncmeta.c
deleted file mode 100644
index d74b3cd46..000000000
--- a/gst-libs/gst/gl/gstglsyncmeta.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 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.
- */
-
-/**
- * SECTION:gstglsyncmeta
- * @title: GstGLSyncMeta
- * @short_description: synchronization primitives
- * @see_also: #GstGLBaseMemory, #GstGLContext
- *
- * #GstGLSyncMeta provides the ability to synchronize the OpenGL command stream
- * with the CPU or with other OpenGL contexts.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstglsyncmeta.h"
-
-#include "gstglcontext.h"
-#include "gstglfuncs.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_sync_meta_debug);
-#define GST_CAT_DEFAULT gst_gl_sync_meta_debug
-
-#ifndef GL_SYNC_GPU_COMMANDS_COMPLETE
-#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
-#endif
-#ifndef GL_SYNC_FLUSH_COMMANDS_BIT
-#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
-#endif
-#ifndef GL_TIMEOUT_EXPIRED
-#define GL_TIMEOUT_EXPIRED 0x911B
-#endif
-#ifndef GL_TIMEOUT_IGNORED
-#define GL_TIMEOUT_IGNORED G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFFFF)
-#endif
-
-static void
-_default_set_sync_gl (GstGLSyncMeta * sync_meta, GstGLContext * context)
-{
- const GstGLFuncs *gl = context->gl_vtable;
-
- if (gl->FenceSync) {
- if (sync_meta->data) {
- GST_LOG ("deleting sync object %p", sync_meta->data);
- gl->DeleteSync ((GLsync) sync_meta->data);
- }
- sync_meta->data =
- (gpointer) gl->FenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
- GST_LOG ("setting sync object %p", sync_meta->data);
- }
-
- if (gst_gl_context_is_shared (context))
- gl->Flush ();
-}
-
-static void
-_default_wait_gl (GstGLSyncMeta * sync_meta, GstGLContext * context)
-{
- const GstGLFuncs *gl = context->gl_vtable;
-
- if (sync_meta->data && gl->WaitSync) {
- GST_LOG ("waiting on sync object %p", sync_meta->data);
- gl->WaitSync ((GLsync) sync_meta->data, 0, GL_TIMEOUT_IGNORED);
- }
-}
-
-static void
-_default_wait_cpu_gl (GstGLSyncMeta * sync_meta, GstGLContext * context)
-{
- const GstGLFuncs *gl = context->gl_vtable;
- GLenum res;
-
- if (sync_meta->data && gl->ClientWaitSync) {
- do {
- GST_LOG ("waiting on sync object %p", sync_meta->data);
- res =
- gl->ClientWaitSync ((GLsync) sync_meta->data,
- GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000 /* 1s */ );
- } while (res == GL_TIMEOUT_EXPIRED);
- } else {
- gl->Finish ();
- }
-}
-
-static void
-_default_copy (GstGLSyncMeta * src, GstBuffer * sbuffer, GstGLSyncMeta * dest,
- GstBuffer * dbuffer)
-{
- GST_LOG ("copy sync object %p from meta %p to %p", src->data, src, dest);
-
- /* Setting a sync point here relies on GstBuffer copying
- * metas after data */
- gst_gl_sync_meta_set_sync_point (src, src->context);
-}
-
-static void
-_default_free_gl (GstGLSyncMeta * sync_meta, GstGLContext * context)
-{
- const GstGLFuncs *gl = context->gl_vtable;
-
- if (sync_meta->data) {
- GST_LOG ("deleting sync object %p", sync_meta->data);
- gl->DeleteSync ((GLsync) sync_meta->data);
- sync_meta->data = NULL;
- }
-}
-
-/**
- * gst_buffer_add_gl_sync_meta_full:
- * @context: a #GstGLContext
- * @buffer: a #GstBuffer
- * @data: sync data to hold
- *
- * Returns: (transfer none): the #GstGLSyncMeta added to #GstBuffer
- *
- * Since: 1.8
- */
-GstGLSyncMeta *
-gst_buffer_add_gl_sync_meta_full (GstGLContext * context, GstBuffer * buffer,
- gpointer data)
-{
- GstGLSyncMeta *meta;
-
- g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
-
- meta =
- (GstGLSyncMeta *) gst_buffer_add_meta ((buffer), GST_GL_SYNC_META_INFO,
- NULL);
-
- if (!meta)
- return NULL;
-
- meta->context = gst_object_ref (context);
- meta->data = data;
-
- return meta;
-}
-
-/**
- * gst_buffer_add_gl_sync_meta:
- * @context: a #GstGLContext
- * @buffer: a #GstBuffer
- *
- * Returns: (transfer none): the #GstGLSyncMeta added to #GstBuffer
- *
- * Since: 1.6
- */
-GstGLSyncMeta *
-gst_buffer_add_gl_sync_meta (GstGLContext * context, GstBuffer * buffer)
-{
- GstGLSyncMeta *ret = gst_buffer_add_gl_sync_meta_full (context, buffer, NULL);
- if (!ret)
- return NULL;
-
- ret->set_sync_gl = _default_set_sync_gl;
- ret->wait_gl = _default_wait_gl;
- ret->wait_cpu_gl = _default_wait_cpu_gl;
- ret->copy = _default_copy;
- ret->free_gl = _default_free_gl;
-
- return ret;
-}
-
-static void
-_set_sync_point (GstGLContext * context, GstGLSyncMeta * sync_meta)
-{
- g_assert (sync_meta->set_sync_gl != NULL);
-
- GST_LOG ("setting sync point %p", sync_meta);
- sync_meta->set_sync_gl (sync_meta, context);
-}
-
-/**
- * gst_gl_sync_meta_set_sync_point:
- * @sync_meta: a #GstGLSyncMeta
- * @context: a #GstGLContext
- *
- * Set a sync point to possibly wait on at a later time.
- *
- * Since: 1.6
- */
-void
-gst_gl_sync_meta_set_sync_point (GstGLSyncMeta * sync_meta,
- GstGLContext * context)
-{
- if (sync_meta->set_sync)
- sync_meta->set_sync (sync_meta, context);
- else
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _set_sync_point, sync_meta);
-}
-
-static void
-_wait (GstGLContext * context, GstGLSyncMeta * sync_meta)
-{
- g_assert (sync_meta->wait_gl != NULL);
-
- GST_LOG ("waiting %p", sync_meta);
- sync_meta->wait_gl (sync_meta, context);
-}
-
-/**
- * gst_gl_sync_meta_wait:
- * @sync_meta: a #GstGLSyncMeta
- * @context: a #GstGLContext
- *
- * Insert a wait into @context's command stream ensuring all previous OpenGL
- * commands before @sync_meta have completed.
- *
- * Since: 1.6
- */
-void
-gst_gl_sync_meta_wait (GstGLSyncMeta * sync_meta, GstGLContext * context)
-{
- if (sync_meta->wait)
- sync_meta->wait (sync_meta, context);
- else
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _wait, sync_meta);
-}
-
-static void
-_wait_cpu (GstGLContext * context, GstGLSyncMeta * sync_meta)
-{
- g_assert (sync_meta->wait_cpu_gl != NULL);
-
- GST_LOG ("waiting %p", sync_meta);
- sync_meta->wait_cpu_gl (sync_meta, context);
-}
-
-/**
- * gst_gl_sync_meta_wait_cpu:
- * @sync_meta: a #GstGLSyncMeta
- * @context: a #GstGLContext
- *
- * Perform a wait so that the sync point has passed from the CPU's perspective
- * What that means, is that all GL operations changing CPU-visible data before
- * the sync point are now visible.
- *
- * Since: 1.8
- */
-void
-gst_gl_sync_meta_wait_cpu (GstGLSyncMeta * sync_meta, GstGLContext * context)
-{
- if (sync_meta->wait_cpu)
- sync_meta->wait_cpu (sync_meta, context);
- else
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _wait_cpu, sync_meta);
-}
-
-static gboolean
-_gst_gl_sync_meta_transform (GstBuffer * dest, GstMeta * meta,
- GstBuffer * buffer, GQuark type, gpointer data)
-{
- GstGLSyncMeta *dmeta, *smeta;
-
- smeta = (GstGLSyncMeta *) meta;
-
- if (GST_META_TRANSFORM_IS_COPY (type)) {
- GstMetaTransformCopy *copy = data;
-
- g_assert (smeta->copy != NULL);
-
- if (!copy->region) {
- /* only copy if the complete data is copied as well */
- dmeta = gst_buffer_add_gl_sync_meta_full (smeta->context, dest, NULL);
- if (!dmeta)
- return FALSE;
-
- dmeta->set_sync = smeta->set_sync;
- dmeta->set_sync_gl = smeta->set_sync_gl;
- dmeta->wait = smeta->wait;
- dmeta->wait_gl = smeta->wait_gl;
- dmeta->wait_cpu = smeta->wait_cpu;
- dmeta->wait_cpu_gl = smeta->wait_cpu_gl;
- dmeta->copy = smeta->copy;
- dmeta->free = smeta->free;
- dmeta->free_gl = smeta->free_gl;
-
- GST_LOG ("copying sync meta %p into %p", smeta, dmeta);
- smeta->copy (smeta, buffer, dmeta, dest);
- }
- } else {
- /* return FALSE, if transform type is not supported */
- return FALSE;
- }
-
- return TRUE;
-}
-
-static void
-_free_gl_sync_meta (GstGLContext * context, GstGLSyncMeta * sync_meta)
-{
- g_assert (sync_meta->free_gl != NULL);
-
- GST_LOG ("free sync meta %p", sync_meta);
- sync_meta->free_gl (sync_meta, context);
-}
-
-static void
-_gst_gl_sync_meta_free (GstGLSyncMeta * sync_meta, GstBuffer * buffer)
-{
- if (sync_meta->free)
- sync_meta->free (sync_meta, sync_meta->context);
- else
- gst_gl_context_thread_add (sync_meta->context,
- (GstGLContextThreadFunc) _free_gl_sync_meta, sync_meta);
-
- gst_object_unref (sync_meta->context);
-}
-
-static gboolean
-_gst_gl_sync_meta_init (GstGLSyncMeta * sync_meta, gpointer params,
- GstBuffer * buffer)
-{
- static volatile gsize _init;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_INIT (gst_gl_sync_meta_debug, "glsyncmeta", 0,
- "glsyncmeta");
- g_once_init_leave (&_init, 1);
- }
-
- sync_meta->context = NULL;
- sync_meta->data = NULL;
- sync_meta->set_sync = NULL;
- sync_meta->set_sync_gl = NULL;
- sync_meta->wait = NULL;
- sync_meta->wait_gl = NULL;
- sync_meta->wait_cpu = NULL;
- sync_meta->wait_cpu_gl = NULL;
- sync_meta->copy = NULL;
- sync_meta->free = NULL;
- sync_meta->free_gl = NULL;
-
- return TRUE;
-}
-
-GType
-gst_gl_sync_meta_api_get_type (void)
-{
- static volatile GType type = 0;
- static const gchar *tags[] = { NULL };
-
- if (g_once_init_enter (&type)) {
- GType _type = gst_meta_api_type_register ("GstGLSyncMetaAPI", tags);
- g_once_init_leave (&type, _type);
- }
-
- return type;
-}
-
-const GstMetaInfo *
-gst_gl_sync_meta_get_info (void)
-{
- static const GstMetaInfo *meta_info = NULL;
-
- if (g_once_init_enter (&meta_info)) {
- const GstMetaInfo *meta =
- gst_meta_register (GST_GL_SYNC_META_API_TYPE, "GstGLSyncMeta",
- sizeof (GstGLSyncMeta), (GstMetaInitFunction) _gst_gl_sync_meta_init,
- (GstMetaFreeFunction) _gst_gl_sync_meta_free,
- _gst_gl_sync_meta_transform);
- g_once_init_leave (&meta_info, meta);
- }
-
- return meta_info;
-}
diff --git a/gst-libs/gst/gl/gstglsyncmeta.h b/gst-libs/gst/gl/gstglsyncmeta.h
deleted file mode 100644
index ea67b7910..000000000
--- a/gst-libs/gst/gl/gstglsyncmeta.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 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_SYNC_META_H__
-#define __GST_GL_SYNC_META_H__
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-#define GST_GL_SYNC_META_API_TYPE (gst_gl_sync_meta_api_get_type())
-#define GST_GL_SYNC_META_INFO (gst_gl_sync_meta_get_info())
-typedef struct _GstGLSyncMeta GstGLSyncMeta;
-
-/**
- * GST_BUFFER_POOL_OPTION_GL_SYNC_META:
- *
- * An option that can be activated on bufferpools to request OpenGL
- * synchronization metadata on buffers from the pool.
- */
-#define GST_BUFFER_POOL_OPTION_GL_SYNC_META "GstBufferPoolOptionGLSyncMeta"
-
-/**
- * GstGLSyncMeta:
- * @parent: the parent #GstMeta
- * @context: the #GstGLContext used to allocate the meta
- * @data: a custom data pointer for the implementation
- * @set_sync: set a sync point in the OpenGL command stream
- * @set_sync_gl: the same as @set_sync but called from @context's thread
- * @wait: execute a wait on the previously set sync point into the OpenGL command stream
- * @wait_gl: the same as @wait but called from @context's thread
- * @wait_cpu: wait for the previously set sync point to pass from the CPU
- * @wait_cpu_gl: the same as @wait_cpu but called from @context's thread
- * @copy: copy @data into a new #GstGLSyncMeta
- * @free: free @data
- * @free_gl: free @data in @context's thread
- */
-struct _GstGLSyncMeta
-{
- GstMeta parent;
-
- GstGLContext *context;
-
- gpointer data;
-
- void (*set_sync) (GstGLSyncMeta * sync, GstGLContext * context);
- void (*set_sync_gl) (GstGLSyncMeta * sync, GstGLContext * context);
- void (*wait) (GstGLSyncMeta * sync, GstGLContext * context);
- void (*wait_gl) (GstGLSyncMeta * sync, GstGLContext * context);
- void (*wait_cpu) (GstGLSyncMeta * sync, GstGLContext * context);
- void (*wait_cpu_gl) (GstGLSyncMeta * sync, GstGLContext * context);
- void (*copy) (GstGLSyncMeta * src, GstBuffer * sbuffer, GstGLSyncMeta * dest, GstBuffer * dbuffer);
- void (*free) (GstGLSyncMeta * sync, GstGLContext * context);
- void (*free_gl) (GstGLSyncMeta * sync, GstGLContext * context);
-};
-
-GST_EXPORT
-GType gst_gl_sync_meta_api_get_type (void);
-GST_EXPORT
-const GstMetaInfo * gst_gl_sync_meta_get_info (void);
-
-#define gst_buffer_get_gl_sync_meta(b) ((GstGLSyncMeta*)gst_buffer_get_meta((b),GST_GL_SYNC_META_API_TYPE))
-
-GST_EXPORT
-GstGLSyncMeta * gst_buffer_add_gl_sync_meta (GstGLContext * context, GstBuffer *buffer);
-GST_EXPORT
-GstGLSyncMeta * gst_buffer_add_gl_sync_meta_full (GstGLContext * context, GstBuffer * buffer,
- gpointer data);
-GST_EXPORT
-void gst_gl_sync_meta_set_sync_point (GstGLSyncMeta * sync_meta, GstGLContext * context);
-GST_EXPORT
-void gst_gl_sync_meta_wait (GstGLSyncMeta * sync_meta, GstGLContext * context);
-GST_EXPORT
-void gst_gl_sync_meta_wait_cpu (GstGLSyncMeta * sync_meta, GstGLContext * context);
-
-G_END_DECLS
-
-#endif /* __GST_GL_SYNC_META_H__ */
diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
deleted file mode 100644
index feaf2f68e..000000000
--- a/gst-libs/gst/gl/gstglupload.c
+++ /dev/null
@@ -1,1856 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012-2014 Matthew Waters <ystree00@gmail.com>
- * Copyright (C) 2017 Sebastian Dröge <sebastian@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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include "gl.h"
-#include "gstglupload.h"
-
-#if GST_GL_HAVE_PLATFORM_EGL
-#include "egl/gsteglimage.h"
-#include "egl/gstglmemoryegl.h"
-#include "egl/gstglcontext_egl.h"
-#endif
-
-#if GST_GL_HAVE_DMABUF
-#include <gst/allocators/gstdmabuf.h>
-#endif
-
-#if GST_GL_HAVE_VIV_DIRECTVIV
-#include <gst/allocators/gstphysmemory.h>
-#endif
-
-/**
- * SECTION:gstglupload
- * @title: GstGLUpload
- * @short_description: an object that uploads to GL textures
- * @see_also: #GstGLDownload, #GstGLMemory
- *
- * #GstGLUpload is an object that uploads data from system memory into GL textures.
- *
- * A #GstGLUpload can be created with gst_gl_upload_new()
- */
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug);
-#define GST_CAT_DEFAULT gst_gl_upload_debug
-
-#define DEBUG_INIT \
- GST_DEBUG_CATEGORY_INIT (gst_gl_upload_debug, "glupload", 0, "upload");
-
-G_DEFINE_TYPE_WITH_CODE (GstGLUpload, gst_gl_upload, GST_TYPE_OBJECT,
- DEBUG_INIT);
-static void gst_gl_upload_finalize (GObject * object);
-
-#define GST_GL_UPLOAD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- GST_TYPE_GL_UPLOAD, GstGLUploadPrivate))
-
-static GstGLTextureTarget
-_caps_get_texture_target (GstCaps * caps, GstGLTextureTarget default_target)
-{
- GstGLTextureTarget ret = 0;
- GstStructure *s = gst_caps_get_structure (caps, 0);
-
- if (gst_structure_has_field_typed (s, "texture-target", G_TYPE_STRING)) {
- const gchar *target_str = gst_structure_get_string (s, "texture-target");
- ret = gst_gl_texture_target_from_string (target_str);
- }
-
- if (!ret)
- ret = default_target;
-
- return ret;
-}
-
-/* Define the maximum number of planes we can upload - handle 2 views per buffer */
-#define GST_GL_UPLOAD_MAX_PLANES (GST_VIDEO_MAX_PLANES * 2)
-
-typedef struct _UploadMethod UploadMethod;
-
-struct _GstGLUploadPrivate
-{
- GstVideoInfo in_info;
- GstVideoInfo out_info;
- GstCaps *in_caps;
- GstCaps *out_caps;
-
- GstBuffer *outbuf;
-
- /* all method impl pointers */
- gpointer *upload_impl;
-
- /* current method */
- const UploadMethod *method;
- gpointer method_impl;
- int method_i;
-};
-
-static GstCaps *
-_set_caps_features_with_passthrough (const GstCaps * caps,
- const gchar * feature_name, GstCapsFeatures * passthrough)
-{
- guint i, j, m, n;
- GstCaps *tmp;
-
- tmp = gst_caps_new_empty ();
-
- n = gst_caps_get_size (caps);
- for (i = 0; i < n; i++) {
- GstCapsFeatures *features, *orig_features;
- GstStructure *s = gst_caps_get_structure (caps, i);
-
- orig_features = gst_caps_get_features (caps, i);
- features = gst_caps_features_new (feature_name, NULL);
-
- if (gst_caps_features_is_any (orig_features)) {
- /* if we have any features, we add both the features with and without @passthrough */
- gst_caps_append_structure_full (tmp, gst_structure_copy (s),
- gst_caps_features_copy (features));
-
- m = gst_caps_features_get_size (passthrough);
- for (j = 0; j < m; j++) {
- const gchar *feature = gst_caps_features_get_nth (passthrough, j);
-
- /* if we already have the features */
- if (gst_caps_features_contains (features, feature))
- continue;
-
- gst_caps_features_add (features, feature);
- }
- } else {
- m = gst_caps_features_get_size (orig_features);
- for (j = 0; j < m; j++) {
- const gchar *feature = gst_caps_features_get_nth (orig_features, j);
-
- /* if we already have the features */
- if (gst_caps_features_contains (features, feature))
- continue;
-
- if (g_strcmp0 (feature, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY) == 0)
- continue;
-
- if (gst_caps_features_contains (passthrough, feature)) {
- gst_caps_features_add (features, feature);
- }
- }
- }
-
- gst_caps_append_structure_full (tmp, gst_structure_copy (s), features);
- }
-
- return tmp;
-}
-
-static GstCaps *
-_caps_intersect_texture_target (GstCaps * caps, GstGLTextureTarget target_mask)
-{
- GValue targets = G_VALUE_INIT;
- GstCaps *ret, *target;
-
- target = gst_caps_copy (caps);
- gst_gl_value_set_texture_target_from_mask (&targets, target_mask);
- gst_caps_set_value (target, "texture-target", &targets);
-
- ret = gst_caps_intersect_full (caps, target, GST_CAPS_INTERSECT_FIRST);
-
- g_value_unset (&targets);
- gst_caps_unref (target);
- return ret;
-}
-
-typedef enum
-{
- METHOD_FLAG_CAN_SHARE_CONTEXT = 1,
-} GstGLUploadMethodFlags;
-
-struct _UploadMethod
-{
- const gchar *name;
- GstGLUploadMethodFlags flags;
-
- GstStaticCaps *input_template_caps;
-
- gpointer (*new) (GstGLUpload * upload);
- GstCaps *(*transform_caps) (gpointer impl, GstGLContext * context,
- GstPadDirection direction, GstCaps * caps);
- gboolean (*accept) (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
- GstCaps * out_caps);
- void (*propose_allocation) (gpointer impl, GstQuery * decide_query,
- GstQuery * query);
- GstGLUploadReturn (*perform) (gpointer impl, GstBuffer * buffer,
- GstBuffer ** outbuf);
- void (*free) (gpointer impl);
-} _UploadMethod;
-
-struct GLMemoryUpload
-{
- GstGLUpload *upload;
- GstGLTextureTarget input_target;
- GstGLTextureTarget output_target;
-};
-
-static gpointer
-_gl_memory_upload_new (GstGLUpload * upload)
-{
- struct GLMemoryUpload *mem = g_new0 (struct GLMemoryUpload, 1);
-
- mem->upload = upload;
- mem->input_target = GST_GL_TEXTURE_TARGET_NONE;
- mem->output_target = GST_GL_TEXTURE_TARGET_NONE;
-
- return mem;
-}
-
-static GstCaps *
-_gl_memory_upload_transform_caps (gpointer impl, GstGLContext * context,
- GstPadDirection direction, GstCaps * caps)
-{
- struct GLMemoryUpload *upload = impl;
- GstCapsFeatures *passthrough =
- gst_caps_features_from_string
- (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
- GstCaps *ret;
-
- ret =
- _set_caps_features_with_passthrough (caps,
- GST_CAPS_FEATURE_MEMORY_GL_MEMORY, passthrough);
-
- gst_caps_features_free (passthrough);
-
- if (direction == GST_PAD_SINK) {
- GstCaps *tmp;
- GstGLTextureTarget target_mask;
-
- if (upload->input_target != GST_GL_TEXTURE_TARGET_NONE) {
- target_mask = 1 << upload->input_target;
- } else {
- target_mask = 1 << GST_GL_TEXTURE_TARGET_2D |
- 1 << GST_GL_TEXTURE_TARGET_RECTANGLE |
- 1 << GST_GL_TEXTURE_TARGET_EXTERNAL_OES;
- }
-
- tmp = _caps_intersect_texture_target (ret, target_mask);
- gst_caps_unref (ret);
- ret = tmp;
- } else {
- gint i, n;
-
- n = gst_caps_get_size (ret);
- for (i = 0; i < n; i++) {
- GstStructure *s = gst_caps_get_structure (ret, i);
-
- gst_structure_remove_fields (s, "texture-target", NULL);
- }
- }
-
- return ret;
-}
-
-static gboolean
-_gl_memory_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
- GstCaps * out_caps)
-{
- struct GLMemoryUpload *upload = impl;
- GstCapsFeatures *features;
- int i;
-
- features = gst_caps_get_features (out_caps, 0);
- if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
- return FALSE;
-
- features = gst_caps_get_features (in_caps, 0);
- if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY)
- && !gst_caps_features_contains (features,
- GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY))
- return FALSE;
-
- if (buffer) {
- GstVideoInfo *in_info = &upload->upload->priv->in_info;
- guint expected_memories = GST_VIDEO_INFO_N_PLANES (in_info);
-
- /* Support stereo views for separated multiview mode */
- if (GST_VIDEO_INFO_MULTIVIEW_MODE (in_info) ==
- GST_VIDEO_MULTIVIEW_MODE_SEPARATED)
- expected_memories *= GST_VIDEO_INFO_VIEWS (in_info);
-
- if (gst_buffer_n_memory (buffer) != expected_memories)
- return FALSE;
-
- for (i = 0; i < expected_memories; i++) {
- GstMemory *mem = gst_buffer_peek_memory (buffer, i);
-
- if (!gst_is_gl_memory (mem))
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-static void
-_gl_memory_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
- GstQuery * query)
-{
- struct GLMemoryUpload *upload = impl;
- GstBufferPool *pool = NULL;
- guint n_pools, i;
- GstCaps *caps;
- GstCapsFeatures *features;
-
- gst_query_parse_allocation (query, &caps, NULL);
- if (caps == NULL)
- goto invalid_caps;
- features = gst_caps_get_features (caps, 0);
-
- /* Only offer our custom allocator if that type of memory was negotiated. */
- if (gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
- GstAllocator *allocator;
- GstAllocationParams params;
- gst_allocation_params_init (&params);
-
- allocator =
- GST_ALLOCATOR (gst_gl_memory_allocator_get_default (upload->
- upload->context));
- gst_query_add_allocation_param (query, allocator, &params);
- gst_object_unref (allocator);
-
-#if GST_GL_HAVE_PLATFORM_EGL
- if (upload->upload->context
- && gst_gl_context_get_gl_platform (upload->upload->context) ==
- GST_GL_PLATFORM_EGL) {
- allocator =
- GST_ALLOCATOR (gst_allocator_find (GST_GL_MEMORY_EGL_ALLOCATOR_NAME));
- gst_query_add_allocation_param (query, allocator, &params);
- gst_object_unref (allocator);
- }
-#endif
- }
-
- n_pools = gst_query_get_n_allocation_pools (query);
- for (i = 0; i < n_pools; i++) {
- gst_query_parse_nth_allocation_pool (query, i, &pool, NULL, NULL, NULL);
- if (!GST_IS_GL_BUFFER_POOL (pool)) {
- gst_object_unref (pool);
- pool = NULL;
- }
- }
-
- if (!pool) {
- GstStructure *config;
- GstVideoInfo info;
- gsize size;
-
-
- if (!gst_video_info_from_caps (&info, caps))
- goto invalid_caps;
-
- pool = gst_gl_buffer_pool_new (upload->upload->context);
- config = gst_buffer_pool_get_config (pool);
-
- /* the normal size of a frame */
- size = info.size;
- gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
- gst_buffer_pool_config_add_option (config,
- GST_BUFFER_POOL_OPTION_GL_SYNC_META);
- if (upload->upload->priv->out_caps) {
- GstGLTextureTarget target;
- const gchar *target_pool_option_str;
-
- target =
- _caps_get_texture_target (upload->upload->priv->out_caps,
- GST_GL_TEXTURE_TARGET_2D);
- target_pool_option_str =
- gst_gl_texture_target_to_buffer_pool_option (target);
- gst_buffer_pool_config_add_option (config, target_pool_option_str);
- }
-
- if (!gst_buffer_pool_set_config (pool, config)) {
- gst_object_unref (pool);
- goto config_failed;
- }
-
- gst_query_add_allocation_pool (query, pool, size, 1, 0);
- }
-
- if (pool)
- gst_object_unref (pool);
-
- return;
-
-invalid_caps:
- {
- GST_WARNING_OBJECT (upload->upload, "invalid caps specified");
- return;
- }
-config_failed:
- {
- GST_WARNING_OBJECT (upload->upload, "failed setting config");
- return;
- }
-}
-
-static GstGLUploadReturn
-_gl_memory_upload_perform (gpointer impl, GstBuffer * buffer,
- GstBuffer ** outbuf)
-{
- struct GLMemoryUpload *upload = impl;
- GstGLMemory *gl_mem;
- int i, n;
-
- n = gst_buffer_n_memory (buffer);
- for (i = 0; i < n; i++) {
- GstMemory *mem = gst_buffer_peek_memory (buffer, i);
-
- gl_mem = (GstGLMemory *) mem;
- if (!gst_gl_context_can_share (upload->upload->context,
- gl_mem->mem.context))
- return GST_GL_UPLOAD_UNSHARED_GL_CONTEXT;
-
- if (upload->output_target == GST_GL_TEXTURE_TARGET_NONE &&
- upload->upload->priv->out_caps) {
- upload->output_target =
- _caps_get_texture_target (upload->upload->priv->out_caps,
- GST_GL_TEXTURE_TARGET_NONE);
- }
-
- /* always track the last input texture target so ::transform_caps() can
- * use it to build the output caps */
- upload->input_target = gl_mem->tex_target;
- if (upload->output_target != gl_mem->tex_target) {
- *outbuf = NULL;
- return GST_GL_UPLOAD_RECONFIGURE;
- }
-
- if (gst_is_gl_memory_pbo (mem))
- gst_gl_memory_pbo_upload_transfer ((GstGLMemoryPBO *) mem);
- }
-
- *outbuf = gst_buffer_ref (buffer);
-
- return GST_GL_UPLOAD_DONE;
-}
-
-static void
-_gl_memory_upload_free (gpointer impl)
-{
- g_free (impl);
-}
-
-
-static GstStaticCaps _gl_memory_upload_caps =
-GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_GL_MEMORY_VIDEO_FORMATS_STR));
-
-static const UploadMethod _gl_memory_upload = {
- "GLMemory",
- METHOD_FLAG_CAN_SHARE_CONTEXT,
- &_gl_memory_upload_caps,
- &_gl_memory_upload_new,
- &_gl_memory_upload_transform_caps,
- &_gl_memory_upload_accept,
- &_gl_memory_upload_propose_allocation,
- &_gl_memory_upload_perform,
- &_gl_memory_upload_free
-};
-
-#if GST_GL_HAVE_DMABUF
-struct DmabufUpload
-{
- GstGLUpload *upload;
-
- GstEGLImage *eglimage[GST_VIDEO_MAX_PLANES];
- GstBuffer *outbuf;
- GstGLVideoAllocationParams *params;
-};
-
-static GstStaticCaps _dma_buf_upload_caps =
- GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_MEMORY_DMABUF,
- GST_GL_MEMORY_VIDEO_FORMATS_STR) ";"
- GST_VIDEO_CAPS_MAKE (GST_GL_MEMORY_VIDEO_FORMATS_STR));
-
-static gpointer
-_dma_buf_upload_new (GstGLUpload * upload)
-{
- struct DmabufUpload *dmabuf = g_new0 (struct DmabufUpload, 1);
- dmabuf->upload = upload;
- return dmabuf;
-}
-
-static GstCaps *
-_dma_buf_upload_transform_caps (gpointer impl, GstGLContext * context,
- GstPadDirection direction, GstCaps * caps)
-{
- GstCapsFeatures *passthrough =
- gst_caps_features_from_string
- (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
- GstCaps *ret;
-
- if (direction == GST_PAD_SINK) {
- GstCaps *tmp;
-
- ret =
- _set_caps_features_with_passthrough (caps,
- GST_CAPS_FEATURE_MEMORY_GL_MEMORY, passthrough);
-
- tmp = _caps_intersect_texture_target (ret, 1 << GST_GL_TEXTURE_TARGET_2D);
- gst_caps_unref (ret);
- ret = tmp;
- } else {
- gint i, n;
-
- ret =
- _set_caps_features_with_passthrough (caps,
- GST_CAPS_FEATURE_MEMORY_DMABUF, passthrough);
-
- n = gst_caps_get_size (ret);
- for (i = 0; i < n; i++) {
- GstStructure *s = gst_caps_get_structure (ret, i);
-
- gst_structure_remove_fields (s, "texture-target", NULL);
- }
- }
-
- gst_caps_features_free (passthrough);
-
- return ret;
-}
-
-static GQuark
-_eglimage_quark (gint plane)
-{
- static GQuark quark[4] = { 0 };
- static const gchar *quark_str[] = {
- "GstGLDMABufEGLImage0",
- "GstGLDMABufEGLImage1",
- "GstGLDMABufEGLImage2",
- "GstGLDMABufEGLImage3",
- };
-
- if (!quark[plane])
- quark[plane] = g_quark_from_static_string (quark_str[plane]);
-
- return quark[plane];
-}
-
-static GstEGLImage *
-_get_cached_eglimage (GstMemory * mem, gint plane)
-{
- return gst_mini_object_get_qdata (GST_MINI_OBJECT (mem),
- _eglimage_quark (plane));
-}
-
-static void
-_set_cached_eglimage (GstMemory * mem, GstEGLImage * eglimage, gint plane)
-{
- return gst_mini_object_set_qdata (GST_MINI_OBJECT (mem),
- _eglimage_quark (plane), eglimage, (GDestroyNotify) gst_egl_image_unref);
-}
-
-static gboolean
-_dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
- GstCaps * out_caps)
-{
- struct DmabufUpload *dmabuf = impl;
- GstVideoInfo *in_info = &dmabuf->upload->priv->in_info;
- guint n_planes = GST_VIDEO_INFO_N_PLANES (in_info);
- GstVideoMeta *meta;
- guint n_mem;
- guint mems_idx[GST_VIDEO_MAX_PLANES];
- gsize mems_skip[GST_VIDEO_MAX_PLANES];
- GstMemory *mems[GST_VIDEO_MAX_PLANES];
- guint i;
-
- n_mem = gst_buffer_n_memory (buffer);
- meta = gst_buffer_get_video_meta (buffer);
-
- /* dmabuf upload is only supported with EGL contexts. */
- if (gst_gl_context_get_gl_platform (dmabuf->upload->context) !=
- GST_GL_PLATFORM_EGL)
- return FALSE;
-
- if (!gst_gl_context_check_feature (dmabuf->upload->context,
- "EGL_KHR_image_base"))
- return FALSE;
-
- /* This will eliminate most non-dmabuf out there */
- if (!gst_is_dmabuf_memory (gst_buffer_peek_memory (buffer, 0)))
- return FALSE;
-
- /* We cannot have multiple dmabuf per plane */
- if (n_mem > n_planes)
- return FALSE;
-
- /* Update video info based on video meta */
- if (meta) {
- in_info->width = meta->width;
- in_info->height = meta->height;
-
- for (i = 0; i < meta->n_planes; i++) {
- in_info->offset[i] = meta->offset[i];
- in_info->stride[i] = meta->stride[i];
- }
- }
-
- if (dmabuf->params)
- gst_gl_allocation_params_free ((GstGLAllocationParams *) dmabuf->params);
- if (!(dmabuf->params =
- gst_gl_video_allocation_params_new_wrapped_gl_handle (dmabuf->
- upload->context, NULL, &dmabuf->upload->priv->in_info, -1, NULL,
- GST_GL_TEXTURE_TARGET_2D, 0, NULL, NULL, NULL)))
- return FALSE;
-
- /* Find and validate all memories */
- for (i = 0; i < n_planes; i++) {
- guint plane_size;
- guint length;
-
- plane_size = gst_gl_get_plane_data_size (in_info, NULL, i);
-
- if (!gst_buffer_find_memory (buffer, in_info->offset[i], plane_size,
- &mems_idx[i], &length, &mems_skip[i]))
- return FALSE;
-
- /* We can't have more then one dmabuf per plane */
- if (length != 1)
- return FALSE;
-
- mems[i] = gst_buffer_peek_memory (buffer, mems_idx[i]);
-
- /* And all memory found must be dmabuf */
- if (!gst_is_dmabuf_memory (mems[i]))
- return FALSE;
- }
-
- /* Now create an EGLImage for each dmabufs */
- for (i = 0; i < n_planes; i++) {
- /* check if one is cached */
- dmabuf->eglimage[i] = _get_cached_eglimage (mems[i], i);
- if (dmabuf->eglimage[i])
- continue;
-
- /* otherwise create one and cache it */
- dmabuf->eglimage[i] =
- gst_egl_image_from_dmabuf (dmabuf->upload->context,
- gst_dmabuf_memory_get_fd (mems[i]), in_info, i,
- mems[i]->offset + mems_skip[i]);
-
- if (!dmabuf->eglimage[i])
- return FALSE;
-
- _set_cached_eglimage (mems[i], dmabuf->eglimage[i], i);
- }
-
- return TRUE;
-}
-
-static void
-_dma_buf_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
- GstQuery * query)
-{
- /* nothing to do for now. */
-}
-
-static void
-_dma_buf_upload_perform_gl_thread (GstGLContext * context,
- struct DmabufUpload *dmabuf)
-{
- GstGLMemoryAllocator *allocator;
-
- allocator =
- GST_GL_MEMORY_ALLOCATOR (gst_allocator_find
- (GST_GL_MEMORY_EGL_ALLOCATOR_NAME));
-
- /* FIXME: buffer pool */
- dmabuf->outbuf = gst_buffer_new ();
- gst_gl_memory_setup_buffer (allocator, dmabuf->outbuf, dmabuf->params, NULL,
- (gpointer *) dmabuf->eglimage, gst_buffer_n_memory (dmabuf->outbuf));
- gst_object_unref (allocator);
-}
-
-static GstGLUploadReturn
-_dma_buf_upload_perform (gpointer impl, GstBuffer * buffer, GstBuffer ** outbuf)
-{
- struct DmabufUpload *dmabuf = impl;
-
- gst_gl_context_thread_add (dmabuf->upload->context,
- (GstGLContextThreadFunc) _dma_buf_upload_perform_gl_thread, dmabuf);
-
- if (!dmabuf->outbuf)
- return GST_GL_UPLOAD_ERROR;
-
- gst_buffer_add_parent_buffer_meta (dmabuf->outbuf, buffer);
-
- *outbuf = dmabuf->outbuf;
- dmabuf->outbuf = NULL;
-
- return GST_GL_UPLOAD_DONE;
-}
-
-static void
-_dma_buf_upload_free (gpointer impl)
-{
- struct DmabufUpload *dmabuf = impl;
-
- if (dmabuf->params)
- gst_gl_allocation_params_free ((GstGLAllocationParams *) dmabuf->params);
-
- g_free (impl);
-}
-
-static const UploadMethod _dma_buf_upload = {
- "Dmabuf",
- 0,
- &_dma_buf_upload_caps,
- &_dma_buf_upload_new,
- &_dma_buf_upload_transform_caps,
- &_dma_buf_upload_accept,
- &_dma_buf_upload_propose_allocation,
- &_dma_buf_upload_perform,
- &_dma_buf_upload_free
-};
-
-#endif /* GST_GL_HAVE_DMABUF */
-
-struct GLUploadMeta
-{
- GstGLUpload *upload;
-
- gboolean result;
- GstVideoGLTextureUploadMeta *meta;
- guint texture_ids[GST_GL_UPLOAD_MAX_PLANES];
- GstBufferPool *pool;
-};
-
-static gpointer
-_upload_meta_upload_new (GstGLUpload * upload)
-{
- struct GLUploadMeta *meta = g_new0 (struct GLUploadMeta, 1);
-
- meta->upload = upload;
- meta->pool = NULL;
-
- return meta;
-}
-
-static GstCaps *
-_upload_meta_upload_transform_caps (gpointer impl, GstGLContext * context,
- GstPadDirection direction, GstCaps * caps)
-{
- GstCapsFeatures *passthrough =
- gst_caps_features_from_string
- (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
- GstCaps *ret;
-
- if (direction == GST_PAD_SINK) {
- GstCaps *tmp;
-
- ret =
- _set_caps_features_with_passthrough (caps,
- GST_CAPS_FEATURE_MEMORY_GL_MEMORY, passthrough);
-
- tmp = _caps_intersect_texture_target (ret, 1 << GST_GL_TEXTURE_TARGET_2D);
- gst_caps_unref (ret);
- ret = tmp;
- } else {
- gint i, n;
-
- ret =
- _set_caps_features_with_passthrough (caps,
- GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, passthrough);
- gst_caps_set_simple (ret, "format", G_TYPE_STRING, "RGBA", NULL);
-
- n = gst_caps_get_size (ret);
- for (i = 0; i < n; i++) {
- GstStructure *s = gst_caps_get_structure (ret, i);
-
- gst_structure_remove_fields (s, "texture-target", NULL);
- }
- }
-
- gst_caps_features_free (passthrough);
-
- return ret;
-}
-
-static gboolean
-_upload_meta_upload_accept (gpointer impl, GstBuffer * buffer,
- GstCaps * in_caps, GstCaps * out_caps)
-{
- struct GLUploadMeta *upload = impl;
- GstCapsFeatures *features;
- GstVideoGLTextureUploadMeta *meta;
- gboolean ret = TRUE;
- GstStructure *config;
- gsize size;
-
- features = gst_caps_get_features (in_caps, 0);
-
- if (!gst_caps_features_contains (features,
- GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META))
- ret = FALSE;
-
- features = gst_caps_get_features (out_caps, 0);
- if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
- ret = FALSE;
-
- if (!ret)
- return ret;
-
- if (upload->pool == NULL)
- upload->pool = gst_gl_buffer_pool_new (upload->upload->context);
-
- if (!gst_buffer_pool_is_active (upload->pool)) {
- config = gst_buffer_pool_get_config (upload->pool);
-
- size = upload->upload->priv->in_info.size;
- gst_buffer_pool_config_set_params (config, in_caps, size, 0, 0);
-
- if (!gst_buffer_pool_set_config (upload->pool, config)) {
- GST_WARNING_OBJECT (upload->upload, "failed to set bufferpool config");
- return FALSE;
- }
- gst_buffer_pool_set_active (upload->pool, TRUE);
- }
-
- if (buffer) {
- if ((meta = gst_buffer_get_video_gl_texture_upload_meta (buffer)) == NULL)
- return FALSE;
-
- if (meta->texture_type[0] != GST_VIDEO_GL_TEXTURE_TYPE_RGBA) {
- GST_FIXME_OBJECT (upload, "only single rgba texture supported");
- return FALSE;
- }
-
- if (meta->texture_orientation !=
- GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL) {
- GST_FIXME_OBJECT (upload, "only x-normal, y-normal textures supported");
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-static void
-_upload_meta_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
- GstQuery * query)
-{
- struct GLUploadMeta *upload = impl;
- GstStructure *gl_context;
- gchar *platform, *gl_apis;
- gpointer handle;
-
- gl_apis =
- gst_gl_api_to_string (gst_gl_context_get_gl_api (upload->upload->
- context));
- platform =
- gst_gl_platform_to_string (gst_gl_context_get_gl_platform (upload->
- upload->context));
- handle = (gpointer) gst_gl_context_get_gl_context (upload->upload->context);
-
- gl_context =
- gst_structure_new ("GstVideoGLTextureUploadMeta", "gst.gl.GstGLContext",
- GST_TYPE_GL_CONTEXT, upload->upload->context, "gst.gl.context.handle",
- G_TYPE_POINTER, handle, "gst.gl.context.type", G_TYPE_STRING, platform,
- "gst.gl.context.apis", G_TYPE_STRING, gl_apis, NULL);
- gst_query_add_allocation_meta (query,
- GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, gl_context);
-
- g_free (gl_apis);
- g_free (platform);
- gst_structure_free (gl_context);
-}
-
-/*
- * Uploads using gst_video_gl_texture_upload_meta_upload().
- * i.e. consumer of GstVideoGLTextureUploadMeta
- */
-static void
-_do_upload_with_meta (GstGLContext * context, struct GLUploadMeta *upload)
-{
- if (!gst_video_gl_texture_upload_meta_upload (upload->meta,
- upload->texture_ids)) {
- upload->result = FALSE;
- return;
- }
-
- upload->result = TRUE;
-}
-
-static GstGLUploadReturn
-_upload_meta_upload_perform (gpointer impl, GstBuffer * buffer,
- GstBuffer ** outbuf)
-{
- struct GLUploadMeta *upload = impl;
- int i;
- GstVideoInfo *in_info = &upload->upload->priv->in_info;
- guint max_planes = GST_VIDEO_INFO_N_PLANES (in_info);
-
- /* Support stereo views for separated multiview mode */
- if (GST_VIDEO_INFO_MULTIVIEW_MODE (in_info) ==
- GST_VIDEO_MULTIVIEW_MODE_SEPARATED)
- max_planes *= GST_VIDEO_INFO_VIEWS (in_info);
-
- GST_LOG_OBJECT (upload, "Attempting upload with GstVideoGLTextureUploadMeta");
-
- upload->meta = gst_buffer_get_video_gl_texture_upload_meta (buffer);
-
- if (gst_buffer_pool_acquire_buffer (upload->pool, outbuf,
- NULL) != GST_FLOW_OK) {
- GST_WARNING_OBJECT (upload, "failed to acquire buffer from bufferpool");
- return GST_GL_UPLOAD_ERROR;
- }
-
- for (i = 0; i < GST_GL_UPLOAD_MAX_PLANES; i++) {
- guint tex_id = 0;
-
- if (i < max_planes) {
- GstMemory *mem = gst_buffer_peek_memory (*outbuf, i);
- tex_id = ((GstGLMemory *) mem)->tex_id;
- }
-
- upload->texture_ids[i] = tex_id;
- }
-
- GST_LOG ("Uploading with GLTextureUploadMeta with textures "
- "%i,%i,%i,%i / %i,%i,%i,%i",
- upload->texture_ids[0], upload->texture_ids[1],
- upload->texture_ids[2], upload->texture_ids[3],
- upload->texture_ids[4], upload->texture_ids[5],
- upload->texture_ids[6], upload->texture_ids[7]);
-
- gst_gl_context_thread_add (upload->upload->context,
- (GstGLContextThreadFunc) _do_upload_with_meta, upload);
-
- if (!upload->result)
- return GST_GL_UPLOAD_ERROR;
-
- return GST_GL_UPLOAD_DONE;
-}
-
-static void
-_upload_meta_upload_free (gpointer impl)
-{
- struct GLUploadMeta *upload = impl;
-
- g_return_if_fail (impl != NULL);
-
- if (upload->pool)
- gst_object_unref (upload->pool);
-
- g_free (upload);
-}
-
-static GstStaticCaps _upload_meta_upload_caps =
-GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "RGBA"));
-
-static const UploadMethod _upload_meta_upload = {
- "UploadMeta",
- METHOD_FLAG_CAN_SHARE_CONTEXT,
- &_upload_meta_upload_caps,
- &_upload_meta_upload_new,
- &_upload_meta_upload_transform_caps,
- &_upload_meta_upload_accept,
- &_upload_meta_upload_propose_allocation,
- &_upload_meta_upload_perform,
- &_upload_meta_upload_free
-};
-
-struct RawUploadFrame
-{
- gint ref_count;
- GstVideoFrame frame;
-};
-
-struct RawUpload
-{
- GstGLUpload *upload;
- struct RawUploadFrame *in_frame;
- GstGLVideoAllocationParams *params;
-};
-
-static struct RawUploadFrame *
-_raw_upload_frame_new (struct RawUpload *raw, GstBuffer * buffer)
-{
- struct RawUploadFrame *frame;
- GstVideoInfo *info;
- gint i;
-
- if (!buffer)
- return NULL;
-
- frame = g_slice_new (struct RawUploadFrame);
- frame->ref_count = 1;
-
- if (!gst_video_frame_map (&frame->frame, &raw->upload->priv->in_info,
- buffer, GST_MAP_READ)) {
- g_slice_free (struct RawUploadFrame, frame);
- return NULL;
- }
-
- raw->upload->priv->in_info = frame->frame.info;
- info = &raw->upload->priv->in_info;
-
- /* Recalculate the offsets (and size) */
- info->size = 0;
- for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++) {
- info->offset[i] = info->size;
- info->size += gst_gl_get_plane_data_size (info, NULL, i);
- }
-
- return frame;
-}
-
-static void
-_raw_upload_frame_ref (struct RawUploadFrame *frame)
-{
- g_atomic_int_inc (&frame->ref_count);
-}
-
-static void
-_raw_upload_frame_unref (struct RawUploadFrame *frame)
-{
- if (g_atomic_int_dec_and_test (&frame->ref_count)) {
- gst_video_frame_unmap (&frame->frame);
- g_slice_free (struct RawUploadFrame, frame);
- }
-}
-
-static gpointer
-_raw_data_upload_new (GstGLUpload * upload)
-{
- struct RawUpload *raw = g_new0 (struct RawUpload, 1);
-
- raw->upload = upload;
-
- return raw;
-}
-
-static GstCaps *
-_raw_data_upload_transform_caps (gpointer impl, GstGLContext * context,
- GstPadDirection direction, GstCaps * caps)
-{
- GstCapsFeatures *passthrough =
- gst_caps_features_from_string
- (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
- GstCaps *ret;
-
- if (direction == GST_PAD_SINK) {
- GstGLTextureTarget target_mask = 0;
- GstCaps *tmp;
-
- ret =
- _set_caps_features_with_passthrough (caps,
- GST_CAPS_FEATURE_MEMORY_GL_MEMORY, passthrough);
-
- target_mask |= 1 << GST_GL_TEXTURE_TARGET_2D;
- target_mask |= 1 << GST_GL_TEXTURE_TARGET_RECTANGLE;
- tmp = _caps_intersect_texture_target (ret, target_mask);
- gst_caps_unref (ret);
- ret = tmp;
- } else {
- gint i, n;
-
- ret =
- _set_caps_features_with_passthrough (caps,
- GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, passthrough);
-
- n = gst_caps_get_size (ret);
- for (i = 0; i < n; i++) {
- GstStructure *s = gst_caps_get_structure (ret, i);
-
- gst_structure_remove_fields (s, "texture-target", NULL);
- }
- }
-
- gst_caps_features_free (passthrough);
-
- return ret;
-}
-
-static gboolean
-_raw_data_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
- GstCaps * out_caps)
-{
- struct RawUpload *raw = impl;
- GstCapsFeatures *features;
-
- features = gst_caps_get_features (out_caps, 0);
- if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
- return FALSE;
-
- if (raw->in_frame)
- _raw_upload_frame_unref (raw->in_frame);
- raw->in_frame = _raw_upload_frame_new (raw, buffer);
-
- if (raw->params)
- gst_gl_allocation_params_free ((GstGLAllocationParams *) raw->params);
- if (!(raw->params =
- gst_gl_video_allocation_params_new_wrapped_data (raw->upload->context,
- NULL, &raw->upload->priv->in_info, -1, NULL,
- GST_GL_TEXTURE_TARGET_2D, 0, NULL, raw->in_frame,
- (GDestroyNotify) _raw_upload_frame_unref)))
- return FALSE;
-
- return (raw->in_frame != NULL);
-}
-
-static void
-_raw_data_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
- GstQuery * query)
-{
- gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
-}
-
-static GstGLUploadReturn
-_raw_data_upload_perform (gpointer impl, GstBuffer * buffer,
- GstBuffer ** outbuf)
-{
- GstGLBaseMemoryAllocator *allocator;
- struct RawUpload *raw = impl;
- int i;
- GstVideoInfo *in_info = &raw->upload->priv->in_info;
- guint n_mem = GST_VIDEO_INFO_N_PLANES (in_info);
-
- allocator =
- GST_GL_BASE_MEMORY_ALLOCATOR (gst_gl_memory_allocator_get_default
- (raw->upload->context));
-
- /* FIXME Use a buffer pool to cache the generated textures */
- /* FIXME: multiview support with separated left/right frames? */
- *outbuf = gst_buffer_new ();
- for (i = 0; i < n_mem; i++) {
- GstGLBaseMemory *tex;
-
- raw->params->parent.wrapped_data = raw->in_frame->frame.data[i];
- raw->params->plane = i;
- raw->params->tex_format =
- gst_gl_format_from_video_info (raw->upload->context, in_info, i);
-
- tex =
- gst_gl_base_memory_alloc (allocator,
- (GstGLAllocationParams *) raw->params);
- if (!tex) {
- gst_buffer_unref (*outbuf);
- *outbuf = NULL;
- GST_ERROR_OBJECT (raw->upload, "Failed to allocate wrapped texture");
- return GST_GL_UPLOAD_ERROR;
- }
-
- _raw_upload_frame_ref (raw->in_frame);
- gst_buffer_append_memory (*outbuf, (GstMemory *) tex);
- }
- gst_object_unref (allocator);
-
- _raw_upload_frame_unref (raw->in_frame);
- raw->in_frame = NULL;
- return GST_GL_UPLOAD_DONE;
-}
-
-static void
-_raw_data_upload_free (gpointer impl)
-{
- struct RawUpload *raw = impl;
-
- if (raw->params)
- gst_gl_allocation_params_free ((GstGLAllocationParams *) raw->params);
-
- g_free (raw);
-}
-
-static GstStaticCaps _raw_data_upload_caps =
-GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_GL_MEMORY_VIDEO_FORMATS_STR));
-
-static const UploadMethod _raw_data_upload = {
- "Raw Data",
- 0,
- &_raw_data_upload_caps,
- &_raw_data_upload_new,
- &_raw_data_upload_transform_caps,
- &_raw_data_upload_accept,
- &_raw_data_upload_propose_allocation,
- &_raw_data_upload_perform,
- &_raw_data_upload_free
-};
-
-#if GST_GL_HAVE_VIV_DIRECTVIV
-#ifndef GL_BGRA_EXT
-#define GL_BGRA_EXT 0x80E1
-#endif
-#ifndef GL_VIV_YV12
-#define GL_VIV_YV12 0x8FC0
-#endif
-#ifndef GL_VIV_NV12
-#define GL_VIV_NV12 0x8FC1
-#endif
-#ifndef GL_VIV_YUY2
-#define GL_VIV_YUY2 0x8FC2
-#endif
-#ifndef GL_VIV_UYVY
-#define GL_VIV_UYVY 0x8FC3
-#endif
-#ifndef GL_VIV_NV21
-#define GL_VIV_NV21 0x8FC4
-#endif
-#ifndef GL_VIV_I420
-#define GL_VIV_I420 0x8FC5
-#endif
-
-struct DirectVIVUpload
-{
- GstGLUpload *upload;
-
- GstGLVideoAllocationParams *params;
- GstBuffer *inbuf, *outbuf;
- void (*TexDirectVIVMap) (GLenum Target, GLsizei Width, GLsizei Height,
- GLenum Format, GLvoid ** Logical, const GLuint * Physical);
- void (*TexDirectInvalidateVIV) (GLenum Target);
- gboolean loaded_functions;
-};
-
-#define GST_GL_DIRECTVIV_FORMAT "{RGBA, I420, YV12, NV12, NV21, YUY2, UYVY, BGRA, RGB16}"
-
-static GstStaticCaps _directviv_upload_caps =
-GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_GL_DIRECTVIV_FORMAT));
-
-static gpointer
-_directviv_upload_new (GstGLUpload * upload)
-{
- struct DirectVIVUpload *directviv = g_new0 (struct DirectVIVUpload, 1);
- directviv->upload = upload;
- directviv->loaded_functions = FALSE;
-
- return directviv;
-}
-
-static GstCaps *
-_directviv_upload_transform_caps (gpointer impl, GstGLContext * context,
- GstPadDirection direction, GstCaps * caps)
-{
- GstCapsFeatures *passthrough =
- gst_caps_features_from_string
- (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
- GstCaps *ret;
-
- if (direction == GST_PAD_SINK) {
- GstCaps *tmp;
-
- ret =
- _set_caps_features_with_passthrough (caps,
- GST_CAPS_FEATURE_MEMORY_GL_MEMORY, passthrough);
-
- gst_caps_set_simple (ret, "format", G_TYPE_STRING, "RGBA", NULL);
- tmp = _caps_intersect_texture_target (ret, 1 << GST_GL_TEXTURE_TARGET_2D);
- gst_caps_unref (ret);
- ret = tmp;
- } else {
- GstCaps *tmp;
- tmp = gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
- (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, GST_GL_DIRECTVIV_FORMAT));
- ret =
- _set_caps_features_with_passthrough (tmp,
- GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, passthrough);
- gst_caps_unref (tmp);
- }
-
- gst_caps_features_free (passthrough);
- return ret;
-}
-
-
-static void
-_directviv_upload_load_functions_gl_thread (GstGLContext * context,
- struct DirectVIVUpload *directviv)
-{
- directviv->TexDirectVIVMap =
- gst_gl_context_get_proc_address (context, "glTexDirectVIVMap");
- directviv->TexDirectInvalidateVIV =
- gst_gl_context_get_proc_address (context, "glTexDirectInvalidateVIV");
-}
-
-static gboolean
-_directviv_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
- GstCaps * out_caps)
-{
- struct DirectVIVUpload *directviv = impl;
- GstCapsFeatures *features;
- guint n_mem;
- GstMemory *mem;
-
- if (!directviv->loaded_functions && (!directviv->TexDirectInvalidateVIV ||
- !directviv->TexDirectVIVMap)) {
- gst_gl_context_thread_add (directviv->upload->context,
- (GstGLContextThreadFunc) _directviv_upload_load_functions_gl_thread,
- directviv);
- directviv->loaded_functions = TRUE;
- }
- if (!directviv->TexDirectInvalidateVIV || !directviv->TexDirectVIVMap)
- return FALSE;
-
- features = gst_caps_get_features (out_caps, 0);
- if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
- return FALSE;
-
- if (directviv->params)
- gst_gl_allocation_params_free ((GstGLAllocationParams *) directviv->params);
- if (!(directviv->params =
- gst_gl_video_allocation_params_new (directviv->upload->context, NULL,
- &directviv->upload->priv->out_info, -1, NULL,
- GST_GL_TEXTURE_TARGET_2D, GST_VIDEO_GL_TEXTURE_TYPE_RGBA)))
- return FALSE;
-
- /* We only support a single memory per buffer at this point */
- n_mem = gst_buffer_n_memory (buffer);
- if (n_mem == 1) {
- mem = gst_buffer_peek_memory (buffer, 0);
- } else {
- mem = NULL;
- }
-
- return n_mem == 1 && mem && gst_is_phys_memory (mem);
-}
-
-static void
-_directviv_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
- GstQuery * query)
-{
-}
-
-static GLenum
-_directviv_upload_video_format_to_gl_format (GstVideoFormat format)
-{
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- return GL_VIV_I420;
- case GST_VIDEO_FORMAT_YV12:
- return GL_VIV_YV12;
- case GST_VIDEO_FORMAT_NV12:
- return GL_VIV_NV12;
- case GST_VIDEO_FORMAT_NV21:
- return GL_VIV_NV21;
- case GST_VIDEO_FORMAT_YUY2:
- return GL_VIV_YUY2;
- case GST_VIDEO_FORMAT_UYVY:
- return GL_VIV_UYVY;
- case GST_VIDEO_FORMAT_RGB16:
- return GL_RGB565;
- case GST_VIDEO_FORMAT_RGBA:
- return GL_RGBA;
- case GST_VIDEO_FORMAT_BGRA:
- return GL_BGRA_EXT;
- case GST_VIDEO_FORMAT_RGBx:
- return GL_RGBA;
- case GST_VIDEO_FORMAT_BGRx:
- return GL_BGRA_EXT;
- default:
- return 0;
- }
-}
-
-typedef struct
-{
- GstBuffer *buffer;
- GstMemory *memory;
- GstMapInfo map;
- guintptr phys_addr;
-} DirectVIVUnmapData;
-
-static void
-_directviv_memory_unmap (DirectVIVUnmapData * data)
-{
- gst_memory_unmap (data->memory, &data->map);
- gst_memory_unref (data->memory);
- gst_buffer_unref (data->buffer);
- g_free (data);
-}
-
-static void
-_directviv_upload_perform_gl_thread (GstGLContext * context,
- struct DirectVIVUpload *directviv)
-{
- static GQuark directviv_unmap_quark = 0;
- GstGLMemoryAllocator *allocator;
- GstMemory *in_mem;
- GstGLMemory *out_gl_mem;
- GstVideoInfo *in_info;
- DirectVIVUnmapData *unmap_data;
- GstVideoMeta *vmeta;
- gint width, height, gl_format;
- const GstGLFuncs *gl;
-
- if (!directviv_unmap_quark)
- directviv_unmap_quark = g_quark_from_static_string ("GstGLDirectVIVUnmap");
-
- gl = context->gl_vtable;
-
- g_assert (gst_buffer_n_memory (directviv->inbuf) == 1);
- in_info = &directviv->upload->priv->in_info;
- in_mem = gst_buffer_peek_memory (directviv->inbuf, 0);
- unmap_data = g_new0 (DirectVIVUnmapData, 1);
- if (!gst_memory_map (in_mem, &unmap_data->map, GST_MAP_READ)) {
- g_free (unmap_data);
- return;
- }
- unmap_data->phys_addr = gst_phys_memory_get_phys_addr (in_mem);
- if (!unmap_data->phys_addr) {
- gst_memory_unmap (in_mem, &unmap_data->map);
- g_free (unmap_data);
- return;
- }
- unmap_data->memory = gst_memory_ref (in_mem);
- unmap_data->buffer = gst_buffer_ref (directviv->inbuf);
-
- allocator =
- GST_GL_MEMORY_ALLOCATOR (gst_allocator_find
- (GST_GL_MEMORY_PBO_ALLOCATOR_NAME));
-
- /* FIXME: buffer pool */
- directviv->outbuf = gst_buffer_new ();
- gst_gl_memory_setup_buffer (allocator, directviv->outbuf, directviv->params,
- NULL, NULL, 0);
- gst_object_unref (allocator);
-
- out_gl_mem = (GstGLMemory *) gst_buffer_peek_memory (directviv->outbuf, 0);
-
- /* Need to keep the input memory and buffer mapped and valid until
- * the GL memory is not used anymore */
- gst_mini_object_set_qdata ((GstMiniObject *) out_gl_mem,
- directviv_unmap_quark, unmap_data,
- (GDestroyNotify) _directviv_memory_unmap);
- gst_buffer_add_parent_buffer_meta (directviv->outbuf, directviv->inbuf);
-
- /* width/height need to compensate for stride/padding */
- vmeta = gst_buffer_get_video_meta (directviv->inbuf);
- if (vmeta) {
- width = vmeta->stride[0];
- if (GST_VIDEO_INFO_N_PLANES (in_info) == 1)
- height = gst_memory_get_sizes (in_mem, NULL, NULL) / width;
- else
- height = vmeta->offset[1] / width;
- } else {
- width = GST_VIDEO_INFO_PLANE_STRIDE (in_info, 0);
- if (GST_VIDEO_INFO_N_PLANES (in_info) == 1)
- height = gst_memory_get_sizes (in_mem, NULL, NULL) / width;
- else
- height = GST_VIDEO_INFO_PLANE_OFFSET (in_info, 1) / width;
- }
- width /= GST_VIDEO_INFO_COMP_PSTRIDE (in_info, 0);
-
- gl_format =
- _directviv_upload_video_format_to_gl_format (GST_VIDEO_INFO_FORMAT
- (in_info));
-
- gl->BindTexture (GL_TEXTURE_2D, out_gl_mem->tex_id);
- directviv->TexDirectVIVMap (GL_TEXTURE_2D, width, height,
- gl_format, (void **) &unmap_data->map.data, &unmap_data->phys_addr);
- directviv->TexDirectInvalidateVIV (GL_TEXTURE_2D);
-}
-
-static GstGLUploadReturn
-_directviv_upload_perform (gpointer impl, GstBuffer * buffer,
- GstBuffer ** outbuf)
-{
- struct DirectVIVUpload *directviv = impl;
-
- directviv->inbuf = buffer;
- directviv->outbuf = NULL;
- gst_gl_context_thread_add (directviv->upload->context,
- (GstGLContextThreadFunc) _directviv_upload_perform_gl_thread, directviv);
- directviv->inbuf = NULL;
-
- if (!directviv->outbuf)
- return GST_GL_UPLOAD_ERROR;
-
- *outbuf = directviv->outbuf;
- directviv->outbuf = NULL;
-
- return GST_GL_UPLOAD_DONE;
-}
-
-static void
-_directviv_upload_free (gpointer impl)
-{
- struct DirectVIVUpload *directviv = impl;
-
- if (directviv->params)
- gst_gl_allocation_params_free ((GstGLAllocationParams *) directviv->params);
-
- g_free (impl);
-}
-
-static const UploadMethod _directviv_upload = {
- "DirectVIV",
- 0,
- &_directviv_upload_caps,
- &_directviv_upload_new,
- &_directviv_upload_transform_caps,
- &_directviv_upload_accept,
- &_directviv_upload_propose_allocation,
- &_directviv_upload_perform,
- &_directviv_upload_free
-};
-
-#endif /* GST_GL_HAVE_VIV_DIRECTVIV */
-
-static const UploadMethod *upload_methods[] = { &_gl_memory_upload,
-#if GST_GL_HAVE_DMABUF
- &_dma_buf_upload,
-#endif
-#if GST_GL_HAVE_VIV_DIRECTVIV
- &_directviv_upload,
-#endif
- &_upload_meta_upload, &_raw_data_upload
-};
-
-static GMutex upload_global_lock;
-
-GstCaps *
-gst_gl_upload_get_input_template_caps (void)
-{
- GstCaps *ret = NULL;
- gint i;
-
- g_mutex_lock (&upload_global_lock);
-
- /* FIXME: cache this and invalidate on changes to upload_methods */
- for (i = 0; i < G_N_ELEMENTS (upload_methods); i++) {
- GstCaps *template =
- gst_static_caps_get (upload_methods[i]->input_template_caps);
- ret = ret == NULL ? template : gst_caps_merge (ret, template);
- }
-
- ret = gst_caps_simplify (ret);
- ret = gst_gl_overlay_compositor_add_caps (ret);
- g_mutex_unlock (&upload_global_lock);
-
- return ret;
-}
-
-static void
-gst_gl_upload_class_init (GstGLUploadClass * klass)
-{
- g_type_class_add_private (klass, sizeof (GstGLUploadPrivate));
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_upload_finalize;
-}
-
-static void
-gst_gl_upload_init (GstGLUpload * upload)
-{
- upload->priv = GST_GL_UPLOAD_GET_PRIVATE (upload);
-}
-
-/**
- * gst_gl_upload_new:
- * @context: a #GstGLContext
- *
- * Returns: (transfer full): a new #GstGLUpload object
- */
-GstGLUpload *
-gst_gl_upload_new (GstGLContext * context)
-{
- GstGLUpload *upload = g_object_new (GST_TYPE_GL_UPLOAD, NULL);
- gint i, n;
-
- gst_object_ref_sink (upload);
-
- if (context)
- gst_gl_upload_set_context (upload, context);
- else
- upload->context = NULL;
-
- n = G_N_ELEMENTS (upload_methods);
- upload->priv->upload_impl = g_malloc (sizeof (gpointer) * n);
- for (i = 0; i < n; i++) {
- upload->priv->upload_impl[i] = upload_methods[i]->new (upload);
- }
-
- GST_DEBUG_OBJECT (upload, "Created new GLUpload for context %" GST_PTR_FORMAT,
- context);
-
- return upload;
-}
-
-void
-gst_gl_upload_set_context (GstGLUpload * upload, GstGLContext * context)
-{
- g_return_if_fail (upload != NULL);
-
- gst_object_replace ((GstObject **) & upload->context, (GstObject *) context);
-}
-
-static void
-gst_gl_upload_finalize (GObject * object)
-{
- GstGLUpload *upload;
- gint i, n;
-
- upload = GST_GL_UPLOAD (object);
-
- upload->priv->method_i = 0;
-
- if (upload->context) {
- gst_object_unref (upload->context);
- upload->context = NULL;
- }
-
- if (upload->priv->in_caps) {
- gst_caps_unref (upload->priv->in_caps);
- upload->priv->in_caps = NULL;
- }
-
- if (upload->priv->out_caps) {
- gst_caps_unref (upload->priv->out_caps);
- upload->priv->out_caps = NULL;
- }
-
- n = G_N_ELEMENTS (upload_methods);
- for (i = 0; i < n; i++) {
- if (upload->priv->upload_impl[i])
- upload_methods[i]->free (upload->priv->upload_impl[i]);
- }
- g_free (upload->priv->upload_impl);
-
- G_OBJECT_CLASS (gst_gl_upload_parent_class)->finalize (object);
-}
-
-GstCaps *
-gst_gl_upload_transform_caps (GstGLUpload * upload, GstGLContext * context,
- GstPadDirection direction, GstCaps * caps, GstCaps * filter)
-{
- GstCaps *result, *tmp;
- gint i;
-
- tmp = gst_caps_new_empty ();
-
- for (i = 0; i < G_N_ELEMENTS (upload_methods); i++) {
- GstCaps *tmp2;
-
- tmp2 =
- upload_methods[i]->transform_caps (upload->priv->upload_impl[i],
- context, direction, caps);
-
- if (tmp2)
- tmp = gst_caps_merge (tmp, tmp2);
- }
-
- if (filter) {
- result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (tmp);
- } else {
- result = tmp;
- }
-
- return result;
-}
-
-/**
- * gst_gl_upload_propose_allocation:
- * @upload: a #GstGLUpload
- * @decide_query: (allow-none): a #GstQuery from a decide allocation
- * @query: the proposed allocation query
- *
- * Adds the required allocation parameters to support uploading.
- */
-void
-gst_gl_upload_propose_allocation (GstGLUpload * upload, GstQuery * decide_query,
- GstQuery * query)
-{
- gint i;
-
- for (i = 0; i < G_N_ELEMENTS (upload_methods); i++)
- upload_methods[i]->propose_allocation (upload->priv->upload_impl[i],
- decide_query, query);
-}
-
-static gboolean
-_gst_gl_upload_set_caps_unlocked (GstGLUpload * upload, GstCaps * in_caps,
- GstCaps * out_caps)
-{
- g_return_val_if_fail (upload != NULL, FALSE);
- g_return_val_if_fail (gst_caps_is_fixed (in_caps), FALSE);
-
- if (upload->priv->in_caps && upload->priv->out_caps
- && gst_caps_is_equal (upload->priv->in_caps, in_caps)
- && gst_caps_is_equal (upload->priv->out_caps, out_caps))
- return TRUE;
-
- gst_caps_replace (&upload->priv->in_caps, in_caps);
- gst_caps_replace (&upload->priv->out_caps, out_caps);
-
- gst_video_info_from_caps (&upload->priv->in_info, in_caps);
- gst_video_info_from_caps (&upload->priv->out_info, out_caps);
-
- upload->priv->method_impl = NULL;
- upload->priv->method_i = 0;
-
- return TRUE;
-}
-
-/**
- * gst_gl_upload_set_caps:
- * @upload: a #GstGLUpload
- * @in_caps: input #GstCaps
- * @out_caps: output #GstCaps
- *
- * Initializes @upload with the information required for upload.
- *
- * Returns: whether @in_caps and @out_caps could be set on @upload
- */
-gboolean
-gst_gl_upload_set_caps (GstGLUpload * upload, GstCaps * in_caps,
- GstCaps * out_caps)
-{
- gboolean ret;
-
- GST_OBJECT_LOCK (upload);
- ret = _gst_gl_upload_set_caps_unlocked (upload, in_caps, out_caps);
- GST_OBJECT_UNLOCK (upload);
-
- return ret;
-}
-
-/**
- * gst_gl_upload_get_caps:
- * @upload: a #GstGLUpload
- * @in_caps: (transfer full) (allow-none) (out): the input #GstCaps
- * @out_caps: (transfer full) (allow-none) (out): the output #GstCaps
- */
-void
-gst_gl_upload_get_caps (GstGLUpload * upload, GstCaps ** in_caps,
- GstCaps ** out_caps)
-{
- GST_OBJECT_LOCK (upload);
- if (in_caps)
- *in_caps =
- upload->priv->in_caps ? gst_caps_ref (upload->priv->in_caps) : NULL;
- if (out_caps)
- *out_caps =
- upload->priv->out_caps ? gst_caps_ref (upload->priv->out_caps) : NULL;
- GST_OBJECT_UNLOCK (upload);
-}
-
-static gboolean
-_upload_find_method (GstGLUpload * upload)
-{
- gint method_i;
-
- if (upload->priv->method_i >= G_N_ELEMENTS (upload_methods))
- return FALSE;
-
- method_i = upload->priv->method_i;
- upload->priv->method = upload_methods[method_i];
- upload->priv->method_impl = upload->priv->upload_impl[method_i];
-
- GST_DEBUG_OBJECT (upload, "attempting upload with uploader %s",
- upload->priv->method->name);
-
- upload->priv->method_i++;
-
- return TRUE;
-}
-
-/**
- * gst_gl_upload_perform_with_buffer:
- * @upload: a #GstGLUpload
- * @buffer: input #GstBuffer
- * @outbuf_ptr: resulting #GstBuffer
- *
- * Uploads @buffer using the transformation specified by
- * gst_gl_upload_set_caps() creating a new #GstBuffer in @outbuf_ptr.
- *
- * Returns: whether the upload was successful
- */
-GstGLUploadReturn
-gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
- GstBuffer ** outbuf_ptr)
-{
- GstGLUploadReturn ret = GST_GL_UPLOAD_ERROR;
- GstBuffer *outbuf;
-
- g_return_val_if_fail (GST_IS_GL_UPLOAD (upload), FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
- g_return_val_if_fail (outbuf_ptr != NULL, FALSE);
-
- GST_OBJECT_LOCK (upload);
-
-#define NEXT_METHOD \
-do { \
- if (!_upload_find_method (upload)) { \
- GST_OBJECT_UNLOCK (upload); \
- return FALSE; \
- } \
- goto restart; \
-} while (0)
-
- if (!upload->priv->method_impl)
- _upload_find_method (upload);
-
-restart:
- if (!upload->priv->method->accept (upload->priv->method_impl, buffer,
- upload->priv->in_caps, upload->priv->out_caps))
- NEXT_METHOD;
-
- ret =
- upload->priv->method->perform (upload->priv->method_impl, buffer,
- &outbuf);
- if (ret == GST_GL_UPLOAD_UNSHARED_GL_CONTEXT) {
- gint i;
-
- for (i = 0; i < G_N_ELEMENTS (upload_methods); i++) {
- if (upload_methods[i] == &_raw_data_upload) {
- upload->priv->method = &_raw_data_upload;
- upload->priv->method_impl = upload->priv->upload_impl[i];
- upload->priv->method_i = i;
-
- break;
- }
- }
- goto restart;
- } else if (ret == GST_GL_UPLOAD_DONE || ret == GST_GL_UPLOAD_RECONFIGURE) {
- /* we are done */
- } else {
- upload->priv->method_impl = NULL;
- NEXT_METHOD;
- }
-
- if (outbuf && buffer != outbuf)
- gst_buffer_copy_into (outbuf, buffer,
- GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
- *outbuf_ptr = outbuf;
-
- GST_OBJECT_UNLOCK (upload);
-
- return ret;
-
-#undef NEXT_METHOD
-}
diff --git a/gst-libs/gst/gl/gstglupload.h b/gst-libs/gst/gl/gstglupload.h
deleted file mode 100644
index c672fe5e0..000000000
--- a/gst-libs/gst/gl/gstglupload.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystree00@gmail.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_UPLOAD_H__
-#define __GST_GL_UPLOAD_H__
-
-#include <gst/video/video.h>
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_upload_get_type (void);
-#define GST_TYPE_GL_UPLOAD (gst_gl_upload_get_type())
-#define GST_GL_UPLOAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_UPLOAD,GstGLUpload))
-#define GST_GL_UPLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_UPLOAD,GstGLUploadClass))
-#define GST_IS_GL_UPLOAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_UPLOAD))
-#define GST_IS_GL_UPLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_UPLOAD))
-#define GST_GL_UPLOAD_CAST(obj) ((GstGLUpload*)(obj))
-
-/**
- * GstGLUploadReturn:
- * @GST_GL_UPLOAD_DONE: No further processing required
- * @GST_GL_UPLOAD_ERROR: An unspecified error occured
- * @GST_GL_UPLOAD_UNSUPPORTED: The configuration is unsupported.
- * @GST_GL_UPLOAD_RECONFIGURE: This element requires a reconfiguration.
- */
-typedef enum
-{
- GST_GL_UPLOAD_DONE = 1,
-
- GST_GL_UPLOAD_ERROR = -1,
- GST_GL_UPLOAD_UNSUPPORTED = -2,
- GST_GL_UPLOAD_RECONFIGURE = -3,
- /* <private> */
- GST_GL_UPLOAD_UNSHARED_GL_CONTEXT = -100,
-} GstGLUploadReturn;
-
-/**
- * GstGLUpload
- *
- * Opaque #GstGLUpload object
- */
-struct _GstGLUpload
-{
- GstObject parent;
-
- GstGLContext *context;
-
- /* <private> */
- GstGLUploadPrivate *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-/**
- * GstGLUploadClass:
- *
- * The #GstGLUploadClass struct only contains private data
- */
-struct _GstGLUploadClass
-{
- GstObjectClass object_class;
-
- /* <private> */
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstCaps * gst_gl_upload_get_input_template_caps (void);
-
-GST_EXPORT
-GstGLUpload * gst_gl_upload_new (GstGLContext * context);
-
-GST_EXPORT
-void gst_gl_upload_set_context (GstGLUpload * upload,
- GstGLContext * context);
-
-GST_EXPORT
-GstCaps * gst_gl_upload_transform_caps (GstGLUpload * upload,
- GstGLContext * context,
- GstPadDirection direction,
- GstCaps * caps,
- GstCaps * filter);
-GST_EXPORT
-gboolean gst_gl_upload_set_caps (GstGLUpload * upload,
- GstCaps * in_caps,
- GstCaps * out_caps);
-GST_EXPORT
-void gst_gl_upload_get_caps (GstGLUpload * upload,
- GstCaps ** in_caps,
- GstCaps ** out_caps);
-GST_EXPORT
-void gst_gl_upload_propose_allocation (GstGLUpload * upload,
- GstQuery * decide_query,
- GstQuery * query);
-
-GST_EXPORT
-GstGLUploadReturn gst_gl_upload_perform_with_buffer (GstGLUpload * upload,
- GstBuffer * buffer,
- GstBuffer ** outbuf_ptr);
-
-G_END_DECLS
-
-#endif /* __GST_GL_UPLOAD_H__ */
diff --git a/gst-libs/gst/gl/gstglutils.c b/gst-libs/gst/gl/gstglutils.c
deleted file mode 100644
index 8310c415f..000000000
--- a/gst-libs/gst/gl/gstglutils.c
+++ /dev/null
@@ -1,874 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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.
- */
-
-/**
- * SECTION:gstglutils
- * @title: GstGLUtils
- * @short_description: some miscellaneous utilities for OpenGL
- * @see_also: #GstGLContext
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include <gst/gst.h>
-#include <glib/gprintf.h>
-
-#include "gl.h"
-#include "gstglutils.h"
-#include "gstglutils_private.h"
-
-#if GST_GL_HAVE_WINDOW_X11
-#include <gst/gl/x11/gstgldisplay_x11.h>
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND
-#include <gst/gl/wayland/gstgldisplay_wayland.h>
-#endif
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-#ifndef GST_DISABLE_GST_DEBUG
-GST_DEBUG_CATEGORY_STATIC (gst_gl_utils_debug);
-static GstDebugCategory *
-_init_gl_utils_debug_category (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_INIT (gst_gl_utils_debug, "glutils", 0,
- "OpenGL Utilities");
- g_once_init_leave (&_init, 1);
- }
-
- return gst_gl_utils_debug;
-}
-
-#define GST_CAT_DEFAULT _init_gl_utils_debug_category()
-#endif
-
-static gboolean
-gst_gl_display_found (GstElement * element, GstGLDisplay * display)
-{
- if (display) {
- GST_LOG_OBJECT (element, "already have a display (%p)", display);
- return TRUE;
- }
-
- return FALSE;
-}
-
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
-
-static void
-_init_context_debug (void)
-{
-#ifndef GST_DISABLE_GST_DEBUG
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
- g_once_init_leave (&_init, 1);
- }
-#endif
-}
-
-static gboolean
-pad_query (const GValue * item, GValue * value, gpointer user_data)
-{
- GstPad *pad = g_value_get_object (item);
- GstQuery *query = user_data;
- gboolean res;
-
- _init_context_debug ();
-
- res = gst_pad_peer_query (pad, query);
-
- if (res) {
- g_value_set_boolean (value, TRUE);
- return FALSE;
- }
-
- GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, pad, "pad peer query failed");
- return TRUE;
-}
-
-gboolean
-gst_gl_run_query (GstElement * element, GstQuery * query,
- GstPadDirection direction)
-{
- GstIterator *it;
- GstIteratorFoldFunction func = pad_query;
- GValue res = { 0 };
-
- g_value_init (&res, G_TYPE_BOOLEAN);
- g_value_set_boolean (&res, FALSE);
-
- /* Ask neighbor */
- if (direction == GST_PAD_SRC)
- it = gst_element_iterate_src_pads (element);
- else
- it = gst_element_iterate_sink_pads (element);
-
- while (gst_iterator_fold (it, func, &res, query) == GST_ITERATOR_RESYNC)
- gst_iterator_resync (it);
-
- gst_iterator_free (it);
-
- return g_value_get_boolean (&res);
-}
-
-static void
-_gst_context_query (GstElement * element, const gchar * display_type)
-{
- GstQuery *query;
- GstContext *ctxt;
-
- _init_context_debug ();
-
- /* 2a) Query downstream with GST_QUERY_CONTEXT for the context and
- * check if downstream already has a context of the specific type
- * 2b) Query upstream as above.
- */
- query = gst_query_new_context (display_type);
- if (gst_gl_run_query (element, query, GST_PAD_SRC)) {
- gst_query_parse_context (query, &ctxt);
- GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
- "found context (%p) in downstream query", ctxt);
- gst_element_set_context (element, ctxt);
- } else if (gst_gl_run_query (element, query, GST_PAD_SINK)) {
- gst_query_parse_context (query, &ctxt);
- GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
- "found context (%p) in upstream query", ctxt);
- gst_element_set_context (element, ctxt);
- } else {
- /* 3) Post a GST_MESSAGE_NEED_CONTEXT message on the bus with
- * the required context type and afterwards check if a
- * usable context was set now as in 1). The message could
- * be handled by the parent bins of the element and the
- * application.
- */
- GstMessage *msg;
-
- GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
- "posting need context message");
- msg = gst_message_new_need_context (GST_OBJECT_CAST (element),
- display_type);
- gst_element_post_message (element, msg);
- }
-
- /*
- * Whomever responds to the need-context message performs a
- * GstElement::set_context() with the required context in which the element
- * is required to update the display_ptr or call gst_gl_handle_set_context().
- */
-
- gst_query_unref (query);
-}
-
-static void
-gst_gl_display_context_query (GstElement * element, GstGLDisplay ** display_ptr)
-{
- _gst_context_query (element, GST_GL_DISPLAY_CONTEXT_TYPE);
- if (*display_ptr)
- return;
-
-#if GST_GL_HAVE_WINDOW_X11
- _gst_context_query (element, "gst.x11.display.handle");
- if (*display_ptr)
- return;
-#endif
-
-#if GST_GL_HAVE_WINDOW_WAYLAND
- _gst_context_query (element, "GstWaylandDisplayHandleContextType");
- if (*display_ptr)
- return;
-#endif
-}
-
-static void
-gst_gl_context_query (GstElement * element)
-{
- _gst_context_query (element, "gst.gl.app_context");
-}
-
-/* 4) Create a context by itself and post a GST_MESSAGE_HAVE_CONTEXT
- * message.
- */
-void
-gst_gl_element_propagate_display_context (GstElement * element,
- GstGLDisplay * display)
-{
- GstContext *context;
- GstMessage *msg;
-
- if (!display) {
- GST_ERROR_OBJECT (element, "Could not get GL display connection");
- return;
- }
-
- _init_context_debug ();
-
- context = gst_context_new (GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
- gst_context_set_gl_display (context, display);
-
- gst_element_set_context (element, context);
-
- GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
- "posting have context (%p) message with display (%p)", context, display);
- msg = gst_message_new_have_context (GST_OBJECT_CAST (element), context);
- gst_element_post_message (GST_ELEMENT_CAST (element), msg);
-}
-
-/**
- * gst_gl_ensure_element_data:
- * @element: the #GstElement running the query
- * @display_ptr: (inout): the resulting #GstGLDisplay
- * @other_context_ptr: (inout): the resulting #GstGLContext
- *
- * Perform the steps necessary for retrieving a #GstGLDisplay and (optionally)
- * an application provided #GstGLContext from the surrounding elements or from
- * the application using the #GstContext mechanism.
- *
- * If the contents of @display_ptr or @other_context_ptr are not %NULL, then no
- * #GstContext query is necessary for #GstGLDisplay or #GstGLContext retrieval
- * or is performed.
- *
- * This performs #GstContext queries (if necessary) for a winsys display
- * connection with %GST_GL_DISPLAY_CONTEXT_TYPE, "gst.x11.display.handle", and
- * "GstWaylandDisplayHandleContextType" stopping after the first successful
- * retrieval.
- *
- * This also performs a #GstContext query (if necessary) for an optional
- * application provided #GstGLContext using the name "gst.gl.app_context".
- * The returned #GstGLContext will be shared with a GStreamer created OpenGL context.
- *
- * Returns: whether a #GstGLDisplay exists in @display_ptr
- */
-gboolean
-gst_gl_ensure_element_data (gpointer element, GstGLDisplay ** display_ptr,
- GstGLContext ** other_context_ptr)
-{
- GstGLDisplay *display;
-
- g_return_val_if_fail (element != NULL, FALSE);
- g_return_val_if_fail (display_ptr != NULL, FALSE);
- g_return_val_if_fail (other_context_ptr != NULL, FALSE);
-
- /* 1) Check if the element already has a context of the specific
- * type.
- */
- display = *display_ptr;
- if (gst_gl_display_found (element, display))
- goto done;
-
- gst_gl_display_context_query (element, display_ptr);
-
- /* Neighbour found and it updated the display */
- if (gst_gl_display_found (element, *display_ptr))
- goto get_gl_context;
-
- /* If no neighboor, or application not interested, use system default */
- display = gst_gl_display_new ();
-
- *display_ptr = display;
-
- gst_gl_element_propagate_display_context (element, display);
-
-get_gl_context:
- if (*other_context_ptr)
- goto done;
-
- gst_gl_context_query (element);
-
-done:
- return *display_ptr != NULL;
-}
-
-/**
- * gst_gl_handle_set_context:
- * @element: a #GstElement
- * @context: a #GstContext
- * @display: (inout) (transfer full): location of a #GstGLDisplay
- * @other_context: (inout) (transfer full): location of a #GstGLContext
- *
- * Helper function for implementing GstElement::set_context() in OpenGL capable
- * elements.
- *
- * Retrieve's the #GstGLDisplay or #GstGLContext in @context and places the
- * result in @display or @other_context respectively.
- *
- * Returns: whether the @display or @other_context could be set successfully
- */
-gboolean
-gst_gl_handle_set_context (GstElement * element, GstContext * context,
- GstGLDisplay ** display, GstGLContext ** other_context)
-{
- GstGLDisplay *display_replacement = NULL;
- GstGLContext *context_replacement = NULL;
- const gchar *context_type;
-
- g_return_val_if_fail (display != NULL, FALSE);
- g_return_val_if_fail (other_context != NULL, FALSE);
-
- if (!context)
- return FALSE;
-
- context_type = gst_context_get_context_type (context);
-
- if (g_strcmp0 (context_type, GST_GL_DISPLAY_CONTEXT_TYPE) == 0) {
- if (!gst_context_get_gl_display (context, &display_replacement)) {
- GST_WARNING_OBJECT (element, "Failed to get display from context");
- return FALSE;
- }
- }
-#if GST_GL_HAVE_WINDOW_X11
- else if (g_strcmp0 (context_type, "gst.x11.display.handle") == 0) {
- const GstStructure *s;
- Display *display;
-
- s = gst_context_get_structure (context);
- if (gst_structure_get (s, "display", G_TYPE_POINTER, &display, NULL))
- display_replacement =
- (GstGLDisplay *) gst_gl_display_x11_new_with_display (display);
- }
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND
- else if (g_strcmp0 (context_type, "GstWaylandDisplayHandleContextType") == 0) {
- const GstStructure *s;
- struct wl_display *display;
-
- s = gst_context_get_structure (context);
- if (gst_structure_get (s, "display", G_TYPE_POINTER, &display, NULL))
- display_replacement =
- (GstGLDisplay *) gst_gl_display_wayland_new_with_display (display);
- }
-#endif
- else if (g_strcmp0 (context_type, "gst.gl.app_context") == 0) {
- const GstStructure *s = gst_context_get_structure (context);
- GstGLDisplay *context_display;
- GstGLDisplay *element_display;
-
- if (gst_structure_get (s, "context", GST_TYPE_GL_CONTEXT,
- &context_replacement, NULL)) {
- context_display = gst_gl_context_get_display (context_replacement);
- element_display = display_replacement ? display_replacement : *display;
- if (element_display
- && (gst_gl_display_get_handle_type (element_display) &
- gst_gl_display_get_handle_type (context_display)) == 0) {
- GST_ELEMENT_WARNING (element, LIBRARY, SETTINGS, ("%s",
- "Cannot set a GL context with a different display type"), ("%s",
- "Cannot set a GL context with a different display type"));
- gst_object_unref (context_replacement);
- context_replacement = NULL;
- }
- gst_object_unref (context_display);
- }
- }
-
- if (display_replacement) {
- GstGLDisplay *old = *display;
- *display = display_replacement;
-
- if (old)
- gst_object_unref (old);
- }
-
- if (context_replacement) {
- GstGLContext *old = *other_context;
- *other_context = context_replacement;
-
- if (old)
- gst_object_unref (old);
- }
-
- return TRUE;
-}
-
-/**
- * gst_gl_handle_context_query:
- * @element: a #GstElement
- * @query: a #GstQuery of type %GST_QUERY_CONTEXT
- * @display: (transfer none) (nullable): a #GstGLDisplay
- * @context: (transfer none) (nullable): a #GstGLContext
- * @other_context: (transfer none) (nullable): application provided #GstGLContext
- *
- * Returns: Whether the @query was successfully responded to from the passed
- * @display, @context, and @other_context.
- */
-gboolean
-gst_gl_handle_context_query (GstElement * element, GstQuery * query,
- GstGLDisplay * display, GstGLContext * gl_context,
- GstGLContext * other_context)
-{
- const gchar *context_type;
- GstContext *context, *old_context;
-
- g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
- g_return_val_if_fail (GST_IS_QUERY (query), FALSE);
- g_return_val_if_fail (display == NULL || GST_IS_GL_DISPLAY (display), FALSE);
- g_return_val_if_fail (gl_context == NULL
- || GST_IS_GL_CONTEXT (gl_context), FALSE);
- g_return_val_if_fail (other_context == NULL
- || GST_IS_GL_CONTEXT (other_context), FALSE);
-
- GST_LOG_OBJECT (element, "handle context query %" GST_PTR_FORMAT, query);
- gst_query_parse_context_type (query, &context_type);
-
- if (display && g_strcmp0 (context_type, GST_GL_DISPLAY_CONTEXT_TYPE) == 0) {
- gst_query_parse_context (query, &old_context);
-
- if (old_context)
- context = gst_context_copy (old_context);
- else
- context = gst_context_new (GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
-
- gst_context_set_gl_display (context, display);
- gst_query_set_context (query, context);
- gst_context_unref (context);
- GST_DEBUG_OBJECT (element, "successfully set %" GST_PTR_FORMAT
- " on %" GST_PTR_FORMAT, display, query);
-
- return TRUE;
- }
-#if GST_GL_HAVE_WINDOW_X11
- else if (display && g_strcmp0 (context_type, "gst.x11.display.handle") == 0) {
- GstStructure *s;
-
- gst_query_parse_context (query, &old_context);
-
- if (old_context)
- context = gst_context_copy (old_context);
- else
- context = gst_context_new ("gst.x11.display.handle", TRUE);
-
- if (gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_X11) {
- Display *x11_display = (Display *) gst_gl_display_get_handle (display);
-
- if (x11_display) {
- s = gst_context_writable_structure (context);
- gst_structure_set (s, "display", G_TYPE_POINTER, x11_display, NULL);
-
- gst_query_set_context (query, context);
- gst_context_unref (context);
-
- GST_DEBUG_OBJECT (element, "successfully set x11 display %p (from %"
- GST_PTR_FORMAT ") on %" GST_PTR_FORMAT, x11_display, display,
- query);
-
- return TRUE;
- }
- }
- }
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND
- else if (display
- && g_strcmp0 (context_type, "GstWaylandDisplayHandleContextType") == 0) {
- GstStructure *s;
-
- gst_query_parse_context (query, &old_context);
-
- if (old_context)
- context = gst_context_copy (old_context);
- else
- context = gst_context_new ("GstWaylandDisplayHandleContextType", TRUE);
-
- if (gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WAYLAND) {
- struct wl_display *wayland_display =
- (struct wl_display *) gst_gl_display_get_handle (display);
-
- if (wayland_display) {
- s = gst_context_writable_structure (context);
- gst_structure_set (s, "display", G_TYPE_POINTER, wayland_display, NULL);
-
- gst_query_set_context (query, context);
- gst_context_unref (context);
-
- GST_DEBUG_OBJECT (element, "successfully set wayland display %p (from %"
- GST_PTR_FORMAT ") on %" GST_PTR_FORMAT, wayland_display, display,
- query);
-
- return TRUE;
- }
- }
- }
-#endif
- else if (other_context && g_strcmp0 (context_type, "gst.gl.app_context") == 0) {
- GstStructure *s;
-
- gst_query_parse_context (query, &old_context);
-
- if (old_context)
- context = gst_context_copy (old_context);
- else
- context = gst_context_new ("gst.gl.app_context", TRUE);
-
- s = gst_context_writable_structure (context);
- gst_structure_set (s, "context", GST_TYPE_GL_CONTEXT, other_context, NULL);
- gst_query_set_context (query, context);
- gst_context_unref (context);
-
- GST_DEBUG_OBJECT (element, "successfully set application GL context %"
- GST_PTR_FORMAT " on %" GST_PTR_FORMAT, other_context, query);
-
- return TRUE;
- } else if (gl_context
- && g_strcmp0 (context_type, "gst.gl.local_context") == 0) {
- GstStructure *s;
-
- gst_query_parse_context (query, &old_context);
-
- if (old_context)
- context = gst_context_copy (old_context);
- else
- context = gst_context_new ("gst.gl.local_context", TRUE);
-
- s = gst_context_writable_structure (context);
- gst_structure_set (s, "context", GST_TYPE_GL_CONTEXT, gl_context, NULL);
- gst_query_set_context (query, context);
- gst_context_unref (context);
-
- GST_DEBUG_OBJECT (element, "successfully set GL context %"
- GST_PTR_FORMAT " on %" GST_PTR_FORMAT, gl_context, query);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-/**
- * gst_gl_query_local_gl_context:
- * @element: a #GstElement to query from
- * @direction: the #GstPadDirection to query
- * @context_ptr: (inout): location containing the current and/or resulting
- * #GstGLContext
- *
- * Performs a GST_QUERY_CONTEXT query of type "gst.gl.local_context" on all
- * #GstPads in @element of @direction for the local OpenGL context used by
- * GStreamer elements.
- *
- * Returns: whether @context_ptr contains a #GstGLContext
- */
-gboolean
-gst_gl_query_local_gl_context (GstElement * element, GstPadDirection direction,
- GstGLContext ** context_ptr)
-{
- GstQuery *query;
- GstContext *context;
- const GstStructure *s;
-
- g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
- g_return_val_if_fail (context_ptr != NULL, FALSE);
-
- if (*context_ptr)
- return TRUE;
-
- query = gst_query_new_context ("gst.gl.local_context");
- if (gst_gl_run_query (GST_ELEMENT (element), query, direction)) {
- gst_query_parse_context (query, &context);
- if (context) {
- s = gst_context_get_structure (context);
- gst_structure_get (s, "context", GST_TYPE_GL_CONTEXT, context_ptr, NULL);
- }
- }
-
- gst_query_unref (query);
-
- return *context_ptr != NULL;
-}
-
-/**
- * gst_gl_get_plane_data_size:
- * @info: a #GstVideoInfo
- * @align: a #GstVideoAlignment or %NULL
- * @plane: plane number in @info to retrieve the data size of
- *
- * Retrieve the size in bytes of a video plane of data with a certain alignment
- */
-gsize
-gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
- guint plane)
-{
- gint padded_height;
- gsize plane_size;
-
- padded_height = info->height;
-
- if (align)
- padded_height += align->padding_top + align->padding_bottom;
-
- padded_height =
- GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info->finfo, plane, padded_height);
-
- plane_size = GST_VIDEO_INFO_PLANE_STRIDE (info, plane) * padded_height;
-
- return plane_size;
-}
-
-/**
- * gst_gl_get_plane_start:
- * @info: a #GstVideoInfo
- * @valign: a #GstVideoAlignment or %NULL
- * @plane: plane number in @info to retrieve the data size of
- *
- * Returns: difference between the supposed start of the plane from the @info
- * and where the data from the previous plane ends.
- */
-gsize
-gst_gl_get_plane_start (GstVideoInfo * info, GstVideoAlignment * valign,
- guint plane)
-{
- gsize plane_start;
- gint i;
-
- /* find the start of the plane data including padding */
- plane_start = 0;
- for (i = 0; i < plane; i++) {
- plane_start += gst_gl_get_plane_data_size (info, valign, i);
- }
-
- /* offset between the plane data start and where the video frame starts */
- return (GST_VIDEO_INFO_PLANE_OFFSET (info, plane)) - plane_start;
-}
-
-/**
- * gst_gl_value_get_texture_target_mask:
- * @value: an initialized #GValue of type G_TYPE_STRING
- *
- * See gst_gl_value_set_texture_target_from_mask() for what entails a mask
- *
- * Returns: the mask of #GstGLTextureTarget's in @value
- */
-GstGLTextureTarget
-gst_gl_value_get_texture_target_mask (const GValue * targets)
-{
- guint new_targets = 0;
-
- g_return_val_if_fail (targets != NULL, GST_GL_TEXTURE_TARGET_NONE);
-
- if (G_TYPE_CHECK_VALUE_TYPE (targets, G_TYPE_STRING)) {
- GstGLTextureTarget target;
- const gchar *str;
-
- str = g_value_get_string (targets);
- target = gst_gl_texture_target_from_string (str);
-
- if (target)
- new_targets |= 1 << target;
- } else if (G_TYPE_CHECK_VALUE_TYPE (targets, GST_TYPE_LIST)) {
- gint j, m;
-
- m = gst_value_list_get_size (targets);
- for (j = 0; j < m; j++) {
- const GValue *val = gst_value_list_get_value (targets, j);
- GstGLTextureTarget target;
- const gchar *str;
-
- str = g_value_get_string (val);
- target = gst_gl_texture_target_from_string (str);
- if (target)
- new_targets |= 1 << target;
- }
- }
-
- return new_targets;
-}
-
-/**
- * gst_gl_value_set_texture_target:
- * @value: an initialized #GValue of type G_TYPE_STRING
- * @target: a #GstGLTextureTarget's
- *
- * Returns: whether the @target could be set on @value
- */
-gboolean
-gst_gl_value_set_texture_target (GValue * value, GstGLTextureTarget target)
-{
- g_return_val_if_fail (value != NULL, FALSE);
- g_return_val_if_fail (target != GST_GL_TEXTURE_TARGET_NONE, FALSE);
-
- if (target == GST_GL_TEXTURE_TARGET_2D) {
- g_value_set_static_string (value, GST_GL_TEXTURE_TARGET_2D_STR);
- } else if (target == GST_GL_TEXTURE_TARGET_RECTANGLE) {
- g_value_set_static_string (value, GST_GL_TEXTURE_TARGET_RECTANGLE_STR);
- } else if (target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) {
- g_value_set_static_string (value, GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR);
- } else {
- return FALSE;
- }
-
- return TRUE;
-}
-
-static guint64
-_gst_gl_log2_int64 (guint64 value)
-{
- guint64 ret = 0;
-
- while (value >>= 1)
- ret++;
-
- return ret;
-}
-
-/**
- * gst_gl_value_set_texture_target_from_mask:
- * @value: an uninitialized #GValue
- * @target_mask: a bitwise mask of #GstGLTextureTarget's
- *
- * A mask is a bitwise OR of (1 << target) where target is a valid
- * #GstGLTextureTarget
- *
- * Returns: whether the @target_mask could be set on @value
- */
-gboolean
-gst_gl_value_set_texture_target_from_mask (GValue * value,
- GstGLTextureTarget target_mask)
-{
- g_return_val_if_fail (value != NULL, FALSE);
- g_return_val_if_fail (target_mask != GST_GL_TEXTURE_TARGET_NONE, FALSE);
-
- if ((target_mask & (target_mask - 1)) == 0) {
- /* only one texture target set */
- g_value_init (value, G_TYPE_STRING);
- return gst_gl_value_set_texture_target (value,
- _gst_gl_log2_int64 (target_mask));
- } else {
- GValue item = G_VALUE_INIT;
- gboolean ret = FALSE;
-
- g_value_init (value, GST_TYPE_LIST);
- g_value_init (&item, G_TYPE_STRING);
- if (target_mask & (1 << GST_GL_TEXTURE_TARGET_2D)) {
- gst_gl_value_set_texture_target (&item, GST_GL_TEXTURE_TARGET_2D);
- gst_value_list_append_value (value, &item);
- ret = TRUE;
- }
- if (target_mask & (1 << GST_GL_TEXTURE_TARGET_RECTANGLE)) {
- gst_gl_value_set_texture_target (&item, GST_GL_TEXTURE_TARGET_RECTANGLE);
- gst_value_list_append_value (value, &item);
- ret = TRUE;
- }
- if (target_mask & (1 << GST_GL_TEXTURE_TARGET_EXTERNAL_OES)) {
- gst_gl_value_set_texture_target (&item,
- GST_GL_TEXTURE_TARGET_EXTERNAL_OES);
- gst_value_list_append_value (value, &item);
- ret = TRUE;
- }
-
- g_value_unset (&item);
- return ret;
- }
-}
-
-static const gfloat identity_matrix[] = {
- 1.0, 0.0, 0.0, 0.0,
- 0.0, 1.0, 0.0, 0.0,
- 0.0, 0.0, 1.0, 0.0,
- 0.0, 0.0, 0.0, 1.0,
-};
-
-static const gfloat from_ndc_matrix[] = {
- 0.5, 0.0, 0.0, 0.0,
- 0.0, 0.5, 0.0, 0.0,
- 0.0, 0.0, 0.5, 0.0,
- 0.5, 0.5, 0.5, 1.0,
-};
-
-static const gfloat to_ndc_matrix[] = {
- 2.0, 0.0, 0.0, 0.0,
- 0.0, 2.0, 0.0, 0.0,
- 0.0, 0.0, 2.0, 0.0,
- -1.0, -1.0, -1.0, 1.0,
-};
-
-/* multiplies two 4x4 matrices, @a X @b, and stores the result in @result
- * https://en.wikipedia.org/wiki/Matrix_multiplication
- */
-static void
-gst_gl_multiply_matrix4 (const gfloat * a, const gfloat * b, gfloat * result)
-{
- int i, j, k;
- gfloat tmp[16] = { 0.0f };
-
- if (!a || !b || !result)
- return;
- for (i = 0; i < 4; i++) { /* column */
- for (j = 0; j < 4; j++) { /* row */
- for (k = 0; k < 4; k++) {
- tmp[j + (i * 4)] += a[k + (i * 4)] * b[j + (k * 4)];
- }
- }
- }
-
- for (i = 0; i < 16; i++)
- result[i] = tmp[i];
-}
-
-/*
- * gst_gl_get_affine_transformation_meta_as_ndc:
- * @meta: (nullable): a #GstVideoAffineTransformationMeta
- * @matrix: (out): result of the 4x4 matrix
- *
- * Retrieves the stored 4x4 affine transformation matrix stored in @meta in
- * NDC coordinates. if @meta is NULL, an identity matrix is returned.
- *
- * NDC is a left-handed coordinate sytem
- * - x - [-1, 1] - +ve X moves right
- * - y - [-1, 1] - +ve Y moves up
- * - z - [-1, 1] - +ve Z moves into
- */
-void
-gst_gl_get_affine_transformation_meta_as_ndc (GstVideoAffineTransformationMeta *
- meta, gfloat * matrix)
-{
- if (!meta) {
- int i;
-
- for (i = 0; i < 16; i++) {
- matrix[i] = identity_matrix[i];
- }
- } else {
- float tmp[16];
-
- /* change of basis multiplications */
- gst_gl_multiply_matrix4 (to_ndc_matrix, meta->matrix, tmp);
- gst_gl_multiply_matrix4 (tmp, from_ndc_matrix, matrix);
- }
-}
-
-void gst_gl_set_affine_transformation_meta_from_ndc
- (GstVideoAffineTransformationMeta * meta, const gfloat * matrix)
-{
- float tmp[16];
-
- g_return_if_fail (meta != NULL);
-
- /* change of basis multiplications */
- gst_gl_multiply_matrix4 (from_ndc_matrix, matrix, tmp);
- gst_gl_multiply_matrix4 (tmp, to_ndc_matrix, meta->matrix);
-}
diff --git a/gst-libs/gst/gl/gstglutils.h b/gst-libs/gst/gl/gstglutils.h
deleted file mode 100644
index d39f68306..000000000
--- a/gst-libs/gst/gl/gstglutils.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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_UTILS_H__
-#define __GST_GL_UTILS_H__
-
-#include <gst/video/video.h>
-#include <gst/video/gstvideoaffinetransformationmeta.h>
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-gboolean gst_gl_ensure_element_data (gpointer element,
- GstGLDisplay **display_ptr, GstGLContext ** other_context_ptr);
-GST_EXPORT
-gboolean gst_gl_handle_set_context (GstElement * element, GstContext * context,
- GstGLDisplay ** display, GstGLContext ** other_context);
-GST_EXPORT
-gboolean gst_gl_handle_context_query (GstElement * element, GstQuery * query,
- GstGLDisplay * display, GstGLContext * context, GstGLContext * other_context);
-GST_EXPORT
-gboolean gst_gl_query_local_gl_context (GstElement * element, GstPadDirection direction,
- GstGLContext ** context_ptr);
-
-GST_EXPORT
-void gst_gl_element_propagate_display_context (GstElement * element, GstGLDisplay * display);
-
-GST_EXPORT
-gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align,
- guint plane);
-GST_EXPORT
-gsize gst_gl_get_plane_start (GstVideoInfo * info, GstVideoAlignment * valign,
- guint plane);
-
-GST_EXPORT
-gboolean gst_gl_value_set_texture_target_from_mask (GValue * value,
- GstGLTextureTarget target_mask);
-GST_EXPORT
-gboolean gst_gl_value_set_texture_target (GValue * value, GstGLTextureTarget target);
-GST_EXPORT
-GstGLTextureTarget gst_gl_value_get_texture_target_mask (const GValue * value);
-
-G_END_DECLS
-
-#endif /* __GST_GL_UTILS_H__ */
diff --git a/gst-libs/gst/gl/gstglutils_private.h b/gst-libs/gst/gl/gstglutils_private.h
deleted file mode 100644
index 5a314e37b..000000000
--- a/gst-libs/gst/gl/gstglutils_private.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2017 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_UTILS_PRIVATE_H__
-#define __GST_GL_UTILS_PRIVATE_H__
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-
-G_GNUC_INTERNAL gboolean gst_gl_run_query (GstElement * element, GstQuery * query, GstPadDirection direction);
-G_GNUC_INTERNAL void gst_gl_get_affine_transformation_meta_as_ndc (GstVideoAffineTransformationMeta * meta, gfloat * matrix);
-G_GNUC_INTERNAL void gst_gl_set_affine_transformation_meta_from_ndc (GstVideoAffineTransformationMeta * meta, const gfloat * matrix);
-
-G_END_DECLS
-
-#endif /* __GST_GL_UTILS_H__ */
diff --git a/gst-libs/gst/gl/gstglviewconvert.c b/gst-libs/gst/gl/gstglviewconvert.c
deleted file mode 100644
index 755f1b997..000000000
--- a/gst-libs/gst/gl/gstglviewconvert.c
+++ /dev/null
@@ -1,2381 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@mail.com>
- * Copyright (C) 2014 Jan Schmidt <jan@centricular.com>
- * 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.
- */
-
-/**
- * SECTION:gstglviewconvert
- * @title: GstGLViewConvert
- * @short_description: convert between steroscopic/multiview video formats
- * @see_also: #GstGLColorConvert, #GstGLContext
- *
- * Convert stereoscopic/multiview video using fragment shaders.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstglviewconvert.h"
-
-#include <gst/video/gstvideoaffinetransformationmeta.h>
-
-#include "gstglcontext.h"
-#include "gstglframebuffer.h"
-#include "gstglmemory.h"
-#include "gstglshader.h"
-#include "gstglshaderstrings.h"
-#include "gstglsl.h"
-#include "gstglsl_private.h"
-#include "gstglslstage.h"
-#include "gstglutils_private.h"
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-static GstStaticCaps caps_template =
-GST_STATIC_CAPS ("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
- "format = (string) RGBA, "
- "width = " GST_VIDEO_SIZE_RANGE ", "
- "height = " GST_VIDEO_SIZE_RANGE ", "
- "framerate = " GST_VIDEO_FPS_RANGE ", "
- "texture-target = (string) { 2D, rectangle, external-oes } ");
-
-#define GST_CAT_DEFAULT gst_gl_view_convert_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-enum
-{
- PROP_0,
- PROP_INPUT_LAYOUT,
- PROP_INPUT_FLAGS,
- PROP_OUTPUT_LAYOUT,
- PROP_OUTPUT_FLAGS,
- PROP_OUTPUT_DOWNMIX_MODE
-};
-
-#define DEFAULT_DOWNMIX GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS
-
-struct _GstGLViewConvertPrivate
-{
- gboolean result;
-
- GstVideoMultiviewMode input_mode;
- GstVideoMultiviewFlags input_flags;
- GstVideoMultiviewMode output_mode;
- GstVideoMultiviewFlags output_flags;
-
- GstBuffer *primary_in;
- GstBuffer *auxilliary_in;
-
- GstBuffer *primary_out;
- GstBuffer *auxilliary_out;
-
- GstGLMemory *in_tex[GST_VIDEO_MAX_PLANES];
- GstGLMemory *out_tex[GST_VIDEO_MAX_PLANES];
- guint n_out_tex;
-
- GLuint vao;
- GLuint vertex_buffer;
- GLuint vbo_indices;
- GLuint attr_position;
- GLuint attr_texture;
-};
-
-#define GST_GL_VIEW_CONVERT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- GST_TYPE_GL_VIEW_CONVERT, GstGLViewConvertPrivate))
-
-#define DEBUG_INIT \
- GST_DEBUG_CATEGORY_INIT (gst_gl_view_convert_debug, "glviewconvert", 0, "glviewconvert object");
-
-G_DEFINE_TYPE_WITH_CODE (GstGLViewConvert, gst_gl_view_convert,
- GST_TYPE_OBJECT, DEBUG_INIT);
-
-static void gst_gl_view_convert_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_gl_view_convert_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-static void gst_gl_view_convert_finalize (GObject * object);
-
-static void _do_view_convert (GstGLContext * context,
- GstGLViewConvert * viewconvert);
-
-GType
-gst_gl_stereo_downmix_mode_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS,
- "Dubois optimised Green-Magenta anaglyph", "green-magenta-dubois"},
- {GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS,
- "Dubois optimised Red-Cyan anaglyph",
- "red-cyan-dubois"},
- {GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS,
- "Dubois optimised Amber-Blue anaglyph", "amber-blue-dubois"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstGLStereoDownmix", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* *INDENT-OFF* */
-/* These match the order and number of DOWNMIX_ANAGLYPH_* modes */
-static GLfloat downmix_matrices[][2][9] = {
- { /* Green-Magenta Dubois */
- {-0.062f, 0.284f, -0.015f, -0.158f, 0.668f, -0.027f, -0.039f, 0.143f, 0.021f},
- {0.529f, -0.016f, 0.009f, 0.705f, -0.015f, 0.075f, 0.024f, -0.065f, 0.937f}
- },
- { /* Red-Cyan Dubois */
- /* Source of this matrix: http://www.site.uottawa.ca/~edubois/anaglyph/LeastSquaresHowToPhotoshop.pdf */
- {0.437f, -0.062f, -0.048f, 0.449f, -0.062f, -0.050f, 0.164f, -0.024f, -0.017f},
- {-0.011f, 0.377f, -0.026f, -0.032f, 0.761f, -0.093f, -0.007f, 0.009f, 1.234f}
- },
- { /* Amber-blue Dubois */
- {1.062f, -0.026f, -0.038f, -0.205f, 0.908f, -0.173f, 0.299f, 0.068f, 0.022f},
- {-0.016f, 0.006f, 0.094f, -0.123f, 0.062f, 0.185f, -0.017f, -0.017f, 0.911f}
- }
-};
-
-static gfloat identity_matrix[] = {
- 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f,
-};
-/* *INDENT-ON* */
-
-#define glsl_OES_extension_string "#extension GL_OES_EGL_image_external : require \n"
-
-/* *INDENT-OFF* */
-static const gchar *fragment_header =
- "#ifdef GL_ES\n"
- "precision mediump float;\n"
- "#endif\n"
- "uniform sampler2D tex_l;\n"
- "uniform sampler2D tex_r;\n"
- "uniform float width;\n"
- "uniform float height;\n"
- "uniform mat3 downmix[2];\n"
- "uniform vec2 tex_scale[2];\n"
- "uniform vec2 offsets[2];\n";
-
-static const gchar *frag_input =
- " vec2 l_tex = v_texcoord * tex_scale[0] + offsets[0];\n"
- " vec2 r_tex = v_texcoord * tex_scale[1] + offsets[1];\n"
- " l = texture2D(tex_l, l_tex).rgba;\n"
- " r = texture2D(tex_r, r_tex).rgba;\n";
-
-static const gchar *frag_output_downmix =
- " vec3 lcol = l.rgb * l.a + vec3(1.0-l.a);\n"
- " vec3 rcol = r.rgb * r.a + vec3(1.0-r.a);\n"
- " if (l.a + r.a > 0.0) {\n"
- " lcol = clamp (downmix[0] * lcol, 0.0, 1.0);\n"
- " rcol = clamp (downmix[1] * rcol, 0.0, 1.0);\n"
- " gl_FragColor = vec4 (lcol + rcol, 1.0);\n"
- " } else {\n"
- " gl_FragColor = vec4 (0.0);\n"
- " }\n";
-
-static const gchar *frag_output_left =
- " gl_FragColor = l;\n";
-
-static const gchar *frag_output_right =
- " gl_FragColor = r;\n";
-
-static const gchar *frag_output_side_by_side =
- " if (v_texcoord.x < 0.5) {\n"
- " gl_FragColor = l;\n"
- " } else {\n"
- " gl_FragColor = r;\n"
- " };\n";
-
-static const gchar *frag_output_top_bottom =
- "if (v_texcoord.y < 0.5) {\n"
- " gl_FragColor = l;\n"
- "} else {\n"
- " gl_FragColor = r;\n"
- "};\n";
-
-static const gchar *frag_output_column_interleaved =
- "if (int(mod(l_tex.x * width, 2.0)) == 0) {\n"
- " gl_FragColor = l;\n"
- "} else {\n"
- " gl_FragColor = r;\n"
- "};\n";
-
-static const gchar *frag_output_row_interleaved =
- "if (int(mod(l_tex.y * height, 2.0)) == 0) {\n"
- " gl_FragColor = l;\n"
- "} else {\n"
- " gl_FragColor = r;\n"
- "};\n";
-
-static const gchar *frag_output_checkerboard =
- "if (int(mod(l_tex.x * width, 2.0)) == \n"
- " int(mod(l_tex.y * height, 2.0))) {\n"
- " gl_FragColor = l;\n"
- "} else {\n"
- " gl_FragColor = r;\n"
- "};\n";
-
-static const gchar *frag_output_separated =
- "gl_FragData[0] = l;\n"
- "gl_FragData[1] = r;\n";
-/* *INDENT-ON* */
-
-static const GLfloat vertices[] = {
- 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
- -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,
- -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 0.0f, 1.0f, 1.0f
-};
-
-static const GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
-static void
-gst_gl_view_convert_class_init (GstGLViewConvertClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstGLViewConvertPrivate));
-
- gobject_class->set_property = gst_gl_view_convert_set_property;
- gobject_class->get_property = gst_gl_view_convert_get_property;
- gobject_class->finalize = gst_gl_view_convert_finalize;
-
- g_object_class_install_property (gobject_class, PROP_INPUT_LAYOUT,
- g_param_spec_enum ("input-mode-override",
- "Input Multiview Mode Override",
- "Override any input information about multiview layout",
- GST_TYPE_VIDEO_MULTIVIEW_MODE,
- GST_VIDEO_MULTIVIEW_MODE_NONE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_INPUT_FLAGS,
- g_param_spec_flags ("input-flags-override",
- "Input Multiview Flags Override",
- "Override any input information about multiview layout flags",
- GST_TYPE_VIDEO_MULTIVIEW_FLAGS, GST_VIDEO_MULTIVIEW_FLAGS_NONE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_OUTPUT_LAYOUT,
- g_param_spec_enum ("output-mode-override",
- "Output Multiview Mode Override",
- "Override automatic output mode selection for multiview layout",
- GST_TYPE_VIDEO_MULTIVIEW_MODE, GST_VIDEO_MULTIVIEW_MODE_NONE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_OUTPUT_FLAGS,
- g_param_spec_flags ("output-flags-override",
- "Output Multiview Flags Override",
- "Override automatic negotiation for output multiview layout flags",
- GST_TYPE_VIDEO_MULTIVIEW_FLAGS, GST_VIDEO_MULTIVIEW_FLAGS_NONE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_OUTPUT_DOWNMIX_MODE,
- g_param_spec_enum ("downmix-mode", "Mode for mono downmixed output",
- "Output anaglyph type to generate when downmixing to mono",
- GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE, DEFAULT_DOWNMIX,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_gl_view_convert_init (GstGLViewConvert * convert)
-{
- convert->priv = GST_GL_VIEW_CONVERT_GET_PRIVATE (convert);
-
- convert->shader = NULL;
- convert->downmix_mode = DEFAULT_DOWNMIX;
- convert->priv->input_mode = GST_VIDEO_MULTIVIEW_MODE_NONE;
- convert->priv->input_flags = GST_VIDEO_MULTIVIEW_FLAGS_NONE;
- convert->priv->output_mode = GST_VIDEO_MULTIVIEW_MODE_NONE;
- convert->priv->output_flags = GST_VIDEO_MULTIVIEW_FLAGS_NONE;
-
- convert->input_mode_override = GST_VIDEO_MULTIVIEW_MODE_NONE;
- convert->input_flags_override = GST_VIDEO_MULTIVIEW_FLAGS_NONE;
- convert->output_mode_override = GST_VIDEO_MULTIVIEW_MODE_NONE;
- convert->output_flags_override = GST_VIDEO_MULTIVIEW_FLAGS_NONE;
-
- gst_video_info_init (&convert->in_info);
- gst_video_info_init (&convert->out_info);
-}
-
-static void
-gst_gl_view_convert_finalize (GObject * object)
-{
- GstGLViewConvert *viewconvert;
-
- viewconvert = GST_GL_VIEW_CONVERT (object);
-
- gst_gl_view_convert_reset (viewconvert);
-
- gst_buffer_replace (&viewconvert->priv->primary_in, NULL);
- gst_buffer_replace (&viewconvert->priv->auxilliary_in, NULL);
- gst_buffer_replace (&viewconvert->priv->primary_out, NULL);
- gst_buffer_replace (&viewconvert->priv->auxilliary_out, NULL);
-
- if (viewconvert->context) {
- gst_object_unref (viewconvert->context);
- viewconvert->context = NULL;
- }
-
- G_OBJECT_CLASS (gst_gl_view_convert_parent_class)->finalize (object);
-}
-
-/**
- * gst_gl_view_convert_new:
- *
- * Returns: (transfer full): a new #GstGLViewConvert
- *
- * Since: 1.6
- */
-GstGLViewConvert *
-gst_gl_view_convert_new (void)
-{
- GstGLViewConvert *convert;
-
- convert = g_object_new (GST_TYPE_GL_VIEW_CONVERT, NULL);
- gst_object_ref_sink (convert);
-
- return convert;
-}
-
-/**
- * gst_gl_view_convert_set_context:
- * @viewconvert: a #GstGLViewConvert
- * @context: the #GstGLContext to set
- *
- * Set @context on @viewconvert
- *
- * Since: 1.6
- */
-void
-gst_gl_view_convert_set_context (GstGLViewConvert * viewconvert,
- GstGLContext * context)
-{
- g_return_if_fail (GST_IS_GL_VIEW_CONVERT (viewconvert));
-
- if (gst_object_replace ((GstObject **) & viewconvert->context,
- GST_OBJECT (context)))
- gst_gl_view_convert_reset (viewconvert);
-}
-
-static gboolean
-_view_convert_set_format (GstGLViewConvert * viewconvert,
- GstVideoInfo * in_info, GstGLTextureTarget from_target,
- GstVideoInfo * out_info, GstGLTextureTarget to_target)
-{
- gboolean passthrough;
- g_return_val_if_fail (GST_IS_GL_VIEW_CONVERT (viewconvert), FALSE);
-
- if (gst_video_info_is_equal (in_info, &viewconvert->in_info) &&
- gst_video_info_is_equal (out_info, &viewconvert->out_info) &&
- viewconvert->from_texture_target == from_target &&
- viewconvert->to_texture_target == to_target)
- return TRUE;
-
- if (GST_VIDEO_INFO_FORMAT (in_info) != GST_VIDEO_FORMAT_RGBA ||
- GST_VIDEO_INFO_FORMAT (out_info) != GST_VIDEO_FORMAT_RGBA) {
- GST_ERROR_OBJECT (viewconvert,
- "Multiview conversion can currently only be performed on RGBA textures");
- return FALSE;
- }
-
- passthrough = gst_video_info_is_equal (in_info, out_info) &&
- from_target == to_target;
-
- if (!passthrough && to_target != GST_GL_TEXTURE_TARGET_2D
- && to_target != GST_GL_TEXTURE_TARGET_RECTANGLE)
- return FALSE;
-
- /* FIXME: Compare what changed and decide if we need a full reset or not */
- GST_OBJECT_LOCK (viewconvert);
- gst_gl_view_convert_reset (viewconvert);
-
- viewconvert->in_info = *in_info;
- viewconvert->out_info = *out_info;
- viewconvert->from_texture_target = from_target;
- viewconvert->to_texture_target = to_target;
- viewconvert->caps_passthrough = passthrough;
-
- gst_buffer_replace (&viewconvert->priv->primary_in, NULL);
- gst_buffer_replace (&viewconvert->priv->auxilliary_in, NULL);
- gst_buffer_replace (&viewconvert->priv->primary_out, NULL);
- gst_buffer_replace (&viewconvert->priv->auxilliary_out, NULL);
- GST_OBJECT_UNLOCK (viewconvert);
-
- return TRUE;
-}
-
-/**
- * gst_gl_view_convert_set_caps:
- * @viewconvert: a #GstGLViewConvert
- * @in_caps: input #GstCaps
- * @out_caps: output #GstCaps
- *
- * Initializes @viewconvert with the information required for conversion.
- *
- * Since: 1.6
- */
-gboolean
-gst_gl_view_convert_set_caps (GstGLViewConvert * viewconvert,
- GstCaps * in_caps, GstCaps * out_caps)
-{
- GstVideoInfo in_info, out_info;
- GstCapsFeatures *in_features, *out_features;
- GstGLTextureTarget from_target = GST_GL_TEXTURE_TARGET_2D;
- GstGLTextureTarget to_target = GST_GL_TEXTURE_TARGET_2D;
-
- g_return_val_if_fail (GST_IS_GL_VIEW_CONVERT (viewconvert), FALSE);
- g_return_val_if_fail (GST_IS_CAPS (in_caps), FALSE);
- g_return_val_if_fail (GST_IS_CAPS (out_caps), FALSE);
-
- GST_INFO_OBJECT (viewconvert,
- "Configuring multiview conversion from caps %" GST_PTR_FORMAT
- " to %" GST_PTR_FORMAT, in_caps, out_caps);
-
- in_features = gst_caps_get_features (in_caps, 0);
- out_features = gst_caps_get_features (out_caps, 0);
-
- if (!gst_caps_features_contains (in_features,
- GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
- return FALSE;
- if (!gst_caps_features_contains (out_features,
- GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
- return FALSE;
-
- if (!gst_video_info_from_caps (&in_info, in_caps))
- return FALSE;
- if (!gst_video_info_from_caps (&out_info, out_caps))
- return FALSE;
-
- {
- GstStructure *in_s = gst_caps_get_structure (in_caps, 0);
- GstStructure *out_s = gst_caps_get_structure (out_caps, 0);
-
- if (gst_structure_has_field_typed (in_s, "texture-target", G_TYPE_STRING)) {
- from_target =
- gst_gl_texture_target_from_string (gst_structure_get_string (in_s,
- "texture-target"));
- }
-
- if (gst_structure_has_field_typed (out_s, "texture-target", G_TYPE_STRING)) {
- to_target =
- gst_gl_texture_target_from_string (gst_structure_get_string (out_s,
- "texture-target"));
- }
-
- if (to_target == GST_GL_TEXTURE_TARGET_NONE
- || from_target == GST_GL_TEXTURE_TARGET_NONE)
- /* invalid caps */
- return FALSE;
- }
-
- return _view_convert_set_format (viewconvert, &in_info, from_target,
- &out_info, to_target);
-}
-
-/* Function that can halve the value
- * of ints, fractions, int/fraction ranges and lists of ints/fractions */
-static gboolean
-_halve_value (GValue * out, const GValue * in_value)
-{
- /* Fundamental fixed types first */
- if (G_VALUE_HOLDS_INT (in_value)) {
- g_value_init (out, G_TYPE_INT);
- g_value_set_int (out, MAX (g_value_get_int (in_value) / 2, 1));
- } else if (GST_VALUE_HOLDS_FRACTION (in_value)) {
- gint num, den;
- num = gst_value_get_fraction_numerator (in_value);
- den = gst_value_get_fraction_denominator (in_value);
- g_value_init (out, GST_TYPE_FRACTION);
- /* Don't adjust 'infinite' fractions */
- if ((num != 1 || den != 2147483647) && (num != 2147483647 || den != 1)) {
- /* FIXME - could do better approximation when den > G_MAXINT/2? */
- den = den > G_MAXINT / 2 ? G_MAXINT : den * 2;
- }
- gst_value_set_fraction (out, num, den);
- } else if (GST_VALUE_HOLDS_INT_RANGE (in_value)) {
- gint range_min = gst_value_get_int_range_min (in_value);
- gint range_max = gst_value_get_int_range_max (in_value);
- gint range_step = gst_value_get_int_range_step (in_value);
- g_value_init (out, GST_TYPE_INT_RANGE);
- if (range_min != 1)
- range_min = MAX (1, range_min / 2);
- if (range_max != G_MAXINT)
- range_max = MAX (1, range_max / 2);
- gst_value_set_int_range_step (out, range_min,
- range_max, MAX (1, range_step / 2));
- } else if (GST_VALUE_HOLDS_FRACTION_RANGE (in_value)) {
- GValue min_out = G_VALUE_INIT;
- GValue max_out = G_VALUE_INIT;
- const GValue *range_min = gst_value_get_fraction_range_min (in_value);
- const GValue *range_max = gst_value_get_fraction_range_max (in_value);
- _halve_value (&min_out, range_min);
- _halve_value (&max_out, range_max);
- g_value_init (out, GST_TYPE_FRACTION_RANGE);
- gst_value_set_fraction_range (out, &min_out, &max_out);
- g_value_unset (&min_out);
- g_value_unset (&max_out);
- } else if (GST_VALUE_HOLDS_LIST (in_value)) {
- gint i;
- g_value_init (out, GST_TYPE_LIST);
- for (i = 0; i < gst_value_list_get_size (in_value); i++) {
- const GValue *entry;
- GValue tmp = G_VALUE_INIT;
-
- entry = gst_value_list_get_value (in_value, i);
- /* Random list values might not be the right type */
- if (!_halve_value (&tmp, entry))
- goto fail;
- gst_value_list_append_and_take_value (out, &tmp);
- }
- } else {
- return FALSE;
- }
-
- return TRUE;
-fail:
- g_value_unset (out);
- return FALSE;
-}
-
-static GstStructure *
-_halve_structure_field (const GstStructure * in, const gchar * field_name)
-{
- GstStructure *out;
- const GValue *in_value = gst_structure_get_value (in, field_name);
- GValue tmp = G_VALUE_INIT;
-
- if (G_UNLIKELY (in_value == NULL))
- return gst_structure_copy (in); /* Field doesn't exist, leave it as is */
-
- if (!_halve_value (&tmp, in_value))
- return NULL;
-
- out = gst_structure_copy (in);
- gst_structure_set_value (out, field_name, &tmp);
- g_value_unset (&tmp);
-
- return out;
-}
-
-/* Function that can double the value
- * of ints, fractions, int/fraction ranges and lists of ints/fractions */
-static gboolean
-_double_value (GValue * out, const GValue * in_value)
-{
- /* Fundamental fixed types first */
- if (G_VALUE_HOLDS_INT (in_value)) {
- gint n = g_value_get_int (in_value);
- g_value_init (out, G_TYPE_INT);
- if (n <= G_MAXINT / 2)
- g_value_set_int (out, n * 2);
- else
- g_value_set_int (out, G_MAXINT);
- } else if (GST_VALUE_HOLDS_FRACTION (in_value)) {
- gint num, den;
- num = gst_value_get_fraction_numerator (in_value);
- den = gst_value_get_fraction_denominator (in_value);
- g_value_init (out, GST_TYPE_FRACTION);
- /* Don't adjust 'infinite' fractions */
- if ((num != 1 || den != 2147483647) && (num != 2147483647 || den != 1)) {
- /* FIXME - could do better approximation when num > G_MAXINT/2? */
- num = num > G_MAXINT / 2 ? G_MAXINT : num * 2;
- }
- gst_value_set_fraction (out, num, den);
- } else if (GST_VALUE_HOLDS_INT_RANGE (in_value)) {
- gint range_min = gst_value_get_int_range_min (in_value);
- gint range_max = gst_value_get_int_range_max (in_value);
- gint range_step = gst_value_get_int_range_step (in_value);
- if (range_min != 1) {
- range_min = MIN (G_MAXINT / 2, range_min);
- range_min *= 2;
- }
- if (range_max != G_MAXINT) {
- range_max = MIN (G_MAXINT / 2, range_max);
- range_max *= 2;
- }
- range_step = MIN (G_MAXINT / 2, range_step);
- g_value_init (out, GST_TYPE_INT_RANGE);
- gst_value_set_int_range_step (out, range_min, range_max, range_step);
- } else if (GST_VALUE_HOLDS_FRACTION_RANGE (in_value)) {
- GValue min_out = G_VALUE_INIT;
- GValue max_out = G_VALUE_INIT;
- const GValue *range_min = gst_value_get_fraction_range_min (in_value);
- const GValue *range_max = gst_value_get_fraction_range_max (in_value);
- _double_value (&min_out, range_min);
- _double_value (&max_out, range_max);
- g_value_init (out, GST_TYPE_FRACTION_RANGE);
- gst_value_set_fraction_range (out, &min_out, &max_out);
- g_value_unset (&min_out);
- g_value_unset (&max_out);
- } else if (GST_VALUE_HOLDS_LIST (in_value)) {
- gint i;
- g_value_init (out, GST_TYPE_LIST);
- for (i = 0; i < gst_value_list_get_size (in_value); i++) {
- const GValue *entry;
- GValue tmp = G_VALUE_INIT;
-
- entry = gst_value_list_get_value (in_value, i);
- /* Random list values might not be the right type */
- if (!_double_value (&tmp, entry))
- goto fail;
- gst_value_list_append_and_take_value (out, &tmp);
- }
- } else {
- return FALSE;
- }
-
- return TRUE;
-fail:
- g_value_unset (out);
- return FALSE;
-}
-
-static GstStructure *
-_double_structure_field (const GstStructure * in, const gchar * field_name)
-{
- GstStructure *out;
- const GValue *in_value = gst_structure_get_value (in, field_name);
- GValue tmp = G_VALUE_INIT;
-
- if (G_UNLIKELY (in_value == NULL))
- return gst_structure_copy (in); /* Field doesn't exist, leave it as is */
-
- if (!_double_value (&tmp, in_value))
- return NULL;
-
- out = gst_structure_copy (in);
- gst_structure_set_value (out, field_name, &tmp);
- g_value_unset (&tmp);
-
- return out;
-}
-
-/* Return a copy of the caps with the requested field halved in value/range */
-#if 0
-static GstCaps *
-_halve_caps_field (const GstCaps * in, const gchar * field_name)
-{
- gint i;
- GstCaps *out = gst_caps_new_empty ();
-
- for (i = 0; i < gst_caps_get_size (in); i++) {
- const GstStructure *cur = gst_caps_get_structure (in, i);
- GstCapsFeatures *f = gst_caps_get_features (in, i);
-
- GstStructure *res = _halve_structure_field (cur, field_name);
- out =
- gst_caps_merge_structure_full (out, res,
- f ? gst_caps_features_copy (f) : NULL);
- }
-
- return out;
-}
-#endif
-
-/* Return a copy of the caps with the requested field doubled in value/range */
-static GstCaps *
-_double_caps_field (const GstCaps * in, const gchar * field_name)
-{
- gint i;
- GstCaps *out = gst_caps_new_empty ();
-
- for (i = 0; i < gst_caps_get_size (in); i++) {
- const GstStructure *cur = gst_caps_get_structure (in, i);
- GstCapsFeatures *f = gst_caps_get_features (in, i);
-
- GstStructure *res = _double_structure_field (cur, field_name);
- out =
- gst_caps_merge_structure_full (out, res,
- f ? gst_caps_features_copy (f) : NULL);
- }
-
- return out;
-}
-
-/* Takes ownership of the input caps */
-static GstCaps *
-_expand_par_for_half_aspect (GstCaps * in, gboolean vertical_half_aspect)
-{
-
- guint mview_flags, mview_flags_mask;
- GstCaps *out;
- GstStructure *tmp;
-
- out = gst_caps_new_empty ();
-
- while (gst_caps_get_size (in) > 0) {
- GstStructure *s;
- GstCapsFeatures *features;
-
- features = gst_caps_get_features (in, 0);
- if (features)
- features = gst_caps_features_copy (features);
-
- s = gst_caps_steal_structure (in, 0);
-
- if (!gst_structure_get_flagset (s, "multiview-flags", &mview_flags,
- &mview_flags_mask)) {
- gst_caps_append_structure_full (out, s, features);
- continue;
- }
- /* If the input doesn't care about the half-aspect flag, allow current PAR in either variant */
- if ((mview_flags_mask & GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT) == 0) {
- gst_caps_append_structure_full (out, s, features);
- continue;
- }
- if (!gst_structure_has_field (s, "pixel-aspect-ratio")) {
- /* No par field, dont-care the half-aspect flag */
- gst_structure_set (s, "multiview-flags",
- GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
- mview_flags & ~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT,
- mview_flags_mask & ~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT, NULL);
- gst_caps_append_structure_full (out, s, features);
- continue;
- }
-
- /* Halve or double PAR base on inputs input specified. */
-
- /* Append a copy with the half-aspect flag as-is */
- tmp = gst_structure_copy (s);
- out = gst_caps_merge_structure_full (out, tmp,
- features ? gst_caps_features_copy (features) : NULL);
-
- /* and then a copy inverted */
- if (mview_flags & GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT) {
- /* Input is half-aspect. Double/halve the PAR, clear the flag */
- if (vertical_half_aspect)
- tmp = _halve_structure_field (s, "pixel-aspect-ratio");
- else
- tmp = _double_structure_field (s, "pixel-aspect-ratio");
- /* Clear the flag */
- gst_structure_set (tmp, "multiview-flags",
- GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
- mview_flags & ~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT,
- mview_flags_mask | GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT, NULL);
- } else {
- if (vertical_half_aspect)
- tmp = _double_structure_field (s, "pixel-aspect-ratio");
- else
- tmp = _halve_structure_field (s, "pixel-aspect-ratio");
- /* Set the flag */
- gst_structure_set (tmp, "multiview-flags",
- GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
- mview_flags | GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT,
- mview_flags_mask | GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT, NULL);
- }
-
- out = gst_caps_merge_structure_full (out, tmp,
- features ? gst_caps_features_copy (features) : NULL);
-
- gst_structure_free (s);
- if (features)
- gst_caps_features_free (features);
- }
-
- gst_caps_unref (in);
-
- return out;
-}
-
-/* If input supports top-bottom or row-interleaved, we may halve height to mono frames.
- * If input supports left-right, checkerboard, quincunx or column-interleaved,
- * we may halve width to mono frames.
- * For output of top-bottom or row-interleaved, we may double the mono height
- * For output of left-right, checkerboard, quincunx or column-interleaved,
- * we may double the mono width.
- * In all cases, if input has half-aspect and output does not, we may double the PAR
- * And if input does *not* have half-aspect flag and output does not, we may halve the PAR
- */
-static GstCaps *
-_expand_structure (GstGLViewConvert * viewconvert,
- GstCaps * out_caps, GstStructure * structure, GstCapsFeatures * features)
-{
- GstCaps *expanded_caps, *tmp;
- GstCaps *mono_caps;
- const gchar *default_mview_mode_str = NULL;
- guint mview_flags, mview_flags_mask;
- const GValue *in_modes;
- gint i;
-
- /* Empty caps to accumulate into */
- expanded_caps = gst_caps_new_empty ();
-
- /* First, set defaults if multiview flags are missing */
- default_mview_mode_str =
- gst_video_multiview_mode_to_caps_string (GST_VIDEO_MULTIVIEW_MODE_MONO);
-
- mview_flags = GST_VIDEO_MULTIVIEW_FLAGS_NONE;
- mview_flags_mask = GST_FLAG_SET_MASK_EXACT;
-
- if (!gst_structure_has_field (structure, "multiview-mode")) {
- gst_structure_set (structure,
- "multiview-mode", G_TYPE_STRING, default_mview_mode_str, NULL);
- }
- if (!gst_structure_has_field (structure, "multiview-flags")) {
- gst_structure_set (structure,
- "multiview-flags", GST_TYPE_VIDEO_MULTIVIEW_FLAGSET, mview_flags,
- mview_flags_mask, NULL);
- } else {
- gst_structure_get_flagset (structure, "multiview-flags",
- &mview_flags, &mview_flags_mask);
- }
-
- in_modes = gst_structure_get_value (structure, "multiview-mode");
- mono_caps = gst_caps_new_empty ();
- if (gst_value_intersect (NULL, in_modes,
- gst_video_multiview_get_mono_modes ())) {
- GstStructure *new_struct = gst_structure_copy (structure);
- gst_structure_set_value (new_struct, "multiview-mode",
- gst_video_multiview_get_mono_modes ());
- /* Half-aspect makes no sense for mono or unpacked, get rid of it */
- if (mview_flags & GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT) {
- gst_structure_set (new_struct, "multiview-flags",
- GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
- mview_flags & ~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT,
- mview_flags_mask & ~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT, NULL);
- }
- gst_caps_append_structure_full (mono_caps, new_struct,
- features ? gst_caps_features_copy (features) : NULL);
- }
- if (gst_value_intersect (NULL, in_modes,
- gst_video_multiview_get_unpacked_modes ())) {
- GstStructure *new_struct = gst_structure_copy (structure);
-
- gst_structure_set_value (new_struct, "multiview-mode",
- gst_video_multiview_get_mono_modes ());
-
- /* Half-aspect makes no sense for mono or unpacked, get rid of it */
- if (mview_flags & GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT) {
- gst_structure_set (new_struct, "multiview-flags",
- GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
- mview_flags & ~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT,
- mview_flags_mask & ~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT, NULL);
- }
- gst_caps_append_structure_full (mono_caps, new_struct,
- features ? gst_caps_features_copy (features) : NULL);
- }
-
- if (gst_value_intersect (NULL, in_modes,
- gst_video_multiview_get_doubled_height_modes ())) {
- /* Append mono formats with height halved */
- GstStructure *new_struct = _halve_structure_field (structure, "height");
- gst_structure_set_value (new_struct, "multiview-mode",
- gst_video_multiview_get_mono_modes ());
- /* Normalise the half-aspect flag away */
- if (mview_flags & GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT) {
- GstStructure *s =
- _halve_structure_field (new_struct, "pixel-aspect-ratio");
- gst_structure_set (structure, "multiview-flags",
- GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
- mview_flags & ~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT,
- mview_flags_mask | GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT, NULL);
- gst_structure_free (new_struct);
- new_struct = s;
- }
- mono_caps = gst_caps_merge_structure_full (mono_caps, new_struct,
- features ? gst_caps_features_copy (features) : NULL);
- }
- if (gst_value_intersect (NULL, in_modes,
- gst_video_multiview_get_doubled_width_modes ())) {
- /* Append mono formats with width halved */
- GstStructure *new_struct = _halve_structure_field (structure, "width");
- gst_structure_set_value (new_struct, "multiview-mode",
- gst_video_multiview_get_mono_modes ());
- /* Normalise the half-aspect flag away */
- if (mview_flags & GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT) {
- GstStructure *s =
- _double_structure_field (new_struct, "pixel-aspect-ratio");
- gst_structure_set (structure, "multiview-flags",
- GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
- mview_flags & ~GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT,
- mview_flags_mask | GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT, NULL);
- gst_structure_free (new_struct);
- new_struct = s;
- }
- mono_caps = gst_caps_merge_structure_full (mono_caps, new_struct,
- features ? gst_caps_features_copy (features) : NULL);
- }
- if (gst_value_intersect (NULL, in_modes,
- gst_video_multiview_get_doubled_size_modes ())) {
- /* Append checkerboard/doubled size formats with width & height halved */
- GstStructure *new_struct_w = _halve_structure_field (structure, "width");
- GstStructure *new_struct_wh =
- _halve_structure_field (new_struct_w, "height");
- gst_structure_free (new_struct_w);
- gst_structure_set_value (new_struct_wh, "multiview-mode",
- gst_video_multiview_get_mono_modes ());
- mono_caps = gst_caps_merge_structure_full (mono_caps, new_struct_wh,
- features ? gst_caps_features_copy (features) : NULL);
- }
-
- /* Everything is normalised now, unset the flags we can change */
- /* Remove the views field, as these are all 'mono' modes
- * Need to do this before we expand caps back out to frame packed modes */
- for (i = 0; i < gst_caps_get_size (mono_caps); i++) {
- GstStructure *s = gst_caps_get_structure (mono_caps, i);
- gst_structure_remove_fields (s, "views", NULL);
- if (gst_structure_get_flagset (s, "multiview-flags", &mview_flags,
- &mview_flags_mask)) {
- /* Preserve only the half-aspect and mixed-mono flags, for now.
- * The rest we can change */
- mview_flags_mask &=
- (GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT |
- GST_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO);
- gst_structure_set (s, "multiview-flags", GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
- mview_flags, mview_flags_mask, NULL);
- }
- }
-
- GST_TRACE_OBJECT (viewconvert,
- "Collected single-view caps %" GST_PTR_FORMAT, mono_caps);
- /* Put unpacked and mono modes first. We don't care about flags. Clear them */
- tmp = gst_caps_copy (mono_caps);
- for (i = 0; i < gst_caps_get_size (tmp); i++) {
- GstStructure *s = gst_caps_get_structure (tmp, i);
- gst_structure_remove_fields (s, "views", NULL);
- if (gst_structure_get_flagset (s, "multiview-flags", &mview_flags,
- &mview_flags_mask)) {
- /* We can change any flags for mono modes - half-aspect and mixed-mono have no meaning */
- mview_flags_mask = 0;
- gst_structure_set (s, "multiview-flags", GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
- mview_flags, mview_flags_mask, NULL);
- }
- }
- expanded_caps = gst_caps_merge (expanded_caps, tmp);
-
- /* Unpacked output modes have 2 views, for now */
- tmp = gst_caps_copy (mono_caps);
- gst_caps_set_value (tmp, "multiview-mode",
- gst_video_multiview_get_unpacked_modes ());
- for (i = 0; i < gst_caps_get_size (tmp); i++) {
- GstStructure *s = gst_caps_get_structure (tmp, i);
- gst_structure_set (s, "views", G_TYPE_INT, 2, NULL);
- if (gst_structure_get_flagset (s, "multiview-flags", &mview_flags,
- &mview_flags_mask)) {
- /* We can change any flags for unpacked modes - half-aspect and mixed-mono have no meaning */
- mview_flags_mask = 0;
- gst_structure_set (s, "multiview-flags", GST_TYPE_VIDEO_MULTIVIEW_FLAGSET,
- mview_flags, mview_flags_mask, NULL);
- }
- }
- expanded_caps = gst_caps_merge (expanded_caps, tmp);
-
- /* Double height output modes */
- tmp = _double_caps_field (mono_caps, "height");
- gst_caps_set_value (tmp, "multiview-mode",
- gst_video_multiview_get_doubled_height_modes ());
- tmp = _expand_par_for_half_aspect (tmp, TRUE);
-
- expanded_caps = gst_caps_merge (expanded_caps, tmp);
-
- /* Double width output modes */
- tmp = _double_caps_field (mono_caps, "width");
- gst_caps_set_value (tmp, "multiview-mode",
- gst_video_multiview_get_doubled_width_modes ());
- tmp = _expand_par_for_half_aspect (tmp, FALSE);
-
- expanded_caps = gst_caps_merge (expanded_caps, tmp);
-
- /* Double size output modes */
- {
- GstCaps *tmp_w = _double_caps_field (mono_caps, "width");
- tmp = _double_caps_field (tmp_w, "height");
- gst_caps_unref (tmp_w);
- gst_caps_set_value (tmp, "multiview-mode",
- gst_video_multiview_get_doubled_size_modes ());
- expanded_caps = gst_caps_merge (expanded_caps, tmp);
- }
-
- /* We're done with the mono caps now */
- gst_caps_unref (mono_caps);
-
- GST_TRACE_OBJECT (viewconvert,
- "expanded transform caps now %" GST_PTR_FORMAT, expanded_caps);
-
- if (gst_caps_is_empty (expanded_caps)) {
- gst_caps_unref (expanded_caps);
- return out_caps;
- }
- /* Really, we can rescale - so at this point we can append full-range
- * height/width/PAR as an unpreferred final option. */
- tmp = gst_caps_copy (expanded_caps);
- gst_caps_set_simple (tmp, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-
- out_caps = gst_caps_merge (out_caps, expanded_caps);
- out_caps = gst_caps_merge (out_caps, tmp);
- return out_caps;
-}
-
-static GstCaps *
-_intersect_with_mview_mode (GstCaps * caps,
- GstVideoMultiviewMode mode, GstVideoMultiviewFlags flags)
-{
- GstCaps *filter, *result;
- const gchar *caps_str;
-
- caps_str = gst_video_multiview_mode_to_caps_string (mode);
-
- filter = gst_caps_new_simple ("video/x-raw",
- "multiview-mode", G_TYPE_STRING,
- caps_str, "multiview-flags", GST_TYPE_VIDEO_MULTIVIEW_FLAGSET, flags,
- GST_FLAG_SET_MASK_EXACT, NULL);
-
- if (mode == GST_VIDEO_MULTIVIEW_MODE_SEPARATED ||
- mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME)
- gst_caps_set_simple (filter, "views", G_TYPE_INT, 2, NULL);
-
- gst_caps_set_features (filter, 0, gst_caps_features_new_any ());
-
- GST_DEBUG ("Intersecting target caps %" GST_PTR_FORMAT
- " with caps %" GST_PTR_FORMAT, caps, filter);
-
- result = gst_caps_intersect_full (caps, filter, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (filter);
- return result;
-}
-
-static GstCaps *
-_intersect_with_mview_modes (GstCaps * caps, const GValue * modes)
-{
- GstCaps *filter, *result;
-
- filter = gst_caps_new_empty_simple ("video/x-raw");
-
- gst_caps_set_value (filter, "multiview-mode", modes);
- gst_caps_set_features (filter, 0, gst_caps_features_new_any ());
-
- GST_DEBUG ("Intersecting target caps %" GST_PTR_FORMAT
- " with caps %" GST_PTR_FORMAT, caps, filter);
-
- result = gst_caps_intersect_full (caps, filter, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (filter);
- return result;
-}
-
-/**
- * gst_gl_view_convert_transform_caps:
- * @viewconvert: a #GstGLViewConvert
- * @direction: a #GstPadDirection
- * @caps: (transfer none): the #GstCaps to transform
- * @filter: (transfer none): a set of filter #GstCaps
- *
- * Provides an implementation of #GstBaseTransformClass::transform_caps()
- *
- * Returns: (transfer full): the converted #GstCaps
- *
- * Since: 1.6
- */
-GstCaps *
-gst_gl_view_convert_transform_caps (GstGLViewConvert * viewconvert,
- GstPadDirection direction, GstCaps * caps, GstCaps * filter)
-{
- gint i, n;
- GstCaps *base_caps = gst_static_caps_get (&caps_template);
- GstCaps *out_caps, *tmp_caps;
-
- g_return_val_if_fail (GST_IS_GL_VIEW_CONVERT (viewconvert), NULL);
-
- GST_DEBUG_OBJECT (viewconvert, "Direction %s "
- "input caps %" GST_PTR_FORMAT " filter %" GST_PTR_FORMAT,
- direction == GST_PAD_SINK ? "sink" : "src", caps, filter);
-
- /* We can only process GLmemory RGBA caps, start from that */
- caps = gst_caps_intersect (caps, base_caps);
- gst_caps_unref (base_caps);
-
- /* Change input/output to the formats we can convert to/from,
- * but keep the original caps at the start - we will always prefer
- * passthrough */
- if (direction == GST_PAD_SINK) {
- out_caps = gst_caps_copy (caps);
- if (viewconvert->input_mode_override != GST_VIDEO_MULTIVIEW_MODE_NONE) {
- GstVideoMultiviewMode mode = viewconvert->input_mode_override;
- GstVideoMultiviewFlags flags = viewconvert->input_flags_override;
-
- const gchar *caps_str = gst_video_multiview_mode_to_caps_string (mode);
- /* Coerce the input caps before transforming, so the sizes come out right */
- gst_caps_set_simple (out_caps, "multiview-mode", G_TYPE_STRING,
- caps_str, "multiview-flags", GST_TYPE_VIDEO_MULTIVIEW_FLAGSET, flags,
- GST_FLAG_SET_MASK_EXACT, NULL);
- }
- } else {
- out_caps = gst_caps_new_empty ();
- }
-
- for (i = 0; i < gst_caps_get_size (caps); i++) {
- GstStructure *structure = gst_caps_get_structure (caps, i);
- GstCapsFeatures *features = gst_caps_get_features (caps, i);
- out_caps = _expand_structure (viewconvert, out_caps, structure, features);
- }
-
- if (gst_caps_is_empty (out_caps))
- goto out;
-
- /* If we have an output mode override, limit things to that */
- if (direction == GST_PAD_SINK &&
- viewconvert->output_mode_override != GST_VIDEO_MULTIVIEW_MODE_NONE) {
-
- tmp_caps = _intersect_with_mview_mode (out_caps,
- viewconvert->output_mode_override, viewconvert->output_flags_override);
-
- gst_caps_unref (out_caps);
- out_caps = tmp_caps;
- } else if (viewconvert->input_mode_override != GST_VIDEO_MULTIVIEW_MODE_NONE) {
- /* Prepend a copy of our preferred input caps in case the peer
- * can handle them */
- tmp_caps = _intersect_with_mview_mode (out_caps,
- viewconvert->input_mode_override, viewconvert->input_flags_override);
- out_caps = gst_caps_merge (out_caps, tmp_caps);
- }
- if (direction == GST_PAD_SRC) {
- GstStructure *s;
- /* When generating input caps, we also need a copy of the mono caps
- * without multiview-mode or flags for backwards compat, at the end */
- tmp_caps = _intersect_with_mview_mode (caps,
- GST_VIDEO_MULTIVIEW_MODE_MONO, GST_VIDEO_MULTIVIEW_FLAGS_NONE);
- if (!gst_caps_is_empty (tmp_caps)) {
- s = gst_caps_get_structure (tmp_caps, 0);
- gst_structure_remove_fields (s, "multiview-mode", "multiview-flags",
- NULL);
- out_caps = gst_caps_merge (out_caps, tmp_caps);
- } else
- gst_caps_unref (tmp_caps);
- }
-out:
- gst_caps_unref (caps);
-
- n = gst_caps_get_size (out_caps);
- for (i = 0; i < n; i++) {
- GstStructure *s = gst_caps_get_structure (out_caps, i);
-
- gst_structure_remove_fields (s, "texture-target", NULL);
- }
-
- GST_DEBUG_OBJECT (viewconvert, "Returning caps %" GST_PTR_FORMAT, out_caps);
- return out_caps;
-}
-
-static guint
-_get_target_bitmask_from_g_value (const GValue * targets)
-{
- guint new_targets = 0;
-
- if (targets == NULL) {
- new_targets = 1 << GST_GL_TEXTURE_TARGET_2D;
- } else if (G_TYPE_CHECK_VALUE_TYPE (targets, G_TYPE_STRING)) {
- GstGLTextureTarget target;
- const gchar *str;
-
- str = g_value_get_string (targets);
- target = gst_gl_texture_target_from_string (str);
-
- if (target)
- new_targets |= 1 << target;
- } else if (G_TYPE_CHECK_VALUE_TYPE (targets, GST_TYPE_LIST)) {
- gint j, m;
-
- m = gst_value_list_get_size (targets);
- for (j = 0; j < m; j++) {
- const GValue *val = gst_value_list_get_value (targets, j);
- GstGLTextureTarget target;
- const gchar *str;
-
- str = g_value_get_string (val);
- target = gst_gl_texture_target_from_string (str);
- if (target)
- new_targets |= 1 << target;
- }
- }
-
- return new_targets;
-}
-
-static GstCaps *
-_fixate_texture_target (GstGLViewConvert * viewconvert,
- GstPadDirection direction, GstCaps * caps, GstCaps * other)
-{
- GValue item = G_VALUE_INIT;
- const GValue *targets, *other_targets;
- guint targets_mask = 0, other_targets_mask = 0, result_mask;
- GstStructure *s, *s_other;
-
- other = gst_caps_make_writable (other);
- s = gst_caps_get_structure (caps, 0);
- s_other = gst_caps_get_structure (other, 0);
-
- other_targets = gst_structure_get_value (s_other, "texture-target");
- targets = gst_structure_get_value (s, "texture-target");
-
- targets_mask = _get_target_bitmask_from_g_value (targets);
- other_targets_mask = _get_target_bitmask_from_g_value (other_targets);
-
- result_mask = targets_mask & other_targets_mask;
- if (result_mask == 0) {
- /* nothing we can do here */
- return gst_caps_fixate (other);
- }
-
- if (direction == GST_PAD_SINK) {
- result_mask &=
- (1 << GST_GL_TEXTURE_TARGET_2D | 1 << GST_GL_TEXTURE_TARGET_RECTANGLE);
- } else {
- /* if the src caps has 2D support we can 'convert' to anything */
- if (targets_mask & (1 << GST_GL_TEXTURE_TARGET_2D))
- result_mask = -1;
- else
- result_mask = other_targets_mask;
- }
-
- g_value_init (&item, G_TYPE_STRING);
- if (result_mask & (1 << GST_GL_TEXTURE_TARGET_2D)) {
- g_value_set_static_string (&item, GST_GL_TEXTURE_TARGET_2D_STR);
- } else if (result_mask & (1 << GST_GL_TEXTURE_TARGET_RECTANGLE)) {
- g_value_set_static_string (&item, GST_GL_TEXTURE_TARGET_RECTANGLE_STR);
- } else if (result_mask & (1 << GST_GL_TEXTURE_TARGET_EXTERNAL_OES)) {
- g_value_set_static_string (&item, GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR);
- }
-
- gst_structure_set_value (s_other, "texture-target", &item);
-
- g_value_unset (&item);
-
- return gst_caps_fixate (other);
-}
-
-/**
- * gst_gl_view_convert_fixate_caps:
- * @viewconvert: a #GstGLViewConvert
- * @direction: a #GstPadDirection
- * @caps: (transfer none): the #GstCaps of @direction
- * @othercaps: (transfer full): the #GstCaps to fixate
- *
- * Provides an implementation of #GstBaseTransformClass::fixate_caps()
- *
- * Returns: (transfer full): the fixated #GstCaps
- *
- * Since: 1.6
- */
-GstCaps *
-gst_gl_view_convert_fixate_caps (GstGLViewConvert * viewconvert,
- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
-{
- GstVideoMultiviewMode mode = viewconvert->output_mode_override;
- GstVideoMultiviewFlags flags = viewconvert->output_flags_override;
- GstCaps *tmp;
-
- g_return_val_if_fail (GST_IS_GL_VIEW_CONVERT (viewconvert), NULL);
-
- othercaps = gst_caps_make_writable (othercaps);
- GST_LOG_OBJECT (viewconvert, "dir %s fixating %" GST_PTR_FORMAT
- " against caps %" GST_PTR_FORMAT,
- direction == GST_PAD_SINK ? "sink" : "src", othercaps, caps);
-
- if (direction == GST_PAD_SINK) {
- if (mode != GST_VIDEO_MULTIVIEW_MODE_NONE) {
- /* We have a requested output mode and are fixating source caps, try and enforce it */
- tmp = _intersect_with_mview_mode (othercaps, mode, flags);
- gst_caps_unref (othercaps);
- othercaps = tmp;
- } else {
- /* See if we can do passthrough */
- GstVideoInfo info;
-
- if (gst_video_info_from_caps (&info, caps)) {
- GstVideoMultiviewMode mode = GST_VIDEO_INFO_MULTIVIEW_MODE (&info);
- GstVideoMultiviewFlags flags = GST_VIDEO_INFO_MULTIVIEW_FLAGS (&info);
-
- if (viewconvert->input_mode_override != GST_VIDEO_MULTIVIEW_MODE_NONE) {
- mode = viewconvert->input_mode_override;
- flags = viewconvert->input_flags_override;
- }
-
- tmp = _intersect_with_mview_mode (othercaps, mode, flags);
- if (gst_caps_is_empty (tmp)) {
- /* Nope, we can't pass our input caps downstream */
- gst_caps_unref (tmp);
- } else {
- gst_caps_unref (othercaps);
- othercaps = tmp;
- goto done;
- }
- }
-
- /* Prefer an unpacked mode for output */
- tmp =
- _intersect_with_mview_modes (othercaps,
- gst_video_multiview_get_unpacked_modes ());
- if (!gst_caps_is_empty (tmp)) {
- gst_caps_unref (othercaps);
- othercaps = tmp;
- } else {
- gst_caps_unref (tmp);
- }
- }
- } else if (viewconvert->input_mode_override != GST_VIDEO_MULTIVIEW_MODE_NONE) {
- /* See if we can coerce the caps into matching input mode/flags,
- * in case it doesn't care at all, but allow it not to too */
- mode = viewconvert->input_mode_override;
- flags = viewconvert->input_flags_override;
- tmp = _intersect_with_mview_mode (othercaps, mode, flags);
- if (gst_caps_is_empty (tmp)) {
- /* Nope, we can pass our input caps downstream */
- gst_caps_unref (tmp);
- } else {
- gst_caps_unref (othercaps);
- othercaps = tmp;
- }
- }
-
- othercaps = _fixate_texture_target (viewconvert, direction, caps, othercaps);
-
-done:
- GST_DEBUG_OBJECT (viewconvert, "dir %s fixated to %" GST_PTR_FORMAT
- " against caps %" GST_PTR_FORMAT,
- direction == GST_PAD_SINK ? "sink" : "src", othercaps, caps);
- return othercaps;
-}
-
-/**
- * gst_gl_view_convert_reset:
- * @viewconvert: a #GstGLViewConvert
- *
- * Reset @viewconvert to the default state. Further operation will require
- * setting the caps with gst_gl_view_convert_set_caps().
- *
- * Since: 1.6
- */
-void
-gst_gl_view_convert_reset (GstGLViewConvert * viewconvert)
-{
- g_return_if_fail (GST_IS_GL_VIEW_CONVERT (viewconvert));
- if (viewconvert->shader)
- gst_object_unref (viewconvert->shader);
- viewconvert->shader = NULL;
-
- if (viewconvert->fbo)
- gst_object_unref (viewconvert->fbo);
- viewconvert->fbo = NULL;
-
- viewconvert->initted = FALSE;
- viewconvert->reconfigure = FALSE;
-}
-
-static void
-gst_gl_view_convert_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstGLViewConvert *convert = GST_GL_VIEW_CONVERT (object);
- switch (prop_id) {
- case PROP_INPUT_LAYOUT:
- convert->input_mode_override = g_value_get_enum (value);
- break;
- case PROP_INPUT_FLAGS:
- convert->input_flags_override = g_value_get_flags (value);
- break;
- case PROP_OUTPUT_LAYOUT:
- convert->output_mode_override = g_value_get_enum (value);
- break;
- case PROP_OUTPUT_FLAGS:
- convert->output_flags_override = g_value_get_flags (value);
- break;
- case PROP_OUTPUT_DOWNMIX_MODE:
- convert->downmix_mode = g_value_get_enum (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- GST_OBJECT_LOCK (convert);
- convert->reconfigure = TRUE;
- GST_OBJECT_UNLOCK (convert);
-}
-
-static void
-gst_gl_view_convert_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstGLViewConvert *convert = GST_GL_VIEW_CONVERT (object);
- switch (prop_id) {
- case PROP_INPUT_LAYOUT:
- g_value_set_enum (value, convert->input_mode_override);
- break;
- case PROP_INPUT_FLAGS:
- g_value_set_flags (value, convert->input_flags_override);
- break;
- case PROP_OUTPUT_LAYOUT:
- g_value_set_enum (value, convert->output_mode_override);
- break;
- case PROP_OUTPUT_FLAGS:
- g_value_set_flags (value, convert->output_flags_override);
- break;
- case PROP_OUTPUT_DOWNMIX_MODE:
- g_value_set_enum (value, convert->downmix_mode);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
- * gst_gl_view_convert_perform:
- * @viewconvert: a #GstGLViewConvert
- * @inbuf: (transfer none): the #GstGLMemory filled #GstBuffer to convert
- *
- * Converts the data contained by @inbuf using the formats specified by the
- * #GstCaps passed to gst_gl_view_convert_set_caps()
- *
- * Returns: (transfer full): a converted #GstBuffer or %NULL
- *
- * Since: 1.6
- */
-GstBuffer *
-gst_gl_view_convert_perform (GstGLViewConvert * viewconvert, GstBuffer * inbuf)
-{
- GstBuffer *out;
-
- if (gst_gl_view_convert_submit_input_buffer (viewconvert,
- GST_BUFFER_IS_DISCONT (inbuf), gst_buffer_ref (inbuf)) != GST_FLOW_OK)
- return NULL;
- if (gst_gl_view_convert_get_output (viewconvert, &out) != GST_FLOW_OK)
- return NULL;
-
- return out;
-}
-
-/* called by _init_convert (in the gl thread) */
-static gboolean
-_init_view_convert_fbo (GstGLViewConvert * viewconvert)
-{
- guint out_width, out_height;
-
- out_width = GST_VIDEO_INFO_WIDTH (&viewconvert->out_info);
- out_height = GST_VIDEO_INFO_HEIGHT (&viewconvert->out_info);
-
- viewconvert->fbo =
- gst_gl_framebuffer_new_with_default_depth (viewconvert->context,
- out_width, out_height);
-
- return viewconvert->fbo != NULL;
-}
-
-/* free after use */
-static gchar *
-_get_shader_string (GstGLViewConvert * viewconvert, GstGLShader * shader,
- GstVideoMultiviewMode in_mode, GstVideoMultiviewMode out_mode,
- GstGLSLVersion version, GstGLSLProfile profile)
-{
- const gchar *input_str, *output_str;
- gboolean mono_input = FALSE;
- gchar *tmp, *tmp2;
- GString *str = g_string_new (NULL);
- guint n_outputs = 1;
-
- switch (in_mode) {
- case GST_VIDEO_MULTIVIEW_MODE_NONE:
- case GST_VIDEO_MULTIVIEW_MODE_MONO:
- case GST_VIDEO_MULTIVIEW_MODE_LEFT:
- case GST_VIDEO_MULTIVIEW_MODE_RIGHT:
- mono_input = TRUE;
- /* Fall through */
- default:
- input_str = frag_input;
- break;
- }
-
- switch (out_mode) {
- case GST_VIDEO_MULTIVIEW_MODE_LEFT:
- output_str = frag_output_left;
- break;
- case GST_VIDEO_MULTIVIEW_MODE_RIGHT:
- output_str = frag_output_right;
- break;
- case GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX:
- /* FIXME: implement properly with sub-sampling */
- case GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE:
- output_str = frag_output_side_by_side;
- break;
- case GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM:
- output_str = frag_output_top_bottom;
- break;
- case GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED:
- output_str = frag_output_column_interleaved;
- break;
- case GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED:
- output_str = frag_output_row_interleaved;
- break;
- case GST_VIDEO_MULTIVIEW_MODE_SEPARATED:
- case GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME:
- output_str = frag_output_separated;
- n_outputs = 2;
- break;
- case GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD:
- output_str = frag_output_checkerboard;
- break;
- case GST_VIDEO_MULTIVIEW_MODE_NONE:
- case GST_VIDEO_MULTIVIEW_MODE_MONO:
- default:
- if (mono_input)
- output_str = frag_output_left;
- else
- output_str = frag_output_downmix;
- break;
- }
-
- if (viewconvert->from_texture_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
- g_string_append (str, glsl_OES_extension_string);
-
- g_string_append (str, fragment_header);
-
- /* GL 3.3+ and GL ES 3.x */
- if ((profile == GST_GLSL_PROFILE_CORE && version >= GST_GLSL_VERSION_330)
- || (profile == GST_GLSL_PROFILE_ES && version >= GST_GLSL_VERSION_300)) {
- if (n_outputs > 1) {
- gint i;
-
- for (i = 0; i < n_outputs; i++) {
- g_string_append_printf (str,
- "layout(location = %d) out vec4 fragColor_%d;\n", i, i);
- }
- } else {
- g_string_append (str, "layout (location = 0) out vec4 fragColor;\n");
- }
- } else if (profile == GST_GLSL_PROFILE_CORE
- && version >= GST_GLSL_VERSION_150) {
- /* no layout specifiers, use glBindFragDataLocation instead */
- if (n_outputs > 1) {
- gint i;
-
- for (i = 0; i < n_outputs; i++) {
- gchar *var_name = g_strdup_printf ("fragColor_%d", i);
- g_string_append_printf (str, "out vec4 %s;\n", var_name);
- gst_gl_shader_bind_frag_data_location (shader, i, var_name);
- g_free (var_name);
- }
- } else {
- g_string_append (str, "out vec4 fragColor;\n");
- gst_gl_shader_bind_frag_data_location (shader, 0, "fragColor");
- }
- }
-
- {
- const gchar *varying = NULL;
-
- if ((profile == GST_GLSL_PROFILE_ES && version >= GST_GLSL_VERSION_300)
- || (profile == GST_GLSL_PROFILE_CORE
- && version >= GST_GLSL_VERSION_150)) {
- varying = "in";
- } else {
- varying = "varying";
- }
- g_string_append_printf (str,
- "\n%s vec2 v_texcoord;\nvoid main() {\nvec4 l, r;\n", varying);
- }
-
- g_string_append (str, input_str);
- g_string_append (str, output_str);
- g_string_append (str, "\n}");
- tmp = g_string_free (str, FALSE);
-
- tmp2 =
- _gst_glsl_mangle_shader (tmp, GL_FRAGMENT_SHADER,
- GST_GL_TEXTURE_TARGET_2D, viewconvert->from_texture_target,
- viewconvert->context, &version, &profile);
-
- return tmp2;
-}
-
-static void
-_bind_buffer (GstGLViewConvert * viewconvert)
-{
- const GstGLFuncs *gl = viewconvert->context->gl_vtable;
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, viewconvert->priv->vbo_indices);
- gl->BindBuffer (GL_ARRAY_BUFFER, viewconvert->priv->vertex_buffer);
- /* Load the vertex position */
- gl->VertexAttribPointer (viewconvert->priv->attr_position, 3, GL_FLOAT,
- GL_FALSE, 5 * sizeof (GLfloat), (void *) 0);
- /* Load the texture coordinate */
- gl->VertexAttribPointer (viewconvert->priv->attr_texture, 2, GL_FLOAT,
- GL_FALSE, 5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
- gl->EnableVertexAttribArray (viewconvert->priv->attr_position);
- gl->EnableVertexAttribArray (viewconvert->priv->attr_texture);
-}
-
-static void
-_unbind_buffer (GstGLViewConvert * viewconvert)
-{
- const GstGLFuncs *gl = viewconvert->context->gl_vtable;
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
- gl->BindBuffer (GL_ARRAY_BUFFER, 0);
- gl->DisableVertexAttribArray (viewconvert->priv->attr_position);
- gl->DisableVertexAttribArray (viewconvert->priv->attr_texture);
-}
-
-/* Called in the gl thread */
-static gboolean
-_init_view_convert (GstGLViewConvert * viewconvert)
-{
- GstGLViewConvertPrivate *priv = viewconvert->priv;
- GstVideoMultiviewMode in_mode = priv->input_mode;
- GstVideoMultiviewMode out_mode = priv->output_mode;
- GstVideoMultiviewFlags in_flags = priv->input_flags;
- GstVideoMultiviewFlags out_flags = priv->output_flags;
- gfloat tex_scale[2][2] = {
- {1., 1.},
- {1., 1.}
- };
- gfloat offsets[2][2] = {
- {0., 0.},
- {0., 0.}
- };
- gchar *fragment_source_str;
- GstGLFuncs *gl;
- gint l_index, r_index;
-
- gl = viewconvert->context->gl_vtable;
- if (viewconvert->reconfigure)
- gst_gl_view_convert_reset (viewconvert);
- if (viewconvert->initted)
- return TRUE;
-
- GST_LOG_OBJECT (viewconvert,
- "Initializing multiview conversion from %s mode %d flags 0x%x w %u h %u to "
- "%s mode %d flags 0x%x w %u h %u",
- gst_video_format_to_string (GST_VIDEO_INFO_FORMAT
- (&viewconvert->in_info)), in_mode, in_flags,
- viewconvert->in_info.width, viewconvert->in_info.height,
- gst_video_format_to_string (GST_VIDEO_INFO_FORMAT
- (&viewconvert->out_info)), out_mode, out_flags,
- viewconvert->out_info.width, viewconvert->out_info.height);
-
- if (!gl->CreateProgramObject && !gl->CreateProgram) {
- GST_ERROR_OBJECT (viewconvert, "Cannot perform multiview conversion "
- "without OpenGL shaders");
- goto error;
- }
-
- if (out_mode == GST_VIDEO_MULTIVIEW_MODE_SEPARATED
- || out_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME) {
- if (!gl->DrawBuffers) {
- GST_ERROR_OBJECT (viewconvert,
- "Separate texture output mode requested however the current "
- "OpenGL API does not support drawing to multiple buffers");
- goto error;
- }
- }
-
- if ((in_flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST) ==
- (out_flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST)) {
- l_index = 0;
- r_index = 1;
- } else {
- GST_LOG_OBJECT (viewconvert, "Switching left/right views");
- /* Swap the views */
- l_index = 1;
- r_index = 0;
- }
-
- if (in_mode < GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE) { /* unknown/mono/left/right single image */
- } else if (in_mode == GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE ||
- in_mode == GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX) {
- /* Side-by-side input */
- offsets[r_index][0] += 0.5 * tex_scale[r_index][0];
- tex_scale[0][0] *= 0.5f; /* Half horizontal scale */
- tex_scale[1][0] *= 0.5f;
- } else if (in_mode == GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM) { /* top-bottom */
- offsets[r_index][1] += 0.5 * tex_scale[r_index][1];
- tex_scale[0][1] *= 0.5f; /* Half vertical scale */
- tex_scale[1][1] *= 0.5f;
- }
-
- /* Flipped is vertical, flopped is horizontal.
- * Adjust and offset per-view scaling. This needs to be done
- * after the input scaling already splits the views, before
- * adding any output scaling. */
- if ((in_flags & GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED) !=
- (out_flags & GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED)) {
- offsets[l_index][1] += tex_scale[l_index][1];
- tex_scale[l_index][1] *= -1.0;
- }
- if ((in_flags & GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED) !=
- (out_flags & GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED)) {
- offsets[l_index][0] += tex_scale[l_index][0];
- tex_scale[l_index][0] *= -1.0;
- }
- if ((in_flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED) !=
- (out_flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED)) {
- offsets[r_index][1] += tex_scale[r_index][1];
- tex_scale[r_index][1] *= -1.0;
- }
- if ((in_flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED) !=
- (out_flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED)) {
- offsets[r_index][0] += tex_scale[r_index][0];
- tex_scale[r_index][0] *= -1.0;
- }
-
- if (out_mode == GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE ||
- out_mode == GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX) {
- /* Side-by-Side */
- offsets[1][0] -= tex_scale[1][0];
- tex_scale[0][0] *= 2.0f;
- tex_scale[1][0] *= 2.0f;
- } else if (out_mode == GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM) {
- offsets[1][1] -= tex_scale[1][1];
- tex_scale[0][1] *= 2.0f;
- tex_scale[1][1] *= 2.0f;
- }
-
- GST_DEBUG_OBJECT (viewconvert,
- "Scaling matrix [ %f, %f ] [ %f %f]. Offsets [ %f, %f ] [ %f, %f ]",
- tex_scale[0][0], tex_scale[0][1],
- tex_scale[1][0], tex_scale[1][1],
- offsets[0][0], offsets[0][1], offsets[1][0], offsets[1][1]);
-
- viewconvert->shader = gst_gl_shader_new (viewconvert->context);
- {
- GstGLSLVersion version;
- GstGLSLProfile profile;
- GstGLSLStage *vert, *frag;
- gchar *tmp, *tmp1, *version_str;
- const gchar *strings[2];
- GError *error = NULL;
-
- tmp =
- _gst_glsl_mangle_shader
- (gst_gl_shader_string_vertex_mat4_vertex_transform, GL_VERTEX_SHADER,
- GST_GL_TEXTURE_TARGET_2D, viewconvert->from_texture_target,
- viewconvert->context, &version, &profile);
-
- tmp1 = gst_glsl_version_profile_to_string (version, profile);
- version_str = g_strdup_printf ("#version %s\n", tmp1);
- g_free (tmp1);
- strings[0] = version_str;
-
- strings[1] = tmp;
- vert =
- gst_glsl_stage_new_with_strings (viewconvert->context,
- GL_VERTEX_SHADER, version, profile, 2, strings);
- g_free (tmp);
-
- if (!gst_gl_shader_compile_attach_stage (viewconvert->shader, vert, &error)) {
- GST_ERROR_OBJECT (viewconvert, "Failed to compile vertex stage %s",
- error->message);
- gst_object_unref (viewconvert->shader);
- viewconvert->shader = NULL;
- g_free (version_str);
- goto error;
- }
-
- fragment_source_str = _get_shader_string (viewconvert, viewconvert->shader,
- in_mode, out_mode, version, profile);
- strings[1] = fragment_source_str;
-
- frag =
- gst_glsl_stage_new_with_strings (viewconvert->context,
- GL_FRAGMENT_SHADER, version, profile, 2, strings);
- g_free (version_str);
-
- if (!gst_gl_shader_compile_attach_stage (viewconvert->shader, frag, &error)) {
- GST_ERROR_OBJECT (viewconvert, "Failed to compile fragment stage %s",
- error->message);
- g_free (fragment_source_str);
- gst_object_unref (viewconvert->shader);
- viewconvert->shader = NULL;
- goto error;
- }
- g_free (fragment_source_str);
-
- if (!gst_gl_shader_link (viewconvert->shader, &error)) {
- GST_ERROR_OBJECT (viewconvert, "Failed to link conversion shader %s",
- error->message);
- gst_object_unref (viewconvert->shader);
- viewconvert->shader = NULL;
- goto error;
- }
- }
-
- viewconvert->priv->attr_position =
- gst_gl_shader_get_attribute_location (viewconvert->shader, "a_position");
- viewconvert->priv->attr_texture =
- gst_gl_shader_get_attribute_location (viewconvert->shader, "a_texcoord");
- gst_gl_shader_use (viewconvert->shader);
- gst_gl_shader_set_uniform_2fv (viewconvert->shader, "tex_scale",
- 2, tex_scale[0]);
- gst_gl_shader_set_uniform_2fv (viewconvert->shader, "offsets", 2, offsets[0]);
- gst_gl_shader_set_uniform_1f (viewconvert->shader, "width",
- GST_VIDEO_INFO_WIDTH (&viewconvert->out_info));
- gst_gl_shader_set_uniform_1f (viewconvert->shader, "height",
- GST_VIDEO_INFO_HEIGHT (&viewconvert->out_info));
- gst_gl_shader_set_uniform_matrix_3fv (viewconvert->shader, "downmix",
- 2, FALSE, &downmix_matrices[viewconvert->downmix_mode][0][0]);
- gst_gl_shader_set_uniform_matrix_4fv (viewconvert->shader, "u_transformation",
- 1, FALSE, identity_matrix);
- if (in_mode == GST_VIDEO_MULTIVIEW_MODE_SEPARATED ||
- in_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME) {
- gst_gl_shader_set_uniform_1i (viewconvert->shader, "tex_l", l_index);
- gst_gl_shader_set_uniform_1i (viewconvert->shader, "tex_r", r_index);
- } else {
- gst_gl_shader_set_uniform_1i (viewconvert->shader, "tex_l", 0);
- gst_gl_shader_set_uniform_1i (viewconvert->shader, "tex_r", 0);
- }
- gst_gl_context_clear_shader (viewconvert->context);
- if (!_init_view_convert_fbo (viewconvert)) {
- goto error;
- }
-
- if (!viewconvert->priv->vertex_buffer) {
- if (gl->GenVertexArrays) {
- gl->GenVertexArrays (1, &viewconvert->priv->vao);
- gl->BindVertexArray (viewconvert->priv->vao);
- }
-
- gl->GenBuffers (1, &viewconvert->priv->vertex_buffer);
- gl->BindBuffer (GL_ARRAY_BUFFER, viewconvert->priv->vertex_buffer);
- gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices,
- GL_STATIC_DRAW);
- gl->GenBuffers (1, &viewconvert->priv->vbo_indices);
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, viewconvert->priv->vbo_indices);
- gl->BufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof (indices), indices,
- GL_STATIC_DRAW);
- if (gl->GenVertexArrays) {
- _bind_buffer (viewconvert);
- gl->BindVertexArray (0);
- }
-
- gl->BindBuffer (GL_ARRAY_BUFFER, 0);
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
- }
-
- viewconvert->initted = TRUE;
- return TRUE;
-error:
- return FALSE;
-}
-
-static gboolean
-_do_view_convert_draw (GstGLContext * context, GstGLViewConvert * viewconvert)
-{
- GstGLViewConvertPrivate *priv = viewconvert->priv;
- GstGLFuncs *gl;
- guint out_width, out_height;
- gint out_views, i;
- GLint viewport_dim[4] = { 0 };
- GLenum multipleRT[] = {
- GL_COLOR_ATTACHMENT0,
- GL_COLOR_ATTACHMENT1,
- GL_COLOR_ATTACHMENT2
- };
- GstVideoMultiviewMode in_mode = priv->input_mode;
- GstVideoMultiviewMode out_mode = priv->output_mode;
- guint from_gl_target =
- gst_gl_texture_target_to_gl (viewconvert->from_texture_target);
-
- gl = context->gl_vtable;
-
- gst_gl_framebuffer_bind (viewconvert->fbo);
-
- if (out_mode == GST_VIDEO_MULTIVIEW_MODE_SEPARATED ||
- out_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME) {
- out_views = viewconvert->out_info.views;
- } else {
- out_views = 1;
- }
-
- /* attach the texture to the FBO to renderer to */
- for (i = 0; i < out_views; i++) {
- GstGLBaseMemory *tex = (GstGLBaseMemory *) priv->out_tex[i];
-
- gst_gl_framebuffer_attach (viewconvert->fbo, GL_COLOR_ATTACHMENT0 + i, tex);
- }
-
- if (gl->DrawBuffers)
- gl->DrawBuffers (out_views, multipleRT);
- else if (gl->DrawBuffer)
- gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
-
- gst_gl_framebuffer_get_effective_dimensions (viewconvert->fbo, &out_width,
- &out_height);
- gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
- gl->Viewport (0, 0, out_width, out_height);
-
- gst_gl_shader_use (viewconvert->shader);
-
- /* FIXME: the auxillary buffer could have a different transform matrix */
- {
- GstVideoAffineTransformationMeta *af_meta;
- gfloat matrix[16];
-
- af_meta =
- gst_buffer_get_video_affine_transformation_meta (priv->primary_in);
- gst_gl_get_affine_transformation_meta_as_ndc (af_meta, matrix);
- gst_gl_shader_set_uniform_matrix_4fv (viewconvert->shader,
- "u_transformation", 1, FALSE, matrix);
- }
-
- if (gl->BindVertexArray)
- gl->BindVertexArray (priv->vao);
- _bind_buffer (viewconvert);
-
- if (in_mode == GST_VIDEO_MULTIVIEW_MODE_SEPARATED ||
- in_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME) {
- if (priv->in_tex[1] == NULL) {
- GST_ERROR_OBJECT (viewconvert,
- "No 2nd view available during conversion!");
- return FALSE;
- }
- gl->ActiveTexture (GL_TEXTURE1);
- gl->BindTexture (from_gl_target, priv->in_tex[1]->tex_id);
- }
-
- gl->ActiveTexture (GL_TEXTURE0);
- gl->BindTexture (from_gl_target, priv->in_tex[0]->tex_id);
-
- gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);
-
- if (gl->BindVertexArray)
- gl->BindVertexArray (0);
- _unbind_buffer (viewconvert);
- if (gl->DrawBuffer)
- gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
- /* we are done with the shader */
- gst_gl_context_clear_shader (context);
- gl->Viewport (viewport_dim[0], viewport_dim[1], viewport_dim[2],
- viewport_dim[3]);
- gst_gl_context_clear_framebuffer (context);
-
- return TRUE;
-}
-
-static gboolean
-_gen_buffer (GstGLViewConvert * viewconvert, GstBuffer ** target)
-{
- GstGLVideoAllocationParams *params;
- GstGLMemoryAllocator *mem_allocator;
- GstAllocator *allocator;
-
- *target = gst_buffer_new ();
-
- allocator =
- GST_ALLOCATOR (gst_gl_memory_allocator_get_default
- (viewconvert->context));
- mem_allocator = GST_GL_MEMORY_ALLOCATOR (allocator);
- params = gst_gl_video_allocation_params_new (viewconvert->context, NULL,
- &viewconvert->out_info, 0, NULL, viewconvert->to_texture_target, 0);
-
- if (!gst_gl_memory_setup_buffer (mem_allocator, *target, params, NULL, NULL,
- 0)) {
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- gst_object_unref (allocator);
- return FALSE;
- }
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- gst_object_unref (allocator);
-
- gst_buffer_add_video_meta_full (*target, 0,
- GST_VIDEO_INFO_FORMAT (&viewconvert->out_info),
- GST_VIDEO_INFO_WIDTH (&viewconvert->out_info),
- GST_VIDEO_INFO_HEIGHT (&viewconvert->out_info),
- GST_VIDEO_INFO_N_PLANES (&viewconvert->out_info),
- viewconvert->out_info.offset, viewconvert->out_info.stride);
-
- return TRUE;
-}
-
-static void
-_do_view_convert (GstGLContext * context, GstGLViewConvert * viewconvert)
-{
- GstGLViewConvertPrivate *priv = viewconvert->priv;
- guint in_width, in_height, out_width, out_height;
- GstMapInfo out_info[GST_VIDEO_MAX_PLANES], in_info[GST_VIDEO_MAX_PLANES];
- GstGLMemory *dest_tex[GST_VIDEO_MAX_PLANES];
- gboolean res = TRUE;
- gint i = 0, j = 0;
- gint in_views, out_views;
- GstVideoMultiviewMode in_mode;
- GstVideoMultiviewMode out_mode;
-
- out_width = GST_VIDEO_INFO_WIDTH (&viewconvert->out_info);
- out_height = GST_VIDEO_INFO_HEIGHT (&viewconvert->out_info);
- in_width = GST_VIDEO_INFO_WIDTH (&viewconvert->in_info);
- in_height = GST_VIDEO_INFO_HEIGHT (&viewconvert->in_info);
-
- g_return_if_fail (priv->primary_out == NULL);
- g_return_if_fail (priv->auxilliary_out == NULL);
-
- in_mode = priv->input_mode;
- out_mode = priv->output_mode;
-
- if (in_mode == GST_VIDEO_MULTIVIEW_MODE_SEPARATED ||
- in_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME)
- in_views = viewconvert->in_info.views;
- else
- in_views = 1;
-
- if (out_mode == GST_VIDEO_MULTIVIEW_MODE_SEPARATED ||
- out_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME)
- out_views = viewconvert->out_info.views;
- else
- out_views = 1;
-
- if (!_init_view_convert (viewconvert)) {
- priv->result = FALSE;
- return;
- }
-
- if (!_gen_buffer (viewconvert, &priv->primary_out)) {
- GST_ERROR_OBJECT (viewconvert,
- "Failed to setup memory for primary output buffer");
- priv->result = FALSE;
- return;
- }
-
- if (out_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME) {
- if (!_gen_buffer (viewconvert, &priv->auxilliary_out)) {
- GST_ERROR_OBJECT (viewconvert,
- "Failed to setup memory for second view output buffer");
- priv->result = FALSE;
- return;
- }
- }
-
- for (i = 0; i < in_views; i++) {
- if (in_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME && i > 0) {
- priv->in_tex[i] =
- (GstGLMemory *) gst_buffer_peek_memory (priv->auxilliary_in, 0);
- } else {
- priv->in_tex[i] =
- (GstGLMemory *) gst_buffer_peek_memory (priv->primary_in, i);
- }
- if (!gst_is_gl_memory ((GstMemory *) priv->in_tex[i])) {
- GST_ERROR_OBJECT (viewconvert, "input must be GstGLMemory");
- res = FALSE;
- goto out;
- }
- if (!gst_memory_map ((GstMemory *) priv->in_tex[i],
- &in_info[i], GST_MAP_READ | GST_MAP_GL)) {
- GST_ERROR_OBJECT (viewconvert, "failed to map input memory %p",
- priv->in_tex[i]);
- res = FALSE;
- goto out;
- }
- }
-
- for (j = 0; j < out_views; j++) {
- GstGLMemory *out_tex;
- guint width, height;
- GstVideoInfo temp_info;
-
- if (j > 0 && out_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME) {
- dest_tex[j] = out_tex =
- (GstGLMemory *) gst_buffer_peek_memory (priv->auxilliary_out, 0);
- } else {
- dest_tex[j] = out_tex =
- (GstGLMemory *) gst_buffer_peek_memory (priv->primary_out, j);
- }
-
- if (!gst_is_gl_memory ((GstMemory *) out_tex)) {
- GST_ERROR_OBJECT (viewconvert, "output must be GstGLMemory");
- res = FALSE;
- goto out;
- }
-
- width = gst_gl_memory_get_texture_width (out_tex);
- height = gst_gl_memory_get_texture_height (out_tex);
- gst_video_info_set_format (&temp_info, GST_VIDEO_FORMAT_RGBA, width,
- height);
- if (out_tex->tex_format == GST_GL_LUMINANCE
- || out_tex->tex_format == GST_GL_LUMINANCE_ALPHA
- || out_width != width || out_height != height) {
- /* Luminance formats are not color renderable */
- /* renderering to a framebuffer only renders the intersection of all
- * the attachments i.e. the smallest attachment size */
- if (!priv->out_tex[j]) {
- GstGLVideoAllocationParams *params;
- GstGLBaseMemoryAllocator *base_mem_allocator;
- GstAllocator *allocator;
- GstVideoInfo temp_info;
-
- gst_video_info_set_format (&temp_info, GST_VIDEO_FORMAT_RGBA, out_width,
- out_height);
-
- allocator =
- GST_ALLOCATOR (gst_gl_memory_allocator_get_default (context));
- base_mem_allocator = GST_GL_BASE_MEMORY_ALLOCATOR (allocator);
- params = gst_gl_video_allocation_params_new (context, NULL, &temp_info,
- 0, NULL, viewconvert->to_texture_target, GST_GL_RGBA);
-
- priv->out_tex[j] =
- (GstGLMemory *) gst_gl_base_memory_alloc (base_mem_allocator,
- (GstGLAllocationParams *) params);
-
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- gst_object_unref (allocator);
- }
- } else {
- priv->out_tex[j] = out_tex;
- }
-
- if (!gst_memory_map ((GstMemory *) priv->out_tex[j],
- &out_info[j], GST_MAP_WRITE | GST_MAP_GL)) {
- GST_ERROR_OBJECT (viewconvert, "failed to map output memory %p",
- priv->out_tex[i]);
- res = FALSE;
- goto out;
- }
- }
- priv->n_out_tex = out_views;
-
- GST_LOG_OBJECT (viewconvert, "multiview splitting to textures:%p,%p,%p,%p "
- "dimensions:%ux%u, from textures:%p,%p,%p,%p dimensions:%ux%u",
- priv->out_tex[0], priv->out_tex[1],
- priv->out_tex[2], priv->out_tex[3],
- out_width, out_height, priv->in_tex[0],
- priv->in_tex[1], priv->in_tex[2], priv->in_tex[3], in_width, in_height);
-
- if (!_do_view_convert_draw (context, viewconvert))
- res = FALSE;
-out:
- for (j--; j >= 0; j--) {
- GstGLMemory *out_tex;
- guint width, height;
-
- out_tex = dest_tex[j];
-
- width = gst_gl_memory_get_texture_width (out_tex);
- height = gst_gl_memory_get_texture_height (out_tex);
-
- gst_memory_unmap ((GstMemory *) priv->out_tex[j], &out_info[j]);
- if (out_tex != priv->out_tex[j]) {
- GstMapInfo to_info, from_info;
- if (!gst_memory_map ((GstMemory *) priv->out_tex[j],
- &from_info, GST_MAP_READ | GST_MAP_GL)) {
- GST_ERROR_OBJECT (viewconvert, "Failed to map intermediate memory");
- res = FALSE;
- continue;
- }
- if (!gst_memory_map ((GstMemory *) out_tex, &to_info,
- GST_MAP_WRITE | GST_MAP_GL)) {
- GST_ERROR_OBJECT (viewconvert, "Failed to map intermediate memory");
- res = FALSE;
- continue;
- }
- gst_gl_memory_copy_into (priv->out_tex[j], out_tex->tex_id,
- viewconvert->to_texture_target, out_tex->tex_format, width, height);
- gst_memory_unmap ((GstMemory *) out_tex, &to_info);
- }
-
- priv->out_tex[j] = NULL;
- }
-
- for (i--; i >= 0; i--) {
- gst_memory_unmap ((GstMemory *) priv->in_tex[i], &in_info[i]);
- }
-
- if (!res) {
- gst_buffer_replace (&priv->primary_out, NULL);
- gst_buffer_replace (&priv->auxilliary_out, NULL);
- }
-
- priv->result = res;
- return;
-}
-
-/**
- * gst_gl_view_convert_submit_input_buffer:
- * @viewconvert: a #GstGLViewConvert
- * @is_discont: true if we have a discontinuity
- * @input: (transfer full): a #GstBuffer
- *
- * Submit @input to be processed by @viewconvert
- *
- * Returns: a #GstFlowReturn
- *
- * Since: 1.6
- */
-GstFlowReturn
-gst_gl_view_convert_submit_input_buffer (GstGLViewConvert * viewconvert,
- gboolean is_discont, GstBuffer * input)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- GstVideoMultiviewMode mode;
- GstBuffer **target;
-
- if (is_discont) {
- gst_buffer_replace (&viewconvert->priv->primary_in, NULL);
- gst_buffer_replace (&viewconvert->priv->auxilliary_in, NULL);
- }
-
- mode = viewconvert->input_mode_override;
- if (mode == GST_VIDEO_MULTIVIEW_MODE_NONE)
- mode = GST_VIDEO_INFO_MULTIVIEW_MODE (&viewconvert->in_info);
-
- target = &viewconvert->priv->primary_in;
-
- /* For frame-by-frame mode, we need to collect the 2nd eye into
- * our auxilliary buffer */
- if (mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME) {
- if (!GST_BUFFER_FLAG_IS_SET (input, GST_VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE))
- target = &viewconvert->priv->auxilliary_in;
- }
-
- if (*target)
- gst_buffer_unref (*target);
- *target = input;
-
- return ret;
-}
-
-/**
- * gst_gl_view_convert_get_output:
- * @viewconvert: a #GstGLViewConvert
- * @outbuf_ptr: (out): a #GstBuffer
- *
- * Retrieve the processed output buffer placing the output in @outbuf_ptr.
- *
- * Returns: a #GstFlowReturn
- *
- * Since: 1.6
- */
-GstFlowReturn
-gst_gl_view_convert_get_output (GstGLViewConvert * viewconvert,
- GstBuffer ** outbuf_ptr)
-{
- GstGLViewConvertPrivate *priv = viewconvert->priv;
- GstBuffer *outbuf = NULL;
- GstFlowReturn ret = GST_FLOW_OK;
- GstVideoMultiviewMode in_mode, out_mode;
- GstVideoMultiviewFlags in_flags, out_flags;
-
- g_return_val_if_fail (GST_IS_GL_VIEW_CONVERT (viewconvert), GST_FLOW_ERROR);
- g_return_val_if_fail (GST_IS_GL_CONTEXT (viewconvert->context),
- GST_FLOW_ERROR);
-
- GST_OBJECT_LOCK (viewconvert);
-
- /* See if a buffer is available already */
- if (priv->primary_out) {
- outbuf = viewconvert->priv->primary_out;
- priv->primary_out = NULL;
- goto done;
- }
- if (viewconvert->priv->auxilliary_out) {
- outbuf = priv->auxilliary_out;
- priv->auxilliary_out = NULL;
- goto done;
- }
-
- /* Check prereqs before processing a new input buffer */
- if (priv->primary_in == NULL)
- goto done;
-
- in_mode = viewconvert->input_mode_override;
- in_flags = viewconvert->input_flags_override;
- if (in_mode == GST_VIDEO_MULTIVIEW_MODE_NONE) {
- in_mode = GST_VIDEO_INFO_MULTIVIEW_MODE (&viewconvert->in_info);
- in_flags = GST_VIDEO_INFO_MULTIVIEW_FLAGS (&viewconvert->in_info);
- }
-
- /* Configured output mode already takes any override
- * into account */
- out_mode = GST_VIDEO_INFO_MULTIVIEW_MODE (&viewconvert->out_info);
- out_flags = GST_VIDEO_INFO_MULTIVIEW_FLAGS (&viewconvert->out_info);
-
- if (in_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME) {
- /* For frame-by-frame, we need 2 input buffers */
- if (priv->auxilliary_in == NULL) {
- GST_LOG_OBJECT (viewconvert,
- "Can't generate output yet - frame-by-frame mode");
- goto done;
- }
- }
-
- /* Store the current conversion in the priv vars */
- priv->input_mode = in_mode;
- priv->input_flags = in_flags;
- priv->output_mode = out_mode;
- priv->output_flags = out_flags;
-
- if (priv->input_mode == priv->output_mode &&
- priv->input_flags == priv->output_flags &&
- viewconvert->in_info.width == viewconvert->out_info.width &&
- viewconvert->in_info.height == viewconvert->out_info.height &&
- viewconvert->from_texture_target == viewconvert->to_texture_target) {
- /* passthrough - just pass input buffers */
- outbuf = gst_buffer_ref (priv->primary_in);
- if (in_mode == GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME)
- priv->auxilliary_out = gst_buffer_ref (priv->auxilliary_in);
- goto done_clear_input;
- }
-
- /* We can't output to OES textures, they're only supported for passthrough */
- if (viewconvert->to_texture_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES) {
- ret = GST_FLOW_ERROR;
- goto done_clear_input;
- }
-
- /* Generate new output buffer(s) */
- gst_gl_context_thread_add (viewconvert->context,
- (GstGLContextThreadFunc) _do_view_convert, viewconvert);
-
- if (!priv->result) {
- if (priv->primary_out)
- gst_object_unref (priv->primary_out);
- if (priv->auxilliary_out)
- gst_object_unref (priv->auxilliary_out);
- priv->primary_out = NULL;
- priv->auxilliary_out = NULL;
- ret = GST_FLOW_ERROR;
- goto done_clear_input;
- }
-
- outbuf = priv->primary_out;
- if (outbuf) {
- gst_buffer_copy_into (outbuf, priv->primary_in,
- GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
- GST_BUFFER_FLAG_SET (outbuf,
- GST_VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE |
- GST_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW);
- }
-
- if (priv->auxilliary_out) {
- gst_buffer_copy_into (priv->auxilliary_out,
- priv->primary_out, GST_BUFFER_COPY_FLAGS, 0, -1);
- GST_BUFFER_FLAG_UNSET (priv->auxilliary_out,
- GST_VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE);
- }
- priv->primary_out = NULL;
-
-done_clear_input:
- /* Invalidate input buffers now they've been used */
- gst_buffer_replace (&priv->primary_in, NULL);
- gst_buffer_replace (&priv->auxilliary_in, NULL);
-
-done:
- GST_OBJECT_UNLOCK (viewconvert);
- *outbuf_ptr = outbuf;
- return ret;
-}
diff --git a/gst-libs/gst/gl/gstglviewconvert.h b/gst-libs/gst/gl/gstglviewconvert.h
deleted file mode 100644
index 3cad3adeb..000000000
--- a/gst-libs/gst/gl/gstglviewconvert.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Jan Schmidt <jan@centricular.com>
- * 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_VIEW_CONVERT_H_
-#define _GST_GL_VIEW_CONVERT_H_
-
-#include <gst/gstmemory.h>
-#include <gst/video/video.h>
-
-#include <gst/gl/gstgl_fwd.h>
-
-G_BEGIN_DECLS
-#define GST_TYPE_GL_VIEW_CONVERT (gst_gl_view_convert_get_type())
-#define GST_GL_VIEW_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_VIEW_CONVERT,GstGLViewConvert))
-#define GST_IS_GL_VIEW_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_VIEW_CONVERT))
-#define GST_GL_VIEW_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_VIEW_CONVERT,GstGLViewConvertClass))
-#define GST_IS_GL_VIEW_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_VIEW_CONVERT))
-#define GST_GL_VIEW_CONVERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_VIEW_CONVERT,GstGLViewConvertClass))
-
-#define GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE gst_gl_stereo_downmix_mode_get_type()
-GST_EXPORT
-GType gst_gl_stereo_downmix_mode_get_type (void);
-
-/**
- * GstGLStereoDownmix:
- * @GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS: Dubois optimised Green-Magenta anaglyph
- * @GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS: Dubois optimised Red-Cyan anaglyph
- * @GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS: Dubois optimised Amber-Blue anaglyph
- *
- * Output anaglyph type to generate when downmixing to mono
- */
-enum _GstGLStereoDownmix {
- GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS,
- GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS,
- GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS,
-};
-typedef enum _GstGLStereoDownmix GstGLStereoDownmix;
-
-/**
- * GstGLViewConvert:
- *
- * #GstGLViewConvert is an opaque struct and should only be accessed through the
- * provided api.
- */
-struct _GstGLViewConvert
-{
- GstObject object;
-
- GstGLContext *context;
-
- GstGLShader *shader;
-
- GstVideoMultiviewMode input_mode_override;
- GstVideoMultiviewFlags input_flags_override;
- GstVideoMultiviewMode output_mode_override;
- GstVideoMultiviewFlags output_flags_override;
-
- GstGLStereoDownmix downmix_mode;
-
- GstVideoInfo in_info;
- GstVideoInfo out_info;
-
- GstGLTextureTarget from_texture_target;
- GstGLTextureTarget to_texture_target;
- gboolean caps_passthrough;
-
- gboolean initted;
- gboolean reconfigure;
-
- GstGLFramebuffer *fbo;
-
- /* <private> */
- GstGLViewConvertPrivate *priv;
-
- gpointer _padding[GST_PADDING];
-};
-
-/**
- * GstGLViewConvertClass:
- *
- * Opaque #GstGLViewConvertClass struct
- */
-struct _GstGLViewConvertClass
-{
- /* <private> */
- GstObjectClass object_class;
-
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GType gst_gl_view_convert_get_type (void);
-GST_EXPORT
-GstGLViewConvert * gst_gl_view_convert_new (void);
-
-GST_EXPORT
-gboolean gst_gl_view_convert_set_caps (GstGLViewConvert * viewconvert, GstCaps * in_caps, GstCaps * out_caps);
-GST_EXPORT
-GstCaps * gst_gl_view_convert_transform_caps (GstGLViewConvert * viewconvert,
- GstPadDirection direction, GstCaps * caps, GstCaps * filter);
-GST_EXPORT
-GstCaps * gst_gl_view_convert_fixate_caps (GstGLViewConvert *viewconvert,
- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
-GST_EXPORT
-GstFlowReturn gst_gl_view_convert_submit_input_buffer (GstGLViewConvert *viewconvert,
- gboolean is_discont, GstBuffer * input);
-GST_EXPORT
-GstFlowReturn gst_gl_view_convert_get_output (GstGLViewConvert *viewconvert,
- GstBuffer ** outbuf_ptr);
-
-GST_EXPORT
-GstBuffer * gst_gl_view_convert_perform (GstGLViewConvert * viewconvert, GstBuffer *inbuf);
-GST_EXPORT
-void gst_gl_view_convert_reset (GstGLViewConvert * viewconvert);
-GST_EXPORT
-void gst_gl_view_convert_set_context (GstGLViewConvert *viewconvert, GstGLContext * context);
-
-G_END_DECLS
-#endif /* _GST_GL_VIEW_CONVERT_H_ */
diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c
deleted file mode 100644
index 3818ab16e..000000000
--- a/gst-libs/gst/gl/gstglwindow.c
+++ /dev/null
@@ -1,1022 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-/**
- * SECTION:gstglwindow
- * @short_description: window/surface abstraction
- * @title: GstGLWindow
- * @see_also: #GstGLContext, #GstGLDisplay
- *
- * GstGLWindow represents a window that elements can render into. A window can
- * either be a user visible window (onscreen) or hidden (offscreen).
- */
-
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gmodule.h>
-#include <stdio.h>
-
-#include "gl.h"
-#include "gstglwindow.h"
-#include "gstglwindow_private.h"
-
-/* FIXME make this work with windowless contexts */
-
-#if GST_GL_HAVE_WINDOW_X11
-#include "x11/gstglwindow_x11.h"
-#endif
-#if GST_GL_HAVE_WINDOW_WIN32
-#include "win32/gstglwindow_win32.h"
-#endif
-#if GST_GL_HAVE_WINDOW_COCOA
-#include "cocoa/gstglwindow_cocoa.h"
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND
-#include "wayland/gstglwindow_wayland_egl.h"
-#endif
-#if GST_GL_HAVE_WINDOW_ANDROID
-#include "android/gstglwindow_android_egl.h"
-#endif
-#if GST_GL_HAVE_WINDOW_EAGL
-#include "eagl/gstglwindow_eagl.h"
-#endif
-#if GST_GL_HAVE_WINDOW_VIV_FB
-#include "viv-fb/gstglwindow_viv_fb_egl.h"
-#endif
-#if GST_GL_HAVE_WINDOW_DISPMANX
-#include "dispmanx/gstglwindow_dispmanx_egl.h"
-#endif
-
-#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
-#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
-#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
-#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
-#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
-#define GST_CAT_DEFAULT gst_gl_window_debug
-GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
-
-#define gst_gl_window_parent_class parent_class
-G_DEFINE_ABSTRACT_TYPE (GstGLWindow, gst_gl_window, GST_TYPE_OBJECT);
-
-#define GST_GL_WINDOW_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_WINDOW, GstGLWindowPrivate))
-
-static void gst_gl_window_default_draw (GstGLWindow * window);
-static void gst_gl_window_default_run (GstGLWindow * window);
-static void gst_gl_window_default_quit (GstGLWindow * window);
-static void gst_gl_window_default_send_message (GstGLWindow * window,
- GstGLWindowCB callback, gpointer data);
-static void gst_gl_window_default_send_message_async (GstGLWindow * window,
- GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
-
-struct _GstGLWindowPrivate
-{
- GMainLoop *loop;
-
- guint surface_width;
- guint surface_height;
-
- gboolean alive;
-
- GMutex sync_message_lock;
- GCond sync_message_cond;
-};
-
-static void gst_gl_window_finalize (GObject * object);
-
-typedef struct _GstGLDummyWindow
-{
- GstGLWindow parent;
-
- guintptr handle;
-} GstGLDummyWindow;
-
-typedef struct _GstGLDummyWindowCass
-{
- GstGLWindowClass parent;
-} GstGLDummyWindowClass;
-
-static GstGLDummyWindow *gst_gl_dummy_window_new (void);
-
-enum
-{
- SIGNAL_0,
- EVENT_MOUSE_SIGNAL,
- EVENT_KEY_SIGNAL,
- LAST_SIGNAL
-};
-
-static guint gst_gl_window_signals[LAST_SIGNAL] = { 0 };
-
-GQuark
-gst_gl_window_error_quark (void)
-{
- return g_quark_from_static_string ("gst-gl-window-error-quark");
-}
-
-static gboolean
-gst_gl_window_default_open (GstGLWindow * window, GError ** error)
-{
- return TRUE;
-}
-
-static void
-gst_gl_window_default_close (GstGLWindow * window)
-{
-}
-
-static void
-_init_debug (void)
-{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
- GST_DEBUG_CATEGORY_INIT (gst_gl_window_debug, "glwindow", 0,
- "glwindow element");
- g_once_init_leave (&_init, 1);
- }
-}
-
-static void
-gst_gl_window_init (GstGLWindow * window)
-{
- GstGLWindowPrivate *priv = GST_GL_WINDOW_GET_PRIVATE (window);
- window->priv = priv;
-
- g_mutex_init (&window->lock);
- window->is_drawing = FALSE;
-
- g_weak_ref_init (&window->context_ref, NULL);
-
- g_mutex_init (&window->priv->sync_message_lock);
- g_cond_init (&window->priv->sync_message_cond);
-
- window->main_context = g_main_context_new ();
- priv->loop = g_main_loop_new (window->main_context, FALSE);
-}
-
-static void
-gst_gl_window_class_init (GstGLWindowClass * klass)
-{
- g_type_class_add_private (klass, sizeof (GstGLWindowPrivate));
-
- klass->open = GST_DEBUG_FUNCPTR (gst_gl_window_default_open);
- klass->close = GST_DEBUG_FUNCPTR (gst_gl_window_default_close);
- klass->run = GST_DEBUG_FUNCPTR (gst_gl_window_default_run);
- klass->quit = GST_DEBUG_FUNCPTR (gst_gl_window_default_quit);
- klass->draw = GST_DEBUG_FUNCPTR (gst_gl_window_default_draw);
- klass->send_message = GST_DEBUG_FUNCPTR (gst_gl_window_default_send_message);
- klass->send_message_async =
- GST_DEBUG_FUNCPTR (gst_gl_window_default_send_message_async);
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_window_finalize;
-
- /**
- * GstGLWindow::mouse-event:
- * @object: the #GstGLWindow
- * @id: the name of the event
- * @button: the id of the button
- * @x: the x coordinate of the mouse event
- * @y: the y coordinate of the mouse event
- *
- * Will be emitted when a mouse event is received by the GstGLwindow.
- *
- * Since: 1.6
- */
- gst_gl_window_signals[EVENT_MOUSE_SIGNAL] =
- g_signal_new ("mouse-event", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
- G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_INT, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
-
- /**
- * GstGLWindow::key-event:
- * @object: the #GstGLWindow
- * @id: the name of the event
- * @key: the id of the key pressed
- *
- * Will be emitted when a key event is received by the GstGLwindow.
- *
- * Since: 1.6
- */
- gst_gl_window_signals[EVENT_KEY_SIGNAL] =
- g_signal_new ("key-event", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
-
- _init_debug ();
-}
-
-/**
- * gst_gl_window_new:
- * @display: a #GstGLDisplay
- *
- * Returns: (transfer full): a new #GstGLWindow using @display's connection
- *
- * Since: 1.4
- */
-GstGLWindow *
-gst_gl_window_new (GstGLDisplay * display)
-{
- GstGLWindow *window = NULL;
- const gchar *user_choice;
-
- g_return_val_if_fail (display != NULL, NULL);
-
- _init_debug ();
-
- user_choice = g_getenv ("GST_GL_WINDOW");
- GST_INFO ("creating a window, user choice:%s", user_choice);
-
-#if GST_GL_HAVE_WINDOW_COCOA
- if (!window && (!user_choice || g_strstr_len (user_choice, 5, "cocoa")))
- window = GST_GL_WINDOW (gst_gl_window_cocoa_new (display));
-#endif
-#if GST_GL_HAVE_WINDOW_X11
- if (!window && (!user_choice || g_strstr_len (user_choice, 3, "x11")))
- window = GST_GL_WINDOW (gst_gl_window_x11_new (display));
-#endif
-#if GST_GL_HAVE_WINDOW_WIN32
- if (!window && (!user_choice || g_strstr_len (user_choice, 5, "win32")))
- window = GST_GL_WINDOW (gst_gl_window_win32_new (display));
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND
- if (!window && (!user_choice || g_strstr_len (user_choice, 7, "wayland")))
- window = GST_GL_WINDOW (gst_gl_window_wayland_egl_new (display));
-#endif
-#if GST_GL_HAVE_WINDOW_DISPMANX
- if (!window && (!user_choice || g_strstr_len (user_choice, 8, "dispmanx")))
- window = GST_GL_WINDOW (gst_gl_window_dispmanx_egl_new (display));
-#endif
-#if GST_GL_HAVE_WINDOW_ANDROID
- if (!window && (!user_choice || g_strstr_len (user_choice, 7, "android")))
- window = GST_GL_WINDOW (gst_gl_window_android_egl_new (display));
-#endif
-#if GST_GL_HAVE_WINDOW_EAGL
- if (!window && (!user_choice || g_strstr_len (user_choice, 4, "eagl")))
- window = GST_GL_WINDOW (gst_gl_window_eagl_new (display));
-#endif
-#if GST_GL_HAVE_WINDOW_VIV_FB
- if (!window && (!user_choice || g_strstr_len (user_choice, 6, "viv-fb")))
- window = GST_GL_WINDOW (gst_gl_window_viv_fb_egl_new (display));
-#endif
-
- if (!window) {
- /* subclass returned a NULL window */
- GST_WARNING ("Could not create window. user specified %s, creating dummy"
- " window", user_choice ? user_choice : "(null)");
-
- window = GST_GL_WINDOW (gst_gl_dummy_window_new ());
- }
-
- window->display = gst_object_ref (display);
-
- return window;
-}
-
-static void
-gst_gl_window_finalize (GObject * object)
-{
- GstGLWindow *window = GST_GL_WINDOW (object);
- GstGLWindowPrivate *priv = window->priv;
-
- if (priv->loop)
- g_main_loop_unref (priv->loop);
-
- if (window->main_context)
- g_main_context_unref (window->main_context);
- window->main_context = NULL;
-
- g_weak_ref_clear (&window->context_ref);
-
- g_mutex_clear (&window->lock);
- g_mutex_clear (&window->priv->sync_message_lock);
- g_cond_clear (&window->priv->sync_message_cond);
- gst_object_unref (window->display);
-
- G_OBJECT_CLASS (gst_gl_window_parent_class)->finalize (object);
-}
-
-typedef struct _GstSetWindowHandleCb
-{
- GstGLWindow *window;
- guintptr handle;
-} GstSetWindowHandleCb;
-
-static void
-_set_window_handle_cb (GstSetWindowHandleCb * data)
-{
- GstGLContext *context = gst_gl_window_get_context (data->window);
- GstGLWindowClass *window_class = GST_GL_WINDOW_GET_CLASS (data->window);
- GThread *thread = NULL;
-
- /* deactivate if necessary */
- if (context) {
- thread = gst_gl_context_get_thread (context);
- if (thread) {
- /* This is only thread safe iff the context thread == g_thread_self() */
- g_assert (thread == g_thread_self ());
- gst_gl_context_activate (context, FALSE);
- }
- }
-
- window_class->set_window_handle (data->window, data->handle);
-
- /* reactivate */
- if (context && thread)
- gst_gl_context_activate (context, TRUE);
-
- if (context)
- gst_object_unref (context);
- if (thread)
- g_thread_unref (thread);
-}
-
-static void
-_free_swh_cb (GstSetWindowHandleCb * data)
-{
- gst_object_unref (data->window);
- g_slice_free (GstSetWindowHandleCb, data);
-}
-
-/**
- * gst_gl_window_set_window_handle:
- * @window: a #GstGLWindow
- * @handle: handle to the window
- *
- * Sets the window that this @window should render into. Some implementations
- * require this to be called with a valid handle before drawing can commence.
- *
- * Since: 1.4
- */
-void
-gst_gl_window_set_window_handle (GstGLWindow * window, guintptr handle)
-{
- GstGLWindowClass *window_class;
- GstSetWindowHandleCb *data;
-
- g_return_if_fail (GST_IS_GL_WINDOW (window));
- g_return_if_fail (handle != 0);
- window_class = GST_GL_WINDOW_GET_CLASS (window);
- g_return_if_fail (window_class->set_window_handle != NULL);
-
- data = g_slice_new (GstSetWindowHandleCb);
- data->window = gst_object_ref (window);
- data->handle = handle;
-
- /* FIXME: Move to a message which deactivates, calls implementation, activates */
- gst_gl_window_send_message_async (window,
- (GstGLWindowCB) _set_window_handle_cb, data,
- (GDestroyNotify) _free_swh_cb);
-
- /* window_class->set_window_handle (window, handle); */
-}
-
-static void
-draw_cb (gpointer data)
-{
- GstGLWindow *window = GST_GL_WINDOW (data);
- GstGLContext *context = gst_gl_window_get_context (window);
-
- if (window->queue_resize) {
- guint width, height;
-
- gst_gl_window_get_surface_dimensions (window, &width, &height);
- gst_gl_window_resize (window, width, height);
- }
-
- if (window->draw)
- window->draw (window->draw_data);
-
- gst_gl_context_swap_buffers (context);
-
- gst_object_unref (context);
-}
-
-static void
-gst_gl_window_default_draw (GstGLWindow * window)
-{
- gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
-}
-
-/**
- * gst_gl_window_draw:
- * @window: a #GstGLWindow
- *
- * Redraw the window contents. Implementations should invoke the draw callback.
- *
- * Since: 1.4
- */
-void
-gst_gl_window_draw (GstGLWindow * window)
-{
- GstGLWindowClass *window_class;
-
- g_return_if_fail (GST_IS_GL_WINDOW (window));
- window_class = GST_GL_WINDOW_GET_CLASS (window);
- g_return_if_fail (window_class->draw != NULL);
-
- /* avoid to overload the drawer */
- if (window->is_drawing) {
- return;
- }
-
- window_class->draw (window);
-}
-
-/**
- * gst_gl_window_set_preferred_size:
- * @window: a #GstGLWindow
- * @width: new preferred width
- * @height: new preferred height
- *
- * Set the preferred width and height of the window. Implementations are free
- * to ignore this information.
- *
- * Since: 1.6
- */
-void
-gst_gl_window_set_preferred_size (GstGLWindow * window, gint width, gint height)
-{
- GstGLWindowClass *window_class;
-
- g_return_if_fail (GST_IS_GL_WINDOW (window));
- window_class = GST_GL_WINDOW_GET_CLASS (window);
-
- if (window_class->set_preferred_size)
- window_class->set_preferred_size (window, width, height);
-}
-
-/**
- * gst_gl_window_show:
- * @window: a #GstGLWindow
- *
- * Present the window to the screen.
- *
- * Since: 1.6
- */
-void
-gst_gl_window_show (GstGLWindow * window)
-{
- GstGLWindowClass *window_class;
-
- g_return_if_fail (GST_IS_GL_WINDOW (window));
- window_class = GST_GL_WINDOW_GET_CLASS (window);
-
- if (window_class->show)
- window_class->show (window);
-}
-
-static void
-gst_gl_window_default_run (GstGLWindow * window)
-{
- GstGLWindowPrivate *priv = window->priv;
-
- g_main_context_push_thread_default (window->main_context);
-
- g_main_loop_run (priv->loop);
-
- g_main_context_pop_thread_default (window->main_context);
-}
-
-/**
- * gst_gl_window_run:
- * @window: a #GstGLWindow
- *
- * Start the execution of the runloop.
- *
- * Since: 1.4
- */
-void
-gst_gl_window_run (GstGLWindow * window)
-{
- GstGLWindowClass *window_class;
-
- g_return_if_fail (GST_IS_GL_WINDOW (window));
- window_class = GST_GL_WINDOW_GET_CLASS (window);
- g_return_if_fail (window_class->run != NULL);
-
- window->priv->alive = TRUE;
- window_class->run (window);
-}
-
-static void
-gst_gl_window_default_quit (GstGLWindow * window)
-{
- g_main_loop_quit (window->priv->loop);
-}
-
-/**
- * gst_gl_window_quit:
- * @window: a #GstGLWindow
- *
- * Quit the runloop's execution.
- *
- * Since: 1.4
- */
-void
-gst_gl_window_quit (GstGLWindow * window)
-{
- GstGLWindowClass *window_class;
-
- g_return_if_fail (GST_IS_GL_WINDOW (window));
- window_class = GST_GL_WINDOW_GET_CLASS (window);
- g_return_if_fail (window_class->quit != NULL);
-
- GST_GL_WINDOW_LOCK (window);
-
- window->priv->alive = FALSE;
-
- window_class->quit (window);
-
- GST_INFO ("quit sent to gl window loop");
-
- GST_GL_WINDOW_UNLOCK (window);
-}
-
-typedef struct _GstGLSyncMessage
-{
- GstGLWindow *window;
- gboolean fired;
-
- GstGLWindowCB callback;
- gpointer data;
-} GstGLSyncMessage;
-
-static void
-_run_message_sync (GstGLSyncMessage * message)
-{
-
- if (message->callback)
- message->callback (message->data);
-
- g_mutex_lock (&message->window->priv->sync_message_lock);
- message->fired = TRUE;
- g_cond_broadcast (&message->window->priv->sync_message_cond);
- g_mutex_unlock (&message->window->priv->sync_message_lock);
-}
-
-void
-gst_gl_window_default_send_message (GstGLWindow * window,
- GstGLWindowCB callback, gpointer data)
-{
- GstGLSyncMessage message;
-
- message.window = window;
- message.callback = callback;
- message.data = data;
- message.fired = FALSE;
-
- gst_gl_window_send_message_async (window, (GstGLWindowCB) _run_message_sync,
- &message, NULL);
-
- g_mutex_lock (&window->priv->sync_message_lock);
-
- /* block until opengl calls have been executed in the gl thread */
- while (!message.fired)
- g_cond_wait (&window->priv->sync_message_cond,
- &window->priv->sync_message_lock);
- g_mutex_unlock (&window->priv->sync_message_lock);
-}
-
-/**
- * gst_gl_window_send_message:
- * @window: a #GstGLWindow
- * @callback: (scope async): function to invoke
- * @data: (closure): data to invoke @callback with
- *
- * Invoke @callback with data on the window thread. @callback is guarenteed to
- * have executed when this function returns.
- *
- * Since: 1.4
- */
-void
-gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
- gpointer data)
-{
- GstGLWindowClass *window_class;
-
- g_return_if_fail (GST_IS_GL_WINDOW (window));
- g_return_if_fail (callback != NULL);
- window_class = GST_GL_WINDOW_GET_CLASS (window);
- g_return_if_fail (window_class->send_message != NULL);
-
- window_class->send_message (window, callback, data);
-}
-
-typedef struct _GstGLAsyncMessage
-{
- GstGLWindowCB callback;
- gpointer data;
- GDestroyNotify destroy;
-} GstGLAsyncMessage;
-
-static gboolean
-_run_message_async (GstGLAsyncMessage * message)
-{
- if (message->callback)
- message->callback (message->data);
-
- if (message->destroy)
- message->destroy (message->data);
-
- g_slice_free (GstGLAsyncMessage, message);
-
- return FALSE;
-}
-
-static void
-gst_gl_window_default_send_message_async (GstGLWindow * window,
- GstGLWindowCB callback, gpointer data, GDestroyNotify destroy)
-{
- GstGLAsyncMessage *message = g_slice_new (GstGLAsyncMessage);
-
- message->callback = callback;
- message->data = data;
- message->destroy = destroy;
-
- g_main_context_invoke (window->main_context, (GSourceFunc) _run_message_async,
- message);
-}
-
-/**
- * gst_gl_window_send_message_async:
- * @window: a #GstGLWindow
- * @callback: (scope async): function to invoke
- * @data: (closure): data to invoke @callback with
- * @destroy: called when @data is not needed anymore
- *
- * Invoke @callback with @data on the window thread. The callback may not
- * have been executed when this function returns.
- *
- * Since: 1.4
- */
-void
-gst_gl_window_send_message_async (GstGLWindow * window, GstGLWindowCB callback,
- gpointer data, GDestroyNotify destroy)
-{
- GstGLWindowClass *window_class;
-
- g_return_if_fail (GST_IS_GL_WINDOW (window));
- g_return_if_fail (callback != NULL);
- window_class = GST_GL_WINDOW_GET_CLASS (window);
- g_return_if_fail (window_class->send_message_async != NULL);
-
- window_class->send_message_async (window, callback, data, destroy);
-}
-
-/**
- * gst_gl_window_set_draw_callback:
- * @window: a #GstGLWindow
- * @callback: (scope notified): function to invoke
- * @data: (closure): data to invoke @callback with
- * @destroy_notify: called when @data is not needed any more
- *
- * Sets the draw callback called everytime gst_gl_window_draw() is called
- *
- * Since: 1.4
- */
-void
-gst_gl_window_set_draw_callback (GstGLWindow * window, GstGLWindowCB callback,
- gpointer data, GDestroyNotify destroy_notify)
-{
- g_return_if_fail (GST_IS_GL_WINDOW (window));
-
- GST_GL_WINDOW_LOCK (window);
-
- if (window->draw_notify)
- window->draw_notify (window->draw_data);
-
- window->draw = callback;
- window->draw_data = data;
- window->draw_notify = destroy_notify;
-
- GST_GL_WINDOW_UNLOCK (window);
-}
-
-/**
- * gst_gl_window_set_resize_callback:
- * @window: a #GstGLWindow
- * @callback: (scope notified): function to invoke
- * @data: (closure): data to invoke @callback with
- * @destroy_notify: called when @data is not needed any more
- *
- * Sets the resize callback called everytime a resize of the window occurs.
- *
- * Since: 1.4
- */
-void
-gst_gl_window_set_resize_callback (GstGLWindow * window,
- GstGLWindowResizeCB callback, gpointer data, GDestroyNotify destroy_notify)
-{
- g_return_if_fail (GST_IS_GL_WINDOW (window));
-
- GST_GL_WINDOW_LOCK (window);
-
- if (window->resize_notify)
- window->resize_notify (window->resize_data);
-
- window->resize = callback;
- window->resize_data = data;
- window->resize_notify = destroy_notify;
-
- GST_GL_WINDOW_UNLOCK (window);
-}
-
-/**
- * gst_gl_window_set_close_callback:
- * @window: a #GstGLWindow
- * @callback: (scope notified): function to invoke
- * @data: (closure): data to invoke @callback with
- * @destroy_notify: called when @data is not needed any more
- *
- * Sets the callback called when the window is about to close.
- *
- * Since: 1.4
- */
-void
-gst_gl_window_set_close_callback (GstGLWindow * window, GstGLWindowCB callback,
- gpointer data, GDestroyNotify destroy_notify)
-{
- g_return_if_fail (GST_IS_GL_WINDOW (window));
-
- GST_GL_WINDOW_LOCK (window);
-
- if (window->close_notify)
- window->close_notify (window->close_data);
-
- window->close = callback;
- window->close_data = data;
- window->close_notify = destroy_notify;
-
- GST_GL_WINDOW_UNLOCK (window);
-}
-
-/**
- * gst_gl_window_get_display:
- * @window: a #GstGLWindow
- *
- * Returns: the windowing system display handle for this @window
- *
- * Since: 1.4
- */
-guintptr
-gst_gl_window_get_display (GstGLWindow * window)
-{
- GstGLWindowClass *window_class;
-
- g_return_val_if_fail (GST_IS_GL_WINDOW (window), 0);
- window_class = GST_GL_WINDOW_GET_CLASS (window);
- g_return_val_if_fail (window_class->get_display != NULL, 0);
-
- return window_class->get_display (window);
-}
-
-/**
- * gst_gl_window_get_window_handle:
- * @window: a #GstGLWindow
- *
- * Returns: the window handle we are currently rendering into
- *
- * Since: 1.4
- */
-guintptr
-gst_gl_window_get_window_handle (GstGLWindow * window)
-{
- GstGLWindowClass *window_class;
-
- g_return_val_if_fail (GST_IS_GL_WINDOW (window), 0);
- window_class = GST_GL_WINDOW_GET_CLASS (window);
- g_return_val_if_fail (window_class->get_window_handle != NULL, 0);
-
- return window_class->get_window_handle (window);
-}
-
-/**
- * gst_gl_window_get_context:
- * @window: a #GstGLWindow
- *
- * Returns: (transfer full): the #GstGLContext associated with this @window
- *
- * Since: 1.4
- */
-GstGLContext *
-gst_gl_window_get_context (GstGLWindow * window)
-{
- g_return_val_if_fail (GST_IS_GL_WINDOW (window), NULL);
-
- return (GstGLContext *) g_weak_ref_get (&window->context_ref);
-}
-
-/**
- * gst_gl_window_get_surface_dimensions:
- * @window: a #GstGLWindow
- * @width: (out): resulting surface width
- * @height: (out): resulting surface height
- *
- * Since: 1.6
- */
-void
-gst_gl_window_get_surface_dimensions (GstGLWindow * window, guint * width,
- guint * height)
-{
- if (width)
- *width = window->priv->surface_width;
- if (height)
- *height = window->priv->surface_height;
-}
-
-void
-gst_gl_window_send_key_event (GstGLWindow * window, const char *event_type,
- const char *key_str)
-{
- g_signal_emit (window, gst_gl_window_signals[EVENT_KEY_SIGNAL], 0,
- event_type, key_str);
-}
-
-void
-gst_gl_window_send_mouse_event (GstGLWindow * window, const char *event_type,
- int button, double posx, double posy)
-{
- g_signal_emit (window, gst_gl_window_signals[EVENT_MOUSE_SIGNAL], 0,
- event_type, button, posx, posy);
-}
-
-/**
- * gst_gl_window_handle_events:
- * @window: a #GstGLWindow
- * @handle_events: a #gboolean indicating if events should be handled or not.
- *
- * Tell a @window that it should handle events from the window system. These
- * events are forwarded upstream as navigation events. In some window systems
- * events are not propagated in the window hierarchy if a client is listening
- * for them. This method allows you to disable events handling completely
- * from the @window.
- */
-void
-gst_gl_window_handle_events (GstGLWindow * window, gboolean handle_events)
-{
- GstGLWindowClass *window_class;
-
- g_return_if_fail (GST_IS_GL_WINDOW (window));
- window_class = GST_GL_WINDOW_GET_CLASS (window);
-
- if (window_class->handle_events)
- window_class->handle_events (window, handle_events);
-}
-
-/**
- * gst_gl_window_set_render_rectangle:
- * @window: a #GstGLWindow
- * @x: x position
- * @y: y position
- * @width: width
- * @height: height
- *
- * Tell a @window that it should render into a specific region of the window
- * according to the #GstVideoOverlay interface.
- *
- * Returns: whether the specified region could be set
- */
-gboolean
-gst_gl_window_set_render_rectangle (GstGLWindow * window, gint x, gint y,
- gint width, gint height)
-{
- GstGLWindowClass *window_class;
- gboolean ret = FALSE;
-
- g_return_val_if_fail (GST_IS_GL_WINDOW (window), FALSE);
- window_class = GST_GL_WINDOW_GET_CLASS (window);
-
- if (x < 0 || y < 0 || width <= 0 || height <= 0)
- return FALSE;
-
- if (window_class->set_render_rectangle)
- ret = window_class->set_render_rectangle (window, x, y, width, height);
-
- return ret;
-}
-
-void
-gst_gl_window_queue_resize (GstGLWindow * window)
-{
- GstGLWindowClass *window_class;
-
- g_return_if_fail (GST_IS_GL_WINDOW (window));
- window_class = GST_GL_WINDOW_GET_CLASS (window);
-
- window->queue_resize = TRUE;
- if (window_class->queue_resize)
- window_class->queue_resize (window);
-}
-
-struct resize_data
-{
- GstGLWindow *window;
- guint width, height;
-};
-
-static void
-_on_resize (gpointer data)
-{
- struct resize_data *resize = data;
-
- resize->window->resize (resize->window->resize_data, resize->width,
- resize->height);
-}
-
-void
-gst_gl_window_resize (GstGLWindow * window, guint width, guint height)
-{
- g_return_if_fail (GST_IS_GL_WINDOW (window));
-
- if (window->resize) {
- struct resize_data resize = { 0, };
-
- resize.window = window;
- resize.width = width;
- resize.height = height;
-
- gst_gl_window_send_message (window, (GstGLWindowCB) _on_resize, &resize);
- }
-
- window->priv->surface_width = width;
- window->priv->surface_height = height;
-
- window->queue_resize = FALSE;
-}
-
-static GType gst_gl_dummy_window_get_type (void);
-
-G_DEFINE_TYPE (GstGLDummyWindow, gst_gl_dummy_window, GST_TYPE_GL_WINDOW);
-
-static void
-gst_gl_dummy_window_set_window_handle (GstGLWindow * window, guintptr handle)
-{
- GstGLDummyWindow *dummy = (GstGLDummyWindow *) window;
-
- dummy->handle = handle;
-}
-
-static guintptr
-gst_gl_dummy_window_get_window_handle (GstGLWindow * window)
-{
- GstGLDummyWindow *dummy = (GstGLDummyWindow *) window;
-
- return (guintptr) dummy->handle;
-}
-
-static guintptr
-gst_gl_dummy_window_get_display (GstGLWindow * window)
-{
- return 0;
-}
-
-static void
-gst_gl_dummy_window_class_init (GstGLDummyWindowClass * klass)
-{
- GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
-
- window_class->get_display =
- GST_DEBUG_FUNCPTR (gst_gl_dummy_window_get_display);
- window_class->get_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_dummy_window_get_window_handle);
- window_class->set_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_dummy_window_set_window_handle);
-}
-
-static void
-gst_gl_dummy_window_init (GstGLDummyWindow * dummy)
-{
- dummy->handle = 0;
-}
-
-static GstGLDummyWindow *
-gst_gl_dummy_window_new (void)
-{
- GstGLDummyWindow *window;
-
- window = g_object_new (gst_gl_dummy_window_get_type (), NULL);
- gst_object_ref_sink (window);
-
- return window;
-}
diff --git a/gst-libs/gst/gl/gstglwindow.h b/gst-libs/gst/gl/gstglwindow.h
deleted file mode 100644
index d943b795f..000000000
--- a/gst-libs/gst/gl/gstglwindow.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_WINDOW_H__
-#define __GST_GL_WINDOW_H__
-
-#include <gst/gst.h>
-
-#include <gst/gl/gstgl_fwd.h>
-#include <gst/gl/gstglcontext.h>
-#include <gst/gl/gstgldisplay.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_window_get_type (void);
-#define GST_TYPE_GL_WINDOW (gst_gl_window_get_type())
-
-/* FIXME: remove this when moving to -base */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_GL_TYPE_WINDOW GST_TYPE_GL_WINDOW
-#endif
-#define GST_GL_WINDOW(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW, GstGLWindow))
-#define GST_GL_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_GL_WINDOW, GstGLWindowClass))
-#define GST_IS_GL_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW))
-#define GST_IS_GL_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW))
-#define GST_GL_WINDOW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW, GstGLWindowClass))
-
-#define GST_GL_WINDOW_LOCK(w) g_mutex_lock(&GST_GL_WINDOW(w)->lock)
-#define GST_GL_WINDOW_UNLOCK(w) g_mutex_unlock(&GST_GL_WINDOW(w)->lock)
-#define GST_GL_WINDOW_GET_LOCK(w) (&GST_GL_WINDOW(w)->lock)
-
-GST_EXPORT
-GQuark gst_gl_window_error_quark (void);
-/**
- * GST_GL_WINDOW_ERROR:
- *
- * Error domain for GStreamer's GL window module. Errors in this domain will be
- * from the #GstGLWindowError enumeration
- */
-#define GST_GL_WINDOW_ERROR (gst_gl_window_error_quark ())
-
-/**
- * GstGLWindowError:
- * @GST_GL_WINDOW_ERROR_FAILED: failed for a unspecified reason
- * @GST_GL_WINDOW_ERROR_OLD_LIBS: the implementation is too old
- * @GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE: no such resource was found
- */
-typedef enum
-{
- GST_GL_WINDOW_ERROR_FAILED,
- GST_GL_WINDOW_ERROR_OLD_LIBS,
- GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
-} GstGLWindowError;
-
-typedef void (*GstGLWindowCB) (gpointer data);
-typedef void (*GstGLWindowResizeCB) (gpointer data, guint width, guint height);
-
-/**
- * GST_GL_WINDOW_CB:
- * @f: the function to cast
- *
- * Cast to the currect function type for generic window callbacks
- */
-#define GST_GL_WINDOW_CB(f) ((GstGLWindowCB) (f))
-
-/**
- * GST_GL_WINDOW_RESIZE_CB:
- * @f: the function to cast
- *
- * Cast to the currect function type for window resize callbacks
- */
-#define GST_GL_WINDOW_RESIZE_CB(f) ((GstGLWindowResizeCB) (f))
-
-/**
- * GstGLWindow:
- *
- * #GstGLWindow is an opaque struct and should only be accessed through the
- * provided api.
- */
-struct _GstGLWindow {
- /*< private >*/
- GstObject parent;
-
- GMutex lock;
-
- GstGLDisplay *display;
- GWeakRef context_ref;
-
- /*< protected >*/
- gboolean is_drawing;
-
- GstGLWindowCB draw;
- gpointer draw_data;
- GDestroyNotify draw_notify;
- GstGLWindowCB close;
- gpointer close_data;
- GDestroyNotify close_notify;
- GstGLWindowResizeCB resize;
- gpointer resize_data;
- GDestroyNotify resize_notify;
-
- gboolean queue_resize;
-
- GMainContext *main_context; /* default main_context */
-
- /*< private >*/
- GstGLWindowPrivate *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-/**
- * GstGLWindowClass:
- * @parent_class: Parent class
- * @get_display: Gets the current windowing system display connection
- * @set_window_handle: Set a window handle to render into
- * @get_window_handle: Gets the current window handle that this #GstGLWindow is
- * rendering into. This may return a different value to
- * what is passed into @set_window_handle
- * @draw: redraw the window with the specified dimensions
- * @run: run the mainloop
- * @quit: send a quit to the mainloop
- * @send_message: invoke a function on the window thread. Required to be reentrant.
- * @send_message_async: invoke a function on the window thread. @run may or may
- * not have been called. Required to be reentrant.
- * @open: open the connection to the display
- * @close: close the connection to the display
- * @handle_events: whether to handle 'extra' events from the windowing system.
- * Basic events like surface moves and resizes are still valid
- * things to listen for.
- * @set_preferred_size: request that the window change surface size. The
- * implementation is free to ignore this information.
- * @show: request that the window be shown to the user
- * @set_render_rectangle: request a rectangle to render into. See #GstVideoOverlay
- * @queue_resize: request a resize to occur when possible
- */
-struct _GstGLWindowClass {
- GstObjectClass parent_class;
-
- guintptr (*get_display) (GstGLWindow *window);
- void (*set_window_handle) (GstGLWindow *window, guintptr handle);
- guintptr (*get_window_handle) (GstGLWindow *window);
- void (*draw) (GstGLWindow *window);
- void (*run) (GstGLWindow *window);
- void (*quit) (GstGLWindow *window);
- void (*send_message) (GstGLWindow *window, GstGLWindowCB callback, gpointer data);
- void (*send_message_async) (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
-
- gboolean (*open) (GstGLWindow *window, GError **error);
- void (*close) (GstGLWindow *window);
- void (*handle_events) (GstGLWindow *window, gboolean handle_events);
- void (*set_preferred_size) (GstGLWindow *window, gint width, gint height);
- void (*show) (GstGLWindow *window);
- gboolean (*set_render_rectangle)(GstGLWindow *window, gint x, gint y, gint width, gint height);
- void (*queue_resize) (GstGLWindow *window);
-
- /*< private >*/
- gpointer _reserved[GST_PADDING];
-};
-
-GST_EXPORT
-GstGLWindow * gst_gl_window_new (GstGLDisplay *display);
-
-/* callbacks */
-GST_EXPORT
-void gst_gl_window_set_draw_callback (GstGLWindow *window,
- GstGLWindowCB callback,
- gpointer data,
- GDestroyNotify destroy_notify);
-GST_EXPORT
-void gst_gl_window_set_resize_callback (GstGLWindow *window,
- GstGLWindowResizeCB callback,
- gpointer data,
- GDestroyNotify destroy_notify);
-GST_EXPORT
-void gst_gl_window_set_close_callback (GstGLWindow *window,
- GstGLWindowCB callback,
- gpointer data,
- GDestroyNotify destroy_notify);
-
-GST_EXPORT
-void gst_gl_window_set_window_handle (GstGLWindow *window, guintptr handle);
-GST_EXPORT
-guintptr gst_gl_window_get_window_handle (GstGLWindow *window);
-
-/* loop/events */
-GST_EXPORT
-void gst_gl_window_run (GstGLWindow *window);
-GST_EXPORT
-void gst_gl_window_quit (GstGLWindow *window);
-GST_EXPORT
-void gst_gl_window_send_message (GstGLWindow *window,
- GstGLWindowCB callback,
- gpointer data);
-GST_EXPORT
-void gst_gl_window_send_message_async (GstGLWindow *window,
- GstGLWindowCB callback,
- gpointer data,
- GDestroyNotify destroy);
-
-/* navigation */
-GST_EXPORT
-void gst_gl_window_handle_events (GstGLWindow * window,
- gboolean handle_events);
-
-GST_EXPORT
-void gst_gl_window_send_key_event (GstGLWindow * window,
- const char * event_type,
- const char * key_str);
-GST_EXPORT
-void gst_gl_window_send_mouse_event (GstGLWindow * window,
- const char * event_type,
- int button,
- double posx,
- double posy);
-
-/* surfaces/rendering */
-GST_EXPORT
-void gst_gl_window_queue_resize (GstGLWindow *window);
-GST_EXPORT
-void gst_gl_window_draw (GstGLWindow *window);
-GST_EXPORT
-void gst_gl_window_show (GstGLWindow *window);
-GST_EXPORT
-void gst_gl_window_set_preferred_size (GstGLWindow * window,
- gint width,
- gint height);
-GST_EXPORT
-void gst_gl_window_get_surface_dimensions (GstGLWindow * window,
- guint * width,
- guint * height);
-GST_EXPORT
-gboolean gst_gl_window_set_render_rectangle (GstGLWindow * window,
- gint x,
- gint y,
- gint width,
- gint height);
-
-/* subclass usage only */
-GST_EXPORT
-void gst_gl_window_resize (GstGLWindow *window, guint width, guint height);
-
-GST_EXPORT
-GstGLContext * gst_gl_window_get_context (GstGLWindow *window);
-GST_EXPORT
-guintptr gst_gl_window_get_display (GstGLWindow *window);
-
-G_END_DECLS
-
-#endif /* __GST_GL_WINDOW_H__ */
diff --git a/gst-libs/gst/gl/gstglwindow_private.h b/gst-libs/gst/gl/gstglwindow_private.h
deleted file mode 100644
index 001165bfe..000000000
--- a/gst-libs/gst/gl/gstglwindow_private.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_WINDOW_PRIVATE_H__
-#define __GST_GL_WINDOW_PRIVATE_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-G_GNUC_INTERNAL extern GstDebugCategory *gst_gl_window_debug;
-
-G_END_DECLS
-
-#endif /* __GST_GL_WINDOW_PRIVATE_H__ */
diff --git a/gst-libs/gst/gl/meson.build b/gst-libs/gst/gl/meson.build
deleted file mode 100644
index b8d3687ae..000000000
--- a/gst-libs/gst/gl/meson.build
+++ /dev/null
@@ -1,702 +0,0 @@
-gl_sources = [
- 'gstglapi.c',
- 'gstglbasefilter.c',
- 'gstglbasememory.c',
- 'gstglcolorconvert.c',
- 'gstglbuffer.c',
- 'gstglbufferpool.c',
- 'gstglcontext.c',
- 'gstgldebug.c',
- 'gstgldisplay.c',
- 'gstglfeature.c',
- 'gstglfilter.c',
- 'gstglformat.c',
- 'gstglframebuffer.c',
- 'gstglmemory.c',
- 'gstglmemorypbo.c',
- 'gstgloverlaycompositor.c',
- 'gstglquery.c',
- 'gstglrenderbuffer.c',
- 'gstglshader.c',
- 'gstglshaderstrings.c',
- 'gstglsl.c',
- 'gstglslstage.c',
- 'gstglsyncmeta.c',
- 'gstglupload.c',
- 'gstglutils.c',
- 'gstglviewconvert.c',
- 'gstglwindow.c',
-]
-
-gl_headers = [
- 'gl.h',
- 'gstgl_enums.h',
- 'gstgl_fwd.h',
- 'gstglapi.h',
- 'gstglbasefilter.h',
- 'gstglbasememory.h',
- 'gstglbuffer.h',
- 'gstglbufferpool.h',
- 'gstglcolorconvert.h',
- 'gstglcontext.h',
- 'gstgldebug.h',
- 'gstgldisplay.h',
- 'gstglfeature.h',
- 'gstglfilter.h',
- 'gstglformat.h',
- 'gstglfuncs.h',
- 'gstglframebuffer.h',
- 'gstglmemory.h',
- 'gstglmemorypbo.h',
- 'gstgloverlaycompositor.h',
- 'gstglquery.h',
- 'gstglrenderbuffer.h',
- 'gstglshader.h',
- 'gstglshaderstrings.h',
- 'gstglsl.h',
- 'gstglslstage.h',
- 'gstglsyncmeta.h',
- 'gstglupload.h',
- 'gstglutils.h',
- 'gstglviewconvert.h',
- 'gstglwindow.h',
-]
-
-gl_prototype_headers = [
- 'glprototypes/all_functions.h',
- 'glprototypes/base.h',
- 'glprototypes/blending.h',
- 'glprototypes/buffers.h',
- 'glprototypes/debug.h',
- 'glprototypes/eglimage.h',
- 'glprototypes/fbo.h',
- 'glprototypes/fixedfunction.h',
- 'glprototypes/gles.h',
- 'glprototypes/gstgl_compat.h',
- 'glprototypes/gstgl_gles2compat.h',
- 'glprototypes/Makefile.am',
- 'glprototypes/opengl.h',
- 'glprototypes/query.h',
- 'glprototypes/README',
- 'glprototypes/shaders.h',
- 'glprototypes/sync.h',
- 'glprototypes/vao.h',
-]
-
-gl_x11_headers = []
-gl_wayland_headers = []
-gl_win32_headers = []
-gl_cocoa_headers = []
-gl_egl_headers = []
-
-glconf = configuration_data()
-glconf_options = [
- 'GST_GL_HAVE_OPENGL',
- 'GST_GL_HAVE_GLES2',
- 'GST_GL_HAVE_GLES3',
- 'GST_GL_HAVE_GLES3EXT3_H',
-
- 'GST_GL_HAVE_WINDOW_X11',
- 'GST_GL_HAVE_WINDOW_COCOA',
- 'GST_GL_HAVE_WINDOW_WIN32',
- 'GST_GL_HAVE_WINDOW_WAYLAND',
- 'GST_GL_HAVE_WINDOW_ANDROID',
- 'GST_GL_HAVE_WINDOW_DISPMANX',
- 'GST_GL_HAVE_WINDOW_EAGL',
- 'GST_GL_HAVE_WINDOW_VIV_FB',
-
- 'GST_GL_HAVE_PLATFORM_EGL',
- 'GST_GL_HAVE_PLATFORM_GLX',
- 'GST_GL_HAVE_PLATFORM_WGL',
- 'GST_GL_HAVE_PLATFORM_CGL',
- 'GST_GL_HAVE_PLATFORM_EAGL',
-
- 'GST_GL_HAVE_DMABUF',
- 'GST_GL_HAVE_VIV_DIRECTVIV',
-
- 'GST_GL_HAVE_GLEGLIMAGEOES',
- 'GST_GL_HAVE_GLCHAR',
- 'GST_GL_HAVE_GLSIZEIPTR',
- 'GST_GL_HAVE_GLINTPTR',
- 'GST_GL_HAVE_GLSYNC',
- 'GST_GL_HAVE_GLUINT64',
- 'GST_GL_HAVE_GLINT64',
- 'GST_GL_HAVE_EGLATTRIB',
-]
-
-foreach option : glconf_options
- glconf.set10(option, false)
-endforeach
-
-gmodule_dep = dependency('gmodule-no-export-2.0',
- fallback: ['glib', 'libgmodule_dep'])
-unneeded_dep = dependency('', required : false)
-if unneeded_dep.found()
- error ('Found unfindable dependency')
-endif
-
-# OpenGL/GLES2 libraries
-gl_lib_deps = []
-# GL platform - EGL, GLX, CGL, WGL, etc
-gl_platform_deps = []
-# GL winsys - wayland, X11, Cocoa, win32, etc
-gl_winsys_deps = []
-# other things we need.
-gl_misc_deps = []
-# Other preprocessor arguments
-gl_cpp_args = ['-DGST_USE_UNSTABLE_API', '-DGST_EXPORTS']
-
-enabled_gl_apis = []
-enabled_gl_platforms = []
-enabled_gl_winsys = []
-
-# parse provided options
-libegl_module_name = get_option('with_egl_module_name')
-if libegl_module_name != ''
- gl_cpp_args += ['-DGST_GL_LIBEGL_MODULE_NAME="@0@"'.format(libegl_module_name)]
-endif
-libgles2_module_name = get_option('with_gles2_module_name')
-if libgles2_module_name != ''
- gl_cpp_args += ['-DGST_GL_LIBGLESV2_MODULE_NAME="@0@"'.format(libgles2_module_name)]
-endif
-libgl_module_name = get_option('with_opengl_module_name')
-if libgl_module_name != ''
- gl_cpp_args += ['-DGST_GL_LIBGL_MODULE_NAME="@0@"'.format(libgl_module_name)]
-endif
-
-gl_apis_s = get_option ('with_gl_api')
-if gl_apis_s == 'auto'
- need_api_opengl = 'auto'
- need_api_gles2 = 'auto'
-else
- need_api_opengl = 'no'
- need_api_gles2 = 'no'
- gl_apis = gl_apis_s.split(',')
- foreach api : gl_apis
- if api == 'opengl'
- need_api_opengl = 'yes'
- elif api == 'gles2'
- need_api_gles2 = 'yes'
- else
- error('Unsupported GL api provided ' + api)
- endif
- endforeach
-endif
-
-gl_platforms_s = get_option ('with_gl_platform')
-if gl_platforms_s == 'auto'
- need_platform_egl = 'auto'
- need_platform_glx = 'auto'
- need_platform_cgl = 'auto'
- need_platform_wgl = 'auto'
- need_platform_eagl = 'auto'
-else
- need_platform_egl = 'no'
- need_platform_glx = 'no'
- need_platform_cgl = 'no'
- need_platform_wgl = 'no'
- need_platform_eagl = 'no'
- gl_platforms = gl_platforms_s.split(',')
- foreach platform : gl_platforms
- if platform == 'egl'
- need_platform_egl = 'yes'
- elif platform == 'glx'
- need_platform_glx = 'yes'
-# elif platform == 'cgl'
-# need_platform_cgl = 'yes'
- elif platform == 'wgl'
- need_platform_wgl = 'yes'
-# elif platform == 'eagl'
-# need_platform_eagl = 'yes'
- else
- error('Unsupported GL platform provided ' + platform)
- endif
- endforeach
-endif
-
-gl_winsys_s = get_option ('with_gl_winsys')
-if gl_winsys_s == 'auto'
- need_win_x11 = 'auto'
- need_win_wayland = 'auto'
- need_win_win32 = 'auto'
- need_win_cocoa = 'auto'
- need_win_eagl = 'auto'
- need_win_dispmanx = 'auto'
- need_win_viv_fb = 'auto'
-else
- need_win_x11 = 'no'
- need_win_wayland = 'no'
- need_win_win32 = 'no'
- need_win_cocoa = 'no'
- need_win_eagl = 'no'
- need_win_dispmanx = 'no'
- need_win_viv_fb = 'no'
- gl_winsys = gl_winsys_s.split(',')
- foreach winsys : gl_winsys
- if winsys == 'x11'
- need_win_x11 = 'yes'
- elif winsys == 'wayland'
- need_win_wayland = 'yes'
- elif winsys == 'win32'
- need_win_win32 = 'yes'
-# elif winsys == 'cocoa'
-# need_win_cocoa = 'yes'
-# elif winsys == 'eagl'
-# need_win_eagl = 'yes'
- elif winsys == 'dispmanx'
- need_win_dispmanx = 'yes'
- elif winsys == 'viv-fb'
- need_win_viv_fb = 'yes'
- else
- error('Unsupported GL winsys provided ' + winsys)
- endif
- endforeach
-endif
-
-gl_include_header = '''
-#ifdef __GNUC__
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wredundant-decls"
-#endif
-#ifndef GL_GLEXT_PROTOTYPES
-#define GL_GLEXT_PROTOTYPES 1
-#endif
-'''
-
-# Desktop OpenGL checks
-gl_dep = unneeded_dep
-glx_dep = unneeded_dep
-if need_api_opengl != 'no' or need_platform_glx != 'no'
- gl_dep = dependency('gl', required : false)
- if not gl_dep.found()
- if host_machine.system() == 'windows'
- gl_dep = cc.find_library('opengl32', required : false)
-# elif host_machine.system() == 'darwin'
-# gl_dep = cc.find_library('OpenGL', required : false)
- else
- gl_dep = cc.find_library('GL', required : false)
- endif
-
- if not cc.has_header('GL/gl.h', required : false)
- gl_dep = unneeded_dep
- endif
-
- if not gl_dep.found() and need_api_opengl == 'yes'
- error ('Could not find requested OpenGL library')
- endif
- endif
-
- glx_dep = gl_dep
- if need_api_opengl == 'no'
- gl_dep = unneeded_dep
- endif
- if need_platform_glx == 'no'
- glx_dep = unneeded_dep
- endif
-
- opengl_includes = '''
-#ifdef __APPLE__
-# include <OpenGL/OpenGL.h>
-# include <OpenGL/gl.h>
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
-# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
-# include <OpenGL/gl3.h>
-# endif
-#else
-# if _MSC_VER
-# include <windows.h>
-# endif
-# include <GL/gl.h>
-# if __WIN32__ || _WIN32
-# include <GL/glext.h>
-# endif
-#endif
-'''
-endif
-
-# GLES2 checks
-gles2_dep = unneeded_dep
-gles3_h = false
-gles3ext3_h = false
-if need_api_gles2 != 'no'
- gles2_dep = dependency('glesv2', required : false)
- if not gles2_dep.found()
-# if host_machine.system() == 'windows'
-# elif host_machine.system() == 'darwin'
-# gles2_dep = cc.find_library('GLESv2', required : false)
-# else
- gles2_dep = cc.find_library('GLESv2', required : false)
-# endif
-
- if not cc.has_header('GLES2/gl2.h', required : false)
- gles2_dep = unneeded_dep
- endif
-
- if not gles2_dep.found() and need_api_gles2 == 'yes'
- error ('Could not find requested OpenGL ES library')
- endif
- endif
-
- gles3_h = gles2_dep.found() and cc.has_header('GLES3/gl3.h', required : false, dependencies : gles2_dep)
-
- gles_includes = '''
-#ifdef HAVE_IOS /* FIXME */
-# include <OpenGLES/ES2/gl.h>
-# include <OpenGLES/ES2/glext.h>
-#else'''
- if gles3_h
- gles3ext3_h = gles3_h and cc.has_header('GLES3/gl3ext.h', required : false, dependencies : gles2_dep)
- gles_includes += '''
-# include <GLES3/gl3.h>
-# include <GLES2/gl2ext.h>'''
- if gles3ext3_h
- gles_includes += '''
-# include <GLES3/gl3ext.h>'''
- endif
- else
- gles_includes += '''
-# include <GLES2/gl2.h>
-# include <GLES2/gl2ext.h>'''
- endif
- gles_includes += '''
-#endif
-'''
-endif
-
-# can we include both gles2 and opengl headers?
-if gles2_dep.found() and gl_dep.found()
- gl_include_block = gl_include_header + gles_includes + opengl_includes
- if not cc.compiles('void f (void) {}', prefix : gl_include_block, dependencies : [gles2_dep, gl_dep] )
- message ('Cannot include both OpenGL and OpenGL ES headers')
- if need_gles2 != 'yes'
- gles2_dep = unneeded_dep
- elif need_opengl != 'yes'
- gl_dep = unneeded_dep
- else
- error('Both OpenGL and OpenGL ES were requested but cannot be included together')
- endif
- endif
-endif
-gl_include_block = gl_include_header
-if gles2_dep.found()
- gl_include_block += gles_includes
-endif
-if gl_dep.found()
- gl_include_block += opengl_includes
-endif
-
-if gles2_dep.found()
- gl_lib_deps += gles2_dep
- glconf.set10('GST_GL_HAVE_GLES2', 1)
- if gles3_h
- glconf.set10('GST_GL_HAVE_GLES3', 1)
- if gles3ext3_h
- glconf.set10('GST_GL_HAVE_GLES3EXT3_H', 1)
- endif
- endif
- enabled_gl_apis += 'gles2'
-endif
-
-if gl_dep.found()
- gl_lib_deps += gl_dep
- glconf.set10('GST_GL_HAVE_OPENGL', 1)
- enabled_gl_apis += 'opengl'
-endif
-
-# EGL checks
-egl_dep = unneeded_dep
-if need_platform_egl != 'no'
- egl_dep = dependency('egl', required : false)
- if not egl_dep.found()
- egl_dep = cc.find_library('EGL', required : false)
-
- if not egl_dep.found() and need_platform_egl == 'yes'
- error ('Could not find requested EGL library')
- endif
- endif
-
- if egl_dep.found()
- gl_sources += [
- 'egl/gstegl.c',
- 'egl/gsteglimage.c',
- 'egl/gstglcontext_egl.c',
- 'egl/gstgldisplay_egl.c',
- 'egl/gstglmemoryegl.c',
- ]
- gl_egl_headers += [
- 'egl/gstegl.h',
- 'egl/gsteglimage.h',
- 'egl/gstgldisplay_egl.h',
- 'egl/gstglmemoryegl.h',
- ]
- gl_platform_deps += egl_dep
- glconf.set10('GST_GL_HAVE_PLATFORM_EGL', 1)
-
- if cc.has_header('libdrm/drm_fourcc.h', required : false)
- gl_misc_deps += gstallocators_dep
- glconf.set10('GST_GL_HAVE_DMABUF', 1)
- endif
-
- egl_includes = '''
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-'''
- enabled_gl_platforms += 'egl'
- endif
-
-endif
-
-# wayland checks
-wayland_client_dep = unneeded_dep
-wayland_cursor_dep = unneeded_dep
-wayland_egl_dep = unneeded_dep
-if need_win_wayland != 'no'
- if need_win_wayland == 'yes'
- if need_platform_egl == 'no'
- error('Impossible situation requested: Cannot use Wayland without EGL support')
- endif
- endif
- if not egl_dep.found()
- if need_win_wayland == 'yes'
- error ('Could not find EGL libraries for wayland')
- else
- message ('Could not find EGL libraries for wayland')
- endif
- else
- wayland_client_dep = dependency('wayland-client', version : '>= 1.0', required : false)
- wayland_cursor_dep = dependency('wayland-cursor', version : '>= 1.0', required : false)
- wayland_egl_dep = dependency('wayland-egl', version : '>= 1.0', required : false)
-
- if wayland_client_dep.found() and wayland_cursor_dep.found() and wayland_egl_dep.found()
- gl_sources += [
- 'wayland/gstgldisplay_wayland.c',
- 'wayland/gstglwindow_wayland_egl.c',
- 'wayland/wayland_event_source.c',
- ]
- gl_wayland_headers += [
- 'wayland/gstgldisplay_wayland.h'
- ]
- glconf.set('GST_GL_HAVE_WINDOW_WAYLAND', 1)
- gl_winsys_deps += [wayland_client_dep, wayland_cursor_dep, wayland_egl_dep]
- enabled_gl_winsys += 'wayland'
- else
- if need_win_wayland == 'yes'
- error ('Could not find requested Wayland libraries')
- endif
- wayland_client_dep = unneeded_dep
- wayland_cursor_dep = unneeded_dep
- wayland_egl_dep = unneeded_dep
- endif
- endif
-endif
-
-# X11 checks
-if need_platform_glx == 'yes'
- if need_win_x11 == 'no'
- error('Impossible situation requested: Cannot use GLX without X11 support')
- elif need_api_opengl == 'no'
- error('Impossible situation requested: Cannot use GLX without the OpenGL library')
- endif
-endif
-
-if need_win_x11 != 'no'
- xcb_dep = dependency('x11-xcb', required : false)
- if x11_dep.found() and xcb_dep.found()
- gl_sources += [
- 'x11/gstgldisplay_x11.c',
- 'x11/gstglwindow_x11.c',
- 'x11/xcb_event_source.c',
- ]
- gl_x11_headers += [
- 'x11/gstgldisplay_x11.h',
- ]
- glconf.set('GST_GL_HAVE_WINDOW_X11', 1)
- gl_winsys_deps += [x11_dep, xcb_dep]
- enabled_gl_winsys += 'x11'
-
- if need_platform_glx != 'no' and glx_dep.found()
- glconf.set('GST_GL_HAVE_PLATFORM_GLX', 1)
- gl_sources += [
- 'x11/gstglcontext_glx.c',
- ]
- # GLX is in the opengl library on linux
- gl_platform_deps += glx_dep
- enabled_gl_platforms += 'glx'
- endif
- elif need_win_x11 == 'yes'
- error ('Could not find requested X11 libraries')
- endif
-endif
-
-bcm_host_dep = unneeded_dep
-if need_win_dispmanx != 'no'
-
- # Try pkg-config for bcm_host then fallback to find_library to also
- # support older distribution
- bcm_host_dep = dependency('bcm_host', required : false)
- if not bcm_host_dep.found()
- bcm_host_dep = cc.find_library('bcm_host', required : false)
- endif
-
- if bcm_host_dep.found()
- if not egl_dep.found()
- error('dispmanx requires the use of egl')
- endif
-
- gl_sources += [
- 'dispmanx/gstglwindow_dispmanx_egl.c'
- ]
-
- glconf.set('GST_GL_HAVE_WINDOW_DISPMANX', 1)
- gl_winsys_deps += bcm_host_dep
- enabled_gl_winsys += 'dispmanx'
- gl_cpp_args += ['-DUSE_EGL_RPI']
- elif need_win_dispmanx == 'yes'
- error('Could not find dispmanx libraries')
- endif
-endif
-
-# win32 checks
-if need_platform_wgl == 'yes'
- if need_win_win32 == 'no'
- error('Impossible situation requested: Cannot use WGL without the win32 window system')
- endif
-endif
-
-# XXX: untested
-if need_platform_wgl != 'no' and need_win_win32 != 'no'
- gdi_dep = cc.find_library('gdi32', required : false)
- # FIXME: Revert back to has_header once it gains prefix support
- wglext_h = cc.has_header_symbol('GL/wglext.h', 'WGL_WGLEXT_VERSION',
- prefix : '#include <windows.h>
- #include <GL/gl.h>')
-
- if wglext_h and gdi_dep.found() and gl_dep.found()
- gl_platform_deps += gdi_dep
- gl_sources += [
- 'win32/win32_message_source.c',
- 'win32/gstglwindow_win32.c',
- 'win32/gstglwindow_win32.c',
- ]
- enabled_gl_winsys += 'win32'
- gl_winsys_deps += gdi_dep
- enabled_gl_platforms += 'wgl'
- endif
-endif
-
-if host_machine.system() == 'darwin'
- # FIXME: how to know if we're on iOS or OS X?
-# gl_cocoa_headers += [
-# 'gstglcontext_cocoa.h',
-# 'gstglcaopengllayer.h',
-# ]
-endif
-
-if need_platform_egl != 'no' and need_win_viv_fb != 'no'
- if egl_dep.found() and cc.has_function ('fbGetDisplay', dependencies : egl_dep)
- if cc.has_function ('glTexDirectVIV', dependencies : gles2_dep)
- enabled_gl_winsys += 'viv-fb'
- glconf.set10('GST_GL_HAVE_WINDOW_VIV_FB', 1)
- glconf.set10('GST_GL_HAVE_VIV_DIRECTVIV', 1)
- gl_sources += [
- 'viv-fb/gstgldisplay_viv_fb.c',
- 'viv-fb/gstglwindow_viv_fb_egl.c',
- ]
- gl_cpp_args += ['-DEGL_API_FB']
- endif
- endif
-endif
-
-# TODO: Add rest of gl config here.
-# iOS, OS X, win32 specific support
-
-build_gstgl = true
-if enabled_gl_apis.length() == 0
- message('No OpenGL API libraries found or requested')
- build_gstgl = false
-endif
-if enabled_gl_platforms.length() == 0
- message('No OpenGL Platforms found or requested')
- build_gstgl = false
-endif
-if enabled_gl_winsys.length() == 0
- message('No OpenGL Window systems found or requested')
- build_gstgl = false
-endif
-
-if build_gstgl
- # find some types that may or may not be defined
- if cc.has_type('GLeglImageOES', prefix : gl_include_block, dependencies : gl_lib_deps)
- glconf.set('GST_GL_HAVE_GLEGLIMAGEOES', 1)
- endif
- if cc.has_type('GLchar', prefix : gl_include_block, dependencies : gl_lib_deps)
- glconf.set('GST_GL_HAVE_GLCHAR', 1)
- endif
- if cc.has_type('GLsizeiptr', prefix : gl_include_block, dependencies : gl_lib_deps)
- glconf.set('GST_GL_HAVE_GLSIZEIPTR', 1)
- endif
- if cc.has_type('GLintptr', prefix : gl_include_block, dependencies : gl_lib_deps)
- glconf.set('GST_GL_HAVE_GLINTPTR', 1)
- endif
- if cc.has_type('GLsync', prefix : gl_include_block, dependencies : gl_lib_deps)
- glconf.set('GST_GL_HAVE_GLSYNC', 1)
- endif
- if cc.has_type('GLuint64', prefix : gl_include_block, dependencies : gl_lib_deps)
- glconf.set('GST_GL_HAVE_GLUINT64', 1)
- endif
- if cc.has_type('GLint64', prefix : gl_include_block, dependencies : gl_lib_deps)
- glconf.set('GST_GL_HAVE_GLINT64', 1)
- endif
- if egl_dep.found() and cc.has_type('EGLAttrib', prefix : gl_include_block + egl_includes, dependencies : gl_lib_deps + [egl_dep])
- glconf.set('GST_GL_HAVE_EGLATTRIB', 1)
- endif
-
- message('Building libgstgl with GL api: ' + ' '.join(enabled_gl_apis))
- message('Building libgstgl with GL platform: ' + ' '.join(enabled_gl_platforms))
- message('Building libgstgl with GL winsys: ' + ' '.join(enabled_gl_winsys))
-
- install_headers(gl_headers, subdir : 'gstreamer-1.0/gst/gl')
- install_headers(gl_cocoa_headers, subdir : 'gstreamer-1.0/gst/gl/cocoa')
- install_headers(gl_egl_headers, subdir : 'gstreamer-1.0/gst/gl/egl')
- install_headers(gl_prototype_headers, subdir : 'gstreamer-1.0/gst/gl/glprototypes')
- install_headers(gl_x11_headers, subdir : 'gstreamer-1.0/gst/gl/x11')
- install_headers(gl_wayland_headers, subdir : 'gstreamer-1.0/gst/gl/wayland')
-
- configure_file(input : 'gstglconfig.h.meson',
- output : 'gstglconfig.h',
- install_dir : get_option('libdir') + '/gstreamer-1.0/include/gst/gl',
- configuration : glconf)
-
- gstgl = library('gstgl-' + api_version,
- gl_sources,
- c_args : gst_plugins_bad_args + gl_cpp_args,
- include_directories : [configinc, libsinc],
- version : libversion,
- soversion : soversion,
- install : true,
- dependencies : [gstbase_dep, gstvideo_dep, gstbadallocators_dep, gmodule_dep,
- gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps])
- gen_sources = []
- if build_gir
- gl_gir = gnome.generate_gir(gstgl,
- sources : gl_sources + gl_headers,
- namespace : 'GstGL',
- nsversion : api_version,
- identifier_prefix : 'Gst',
- symbol_prefix : 'gst',
- export_packages : 'gstreamer-gl-1.0',
- includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
- install : true,
- extra_args : gir_init_section + ['-DGST_USE_UNSTABLE_API',
- '--c-include=gst/gl/gl.h'],
- dependencies : [gst_dep, gstbase_dep, gstvideo_dep]
- )
- gen_sources += gl_gir
- endif
-
-
- gstgl_dep = declare_dependency(link_with : gstgl,
- include_directories : [libsinc],
- sources: gen_sources,
- dependencies : [gstbase_dep, gstvideo_dep] + gl_winsys_deps)
-endif
diff --git a/gst-libs/gst/gl/utils/gles_versions.h b/gst-libs/gst/gl/utils/gles_versions.h
deleted file mode 100644
index e80bf1e7e..000000000
--- a/gst-libs/gst/gl/utils/gles_versions.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 _GLES_VERSIONS_H_
-#define _GLES_VERSIONS_H_
-
-/* list of known OpenGL versions */
-/* *INDENT-OFF* */
-
-static const struct { int major, minor; } gles2_versions[] = {
- {3, 2},
- {3, 1},
- {3, 0},
-
- {2, 0},
-
- {0, 0} /* end of list */
-};
-/* *INDENT-ON* */
-
-#endif /* _GLES_VERSIONS_H_ */
diff --git a/gst-libs/gst/gl/utils/opengl_versions.h b/gst-libs/gst/gl/utils/opengl_versions.h
deleted file mode 100644
index 081caeb47..000000000
--- a/gst-libs/gst/gl/utils/opengl_versions.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 _OPENGL_VERSIONS_H_
-#define _OPENGL_VERSIONS_H_
-
-/* list of known OpenGL versions */
-/* *INDENT-OFF* */
-static const struct { int major, minor; } opengl_versions[] = {
- {4, 5},
- {4, 4},
- {4, 3},
- {4, 2},
- {4, 1},
- {4, 0},
-
- {3, 3},
- {3, 2},
- {3, 1},
- {3, 0},
-
- {2, 1},
- {2, 0},
-
- {1, 5},
- {1, 4},
- {1, 3},
- {1, 2},
- {1, 1},
- {1, 0},
-
- {0, 0} /* end of list */
-};
-
-/* *INDENT-ON* */
-
-#endif /* _OPENGL_VERSIONS_H_ */
diff --git a/gst-libs/gst/gl/viv-fb/Makefile.am b/gst-libs/gst/gl/viv-fb/Makefile.am
deleted file mode 100644
index 22294b130..000000000
--- a/gst-libs/gst/gl/viv-fb/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES = libgstgl-viv-fb.la
-
-libgstgl_viv_fb_la_SOURCES = \
- gstgldisplay_viv_fb.c \
- gstglwindow_viv_fb_egl.c
-
-noinst_HEADERS = \
- gstgldisplay_viv_fb.h \
- gstglwindow_viv_fb_egl.h
-
-libgstgl_viv_fbincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/viv-fb
-
-libgstgl_viv_fb_la_CFLAGS = \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GL_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-
-libgstgl_viv_fb_la_LDFLAGS = \
- $(GST_LIB_LDFLAGS) \
- $(GST_ALL_LDFLAGS)
diff --git a/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.c b/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.c
deleted file mode 100644
index b90273e4e..000000000
--- a/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com>
- * Copyright (C) 2015 Freescale Semiconductor <b55597@freescale.com>
- * Copyright (C) 2017 Sebastian Dröge <sebastian@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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstgldisplay_viv_fb.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
-#define GST_CAT_DEFAULT gst_gl_display_debug
-
-G_DEFINE_TYPE (GstGLDisplayVivFB, gst_gl_display_viv_fb, GST_TYPE_GL_DISPLAY);
-
-static void gst_gl_display_viv_fb_finalize (GObject * object);
-static guintptr gst_gl_display_viv_fb_get_handle (GstGLDisplay * display);
-
-static void
-gst_gl_display_viv_fb_class_init (GstGLDisplayVivFBClass * klass)
-{
- GST_GL_DISPLAY_CLASS (klass)->get_handle =
- GST_DEBUG_FUNCPTR (gst_gl_display_viv_fb_get_handle);
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_display_viv_fb_finalize;
-}
-
-static void
-gst_gl_display_viv_fb_init (GstGLDisplayVivFB * display_viv_fb)
-{
- GstGLDisplay *display = (GstGLDisplay *) display_viv_fb;
-
- display->type = GST_GL_DISPLAY_TYPE_VIV_FB;
-
- display_viv_fb->disp_idx = 0;
- display_viv_fb->display = NULL;
-}
-
-static void
-gst_gl_display_viv_fb_finalize (GObject * object)
-{
- GstGLDisplayVivFB *display_viv_fb = GST_GL_DISPLAY_VIV_FB (object);
-
- // We don't destroy the FB Display - it causes crashes in applications
- // because Vivante doesn't seem to do any refcounting
-
- G_OBJECT_CLASS (gst_gl_display_viv_fb_parent_class)->finalize (object);
-}
-
-/**
- * gst_gl_display_viv_fb_new:
- * @disp_idx: a display index
- *
- * Create a new #GstGLDisplayVivFB from the FB display index.
- *
- * Returns: (transfer full): a new #GstGLDisplayVivFB or %NULL
- */
-GstGLDisplayVivFB *
-gst_gl_display_viv_fb_new (gint disp_idx)
-{
- GstGLDisplayVivFB *display;
-
- GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-
- GST_DEBUG ("creating Vivante FB EGL display %d", disp_idx);
-
- display = g_object_new (GST_TYPE_GL_DISPLAY_VIV_FB, NULL);
- gst_object_ref_sink (display);
- display->disp_idx = disp_idx;
- display->display = fbGetDisplayByIndex (display->disp_idx);
- if (!display->display) {
- GST_ERROR ("Failed to open Vivante FB display %d", disp_idx);
- return NULL;
- }
-
- GST_DEBUG ("Created Vivante FB EGL display %p", (gpointer) display->display);
-
- return display;
-}
-
-static guintptr
-gst_gl_display_viv_fb_get_handle (GstGLDisplay * display)
-{
- return (guintptr) GST_GL_DISPLAY_VIV_FB (display)->display;
-}
diff --git a/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.h b/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.h
deleted file mode 100644
index 9ce1dce84..000000000
--- a/gst-libs/gst/gl/viv-fb/gstgldisplay_viv_fb.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com>
- * Copyright (C) 2015 Freescale Semiconductor <b55597@freescale.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_DISPLAY_VIV_FB_H__
-#define __GST_GL_DISPLAY_VIV_FB_H__
-
-#include <gst/gst.h>
-#include <gst/gl/gstgldisplay.h>
-#include <gst/gl/egl/gstegl.h>
-
-G_BEGIN_DECLS
-
-GType gst_gl_display_viv_fb_get_type (void);
-
-#define GST_TYPE_GL_DISPLAY_VIV_FB (gst_gl_display_viv_fb_get_type())
-#define GST_GL_DISPLAY_VIV_FB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_VIV_FB,GstGLDisplayVivFB))
-#define GST_GL_DISPLAY_VIV_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_VIV_FB,GstGLDisplayVivFBClass))
-#define GST_IS_GL_DISPLAY_VIV_FB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_VIV_FB))
-#define GST_IS_GL_DISPLAY_VIV_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_VIV_FB))
-#define GST_GL_DISPLAY_VIV_FB_CAST(obj) ((GstGLDisplayVivFB*)(obj))
-
-typedef struct _GstGLDisplayVivFB GstGLDisplayVivFB;
-typedef struct _GstGLDisplayVivFBClass GstGLDisplayVivFBClass;
-
-/**
- * GstGLDisplayVivFB:
- *
- * the contents of a #GstGLDisplayVivFB are private and should only be accessed
- * through the provided API
- */
-struct _GstGLDisplayVivFB
-{
- GstGLDisplay parent;
-
- /* <private> */
- gint disp_idx;
- EGLNativeDisplayType display;
-};
-
-struct _GstGLDisplayVivFBClass
-{
- GstGLDisplayClass object_class;
-};
-
-GstGLDisplayVivFB *gst_gl_display_viv_fb_new (gint disp_idx);
-
-G_END_DECLS
-
-#endif /* __GST_GL_DISPLAY_VIV_FB_H__ */
diff --git a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c b/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c
deleted file mode 100644
index 8515dc8ec..000000000
--- a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
- * Copyright (C) 2015 Freescale Semiconductor <b55597@freescale.com>
- * Copyright (C) 2017 Sebastian Dröge <sebastian@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.
- */
-
-#include "../gstgl_fwd.h"
-#include <gst/gl/gstglcontext.h>
-
-#include "gstglwindow_viv_fb_egl.h"
-#include "../gstglwindow_private.h"
-
-#define GST_CAT_DEFAULT gst_gl_window_debug
-
-#define gst_gl_window_viv_fb_egl_parent_class parent_class
-G_DEFINE_TYPE (GstGLWindowVivFBEGL, gst_gl_window_viv_fb_egl,
- GST_TYPE_GL_WINDOW);
-
-static guintptr gst_gl_window_viv_fb_egl_get_window_handle (GstGLWindow *
- window);
-static guintptr gst_gl_window_viv_fb_egl_get_display (GstGLWindow * window);
-static void gst_gl_window_viv_fb_egl_set_window_handle (GstGLWindow * window,
- guintptr handle);
-static void gst_gl_window_viv_fb_egl_close (GstGLWindow * window);
-static gboolean gst_gl_window_viv_fb_egl_open (GstGLWindow * window,
- GError ** error);
-static void gst_gl_window_viv_fb_egl_draw (GstGLWindow * window);
-static gboolean
-gst_gl_window_viv_fb_egl_set_render_rectangle (GstGLWindow * window,
- gint x, gint y, gint width, gint height);
-
-static void
-gst_gl_window_viv_fb_egl_class_init (GstGLWindowVivFBEGLClass * klass)
-{
- GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
-
- window_class->get_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_viv_fb_egl_get_window_handle);
- window_class->get_display =
- GST_DEBUG_FUNCPTR (gst_gl_window_viv_fb_egl_get_display);
- window_class->set_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_viv_fb_egl_set_window_handle);
- window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_viv_fb_egl_close);
- window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_viv_fb_egl_open);
- window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_viv_fb_egl_draw);
- window_class->set_render_rectangle =
- GST_DEBUG_FUNCPTR (gst_gl_window_viv_fb_egl_set_render_rectangle);
-}
-
-static void
-gst_gl_window_viv_fb_egl_init (GstGLWindowVivFBEGL * window)
-{
-}
-
-/* Must be called in the gl thread */
-GstGLWindowVivFBEGL *
-gst_gl_window_viv_fb_egl_new (GstGLDisplay * display)
-{
- GstGLWindowVivFBEGL *window;
-
- if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_VIV_FB) ==
- 0)
- /* we require a Vivante FB display to create windows */
- return NULL;
-
- window = g_object_new (GST_TYPE_GL_WINDOW_VIV_FB_EGL, NULL);
- gst_object_ref_sink (window);
-
- return window;
-}
-
-static void
-gst_gl_window_viv_fb_egl_close (GstGLWindow * window)
-{
- GstGLWindowVivFBEGL *window_egl = GST_GL_WINDOW_VIV_FB_EGL (window);
-
- if (window_egl->win_id && !window_egl->external_window) {
- fbDestroyWindow (window_egl->win_id);
- window_egl->win_id = 0;
- }
-
- GST_GL_WINDOW_CLASS (parent_class)->close (window);
-}
-
-static guintptr
-gst_gl_window_viv_fb_egl_get_display (GstGLWindow * window)
-{
- return gst_gl_display_get_handle (window->display);
-}
-
-static gboolean
-gst_gl_window_viv_fb_egl_open (GstGLWindow * window, GError ** error)
-{
- GstGLWindowVivFBEGL *window_egl = GST_GL_WINDOW_VIV_FB_EGL (window);
- EGLNativeDisplayType display;
-
- display = (EGLNativeDisplayType) gst_gl_window_get_display (window);
-
- window_egl->win_id = fbCreateWindow (display, -1, -1, 0, 0);
- window_egl->external_window = FALSE;
- if (!window_egl->win_id) {
- g_set_error (error, GST_GL_WINDOW_ERROR,
- GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE, "Can't create window");
- return FALSE;
- }
-
- fbGetWindowGeometry (window_egl->win_id, NULL, NULL,
- &window_egl->window_width, &window_egl->window_height);
- window_egl->render_rectangle.x = 0;
- window_egl->render_rectangle.y = 0;
- window_egl->render_rectangle.w = window_egl->window_width;
- window_egl->render_rectangle.h = window_egl->window_height;
- gst_gl_window_resize (window, window_egl->window_width,
- window_egl->window_height);
-
- GST_DEBUG
- ("Opened Vivante FB display succesfully, resolution is (%dx%d), display %p, window %p.",
- window_egl->window_width, window_egl->window_height, (gpointer) display,
- (gpointer) window_egl->win_id);
-
- return GST_GL_WINDOW_CLASS (parent_class)->open (window, error);
-}
-
-static guintptr
-gst_gl_window_viv_fb_egl_get_window_handle (GstGLWindow * window)
-{
- return (guintptr) GST_GL_WINDOW_VIV_FB_EGL (window)->win_id;
-}
-
-static void
-gst_gl_window_viv_fb_egl_set_window_handle (GstGLWindow * window,
- guintptr handle)
-{
- GstGLWindowVivFBEGL *window_egl = GST_GL_WINDOW_VIV_FB_EGL (window);
- gint width, height;
-
- if (window_egl->win_id)
- fbDestroyWindow (window_egl->win_id);
- window_egl->win_id = (EGLNativeWindowType) handle;
- window_egl->external_window = handle != 0;
-
- fbGetWindowGeometry (window_egl->win_id, NULL, NULL, &width, &height);
- gst_gl_window_resize (window, width, height);
-}
-
-static void
-draw_cb (gpointer data)
-{
- GstGLWindowVivFBEGL *window_egl = data;
- GstGLWindow *window = GST_GL_WINDOW (window_egl);
- GstGLContext *context = gst_gl_window_get_context (window);
- const GstGLFuncs *gl;
- gint viewport_dim[4];
-
- gl = context->gl_vtable;
-
- if (window->queue_resize) {
- guint width, height;
-
- gst_gl_window_get_surface_dimensions (window, &width, &height);
- gst_gl_window_resize (window, width, height);
-
- gl->GetIntegerv (GL_VIEWPORT, viewport_dim);
- viewport_dim[0] += window_egl->render_rectangle.x;
- viewport_dim[1] += window_egl->render_rectangle.y;
- gl->Viewport (viewport_dim[0],
- viewport_dim[1], viewport_dim[2], viewport_dim[3]);
- }
-
- if (window->draw)
- window->draw (window->draw_data);
-
- gst_gl_context_swap_buffers (context);
-
- gst_object_unref (context);
-}
-
-static void
-gst_gl_window_viv_fb_egl_draw (GstGLWindow * window)
-{
- gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
-}
-
-typedef struct
-{
- GstGLWindowVivFBEGL *window_egl;
- GstVideoRectangle rect;
-} SetRenderRectangleData;
-
-static void
-_free_set_render_rectangle (SetRenderRectangleData * render)
-{
- if (render) {
- if (render->window_egl)
- gst_object_unref (render->window_egl);
- g_free (render);
- }
-}
-
-static void
-_calculate_viewport_coordinates(GstGLWindowVivFBEGL * window_egl,
- GstVideoRectangle * req, GstVideoRectangle * result)
-{
- result->x = req->x;
- result->y = window_egl->window_height - (req->y + req->h);
- result->w = req->w;
- result->h = req->h;
-}
-
-static void
-_set_render_rectangle (gpointer data)
-{
- SetRenderRectangleData *render = data;
- GstGLWindowVivFBEGL *window_egl = render->window_egl;
- GstGLWindow *window = GST_GL_WINDOW (window_egl);
-
- GST_LOG_OBJECT (render->window_egl, "setting render rectangle %i,%i+%ix%i",
- render->rect.x, render->rect.y, render->rect.w, render->rect.h);
-
- _calculate_viewport_coordinates (window_egl, &render->rect,
- &window_egl->render_rectangle);
-
- gst_gl_window_resize (window, render->rect.w, render->rect.h);
-
- window->queue_resize = TRUE;
-}
-
-static gboolean
-gst_gl_window_viv_fb_egl_set_render_rectangle (GstGLWindow * window,
- gint x, gint y, gint width, gint height)
-{
- GstGLWindowVivFBEGL *window_egl = GST_GL_WINDOW_VIV_FB_EGL (window);
- SetRenderRectangleData *render;
-
- render = g_new0 (SetRenderRectangleData, 1);
- render->window_egl = gst_object_ref (window_egl);
- render->rect.x = x;
- render->rect.y = y;
- render->rect.w = width;
- render->rect.h = height;
-
- gst_gl_window_send_message_async (window,
- (GstGLWindowCB) _set_render_rectangle, render,
- (GDestroyNotify) _free_set_render_rectangle);
-
- return TRUE;
-}
diff --git a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.h b/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.h
deleted file mode 100644
index 60205e0dc..000000000
--- a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
- * Copyright (C) 2015 Freescale Semiconductor <b55597@freescale.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_WINDOW_VIV_FB_EGL_H__
-#define __GST_GL_WINDOW_VIV_FB_EGL_H__
-
-#include <gst/gl/gl.h>
-#include <gst/gl/egl/gstegl.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_WINDOW_VIV_FB_EGL (gst_gl_window_viv_fb_egl_get_type())
-#define GST_GL_WINDOW_VIV_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW_VIV_FB_EGL, GstGLWindowVivFBEGL))
-#define GST_GL_WINDOW_VIV_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_WINDOW_VIV_FB_EGL, GstGLWindowVivFBEGLClass))
-#define GST_IS_GL_WINDOW_VIV_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW_VIV_FB_EGL))
-#define GST_IS_GL_WINDOW_VIV_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW_VIV_FB_EGL))
-#define GST_GL_WINDOW_VIV_FB_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW_VIV_FB_EGL, GstGLWindowVivFBEGL_Class))
-
-typedef struct _GstGLWindowVivFBEGL GstGLWindowVivFBEGL;
-typedef struct _GstGLWindowVivFBEGLClass GstGLWindowVivFBEGLClass;
-
-struct _GstGLWindowVivFBEGL {
- /*< private >*/
- GstGLWindow parent;
-
- /* <private> */
- EGLNativeWindowType win_id;
- gboolean external_window;
- gint window_width, window_height;
-
- GstVideoRectangle render_rectangle;
-};
-
-struct _GstGLWindowVivFBEGLClass {
- /*< private >*/
- GstGLWindowClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING];
-};
-
-GType gst_gl_window_viv_fb_egl_get_type (void);
-
-GstGLWindowVivFBEGL * gst_gl_window_viv_fb_egl_new (GstGLDisplay * display);
-
-G_END_DECLS
-
-#endif /* __GST_GL_WINDOW_VIV_FB_EGL_H__ */
diff --git a/gst-libs/gst/gl/wayland/Makefile.am b/gst-libs/gst/gl/wayland/Makefile.am
deleted file mode 100644
index c739b9d82..000000000
--- a/gst-libs/gst/gl/wayland/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES = libgstgl-wayland.la
-
-libgstgl_wayland_la_SOURCES = \
- gstgldisplay_wayland.c \
- gstglwindow_wayland_egl.c \
- wayland_event_source.c
-
-noinst_HEADERS = \
- gstgldisplay_wayland.h \
- gstglwindow_wayland_egl.h \
- wayland_event_source.h
-
-libgstgl_waylandincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/wayland
-libgstgl_waylandinclude_HEADERS = \
- gstgldisplay_wayland.h
-
-libgstgl_wayland_la_CFLAGS = \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GL_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-
-libgstgl_wayland_la_LDFLAGS = \
- $(GST_LIB_LDFLAGS) \
- $(GST_ALL_LDFLAGS)
diff --git a/gst-libs/gst/gl/wayland/gstgldisplay_wayland.c b/gst-libs/gst/gl/wayland/gstgldisplay_wayland.c
deleted file mode 100644
index 054dcf432..000000000
--- a/gst-libs/gst/gl/wayland/gstgldisplay_wayland.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gl/wayland/gstgldisplay_wayland.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
-#define GST_CAT_DEFAULT gst_gl_display_debug
-
-G_DEFINE_TYPE (GstGLDisplayWayland, gst_gl_display_wayland,
- GST_TYPE_GL_DISPLAY);
-
-static void gst_gl_display_wayland_finalize (GObject * object);
-static guintptr gst_gl_display_wayland_get_handle (GstGLDisplay * display);
-
-static void
-registry_handle_global (void *data, struct wl_registry *registry,
- uint32_t name, const char *interface, uint32_t version)
-{
- GstGLDisplayWayland *display = data;
-
- GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-
- GST_TRACE_OBJECT (display, "registry_handle_global with registry %p, "
- "interface %s, version %u", registry, interface, version);
-
- if (g_strcmp0 (interface, "wl_compositor") == 0) {
- display->compositor =
- wl_registry_bind (registry, name, &wl_compositor_interface, 1);
- } else if (g_strcmp0 (interface, "wl_subcompositor") == 0) {
- display->subcompositor =
- wl_registry_bind (registry, name, &wl_subcompositor_interface, 1);
- } else if (g_strcmp0 (interface, "wl_shell") == 0) {
- display->shell = wl_registry_bind (registry, name, &wl_shell_interface, 1);
- }
-}
-
-static const struct wl_registry_listener registry_listener = {
- registry_handle_global
-};
-
-static void
-_connect_listeners (GstGLDisplayWayland * display)
-{
- display->registry = wl_display_get_registry (display->display);
- wl_registry_add_listener (display->registry, &registry_listener, display);
-
- wl_display_roundtrip (display->display);
-}
-
-static void
-gst_gl_display_wayland_class_init (GstGLDisplayWaylandClass * klass)
-{
- GST_GL_DISPLAY_CLASS (klass)->get_handle =
- GST_DEBUG_FUNCPTR (gst_gl_display_wayland_get_handle);
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_display_wayland_finalize;
-}
-
-static void
-gst_gl_display_wayland_init (GstGLDisplayWayland * display_wayland)
-{
- GstGLDisplay *display = (GstGLDisplay *) display_wayland;
-
- display->type = GST_GL_DISPLAY_TYPE_WAYLAND;
- display_wayland->foreign_display = FALSE;
-}
-
-static void
-gst_gl_display_wayland_finalize (GObject * object)
-{
- GstGLDisplayWayland *display_wayland = GST_GL_DISPLAY_WAYLAND (object);
-
- /* Cause eglTerminate() to occur before wl_display_disconnect()
- * https://bugzilla.gnome.org/show_bug.cgi?id=787293 */
- g_object_set_data (object, "gst.gl.display.egl", NULL);
-
- if (!display_wayland->foreign_display && display_wayland->display) {
- wl_display_flush (display_wayland->display);
- wl_display_disconnect (display_wayland->display);
- }
-
- G_OBJECT_CLASS (gst_gl_display_wayland_parent_class)->finalize (object);
-}
-
-/**
- * gst_gl_display_wayland_new:
- * @name: (allow-none): a display name
- *
- * Create a new #GstGLDisplayWayland from the wayland display name. See wl_display_connect()
- * for details on what is a valid name.
- *
- * Returns: (transfer full): a new #GstGLDisplayWayland or %NULL
- */
-GstGLDisplayWayland *
-gst_gl_display_wayland_new (const gchar * name)
-{
- GstGLDisplayWayland *ret;
-
- GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-
- ret = g_object_new (GST_TYPE_GL_DISPLAY_WAYLAND, NULL);
- gst_object_ref_sink (ret);
- ret->display = wl_display_connect (name);
-
- if (!ret->display) {
- if (name != NULL) {
- GST_ERROR ("Failed to open Wayland display connection with name \'%s\'",
- name);
- } else {
- GST_INFO ("Failed to open Wayland display connection.");
- }
- return NULL;
- }
-
- _connect_listeners (ret);
-
- return ret;
-}
-
-/**
- * gst_gl_display_wayland_new_with_display:
- * @display: an existing, wayland display
- *
- * Creates a new display connection from a wl_display Display.
- *
- * Returns: (transfer full): a new #GstGLDisplayWayland
- */
-GstGLDisplayWayland *
-gst_gl_display_wayland_new_with_display (struct wl_display * display)
-{
- GstGLDisplayWayland *ret;
-
- g_return_val_if_fail (display != NULL, NULL);
-
- GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-
- ret = g_object_new (GST_TYPE_GL_DISPLAY_WAYLAND, NULL);
- gst_object_ref_sink (ret);
-
- ret->display = display;
- ret->foreign_display = TRUE;
-
- _connect_listeners (ret);
-
- return ret;
-}
-
-static guintptr
-gst_gl_display_wayland_get_handle (GstGLDisplay * display)
-{
- return (guintptr) GST_GL_DISPLAY_WAYLAND (display)->display;
-}
diff --git a/gst-libs/gst/gl/wayland/gstgldisplay_wayland.h b/gst-libs/gst/gl/wayland/gstgldisplay_wayland.h
deleted file mode 100644
index ab1d42afa..000000000
--- a/gst-libs/gst/gl/wayland/gstgldisplay_wayland.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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_DISPLAY_WAYLAND_H__
-#define __GST_GL_DISPLAY_WAYLAND_H__
-
-#include <gst/gst.h>
-
-#include <wayland-client.h>
-
-#include <gst/gl/gstgl_fwd.h>
-#include <gst/gl/gstgldisplay.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT GType gst_gl_display_wayland_get_type (void);
-
-#define GST_TYPE_GL_DISPLAY_WAYLAND (gst_gl_display_wayland_get_type())
-#define GST_GL_DISPLAY_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_WAYLAND,GstGLDisplayWayland))
-#define GST_GL_DISPLAY_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_WAYLAND,GstGLDisplayWaylandClass))
-#define GST_IS_GL_DISPLAY_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_WAYLAND))
-#define GST_IS_GL_DISPLAY_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_WAYLAND))
-#define GST_GL_DISPLAY_WAYLAND_CAST(obj) ((GstGLDisplayWayland*)(obj))
-
-typedef struct _GstGLDisplayWayland GstGLDisplayWayland;
-typedef struct _GstGLDisplayWaylandClass GstGLDisplayWaylandClass;
-
-/**
- * GstGLDisplayWayland:
- *
- * the contents of a #GstGLDisplayWayland are private and should only be accessed
- * through the provided API
- */
-struct _GstGLDisplayWayland
-{
- GstGLDisplay parent;
-
- struct wl_display *display;
- struct wl_registry *registry;
- struct wl_compositor *compositor;
- struct wl_subcompositor *subcompositor;
- struct wl_shell *shell;
-
- /* <private> */
- gboolean foreign_display;
-
- gpointer _padding[GST_PADDING];
-};
-
-struct _GstGLDisplayWaylandClass
-{
- GstGLDisplayClass object_class;
-
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstGLDisplayWayland *gst_gl_display_wayland_new (const gchar * name);
-
-GST_EXPORT
-GstGLDisplayWayland *gst_gl_display_wayland_new_with_display (struct wl_display *display);
-
-G_END_DECLS
-
-#endif /* __GST_GL_DISPLAY_WAYLAND_H__ */
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
deleted file mode 100644
index 4c71bf51d..000000000
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
+++ /dev/null
@@ -1,583 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <linux/input.h>
-
-#include "wayland_event_source.h"
-
-#include "../gstgl_fwd.h"
-#include <gst/gl/gstglcontext.h>
-
-#include "gstgldisplay_wayland.h"
-#include "gstglwindow_wayland_egl.h"
-
-#include "../gstglwindow_private.h"
-
-const gchar *WlEGLErrorString ();
-
-#define GST_CAT_DEFAULT gst_gl_window_debug
-
-#define gst_gl_window_wayland_egl_parent_class parent_class
-G_DEFINE_TYPE (GstGLWindowWaylandEGL, gst_gl_window_wayland_egl,
- GST_TYPE_GL_WINDOW);
-
-static guintptr gst_gl_window_wayland_egl_get_window_handle (GstGLWindow *
- window);
-static void gst_gl_window_wayland_egl_set_window_handle (GstGLWindow * window,
- guintptr handle);
-static void gst_gl_window_wayland_egl_show (GstGLWindow * window);
-static void gst_gl_window_wayland_egl_draw (GstGLWindow * window);
-static void gst_gl_window_wayland_egl_close (GstGLWindow * window);
-static gboolean gst_gl_window_wayland_egl_open (GstGLWindow * window,
- GError ** error);
-static guintptr gst_gl_window_wayland_egl_get_display (GstGLWindow * window);
-static gboolean gst_gl_window_wayland_egl_set_render_rectangle (GstGLWindow *
- window, gint x, gint y, gint width, gint height);
-
-#if 0
-static void
-pointer_handle_enter (void *data, struct wl_pointer *pointer, uint32_t serial,
- struct wl_surface *surface, wl_fixed_t sx_w, wl_fixed_t sy_w)
-{
- GstGLWindowWaylandEGL *window_egl = data;
- struct wl_buffer *buffer;
- struct wl_cursor_image *image = NULL;
-
- window_egl->display.serial = serial;
-
- if (window_egl->display.default_cursor) {
- image = window_egl->display.default_cursor->images[0];
- buffer = wl_cursor_image_get_buffer (image);
- wl_pointer_set_cursor (pointer, serial,
- window_egl->display.cursor_surface, image->hotspot_x, image->hotspot_y);
- wl_surface_attach (window_egl->display.cursor_surface, buffer, 0, 0);
- wl_surface_damage (window_egl->display.cursor_surface, 0, 0,
- image->width, image->height);
- wl_surface_commit (window_egl->display.cursor_surface);
- }
-}
-
-static void
-pointer_handle_leave (void *data, struct wl_pointer *pointer, uint32_t serial,
- struct wl_surface *surface)
-{
- GstGLWindowWaylandEGL *window_egl = data;
- window_egl->display.serial = serial;
-}
-
-static void
-pointer_handle_motion (void *data, struct wl_pointer *pointer, uint32_t time,
- wl_fixed_t sx_w, wl_fixed_t sy_w)
-{
- GstGLWindowWaylandEGL *window_egl = data;
-
- window_egl->display.pointer_x = wl_fixed_to_double (sx_w);
- window_egl->display.pointer_y = wl_fixed_to_double (sy_w);
-}
-
-enum wl_edges
-{
- WL_EDGE_NONE = 0,
- WL_EDGE_TOP = 1,
- WL_EDGE_BOTTOM = 2,
- WL_EDGE_LEFT = 4,
- WL_EDGE_RIGHT = 8,
-};
-
-static guint
-_get_closest_pointer_corner (GstGLWindowWaylandEGL * window_egl)
-{
- guint edges = 0;
- gdouble win_width, win_height;
- gdouble p_x, p_y;
-
- win_width = (gdouble) window_egl->window.window_width;
- win_height = (gdouble) window_egl->window.window_height;
- p_x = window_egl->display.pointer_x;
- p_y = window_egl->display.pointer_y;
-
- if (win_width == 0.0 || win_height == 0.0)
- return WL_EDGE_NONE;
-
- edges |= win_width / 2.0 - p_x < 0.0 ? WL_EDGE_RIGHT : WL_EDGE_LEFT;
- edges |= win_height / 2.0 - p_y < 0.0 ? WL_EDGE_BOTTOM : WL_EDGE_TOP;
-
- return edges;
-}
-
-static void
-pointer_handle_button (void *data, struct wl_pointer *pointer, uint32_t serial,
- uint32_t time, uint32_t button, uint32_t state_w)
-{
- GstGLWindowWaylandEGL *window_egl = data;
- guint edges = _get_closest_pointer_corner (window_egl);
- window_egl->display.serial = serial;
-
- if (button == BTN_LEFT && state_w == WL_POINTER_BUTTON_STATE_PRESSED)
- wl_shell_surface_move (window_egl->window.shell_surface,
- window_egl->display.seat, serial);
-
- if (button == BTN_RIGHT && state_w == WL_POINTER_BUTTON_STATE_PRESSED)
- wl_shell_surface_resize (window_egl->window.shell_surface,
- window_egl->display.seat, serial, edges);
-}
-
-static void
-pointer_handle_axis (void *data, struct wl_pointer *pointer, uint32_t time,
- uint32_t axis, wl_fixed_t value)
-{
-}
-
-static const struct wl_pointer_listener pointer_listener = {
- pointer_handle_enter,
- pointer_handle_leave,
- pointer_handle_motion,
- pointer_handle_button,
- pointer_handle_axis,
-};
-
-static void
-seat_handle_capabilities (void *data, struct wl_seat *seat,
- enum wl_seat_capability caps)
-{
- GstGLWindowWaylandEGL *window_egl = data;
- struct display *display = &window_egl->display;
-
- if ((caps & WL_SEAT_CAPABILITY_POINTER) && !display->pointer) {
- display->pointer = wl_seat_get_pointer (seat);
- wl_pointer_set_user_data (display->pointer, window_egl);
- wl_pointer_add_listener (display->pointer, &pointer_listener, window_egl);
- } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && display->pointer) {
- wl_pointer_destroy (display->pointer);
- display->pointer = NULL;
- }
-#if 0
- if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) {
- input->keyboard = wl_seat_get_keyboard (seat);
- wl_keyboard_set_user_data (input->keyboard, input);
- wl_keyboard_add_listener (input->keyboard, &keyboard_listener, input);
- } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) {
- wl_keyboard_destroy (input->keyboard);
- input->keyboard = NULL;
- }
-#endif
-}
-
-static const struct wl_seat_listener seat_listener = {
- seat_handle_capabilities,
-};
-#endif
-static void
-handle_ping (void *data, struct wl_shell_surface *shell_surface,
- uint32_t serial)
-{
- GstGLWindowWaylandEGL *window_egl = data;
-
- GST_TRACE_OBJECT (window_egl, "ping received serial %u", serial);
-
- wl_shell_surface_pong (shell_surface, serial);
-}
-
-static void window_resize (GstGLWindowWaylandEGL * window_egl, guint width,
- guint height);
-
-static void
-handle_configure (void *data, struct wl_shell_surface *shell_surface,
- uint32_t edges, int32_t width, int32_t height)
-{
- GstGLWindowWaylandEGL *window_egl = data;
-
- GST_DEBUG ("configure event on surface %p, %ix%i", shell_surface, width,
- height);
-
- window_resize (window_egl, width, height);
-}
-
-static void
-handle_popup_done (void *data, struct wl_shell_surface *shell_surface)
-{
-}
-
-static const struct wl_shell_surface_listener shell_surface_listener = {
- handle_ping,
- handle_configure,
- handle_popup_done
-};
-
-static void
-destroy_surfaces (GstGLWindowWaylandEGL * window_egl)
-{
- if (window_egl->window.subsurface) {
- wl_subsurface_destroy (window_egl->window.subsurface);
- window_egl->window.subsurface = NULL;
- }
- if (window_egl->window.shell_surface) {
- wl_shell_surface_destroy (window_egl->window.shell_surface);
- window_egl->window.shell_surface = NULL;
- }
- if (window_egl->window.surface) {
- wl_surface_destroy (window_egl->window.surface);
- window_egl->window.surface = NULL;
- }
- if (window_egl->window.native) {
- wl_egl_window_destroy (window_egl->window.native);
- window_egl->window.native = NULL;
- }
-}
-
-static void
-create_surfaces (GstGLWindowWaylandEGL * window_egl)
-{
- GstGLDisplayWayland *display =
- GST_GL_DISPLAY_WAYLAND (GST_GL_WINDOW (window_egl)->display);
- gint width, height;
-
- if (!window_egl->window.surface) {
- window_egl->window.surface =
- wl_compositor_create_surface (display->compositor);
- if (window_egl->window.queue)
- wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.surface,
- window_egl->window.queue);
- }
-
- if (window_egl->window.foreign_surface) {
- /* (re)parent */
- if (!display->subcompositor) {
- GST_ERROR_OBJECT (window_egl,
- "Wayland server does not support subsurfaces");
- window_egl->window.foreign_surface = NULL;
- goto shell_window;
- }
-
- if (!window_egl->window.subsurface) {
- window_egl->window.subsurface =
- wl_subcompositor_get_subsurface (display->subcompositor,
- window_egl->window.surface, window_egl->window.foreign_surface);
- if (window_egl->window.queue)
- wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.subsurface,
- window_egl->window.queue);
-
- wl_subsurface_set_position (window_egl->window.subsurface,
- window_egl->window.window_x, window_egl->window.window_y);
- wl_subsurface_set_desync (window_egl->window.subsurface);
- }
- } else {
- shell_window:
- if (!window_egl->window.shell_surface) {
- window_egl->window.shell_surface =
- wl_shell_get_shell_surface (display->shell,
- window_egl->window.surface);
- if (window_egl->window.queue)
- wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.
- shell_surface, window_egl->window.queue);
-
- wl_shell_surface_add_listener (window_egl->window.shell_surface,
- &shell_surface_listener, window_egl);
-
- wl_shell_surface_set_title (window_egl->window.shell_surface,
- "OpenGL Renderer");
- wl_shell_surface_set_toplevel (window_egl->window.shell_surface);
- }
- }
-
- if (window_egl->window.window_width > 0)
- width = window_egl->window.window_width;
- else
- width = 320;
- window_egl->window.window_width = width;
-
- if (window_egl->window.window_height > 0)
- height = window_egl->window.window_height;
- else
- height = 240;
- window_egl->window.window_height = height;
-
- if (!window_egl->window.native) {
- gst_gl_window_resize (GST_GL_WINDOW (window_egl), width, height);
-
- window_egl->window.native =
- wl_egl_window_create (window_egl->window.surface, width, height);
- if (window_egl->window.queue)
- wl_proxy_set_queue ((struct wl_proxy *) window_egl->window.native,
- window_egl->window.queue);
- }
-}
-
-static void
-gst_gl_window_wayland_egl_class_init (GstGLWindowWaylandEGLClass * klass)
-{
- GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
-
- window_class->get_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_window_handle);
- window_class->set_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_set_window_handle);
- window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_show);
- window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_draw);
- window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_close);
- window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_open);
- window_class->get_display =
- GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_display);
- window_class->set_render_rectangle =
- GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_set_render_rectangle);
-}
-
-static void
-gst_gl_window_wayland_egl_init (GstGLWindowWaylandEGL * window)
-{
-}
-
-/* Must be called in the gl thread */
-GstGLWindowWaylandEGL *
-gst_gl_window_wayland_egl_new (GstGLDisplay * display)
-{
- GstGLWindowWaylandEGL *window;
-
- if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WAYLAND)
- == 0)
- /* we require a wayland display to create wayland surfaces */
- return NULL;
-
- GST_DEBUG ("creating Wayland EGL window");
-
- window = g_object_new (GST_TYPE_GL_WINDOW_WAYLAND_EGL, NULL);
- gst_object_ref_sink (window);
-
- return window;
-}
-
-static void
-gst_gl_window_wayland_egl_close (GstGLWindow * window)
-{
- GstGLWindowWaylandEGL *window_egl;
-
- window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);
-
- destroy_surfaces (window_egl);
-
- g_source_destroy (window_egl->wl_source);
- g_source_unref (window_egl->wl_source);
- window_egl->wl_source = NULL;
-
- GST_GL_WINDOW_CLASS (parent_class)->close (window);
-}
-
-static gboolean
-gst_gl_window_wayland_egl_open (GstGLWindow * window, GError ** error)
-{
- GstGLDisplayWayland *display;
- GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);
-
- if (!GST_IS_GL_DISPLAY_WAYLAND (window->display)) {
- g_set_error (error, GST_GL_WINDOW_ERROR,
- GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
- "Failed to retrieve Wayland display (wrong type?)");
- return FALSE;
- }
- display = GST_GL_DISPLAY_WAYLAND (window->display);
-
- if (!display->display) {
- g_set_error (error, GST_GL_WINDOW_ERROR,
- GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
- "Failed to retrieve Wayland display");
- return FALSE;
- }
-
- window_egl->window.queue = wl_display_create_queue (display->display);
-
- window_egl->wl_source = wayland_event_source_new (display->display,
- window_egl->window.queue);
-
- if (!GST_GL_WINDOW_CLASS (parent_class)->open (window, error))
- return FALSE;
-
- g_source_attach (window_egl->wl_source, window->main_context);
-
- return TRUE;
-}
-
-void
-gst_gl_window_wayland_egl_create_window (GstGLWindowWaylandEGL * window_egl)
-{
- create_surfaces (window_egl);
-}
-
-static guintptr
-gst_gl_window_wayland_egl_get_window_handle (GstGLWindow * window)
-{
- return (guintptr) GST_GL_WINDOW_WAYLAND_EGL (window)->window.native;
-}
-
-static void
-gst_gl_window_wayland_egl_set_window_handle (GstGLWindow * window,
- guintptr handle)
-{
- GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);
- struct wl_surface *surface = (struct wl_surface *) handle;
-
- /* already set the NULL handle */
- if (surface == NULL && window_egl->window.foreign_surface == NULL)
- return;
-
- /* unparent */
- destroy_surfaces (window_egl);
- window_egl->window.foreign_surface = surface;
- create_surfaces (window_egl);
-}
-
-static void
-gst_gl_window_wayland_egl_show (GstGLWindow * window)
-{
- GstGLDisplayWayland *display_wayland =
- GST_GL_DISPLAY_WAYLAND (window->display);
- GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);
-
- create_surfaces (window_egl);
-
- if (gst_gl_wl_display_roundtrip_queue (display_wayland->display,
- window_egl->window.queue) < 0)
- GST_WARNING_OBJECT (window, "failed a roundtrip");
-}
-
-static void
-window_resize (GstGLWindowWaylandEGL * window_egl, guint width, guint height)
-{
- GstGLWindow *window = GST_GL_WINDOW (window_egl);
-
- GST_DEBUG ("resizing window from %ux%u to %ux%u",
- window_egl->window.window_width, window_egl->window.window_height, width,
- height);
-
- if (window_egl->window.native) {
- wl_egl_window_resize (window_egl->window.native, width, height, 0, 0);
- }
-
- gst_gl_window_resize (window, width, height);
-
- window_egl->window.window_width = width;
- window_egl->window.window_height = height;
-}
-
-static void
-draw_cb (gpointer data)
-{
- GstGLWindowWaylandEGL *window_egl = data;
- GstGLWindow *window = GST_GL_WINDOW (window_egl);
- GstGLContext *context = gst_gl_window_get_context (window);
-
- create_surfaces (window_egl);
-
- if (window_egl->window.subsurface)
- wl_subsurface_set_desync (window_egl->window.subsurface);
-
- if (window->queue_resize) {
- guint width, height;
-
- gst_gl_window_get_surface_dimensions (window, &width, &height);
- gst_gl_window_resize (window, width, height);
- }
-
- if (window->draw)
- window->draw (window->draw_data);
-
- gst_gl_context_swap_buffers (context);
-
- if (window_egl->window.subsurface)
- wl_subsurface_set_desync (window_egl->window.subsurface);
-
- gst_object_unref (context);
-}
-
-static void
-gst_gl_window_wayland_egl_draw (GstGLWindow * window)
-{
- gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
-}
-
-struct SetRenderRectangle
-{
- GstGLWindowWaylandEGL *window_egl;
- GstVideoRectangle rect;
-};
-
-static void
-_free_set_render_rectangle (struct SetRenderRectangle *render)
-{
- if (render) {
- if (render->window_egl)
- gst_object_unref (render->window_egl);
- g_free (render);
- }
-}
-
-static void
-_set_render_rectangle (gpointer data)
-{
- struct SetRenderRectangle *render = data;
-
- GST_LOG_OBJECT (render->window_egl, "setting render rectangle %i,%i+%ix%i",
- render->rect.x, render->rect.y, render->rect.w, render->rect.h);
-
- if (render->window_egl->window.subsurface) {
- wl_subsurface_set_sync (render->window_egl->window.subsurface);
- wl_subsurface_set_position (render->window_egl->window.subsurface,
- render->rect.x, render->rect.y);
- render->window_egl->window.window_x = render->rect.x;
- render->window_egl->window.window_y = render->rect.y;
- }
-
- window_resize (render->window_egl, render->rect.w, render->rect.h);
-}
-
-static gboolean
-gst_gl_window_wayland_egl_set_render_rectangle (GstGLWindow * window,
- gint x, gint y, gint width, gint height)
-{
- GstGLWindowWaylandEGL *window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);
- struct SetRenderRectangle *render;
-
- render = g_new0 (struct SetRenderRectangle, 1);
- render->window_egl = gst_object_ref (window_egl);
- render->rect.x = x;
- render->rect.y = y;
- render->rect.w = width;
- render->rect.h = height;
-
- gst_gl_window_send_message_async (window,
- (GstGLWindowCB) _set_render_rectangle, render,
- (GDestroyNotify) _free_set_render_rectangle);
-
- return TRUE;
-}
-
-static guintptr
-gst_gl_window_wayland_egl_get_display (GstGLWindow * window)
-{
- GstGLDisplayWayland *display = GST_GL_DISPLAY_WAYLAND (window->display);
-
- return (guintptr) display->display;
-}
diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h
deleted file mode 100644
index 07c7ad1b9..000000000
--- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_WINDOW_WAYLAND_EGL_H__
-#define __GST_GL_WINDOW_WAYLAND_EGL_H__
-
-#include <wayland-client.h>
-#include <wayland-egl.h>
-#include <wayland-cursor.h>
-
-#include <gst/gl/gl.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_WINDOW_WAYLAND_EGL (gst_gl_window_wayland_egl_get_type())
-#define GST_GL_WINDOW_WAYLAND_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW_WAYLAND_EGL, GstGLWindowWaylandEGL))
-#define GST_GL_WINDOW_WAYLAND_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_WINDOW_WAYLAND_EGL, GstGLWindowWaylandEGLClass))
-#define GST_IS_GL_WINDOW_WAYLAND_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW_WAYLAND_EGL))
-#define GST_IS_GL_WINDOW_WAYLAND_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW_WAYLAND_EGL))
-#define GST_GL_WINDOW_WAYLAND_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW_WAYLAND_EGL, GstGLWindowWaylandEGL_Class))
-
-typedef struct _GstGLWindowWaylandEGL GstGLWindowWaylandEGL;
-typedef struct _GstGLWindowWaylandEGLClass GstGLWindowWaylandEGLClass;
-
-struct window;
-
-struct display {
- struct wl_display *display;
- struct wl_registry *registry;
- struct wl_compositor *compositor;
- struct wl_shell *shell;
- struct wl_seat *seat;
- struct wl_pointer *pointer;
- struct wl_keyboard *keyboard;
- struct wl_shm *shm;
- struct wl_cursor_theme *cursor_theme;
- struct wl_cursor *default_cursor;
- struct wl_surface *cursor_surface;
- struct window *window;
- guint32 serial;
-
- gdouble pointer_x;
- gdouble pointer_y;
-};
-
-struct window {
- struct display *display;
-
- struct wl_event_queue *queue;
- struct wl_surface *surface;
- struct wl_shell_surface *shell_surface;
- struct wl_egl_window *native;
- struct wl_surface *foreign_surface;
- struct wl_subsurface *subsurface;
- struct wl_callback *callback;
- int fullscreen, configured;
- int window_width, window_height;
- int window_x, window_y;
-};
-
-struct _GstGLWindowWaylandEGL {
- /*< private >*/
- GstGLWindow parent;
-
- struct display display;
- struct window window;
-
- GSource *wl_source;
-
- gpointer _reserved[GST_PADDING];
-};
-
-struct _GstGLWindowWaylandEGLClass {
- /*< private >*/
- GstGLWindowClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING];
-};
-
-G_GNUC_INTERNAL
-GType gst_gl_window_wayland_egl_get_type (void);
-
-G_GNUC_INTERNAL
-GstGLWindowWaylandEGL * gst_gl_window_wayland_egl_new (GstGLDisplay * display);
-
-G_GNUC_INTERNAL
-void gst_gl_window_wayland_egl_create_window (GstGLWindowWaylandEGL * window_egl);
-
-G_END_DECLS
-
-#endif /* __GST_GL_WINDOW_WAYLAND_EGL_H__ */
diff --git a/gst-libs/gst/gl/wayland/wayland_event_source.c b/gst-libs/gst/gl/wayland/wayland_event_source.c
deleted file mode 100644
index ffb1503d2..000000000
--- a/gst-libs/gst/gl/wayland/wayland_event_source.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2010 Intel Corporation.
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- *
- * Authors:
- * Matthew Allum
- * Robert Bragg
- * Kristian Høgsberg
- */
-
-/* code originally from clutter's wayland backend found here
- * http://git.gnome.org/browse/clutter/tree/clutter/wayland/clutter-event-wayland.c
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <wayland-client.h>
-
-#include "wayland_event_source.h"
-
-static void
-sync_callback (void *data, struct wl_callback *callback, uint32_t serial)
-{
- gboolean *done = data;
-
- *done = TRUE;
- wl_callback_destroy (callback);
-}
-
-static const struct wl_callback_listener sync_listener = {
- sync_callback
-};
-
-/* only thread safe iff called on the same thread @queue is being dispatched on */
-gint
-gst_gl_wl_display_roundtrip_queue (struct wl_display *display,
- struct wl_event_queue *queue)
-{
- struct wl_callback *callback;
- gboolean done = FALSE;
- gint ret = 0;
-
- if (queue) {
- /* creating a wl_proxy and setting the queue is racy with the dispatching
- * of the default queue */
- while (wl_display_prepare_read_queue (display, queue) != 0) {
- if ((ret = wl_display_dispatch_queue_pending (display, queue)) < 0)
- return ret;
- }
- }
- if (!(callback = wl_display_sync (display))) {
- return -1;
- }
- wl_callback_add_listener (callback, &sync_listener, &done);
- if (queue) {
- wl_proxy_set_queue ((struct wl_proxy *) callback, queue);
- wl_display_cancel_read (display);
- while (!done && ret >= 0)
- ret = wl_display_dispatch_queue (display, queue);
- } else {
- while (!done && ret >= 0)
- ret = wl_display_dispatch (display);
- }
-
- if (ret == -1 && !done)
- wl_callback_destroy (callback);
-
- return ret;
-}
-
-typedef struct _WaylandEventSource
-{
- GSource source;
- GPollFD pfd;
- uint32_t mask;
- struct wl_display *display;
- struct wl_event_queue *queue;
- gboolean reading;
-} WaylandEventSource;
-
-static gboolean
-wayland_event_source_prepare (GSource * base, gint * timeout)
-{
- WaylandEventSource *source = (WaylandEventSource *) base;
-
- *timeout = -1;
-
- /* we may be called multiple times for prepare */
- if (source->reading)
- wl_display_cancel_read (source->display);
-
- if (source->queue) {
- while (wl_display_prepare_read_queue (source->display, source->queue) != 0) {
- if (wl_display_dispatch_queue_pending (source->display,
- source->queue) < 0) {
- g_critical ("Failed to dispatch pending events\n");
- }
- }
- } else {
- while (wl_display_prepare_read (source->display) != 0) {
- if (wl_display_dispatch_pending (source->display) < 0) {
- g_critical ("Failed to dispatch pending events\n");
- }
- }
- }
- source->reading = TRUE;
-
- /* FIXME: this may return EAGAIN if the fd is full */
- if (wl_display_flush (source->display) < 0)
- g_critical ("Failed to flush Wayland connection\n");
-
- return FALSE;
-}
-
-static gboolean
-wayland_event_source_check (GSource * base)
-{
- WaylandEventSource *source = (WaylandEventSource *) base;
- gboolean retval;
-
- retval = source->pfd.revents;
-
- if (source->pfd.revents & G_IO_IN) {
- wl_display_read_events (source->display);
- } else {
- wl_display_cancel_read (source->display);
- }
- source->reading = FALSE;
-
- return retval;
-}
-
-static gboolean
-wayland_event_source_dispatch (GSource * base,
- GSourceFunc callback, gpointer data)
-{
- WaylandEventSource *source = (WaylandEventSource *) base;
-
- if (source->queue)
- wl_display_dispatch_queue_pending (source->display, source->queue);
- else
- wl_display_dispatch_pending (source->display);
- source->pfd.revents = 0;
-
- if (callback)
- callback (data);
-
- return TRUE;
-}
-
-static void
-wayland_event_source_finalize (GSource * base)
-{
- WaylandEventSource *source = (WaylandEventSource *) base;
-
- if (source->reading) {
- wl_display_cancel_read (source->display);
- }
- source->reading = FALSE;
-}
-
-static GSourceFuncs wayland_event_source_funcs = {
- wayland_event_source_prepare,
- wayland_event_source_check,
- wayland_event_source_dispatch,
- wayland_event_source_finalize
-};
-
-GSource *
-wayland_event_source_new (struct wl_display *display,
- struct wl_event_queue *queue)
-{
- WaylandEventSource *source;
-
- source = (WaylandEventSource *)
- g_source_new (&wayland_event_source_funcs, sizeof (WaylandEventSource));
- source->display = display;
- source->queue = queue;
- source->pfd.fd = wl_display_get_fd (display);
- source->pfd.events = G_IO_IN | G_IO_ERR;
- g_source_add_poll (&source->source, &source->pfd);
-
- return &source->source;
-}
diff --git a/gst-libs/gst/gl/wayland/wayland_event_source.h b/gst-libs/gst/gl/wayland/wayland_event_source.h
deleted file mode 100644
index fa20892be..000000000
--- a/gst-libs/gst/gl/wayland/wayland_event_source.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2011 Intel Corporation.
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- * Authors:
- * Robert Bragg <robert@linux.intel.com>
- */
-
-/* code originally from clutter's wayland backend found here
- * http://git.gnome.org/browse/clutter/tree/clutter/wayland/clutter-event-wayland.h
- */
-
-#ifndef __WAYLAND_EVENT_SOURCE_H__
-#define __WAYLAND_EVENT_SOURCE_H__
-
-#include <glib-object.h>
-//#include <clutter/clutter-event.h>
-
-#include <wayland-client.h>
-
-GSource * wayland_event_source_new (struct wl_display *display,
- struct wl_event_queue *queue);
-
-G_GNUC_INTERNAL gint gst_gl_wl_display_roundtrip_queue (struct wl_display *display,
- struct wl_event_queue *queue);
-
-#endif /* __WAYLAND_EVENT_SOURCE_H__ */
diff --git a/gst-libs/gst/gl/win32/Makefile.am b/gst-libs/gst/gl/win32/Makefile.am
deleted file mode 100644
index ed3cc6320..000000000
--- a/gst-libs/gst/gl/win32/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES = libgstgl-win32.la
-
-libgstgl_win32_la_SOURCES = \
- gstglwindow_win32.c \
- win32_message_source.c
-
-noinst_HEADERS = \
- gstglwindow_win32.h \
- win32_message_source.h
-
-if USE_WGL
-libgstgl_win32_la_SOURCES += gstglcontext_wgl.c
-noinst_HEADERS += gstglcontext_wgl.h
-endif
-
-libgstgl_win32_la_CFLAGS = \
- -DGST_EXPORTS \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GL_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-
-libgstgl_win32_la_LDFLAGS = \
- $(GST_LIB_LDFLAGS) \
- $(GST_ALL_LDFLAGS)
diff --git a/gst-libs/gst/gl/win32/gstglcontext_wgl.c b/gst-libs/gst/gl/win32/gstglcontext_wgl.c
deleted file mode 100644
index 47b576c0b..000000000
--- a/gst-libs/gst/gl/win32/gstglcontext_wgl.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include <gst/gl/gl.h>
-#include <gst/gl/gstglfuncs.h>
-
-#include "gstglcontext_wgl.h"
-#include <GL/wglext.h>
-
-#include "../utils/opengl_versions.h"
-#include "../gstglcontext_private.h"
-
-struct _GstGLContextWGLPrivate
-{
- PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
-
- GstGLAPI context_api;
-};
-
-#define GST_CAT_DEFAULT gst_gl_context_debug
-
-#define gst_gl_context_wgl_parent_class parent_class
-G_DEFINE_TYPE (GstGLContextWGL, gst_gl_context_wgl, GST_TYPE_GL_CONTEXT);
-#define GST_GL_CONTEXT_WGL_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT_WGL, GstGLContextWGLPrivate))
-
-static guintptr gst_gl_context_wgl_get_gl_context (GstGLContext * context);
-static void gst_gl_context_wgl_swap_buffers (GstGLContext * context);
-static gboolean gst_gl_context_wgl_choose_format (GstGLContext * context,
- GError ** error);
-static gboolean gst_gl_context_wgl_activate (GstGLContext * context,
- gboolean activate);
-static gboolean gst_gl_context_wgl_create_context (GstGLContext * context,
- GstGLAPI gl_api, GstGLContext * other_context, GError ** error);
-static void gst_gl_context_wgl_destroy_context (GstGLContext * context);
-GstGLAPI gst_gl_context_wgl_get_gl_api (GstGLContext * context);
-static GstGLPlatform gst_gl_context_wgl_get_gl_platform (GstGLContext *
- context);
-
-static void
-gst_gl_context_wgl_class_init (GstGLContextWGLClass * klass)
-{
- GstGLContextClass *context_class = (GstGLContextClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstGLContextWGLPrivate));
-
- context_class->get_gl_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_wgl_get_gl_context);
- context_class->choose_format =
- GST_DEBUG_FUNCPTR (gst_gl_context_wgl_choose_format);
- context_class->activate = GST_DEBUG_FUNCPTR (gst_gl_context_wgl_activate);
- context_class->create_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_wgl_create_context);
- context_class->destroy_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_wgl_destroy_context);
- context_class->swap_buffers =
- GST_DEBUG_FUNCPTR (gst_gl_context_wgl_swap_buffers);
-
- context_class->get_proc_address =
- GST_DEBUG_FUNCPTR (gst_gl_context_wgl_get_proc_address);
- context_class->get_gl_api = GST_DEBUG_FUNCPTR (gst_gl_context_wgl_get_gl_api);
- context_class->get_gl_platform =
- GST_DEBUG_FUNCPTR (gst_gl_context_wgl_get_gl_platform);
-}
-
-static void
-gst_gl_context_wgl_init (GstGLContextWGL * context_wgl)
-{
- context_wgl->priv = GST_GL_CONTEXT_WGL_GET_PRIVATE (context_wgl);
-
- context_wgl->priv->context_api = GST_GL_API_OPENGL | GST_GL_API_OPENGL3;
-}
-
-/* Must be called in the gl thread */
-GstGLContextWGL *
-gst_gl_context_wgl_new (GstGLDisplay * display)
-{
- GstGLContextWGL *context;
-
- if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WIN32) ==
- 0)
- /* we require an win32 display handle to create WGL contexts */
- return NULL;
-
- context = g_object_new (GST_TYPE_GL_CONTEXT_WGL, NULL);
- gst_object_ref_sink (context);
-
- return context;
-}
-
-static HGLRC
-_create_context_with_flags (GstGLContextWGL * context_wgl, HDC dpy,
- HGLRC share_context, gint major, gint minor, gint contextFlags,
- gint profileMask)
-{
- HGLRC ret;
-#define N_ATTRIBS 20
- gint attribs[N_ATTRIBS];
- gint n = 0;
-
- if (major) {
- attribs[n++] = WGL_CONTEXT_MAJOR_VERSION_ARB;
- attribs[n++] = major;
- }
- if (minor) {
- attribs[n++] = WGL_CONTEXT_MINOR_VERSION_ARB;
- attribs[n++] = minor;
- }
- if (contextFlags) {
- attribs[n++] = WGL_CONTEXT_FLAGS_ARB;
- attribs[n++] = contextFlags;
- }
- if (profileMask) {
- attribs[n++] = WGL_CONTEXT_PROFILE_MASK_ARB;
- attribs[n++] = profileMask;
- }
- attribs[n++] = 0;
-
- g_assert (n < N_ATTRIBS);
-#undef N_ATTRIBS
-
- ret =
- context_wgl->priv->wglCreateContextAttribsARB (dpy, share_context,
- attribs);
-
- return ret;
-}
-
-static gboolean
-gst_gl_context_wgl_create_context (GstGLContext * context,
- GstGLAPI gl_api, GstGLContext * other_context, GError ** error)
-{
- GstGLWindow *window;
- GstGLContextWGL *context_wgl;
- HGLRC external_gl_context = NULL;
- HGLRC trampoline;
- HDC device;
-
- context_wgl = GST_GL_CONTEXT_WGL (context);
- window = gst_gl_context_get_window (context);
- device = (HDC) gst_gl_window_get_display (window);
-
- if (other_context) {
- if (gst_gl_context_get_gl_platform (other_context) != GST_GL_PLATFORM_WGL) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
- "Cannot share context with a non-WGL context");
- goto failure;
- }
- external_gl_context = (HGLRC) gst_gl_context_get_gl_context (other_context);
- }
-
- trampoline = wglCreateContext (device);
- if (trampoline)
- GST_DEBUG ("gl context created: %" G_GUINTPTR_FORMAT,
- (guintptr) trampoline);
- else {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, "failed to create glcontext:0x%x",
- (unsigned int) GetLastError ());
- goto failure;
- }
- g_assert (trampoline);
-
- /* get extension functions */
- wglMakeCurrent (device, trampoline);
-
- context_wgl->priv->wglCreateContextAttribsARB =
- (PFNWGLCREATECONTEXTATTRIBSARBPROC)
- wglGetProcAddress ("wglCreateContextAttribsARB");
-
- wglMakeCurrent (device, 0);
- wglDeleteContext (trampoline);
- trampoline = NULL;
-
- if (context_wgl->priv->wglCreateContextAttribsARB != NULL
- && gl_api & GST_GL_API_OPENGL3) {
- gint i;
-
- for (i = 0; i < G_N_ELEMENTS (opengl_versions); i++) {
- gint profileMask = 0;
- gint contextFlags = 0;
-
- if ((opengl_versions[i].major > 3
- || (opengl_versions[i].major == 3
- && opengl_versions[i].minor >= 2))) {
- profileMask |= WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
- contextFlags |= WGL_CONTEXT_DEBUG_BIT_ARB;
- } else {
- break;
- }
-
- GST_DEBUG_OBJECT (context, "trying to create a GL %d.%d context",
- opengl_versions[i].major, opengl_versions[i].minor);
-
- context_wgl->wgl_context = _create_context_with_flags (context_wgl,
- device, external_gl_context, opengl_versions[i].major,
- opengl_versions[i].minor, contextFlags, profileMask);
-
- if (context_wgl->wgl_context) {
- context_wgl->priv->context_api = GST_GL_API_OPENGL3;
- break;
- }
- }
- }
-
- if (!context_wgl->wgl_context) {
-
- if (context_wgl->priv->wglCreateContextAttribsARB && external_gl_context) {
- context_wgl->wgl_context =
- context_wgl->priv->wglCreateContextAttribsARB (device,
- external_gl_context, 0);
- }
-
-
- if (!context_wgl->wgl_context) {
-
- context_wgl->wgl_context = wglCreateContext (device);
-
- if (!context_wgl->wgl_context) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
- "Failed to create WGL context 0x%x",
- (unsigned int) GetLastError ());
- goto failure;
- }
-
- if (external_gl_context) {
- if (!wglShareLists (external_gl_context, context_wgl->wgl_context)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
- "failed to share contexts through wglShareLists 0x%x",
- (unsigned int) GetLastError ());
- goto failure;
- }
- }
- }
-
- context_wgl->priv->context_api = GST_GL_API_OPENGL;
- }
-
- GST_LOG ("gl context id: %" G_GUINTPTR_FORMAT,
- (guintptr) context_wgl->wgl_context);
-
- gst_object_unref (window);
-
- return TRUE;
-
-failure:
- gst_object_unref (window);
-
- return FALSE;
-}
-
-static void
-gst_gl_context_wgl_destroy_context (GstGLContext * context)
-{
- GstGLContextWGL *context_wgl;
-
- context_wgl = GST_GL_CONTEXT_WGL (context);
-
- if (context_wgl->wgl_context)
- wglDeleteContext (context_wgl->wgl_context);
- context_wgl->wgl_context = NULL;
-}
-
-static gboolean
-gst_gl_context_wgl_choose_format (GstGLContext * context, GError ** error)
-{
- GstGLWindow *window;
- PIXELFORMATDESCRIPTOR pfd;
- gint pixelformat = 0;
- gboolean res = FALSE;
- HDC device;
-
- window = gst_gl_context_get_window (context);
- gst_gl_window_win32_create_window (GST_GL_WINDOW_WIN32 (window), error);
- device = (HDC) gst_gl_window_get_display (window);
- gst_object_unref (window);
-
- pfd.nSize = sizeof (PIXELFORMATDESCRIPTOR);
- pfd.nVersion = 1;
- pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
- pfd.iPixelType = PFD_TYPE_RGBA;
- pfd.cColorBits = 24;
- pfd.cRedBits = 8;
- pfd.cRedShift = 0;
- pfd.cGreenBits = 8;
- pfd.cGreenShift = 0;
- pfd.cBlueBits = 8;
- pfd.cBlueShift = 0;
- pfd.cAlphaBits = 0;
- pfd.cAlphaShift = 0;
- pfd.cAccumBits = 0;
- pfd.cAccumRedBits = 0;
- pfd.cAccumGreenBits = 0;
- pfd.cAccumBlueBits = 0;
- pfd.cAccumAlphaBits = 0;
- pfd.cDepthBits = 24;
- pfd.cStencilBits = 8;
- pfd.cAuxBuffers = 0;
- pfd.iLayerType = PFD_MAIN_PLANE;
- pfd.bReserved = 0;
- pfd.dwLayerMask = 0;
- pfd.dwVisibleMask = 0;
- pfd.dwDamageMask = 0;
-
- pfd.cColorBits = (BYTE) GetDeviceCaps (device, BITSPIXEL);
-
- pixelformat = ChoosePixelFormat (device, &pfd);
-
- if (!pixelformat) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "Failed to choose a pixel format");
- return FALSE;
- }
-
- res = SetPixelFormat (device, pixelformat, &pfd);
-
- return res;
-}
-
-static void
-gst_gl_context_wgl_swap_buffers (GstGLContext * context)
-{
- GstGLWindow *window = gst_gl_context_get_window (context);
- HDC device = (HDC) gst_gl_window_get_display (window);
-
- SwapBuffers (device);
-
- gst_object_unref (window);
-}
-
-static guintptr
-gst_gl_context_wgl_get_gl_context (GstGLContext * context)
-{
- return (guintptr) GST_GL_CONTEXT_WGL (context)->wgl_context;
-}
-
-static gboolean
-gst_gl_context_wgl_activate (GstGLContext * context, gboolean activate)
-{
- GstGLWindow *window;
- GstGLContextWGL *context_wgl;
- HDC device;
- gboolean result;
-
- window = gst_gl_context_get_window (context);
- context_wgl = GST_GL_CONTEXT_WGL (context);
- device = (HDC) gst_gl_window_get_display (window);
-
- if (activate) {
- result = wglMakeCurrent (device, context_wgl->wgl_context);
- } else {
- result = wglMakeCurrent (NULL, NULL);
- }
-
- gst_object_unref (window);
-
- return result;
-}
-
-GstGLAPI
-gst_gl_context_wgl_get_gl_api (GstGLContext * context)
-{
- GstGLContextWGL *context_wgl = GST_GL_CONTEXT_WGL (context);
-
- return context_wgl->priv->context_api;
-}
-
-static GstGLPlatform
-gst_gl_context_wgl_get_gl_platform (GstGLContext * context)
-{
- return GST_GL_PLATFORM_WGL;
-}
-
-gpointer
-gst_gl_context_wgl_get_proc_address (GstGLAPI gl_api, const gchar * name)
-{
- gpointer result;
-
- if (!(result = gst_gl_context_default_get_proc_address (gl_api, name))) {
- result = wglGetProcAddress ((LPCSTR) name);
- }
-
- return result;
-}
-
-guintptr
-gst_gl_context_wgl_get_current_context (void)
-{
- return (guintptr) wglGetCurrentContext ();
-}
diff --git a/gst-libs/gst/gl/win32/gstglcontext_wgl.h b/gst-libs/gst/gl/win32/gstglcontext_wgl.h
deleted file mode 100644
index f44db50d3..000000000
--- a/gst-libs/gst/gl/win32/gstglcontext_wgl.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_CONTEXT_WGL_H__
-#define __GST_GL_CONTEXT_WGL_H__
-
-#include "gstglwindow_win32.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_CONTEXT_WGL (gst_gl_context_wgl_get_type())
-#define GST_GL_CONTEXT_WGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_CONTEXT_WGL, GstGLContextWGL))
-#define GST_GL_CONTEXT_WGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_CONTEXT_WGL, GstGLContextWGLClass))
-#define GST_IS_GL_CONTEXT_WGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_CONTEXT_WGL))
-#define GST_IS_GL_CONTEXT_WGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_CONTEXT_WGL))
-#define GST_GL_CONTEXT_WGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_CONTEXT_WGL, GstGLContextWGLClass))
-
-typedef struct _GstGLContextWGL GstGLContextWGL;
-typedef struct _GstGLContextWGLClass GstGLContextWGLClass;
-typedef struct _GstGLContextWGLPrivate GstGLContextWGLPrivate;
-
-struct _GstGLContextWGL {
- /*< private >*/
- GstGLContext parent;
-
- HGLRC wgl_context;
- HGLRC external_gl_context;
-
- GstGLContextWGLPrivate *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-struct _GstGLContextWGLClass {
- /*< private >*/
- GstGLContextClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING];
-};
-
-GType gst_gl_context_wgl_get_type (void);
-
-GstGLContextWGL * gst_gl_context_wgl_new (GstGLDisplay * display);
-guintptr gst_gl_context_wgl_get_current_context (void);
-gpointer gst_gl_context_wgl_get_proc_address (GstGLAPI gl_api, const gchar * name);
-
-G_END_DECLS
-
-#endif /* __GST_GL_CONTEXT_WGL_H__ */
diff --git a/gst-libs/gst/gl/win32/gstglwindow_win32.c b/gst-libs/gst/gl/win32/gstglwindow_win32.c
deleted file mode 100644
index 324954e58..000000000
--- a/gst-libs/gst/gl/win32/gstglwindow_win32.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstglwindow_win32.h"
-#include "win32_message_source.h"
-
-LRESULT CALLBACK window_proc (HWND hWnd, UINT uMsg, WPARAM wParam,
- LPARAM lParam);
-LRESULT FAR PASCAL sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam,
- LPARAM lParam);
-
-#define GST_GL_WINDOW_WIN32_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_WINDOW_WIN32, GstGLWindowWin32Private))
-
-enum
-{
- PROP_0
-};
-
-struct _GstGLWindowWin32Private
-{
- gint preferred_width;
- gint preferred_height;
-};
-
-#define GST_CAT_DEFAULT gst_gl_window_win32_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-#define DEBUG_INIT \
- GST_DEBUG_CATEGORY_GET (GST_CAT_DEFAULT, "glwindow");
-#define gst_gl_window_win32_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstGLWindowWin32, gst_gl_window_win32,
- GST_TYPE_GL_WINDOW, DEBUG_INIT);
-
-static void gst_gl_window_win32_set_window_handle (GstGLWindow * window,
- guintptr handle);
-static guintptr gst_gl_window_win32_get_display (GstGLWindow * window);
-static void gst_gl_window_win32_set_preferred_size (GstGLWindow * window,
- gint width, gint height);
-static void gst_gl_window_win32_show (GstGLWindow * window);
-static void gst_gl_window_win32_draw (GstGLWindow * window);
-gboolean gst_gl_window_win32_open (GstGLWindow * window, GError ** error);
-void gst_gl_window_win32_close (GstGLWindow * window);
-static void release_parent_win_id (GstGLWindowWin32 * window_win32);
-
-static void
-gst_gl_window_win32_class_init (GstGLWindowWin32Class * klass)
-{
- GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstGLWindowWin32Private));
-
- window_class->set_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_win32_set_window_handle);
- window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_win32_draw);
- window_class->get_display =
- GST_DEBUG_FUNCPTR (gst_gl_window_win32_get_display);
- window_class->set_preferred_size =
- GST_DEBUG_FUNCPTR (gst_gl_window_win32_set_preferred_size);
- window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_win32_show);
- window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_win32_open);
- window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_win32_close);
-}
-
-static void
-gst_gl_window_win32_init (GstGLWindowWin32 * window)
-{
- window->priv = GST_GL_WINDOW_WIN32_GET_PRIVATE (window);
-}
-
-GstGLWindowWin32 *
-gst_gl_window_win32_new (GstGLDisplay * display)
-{
- GstGLWindowWin32 *window;
-
- if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_WIN32) ==
- 0)
- /* we require an win32 display to create win32 windows */
- return NULL;
-
- window = g_object_new (GST_TYPE_GL_WINDOW_WIN32, NULL);
- gst_object_ref_sink (window);
-
- return window;
-}
-
-static void
-msg_cb (GstGLWindowWin32 * window_win32, MSG * msg, gpointer user_data)
-{
- GST_TRACE ("handle message");
- TranslateMessage (msg);
- DispatchMessage (msg);
-}
-
-gboolean
-gst_gl_window_win32_open (GstGLWindow * window, GError ** error)
-{
- GstGLWindowWin32 *window_win32 = GST_GL_WINDOW_WIN32 (window);
-
- if (!GST_GL_WINDOW_CLASS (parent_class)->open (window, error))
- return FALSE;
-
- window_win32->msg_source = win32_message_source_new (window_win32);
- g_source_set_callback (window_win32->msg_source, (GSourceFunc) msg_cb,
- NULL, NULL);
- g_source_attach (window_win32->msg_source, window->main_context);
-
- return TRUE;
-}
-
-void
-gst_gl_window_win32_close (GstGLWindow * window)
-{
- GstGLWindowWin32 *window_win32 = GST_GL_WINDOW_WIN32 (window);
-
- release_parent_win_id (window_win32);
-
- if (window_win32->internal_win_id) {
- RemoveProp (window_win32->internal_win_id, "gl_window");
- ShowWindow (window_win32->internal_win_id, SW_HIDE);
- SetParent (window_win32->internal_win_id, NULL);
- if (!DestroyWindow (window_win32->internal_win_id))
- GST_WARNING ("failed to destroy window %" G_GUINTPTR_FORMAT
- ", 0x%x", (guintptr) window_win32->internal_win_id,
- (unsigned int) GetLastError ());
- }
-
- g_source_destroy (window_win32->msg_source);
- g_source_unref (window_win32->msg_source);
- window_win32->msg_source = NULL;
-
- GST_GL_WINDOW_CLASS (parent_class)->close (window);
-}
-
-static void
-set_parent_win_id (GstGLWindowWin32 * window_win32)
-{
- WNDPROC window_parent_proc;
- RECT rect;
-
- if (!window_win32->parent_win_id) {
- /* no parent so the internal window needs borders and system menu */
- SetWindowLongPtr (window_win32->internal_win_id, GWL_STYLE,
- WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW);
- SetParent (window_win32->internal_win_id, NULL);
- return;
- }
-
- window_parent_proc =
- (WNDPROC) GetWindowLongPtr (window_win32->parent_win_id, GWLP_WNDPROC);
-
- GST_DEBUG ("set parent %" G_GUINTPTR_FORMAT,
- (guintptr) window_win32->parent_win_id);
-
- SetProp (window_win32->parent_win_id, "gl_window_id",
- window_win32->internal_win_id);
- SetProp (window_win32->parent_win_id, "gl_window_parent_proc",
- (WNDPROC) window_parent_proc);
- SetWindowLongPtr (window_win32->parent_win_id, GWLP_WNDPROC,
- (LONG_PTR) sub_class_proc);
-
- SetWindowLongPtr (window_win32->internal_win_id, GWL_STYLE,
- WS_CHILD | WS_MAXIMIZE);
- SetParent (window_win32->internal_win_id, window_win32->parent_win_id);
-
- /* take changes into account: SWP_FRAMECHANGED */
- GetClientRect (window_win32->parent_win_id, &rect);
- SetWindowPos (window_win32->internal_win_id, HWND_TOP, rect.left, rect.top,
- rect.right, rect.bottom,
- SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
- SWP_FRAMECHANGED | SWP_NOACTIVATE);
- MoveWindow (window_win32->internal_win_id, rect.left, rect.top, rect.right,
- rect.bottom, FALSE);
-}
-
-static void
-release_parent_win_id (GstGLWindowWin32 * window_win32)
-{
- WNDPROC parent_proc;
-
- if (!window_win32->parent_win_id)
- return;
-
- parent_proc = GetProp (window_win32->parent_win_id, "gl_window_parent_proc");
- if (!parent_proc)
- return;
-
- GST_DEBUG ("release parent %" G_GUINTPTR_FORMAT,
- (guintptr) window_win32->parent_win_id);
-
- SetWindowLongPtr (window_win32->parent_win_id, GWLP_WNDPROC,
- (LONG_PTR) parent_proc);
-
- RemoveProp (window_win32->parent_win_id, "gl_window_parent_proc");
-}
-
-gboolean
-gst_gl_window_win32_create_window (GstGLWindowWin32 * window_win32,
- GError ** error)
-{
-// GstGLWindowWin32 *window_win32 = GST_GL_WINDOW_WIN32 (window);
- WNDCLASSEX wc;
- ATOM atom = 0;
- HINSTANCE hinstance = GetModuleHandle (NULL);
-
- static gint x = 0;
- static gint y = 0;
-
- GST_LOG ("Attempting to create a win32 window");
-
- x += 20;
- y += 20;
-
- atom = GetClassInfoEx (hinstance, "GSTGL", &wc);
-
- if (atom == 0) {
- ZeroMemory (&wc, sizeof (WNDCLASSEX));
-
- wc.cbSize = sizeof (WNDCLASSEX);
- wc.lpfnWndProc = window_proc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hinstance;
- wc.hIcon = LoadIcon (NULL, IDI_WINLOGO);
- wc.hIconSm = NULL;
- wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
- wc.hCursor = LoadCursor (NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = "GSTGL";
-
- atom = RegisterClassEx (&wc);
-
- if (atom == 0) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "Failed to register window class 0x%x\n",
- (unsigned int) GetLastError ());
- goto failure;
- }
- }
-
- window_win32->internal_win_id = 0;
- window_win32->device = 0;
- window_win32->visible = FALSE;
-
- window_win32->internal_win_id = CreateWindowEx (0,
- "GSTGL",
- "OpenGL renderer",
- WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW,
- x, y, 0, 0, (HWND) NULL, (HMENU) NULL, hinstance, window_win32);
-
- if (!window_win32->internal_win_id) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "failed to create gl window");
- goto failure;
- }
-
- GST_DEBUG ("gl window created: %" G_GUINTPTR_FORMAT,
- (guintptr) window_win32->internal_win_id);
-
- //device is set in the window_proc
- if (!window_win32->device) {
- g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
- "failed to create device");
- goto failure;
- }
-
- ShowCursor (TRUE);
-
- GST_LOG ("Created a win32 window");
-
- /* The window has been created as if it had no parent, so there is nothing
- * else to do in that case. Even if user has already set a window,
- * parent_win_id could still be 0 at this point, and in that case calling
- * set_parent_win_id() here would steal focus from the parent window. */
- if (window_win32->parent_win_id)
- set_parent_win_id (window_win32);
-
- return TRUE;
-
-failure:
- return FALSE;
-}
-
-static guintptr
-gst_gl_window_win32_get_display (GstGLWindow * window)
-{
- GstGLWindowWin32 *window_win32;
-
- window_win32 = GST_GL_WINDOW_WIN32 (window);
-
- return (guintptr) window_win32->device;
-}
-
-static void
-gst_gl_window_win32_set_window_handle (GstGLWindow * window, guintptr id)
-{
- GstGLWindowWin32 *window_win32;
-
- window_win32 = GST_GL_WINDOW_WIN32 (window);
-
- if (!window_win32->internal_win_id) {
- window_win32->parent_win_id = (HWND) id;
- return;
- }
-
- if (window_win32->visible) {
- ShowWindow (window_win32->internal_win_id, SW_HIDE);
- window_win32->visible = FALSE;
- }
-
- release_parent_win_id (window_win32);
- window_win32->parent_win_id = (HWND) id;
- set_parent_win_id (window_win32);
-}
-
-static void
-gst_gl_window_win32_show (GstGLWindow * window)
-{
- GstGLWindowWin32 *window_win32 = GST_GL_WINDOW_WIN32 (window);
- gint width = window_win32->priv->preferred_width;
- gint height = window_win32->priv->preferred_height;
-
- if (!window_win32->visible) {
- HWND parent_id = window_win32->parent_win_id;
-
- /* if no parent the real size has to be set now because this has not been done
- * when at window creation */
- if (!parent_id) {
- RECT rect;
- GetClientRect (window_win32->internal_win_id, &rect);
- width += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
- height +=
- 2 * GetSystemMetrics (SM_CYSIZEFRAME) +
- GetSystemMetrics (SM_CYCAPTION);
- MoveWindow (window_win32->internal_win_id, rect.left, rect.top, width,
- height, FALSE);
- }
-
- ShowWindowAsync (window_win32->internal_win_id, SW_SHOW);
- window_win32->visible = TRUE;
- }
-}
-
-static void
-gst_gl_window_win32_set_preferred_size (GstGLWindow * window, gint width,
- gint height)
-{
- GstGLWindowWin32 *window_win32 = GST_GL_WINDOW_WIN32 (window);
-
- window_win32->priv->preferred_width = width;
- window_win32->priv->preferred_height = height;
-}
-
-/* Thread safe */
-static void
-gst_gl_window_win32_draw (GstGLWindow * window)
-{
- GstGLWindowWin32 *window_win32 = GST_GL_WINDOW_WIN32 (window);
-
- RedrawWindow (window_win32->internal_win_id, NULL, NULL,
- RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE);
-}
-
-/* PRIVATE */
-
-LRESULT CALLBACK
-window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- GstGLWindowWin32 *window_win32;
- LRESULT ret = 0;
-
- if (uMsg == WM_CREATE) {
- window_win32 =
- GST_GL_WINDOW_WIN32 (((LPCREATESTRUCT) lParam)->lpCreateParams);
-
- GST_TRACE ("WM_CREATE");
-
- window_win32->device = GetDC (hWnd);
- /* Do this, otherwise we hang on exit. We can still use it (due to the
- * CS_OWNDC flag in the WindowClass) after we have Released.
- */
- ReleaseDC (hWnd, window_win32->device);
-
- SetProp (hWnd, "gl_window", window_win32);
- } else if (GetProp (hWnd, "gl_window")) {
- GstGLWindow *window;
- GstGLContext *context;
-
- window_win32 = GST_GL_WINDOW_WIN32 (GetProp (hWnd, "gl_window"));
- window = GST_GL_WINDOW (window_win32);
- context = gst_gl_window_get_context (window);
-
- g_assert (window_win32->internal_win_id == hWnd);
-
- switch (uMsg) {
- case WM_SIZE:
- gst_gl_window_resize (window, LOWORD (lParam), HIWORD (lParam));
- break;
- case WM_PAINT:
- {
- if (window->queue_resize) {
- guint width, height;
-
- gst_gl_window_get_surface_dimensions (window, &width, &height);
- gst_gl_window_resize (window, width, height);
- }
- if (window->draw) {
- PAINTSTRUCT ps;
- BeginPaint (hWnd, &ps);
- window->draw (window->draw_data);
- gst_gl_context_swap_buffers (context);
- EndPaint (hWnd, &ps);
- }
- break;
- }
- case WM_CLOSE:
- {
- ShowWindowAsync (window_win32->internal_win_id, SW_HIDE);
-
- GST_TRACE ("WM_CLOSE");
-
- if (window->close)
- window->close (window->close_data);
- break;
- }
- case WM_CAPTURECHANGED:
- {
- GST_DEBUG ("WM_CAPTURECHANGED");
- if (window->queue_resize) {
- guint width, height;
-
- gst_gl_window_get_surface_dimensions (window, &width, &height);
- gst_gl_window_resize (window, width, height);
- }
- if (window->draw)
- window->draw (window->draw_data);
- break;
- }
- case WM_ERASEBKGND:
- {
- ret = TRUE;
- break;
- }
- default:
- {
- /* transmit messages to the parrent (ex: mouse/keyboard input) */
- HWND parent_id = window_win32->parent_win_id;
- if (parent_id)
- PostMessage (parent_id, uMsg, wParam, lParam);
- ret = DefWindowProc (hWnd, uMsg, wParam, lParam);
- }
- }
-
- gst_object_unref (context);
- } else {
- ret = DefWindowProc (hWnd, uMsg, wParam, lParam);
- }
-
- return ret;
-}
-
-LRESULT FAR PASCAL
-sub_class_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- WNDPROC window_parent_proc = GetProp (hWnd, "gl_window_parent_proc");
-
- if (uMsg == WM_SIZE) {
- HWND gl_window_id = GetProp (hWnd, "gl_window_id");
- MoveWindow (gl_window_id, 0, 0, LOWORD (lParam), HIWORD (lParam), FALSE);
- }
-
- return CallWindowProc (window_parent_proc, hWnd, uMsg, wParam, lParam);
-}
diff --git a/gst-libs/gst/gl/win32/gstglwindow_win32.h b/gst-libs/gst/gl/win32/gstglwindow_win32.h
deleted file mode 100644
index 8a6ca6824..000000000
--- a/gst-libs/gst/gl/win32/gstglwindow_win32.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_WINDOW_WIN32_H__
-#define __GST_GL_WINDOW_WIN32_H__
-
-#include <gst/gl/gl.h>
-
-#undef UNICODE
-#include <windows.h>
-#define UNICODE
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_WINDOW_WIN32 (gst_gl_window_win32_get_type())
-#define GST_GL_WINDOW_WIN32(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW_WIN32, GstGLWindowWin32))
-#define GST_GL_WINDOW_WIN32_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_WINDOW_WIN32, GstGLWindowWin32Class))
-#define GST_IS_GL_WINDOW_WIN32(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW_WIN32))
-#define GST_IS_GL_WINDOW_WIN32_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW_WIN32))
-#define GST_GL_WINDOW_WIN32_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW_WIN32, GstGLWindowWin32Class))
-
-typedef struct _GstGLWindowWin32 GstGLWindowWin32;
-typedef struct _GstGLWindowWin32Private GstGLWindowWin32Private;
-typedef struct _GstGLWindowWin32Class GstGLWindowWin32Class;
-
-struct _GstGLWindowWin32 {
- /*< private >*/
- GstGLWindow parent;
-
- HWND internal_win_id;
- HWND parent_win_id;
- HDC device;
- gboolean is_closed;
- gboolean visible;
-
- GSource *msg_source;
-
- /*< private >*/
- GstGLWindowWin32Private *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-struct _GstGLWindowWin32Class {
- /*< private >*/
- GstGLWindowClass parent_class;
-
- gboolean (*choose_format) (GstGLWindowWin32 *window);
- gboolean (*create_context) (GstGLWindowWin32 *window, GstGLAPI gl_api,
- guintptr external_gl_context, GError ** error);
- gboolean (*share_context) (GstGLWindowWin32 *window, guintptr external_gl_context);
- void (*swap_buffers) (GstGLWindowWin32 *window);
- gboolean (*activate) (GstGLWindowWin32 *window, gboolean activate);
- void (*destroy_context) (GstGLWindowWin32 *window);
- guintptr (*get_gl_context) (GstGLWindowWin32 *window);
-
- /*< private >*/
- gpointer _reserved[GST_PADDING_LARGE];
-};
-
-GType gst_gl_window_win32_get_type (void);
-
-GstGLWindowWin32 * gst_gl_window_win32_new (GstGLDisplay * display);
-
-gboolean gst_gl_window_win32_create_window (GstGLWindowWin32 * window_win32, GError ** error);
-
-G_END_DECLS
-
-#endif /* __GST_GL_WINDOW_WIN32_H__ */
diff --git a/gst-libs/gst/gl/win32/win32_message_source.c b/gst-libs/gst/gl/win32/win32_message_source.c
deleted file mode 100644
index fd785f827..000000000
--- a/gst-libs/gst/gl/win32/win32_message_source.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
- * Copyright (C) 2015 Collabora ltd.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "win32_message_source.h"
-
-typedef struct _Win32MessageSource
-{
- GSource source;
- GPollFD pfd;
- GstGLWindowWin32 *window;
-} Win32MessageSource;
-
-static gboolean
-win32_message_source_check (GSource * base)
-{
- MSG msg;
-
- return PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
-}
-
-static gboolean
-win32_message_source_dispatch (GSource * base, GSourceFunc callback,
- gpointer user_data)
-{
- Win32MessageSource *source = (Win32MessageSource *) base;
- Win32MessageSourceFunc func = (Win32MessageSourceFunc) callback;
- MSG msg;
-
- if (!PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
- return G_SOURCE_CONTINUE;
-
- if (func)
- func (source->window, &msg, user_data);
-
- return G_SOURCE_CONTINUE;
-}
-
-static GSourceFuncs win32_message_source_funcs = {
- NULL,
- win32_message_source_check,
- win32_message_source_dispatch,
- NULL
-};
-
-GSource *
-win32_message_source_new (GstGLWindowWin32 * window_win32)
-{
- Win32MessageSource *source;
-
- source = (Win32MessageSource *)
- g_source_new (&win32_message_source_funcs, sizeof (Win32MessageSource));
- source->window = window_win32;
- source->pfd.fd = G_WIN32_MSG_HANDLE;
- source->pfd.events = G_IO_IN;
- g_source_add_poll (&source->source, &source->pfd);
-
- return &source->source;
-}
diff --git a/gst-libs/gst/gl/win32/win32_message_source.h b/gst-libs/gst/gl/win32/win32_message_source.h
deleted file mode 100644
index eef3eac4d..000000000
--- a/gst-libs/gst/gl/win32/win32_message_source.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
- * Copyright (C) 2015 Collabora ltd.
- *
- * 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 __WIN32_MESSAGE_SOURCE_H__
-#define __WIN32_MESSAGE_SOURCE_H__
-
-#include <glib-object.h>
-#include "gstglwindow_win32.h"
-
-typedef void (*Win32MessageSourceFunc) (GstGLWindowWin32 *window_win32,
- MSG *msg, gpointer user_data);
-
-GSource *
-win32_message_source_new (GstGLWindowWin32 *window_win32);
-
-#endif /* __WIN32_MESSAGE_SOURCE_H__ */
diff --git a/gst-libs/gst/gl/x11/Makefile.am b/gst-libs/gst/gl/x11/Makefile.am
deleted file mode 100644
index d47d16f6d..000000000
--- a/gst-libs/gst/gl/x11/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_LTLIBRARIES = libgstgl-x11.la
-
-libgstgl_x11_la_SOURCES = \
- gstgldisplay_x11.c \
- gstglwindow_x11.c \
- xcb_event_source.c
-
-noinst_HEADERS = \
- gstglwindow_x11.h \
- xcb_event_source.h
-
-libgstgl_x11includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/x11
-libgstgl_x11include_HEADERS = \
- gstgldisplay_x11.h
-
-if USE_GLX
-libgstgl_x11_la_SOURCES += gstglcontext_glx.c
-noinst_HEADERS += gstglcontext_glx.h
-endif
-
-libgstgl_x11_la_CFLAGS = \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GL_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-
-libgstgl_x11_la_LDFLAGS = \
- $(GST_LIB_LDFLAGS) \
- $(GST_ALL_LDFLAGS)
diff --git a/gst-libs/gst/gl/x11/gstglcontext_glx.c b/gst-libs/gst/gl/x11/gstglcontext_glx.c
deleted file mode 100644
index 877e5c6d8..000000000
--- a/gst-libs/gst/gl/x11/gstglcontext_glx.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* FIXME: Sharing contexts requires the Display to be the same.
- * May need to box it
- */
-
-#include <gst/gst.h>
-
-#include "../gstgl_fwd.h"
-#include <gst/gl/gstglcontext.h>
-
-#include <gst/gl/gl.h>
-#include "gstglcontext_glx.h"
-#include "../utils/opengl_versions.h"
-#include "../gstglcontext_private.h"
-
-#define GST_CAT_DEFAULT gst_gl_context_debug
-
-#define gst_gl_context_glx_parent_class parent_class
-G_DEFINE_TYPE (GstGLContextGLX, gst_gl_context_glx, GST_TYPE_GL_CONTEXT);
-
-#define GST_GL_CONTEXT_GLX_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_CONTEXT_GLX, GstGLContextGLXPrivate))
-
-static guintptr gst_gl_context_glx_get_gl_context (GstGLContext * context);
-static void gst_gl_context_glx_swap_buffers (GstGLContext * context);
-static gboolean gst_gl_context_glx_activate (GstGLContext * context,
- gboolean activate);
-static gboolean gst_gl_context_glx_create_context (GstGLContext *
- context, GstGLAPI gl_api, GstGLContext * other_context, GError ** error);
-static void gst_gl_context_glx_destroy_context (GstGLContext * context);
-static gboolean gst_gl_context_glx_choose_format (GstGLContext *
- context, GError ** error);
-static GstGLAPI gst_gl_context_glx_get_gl_api (GstGLContext * context);
-static GstGLPlatform gst_gl_context_glx_get_gl_platform (GstGLContext *
- context);
-static void gst_gl_context_glx_get_gl_platform_version (GstGLContext * context,
- gint * major, gint * minor);
-
-struct _GstGLContextGLXPrivate
-{
- int glx_major;
- int glx_minor;
-
- GstGLAPI context_api;
-
- GLXFBConfig *fbconfigs;
- GLXContext (*glXCreateContextAttribsARB) (Display *, GLXFBConfig,
- GLXContext, Bool, const int *);
-};
-
-static void
-gst_gl_context_glx_class_init (GstGLContextGLXClass * klass)
-{
- GstGLContextClass *context_class = (GstGLContextClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstGLContextGLXPrivate));
-
- context_class->get_gl_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_gl_context);
- context_class->activate = GST_DEBUG_FUNCPTR (gst_gl_context_glx_activate);
- context_class->create_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_glx_create_context);
- context_class->destroy_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_glx_destroy_context);
- context_class->choose_format =
- GST_DEBUG_FUNCPTR (gst_gl_context_glx_choose_format);
- context_class->swap_buffers =
- GST_DEBUG_FUNCPTR (gst_gl_context_glx_swap_buffers);
-
- context_class->get_gl_api = GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_gl_api);
- context_class->get_gl_platform =
- GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_gl_platform);
- context_class->get_proc_address =
- GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_proc_address);
- context_class->get_current_context =
- GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_current_context);
- context_class->get_gl_platform_version =
- GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_gl_platform_version);
-}
-
-static void
-gst_gl_context_glx_init (GstGLContextGLX * context)
-{
- context->priv = GST_GL_CONTEXT_GLX_GET_PRIVATE (context);
-}
-
-GstGLContextGLX *
-gst_gl_context_glx_new (GstGLDisplay * display)
-{
- GstGLContextGLX *context;
-
- if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_X11) == 0)
- /* we require an x11 display handle to create GLX contexts */
- return NULL;
-
- context = g_object_new (GST_TYPE_GL_CONTEXT_GLX, NULL);
- gst_object_ref_sink (context);
-
- return context;
-}
-
-static inline void
-_describe_fbconfig (Display * display, GLXFBConfig config)
-{
- int val;
-
- glXGetFBConfigAttrib (display, config, GLX_FBCONFIG_ID, &val);
- GST_DEBUG ("ID: %d", val);
- glXGetFBConfigAttrib (display, config, GLX_DOUBLEBUFFER, &val);
- GST_DEBUG ("double buffering: %d", val);
- glXGetFBConfigAttrib (display, config, GLX_RED_SIZE, &val);
- GST_DEBUG ("red: %d", val);
- glXGetFBConfigAttrib (display, config, GLX_GREEN_SIZE, &val);
- GST_DEBUG ("green: %d", val);
- glXGetFBConfigAttrib (display, config, GLX_BLUE_SIZE, &val);
- GST_DEBUG ("blue: %d", val);
- glXGetFBConfigAttrib (display, config, GLX_ALPHA_SIZE, &val);
- GST_DEBUG ("alpha: %d", val);
- glXGetFBConfigAttrib (display, config, GLX_DEPTH_SIZE, &val);
- GST_DEBUG ("depth: %d", val);
- glXGetFBConfigAttrib (display, config, GLX_STENCIL_SIZE, &val);
- GST_DEBUG ("stencil: %d", val);
-}
-
-static GLXContext
-_create_context_with_flags (GstGLContextGLX * context_glx, Display * dpy,
- GLXFBConfig fbconfig, GLXContext share_context, gint major, gint minor,
- gint contextFlags, gint profileMask)
-{
- GLXContext ret;
-#define N_ATTRIBS 20
- gint attribs[N_ATTRIBS];
- int x_error = 0;
- gint n = 0;
-
- if (major) {
- attribs[n++] = GLX_CONTEXT_MAJOR_VERSION_ARB;
- attribs[n++] = major;
- }
- if (minor) {
- attribs[n++] = GLX_CONTEXT_MINOR_VERSION_ARB;
- attribs[n++] = minor;
- }
- if (contextFlags) {
- attribs[n++] = GLX_CONTEXT_FLAGS_ARB;
- attribs[n++] = contextFlags;
- }
-#ifdef GLX_ARB_create_context_profile
- if (profileMask) {
- attribs[n++] = GLX_CONTEXT_PROFILE_MASK_ARB;
- attribs[n++] = profileMask;
- }
-#endif
- attribs[n++] = None;
-
- g_assert (n < N_ATTRIBS);
-#undef N_ATTRIBS
-
- gst_gl_window_x11_trap_x_errors ();
- ret = context_glx->priv->glXCreateContextAttribsARB (dpy, fbconfig,
- share_context, True, attribs);
- x_error = gst_gl_window_x11_untrap_x_errors ();
-
- if (x_error)
- ret = 0;
-
- return ret;
-}
-
-static gboolean
-gst_gl_context_glx_create_context (GstGLContext * context,
- GstGLAPI gl_api, GstGLContext * other_context, GError ** error)
-{
- GstGLContextGLX *context_glx;
- GstGLWindow *window;
- GstGLWindowX11 *window_x11;
- GstGLDisplay *display = NULL;
- gboolean create_context;
- const char *glx_exts;
- Display *device;
- guintptr external_gl_context = 0;
-
- context_glx = GST_GL_CONTEXT_GLX (context);
- window = gst_gl_context_get_window (context);
-
- if (!GST_IS_GL_WINDOW_X11 (window)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
- "Cannot create an GLX context from a non-X11 window");
- goto failure;
- }
-
- window_x11 = GST_GL_WINDOW_X11 (window);
- display = gst_gl_context_get_display (context);
-
- if (other_context) {
- if (gst_gl_context_get_gl_platform (other_context) != GST_GL_PLATFORM_GLX) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
- "Cannot share context with non-GLX context");
- goto failure;
- }
-
- external_gl_context = gst_gl_context_get_gl_context (other_context);
- }
-
- device = (Display *) gst_gl_display_get_handle (display);
- if (!device) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, "Invalid Display handle");
- goto failure;
- }
-
- glx_exts = glXQueryExtensionsString (device, DefaultScreen (device));
-
- create_context = gst_gl_check_extension ("GLX_ARB_create_context", glx_exts);
- context_glx->priv->glXCreateContextAttribsARB =
- (gpointer) glXGetProcAddressARB ((const GLubyte *)
- "glXCreateContextAttribsARB");
-
- if (!context_glx->glx_context && gl_api & GST_GL_API_OPENGL3 && create_context
- && context_glx->priv->glXCreateContextAttribsARB) {
- gint i;
-
- for (i = 0; i < G_N_ELEMENTS (opengl_versions); i++) {
- gint profileMask = 0;
- gint contextFlags = 0;
-
- if ((opengl_versions[i].major > 3
- || (opengl_versions[i].major == 3
- && opengl_versions[i].minor >= 2))) {
- profileMask |= GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
- contextFlags |= GLX_CONTEXT_DEBUG_BIT_ARB;
- } else {
- break;
- }
-
- GST_DEBUG_OBJECT (context, "trying to create a GL %d.%d context",
- opengl_versions[i].major, opengl_versions[i].minor);
-
- context_glx->glx_context = _create_context_with_flags (context_glx,
- device, context_glx->priv->fbconfigs[0],
- (GLXContext) external_gl_context, opengl_versions[i].major,
- opengl_versions[i].minor, contextFlags, profileMask);
-
- if (context_glx->glx_context) {
- context_glx->priv->context_api = GST_GL_API_OPENGL3;
- break;
- }
- }
- }
- if (!context_glx->glx_context && gl_api & GST_GL_API_OPENGL) {
- context_glx->glx_context =
- glXCreateContext (device, window_x11->visual_info,
- (GLXContext) external_gl_context, TRUE);
- context_glx->priv->context_api = GST_GL_API_OPENGL;
- }
-
- if (context_glx->priv->fbconfigs)
- XFree (context_glx->priv->fbconfigs);
-
- if (!context_glx->glx_context) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, "Failed to create opengl context");
- goto failure;
- }
-
- GST_LOG ("gl context id: %ld", (gulong) context_glx->glx_context);
-
- gst_object_unref (window);
- gst_object_unref (display);
-
- return TRUE;
-
-failure:
- if (window)
- gst_object_unref (window);
- if (display)
- gst_object_unref (display);
-
- return FALSE;
-}
-
-static void
-gst_gl_context_glx_destroy_context (GstGLContext * context)
-{
- GstGLWindow *window;
- GstGLContextGLX *context_glx;
- Display *device;
-
- context_glx = GST_GL_CONTEXT_GLX (context);
- window = gst_gl_context_get_window (context);
- device = (Display *) gst_gl_display_get_handle (window->display);
-
- glXDestroyContext (device, context_glx->glx_context);
-
- context_glx->glx_context = 0;
-
- gst_object_unref (window);
-}
-
-static gboolean
-gst_gl_context_glx_choose_format (GstGLContext * context, GError ** error)
-{
- GstGLContextGLX *context_glx;
- GstGLWindow *window;
- GstGLWindowX11 *window_x11;
- gint error_base;
- gint event_base;
- Display *device;
-
- context_glx = GST_GL_CONTEXT_GLX (context);
- window = gst_gl_context_get_window (context);
-
- if (!GST_IS_GL_WINDOW_X11 (window)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
- "Cannot create an GLX context from a non-X11 window");
- goto failure;
- }
- window_x11 = GST_GL_WINDOW_X11 (window);
-
- device = (Display *) gst_gl_display_get_handle (window->display);
- if (!device) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, "Invalid Display handle");
- goto failure;
- }
-
- if (!glXQueryExtension (device, &error_base, &event_base)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, "No GLX extension");
- goto failure;
- }
-
- if (!glXQueryVersion (device, &context_glx->priv->glx_major,
- &context_glx->priv->glx_minor)) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
- "Failed to query GLX version (glXQueryVersion failed)");
- goto failure;
- }
-
- GST_INFO ("GLX Version: %d.%d", context_glx->priv->glx_major,
- context_glx->priv->glx_minor);
-
- /* legacy case */
- if (context_glx->priv->glx_major < 1 || (context_glx->priv->glx_major == 1
- && context_glx->priv->glx_minor < 3)) {
- gint attribs[] = {
- GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DEPTH_SIZE, 16,
- GLX_DOUBLEBUFFER,
- None
- };
-
- window_x11->visual_info = glXChooseVisual (device,
- window_x11->screen_num, attribs);
-
- if (!window_x11->visual_info) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
- "Bad attributes in glXChooseVisual");
- goto failure;
- }
- } else {
- gint attribs[] = {
- GLX_RENDER_TYPE, GLX_RGBA_BIT,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DEPTH_SIZE, 16,
- GLX_DOUBLEBUFFER, True,
- None
- };
- int fbcount;
-
- context_glx->priv->fbconfigs = glXChooseFBConfig (device,
- DefaultScreen (device), attribs, &fbcount);
-
- if (!context_glx->priv->fbconfigs) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
- "Could not find any FBConfig's to use (check attributes?)");
- goto failure;
- }
-
- _describe_fbconfig (device, context_glx->priv->fbconfigs[0]);
-
- window_x11->visual_info = glXGetVisualFromFBConfig (device,
- context_glx->priv->fbconfigs[0]);
-
- if (!window_x11->visual_info) {
- g_set_error (error, GST_GL_CONTEXT_ERROR,
- GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "Bad attributes in FBConfig");
- goto failure;
- }
- }
-
- gst_gl_window_x11_create_window ((GstGLWindowX11 *) window);
-
- gst_object_unref (window);
-
- return TRUE;
-
-failure:
- if (window)
- gst_object_unref (window);
-
- return FALSE;
-}
-
-static void
-gst_gl_context_glx_swap_buffers (GstGLContext * context)
-{
- GstGLWindow *window = gst_gl_context_get_window (context);
- Display *device = (Display *) gst_gl_display_get_handle (window->display);
- Window window_handle = (Window) gst_gl_window_get_window_handle (window);
-
- glXSwapBuffers (device, window_handle);
-
- gst_object_unref (window);
-}
-
-static guintptr
-gst_gl_context_glx_get_gl_context (GstGLContext * context)
-{
- return (guintptr) GST_GL_CONTEXT_GLX (context)->glx_context;
-}
-
-static gboolean
-gst_gl_context_glx_activate (GstGLContext * context, gboolean activate)
-{
- GstGLWindow *window = gst_gl_context_get_window (context);
- Display *device = (Display *) gst_gl_display_get_handle (window->display);
- Window window_handle = (Window) gst_gl_window_get_window_handle (window);
- gboolean result;
-
- if (activate) {
- result = glXMakeCurrent (device, window_handle,
- GST_GL_CONTEXT_GLX (context)->glx_context);
- } else {
- result = glXMakeCurrent (device, None, NULL);
- }
-
- gst_object_unref (window);
-
- return result;
-}
-
-GstGLAPI
-gst_gl_context_glx_get_gl_api (GstGLContext * context)
-{
- GstGLContextGLX *context_glx;
-
- context_glx = GST_GL_CONTEXT_GLX (context);
-
- return context_glx->priv->context_api;
-}
-
-static GstGLPlatform
-gst_gl_context_glx_get_gl_platform (GstGLContext * context)
-{
- return GST_GL_PLATFORM_GLX;
-}
-
-gpointer
-gst_gl_context_glx_get_proc_address (GstGLAPI gl_api, const gchar * name)
-{
- gpointer result;
-
- if (!(result = gst_gl_context_default_get_proc_address (gl_api, name))) {
- result = glXGetProcAddressARB ((const GLubyte *) name);
- }
-
- return result;
-}
-
-guintptr
-gst_gl_context_glx_get_current_context (void)
-{
- return (guintptr) glXGetCurrentContext ();
-}
-
-static void
-gst_gl_context_glx_get_gl_platform_version (GstGLContext * context,
- gint * major, gint * minor)
-{
- GstGLContextGLX *context_glx = GST_GL_CONTEXT_GLX (context);
-
- *major = context_glx->priv->glx_major;
- *minor = context_glx->priv->glx_minor;
-}
diff --git a/gst-libs/gst/gl/x11/gstglcontext_glx.h b/gst-libs/gst/gl/x11/gstglcontext_glx.h
deleted file mode 100644
index e3eb8fe3c..000000000
--- a/gst-libs/gst/gl/x11/gstglcontext_glx.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_CONTEXT_GLX_H__
-#define __GST_GL_CONTEXT_GLX_H__
-
-#include "gstglwindow_x11.h"
-
-#include <GL/glx.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_CONTEXT_GLX (gst_gl_context_glx_get_type())
-G_GNUC_INTERNAL GType gst_gl_context_glx_get_type (void);
-
-/* FIXME: remove this when moving to -base */
-#ifndef GST_DISABLE_DEPRECATED
-#define GST_GL_TYPE_CONTEXT_GLX GST_TYPE_GL_CONTEXT_GLX
-#endif
-#define GST_GL_CONTEXT_GLX(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_CONTEXT_GLX, GstGLContextGLX))
-#define GST_GL_CONTEXT_GLX_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_CONTEXT_GLX, GstGLContextGLXClass))
-#define GST_IS_GL_CONTEXT_GLX(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_CONTEXT_GLX))
-#define GST_IS_GL_CONTEXT_GLX_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_CONTEXT_GLX))
-#define GST_GL_CONTEXT_GLX_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_CONTEXT_GLX, GstGLContextGLX_Class))
-
-typedef struct _GstGLContextGLX GstGLContextGLX;
-typedef struct _GstGLContextGLXClass GstGLContextGLXClass;
-typedef struct _GstGLContextGLXPrivate GstGLContextGLXPrivate;
-
-struct _GstGLContextGLX {
- /*< private >*/
- GstGLContext parent;
-
- GLXContext glx_context;
-
- GstGLContextGLXPrivate *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-struct _GstGLContextGLXClass {
- /*< private >*/
- GstGLContextClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING];
-};
-
-G_GNUC_INTERNAL
-GstGLContextGLX * gst_gl_context_glx_new (GstGLDisplay * display);
-
-G_GNUC_INTERNAL
-guintptr gst_gl_context_glx_get_current_context (void);
-
-G_GNUC_INTERNAL
-gpointer gst_gl_context_glx_get_proc_address (GstGLAPI gl_api, const gchar * name);
-
-G_END_DECLS
-
-#endif /* __GST_GL_CONTEXT_H__ */
diff --git a/gst-libs/gst/gl/x11/gstgldisplay_x11.c b/gst-libs/gst/gl/x11/gstgldisplay_x11.c
deleted file mode 100644
index 00cdd3f9a..000000000
--- a/gst-libs/gst/gl/x11/gstgldisplay_x11.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gl/x11/gstgldisplay_x11.h>
-#include <gst/gl/x11/gstglwindow_x11.h>
-#include "xcb_event_source.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
-#define GST_CAT_DEFAULT gst_gl_display_debug
-
-G_DEFINE_TYPE (GstGLDisplayX11, gst_gl_display_x11, GST_TYPE_GL_DISPLAY);
-
-static void gst_gl_display_x11_finalize (GObject * object);
-static guintptr gst_gl_display_x11_get_handle (GstGLDisplay * display);
-
-G_GNUC_INTERNAL
- gboolean gst_gl_display_x11_handle_event (GstGLDisplayX11 * display_x11);
-
-extern gboolean gst_gl_window_x11_handle_event (GstGLWindowX11 * window_x11,
- xcb_generic_event_t * event);
-
-static void
-gst_gl_display_x11_class_init (GstGLDisplayX11Class * klass)
-{
- GST_GL_DISPLAY_CLASS (klass)->get_handle =
- GST_DEBUG_FUNCPTR (gst_gl_display_x11_get_handle);
-
- G_OBJECT_CLASS (klass)->finalize = gst_gl_display_x11_finalize;
-}
-
-static void
-gst_gl_display_x11_init (GstGLDisplayX11 * display_x11)
-{
- GstGLDisplay *display = (GstGLDisplay *) display_x11;
-
- display->type = GST_GL_DISPLAY_TYPE_X11;
- display_x11->foreign_display = FALSE;
-}
-
-static void
-gst_gl_display_x11_finalize (GObject * object)
-{
- GstGLDisplayX11 *display_x11 = GST_GL_DISPLAY_X11 (object);
-
- g_free (display_x11->name);
-
- if (!display_x11->foreign_display && display_x11->display) {
- XSync (display_x11->display, FALSE);
- XCloseDisplay (display_x11->display);
- }
-
- G_OBJECT_CLASS (gst_gl_display_x11_parent_class)->finalize (object);
-}
-
-/**
- * gst_gl_display_x11_new:
- * @name: (allow-none): a display name
- *
- * Create a new #GstGLDisplayX11 from the x11 display name. See XOpenDisplay()
- * for details on what is a valid name.
- *
- * Returns: (transfer full): a new #GstGLDisplayX11 or %NULL
- */
-GstGLDisplayX11 *
-gst_gl_display_x11_new (const gchar * name)
-{
- GstGLDisplayX11 *ret;
-
- GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-
- ret = g_object_new (GST_TYPE_GL_DISPLAY_X11, NULL);
- gst_object_ref_sink (ret);
- ret->name = g_strdup (name);
- ret->display = XOpenDisplay (ret->name);
-
- if (!ret->display) {
- GST_INFO ("Failed to open X11 display connection with name, \'%s\'", name);
- gst_object_unref (ret);
- return NULL;
- }
-
- ret->xcb_connection = XGetXCBConnection (ret->display);
- if (!ret->xcb_connection) {
- GST_ERROR ("Failed to open retieve XCB connection from X11 Display");
- gst_object_unref (ret);
- return NULL;
- }
-
- XSetEventQueueOwner (ret->display, XCBOwnsEventQueue);
-
- GST_GL_DISPLAY (ret)->event_source = xcb_event_source_new (ret);
- g_source_attach (GST_GL_DISPLAY (ret)->event_source,
- GST_GL_DISPLAY (ret)->main_context);
-
- return ret;
-}
-
-/**
- * gst_gl_display_x11_new_with_display:
- * @display: an existing, x11 display
- *
- * Creates a new display connection from a X11 Display.
- *
- * Returns: (transfer full): a new #GstGLDisplayX11
- */
-GstGLDisplayX11 *
-gst_gl_display_x11_new_with_display (Display * display)
-{
- GstGLDisplayX11 *ret;
-
- g_return_val_if_fail (display != NULL, NULL);
-
- GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-
- ret = g_object_new (GST_TYPE_GL_DISPLAY_X11, NULL);
- gst_object_ref_sink (ret);
-
- ret->name = g_strdup (DisplayString (display));
- ret->display = display;
-
- ret->xcb_connection = XGetXCBConnection (ret->display);
- if (!ret->xcb_connection) {
- GST_ERROR ("Failed to open retieve XCB connection from X11 Display");
- gst_object_unref (ret);
- return NULL;
- }
-
- ret->foreign_display = TRUE;
-
- return ret;
-}
-
-static guintptr
-gst_gl_display_x11_get_handle (GstGLDisplay * display)
-{
- return (guintptr) GST_GL_DISPLAY_X11 (display)->display;
-}
-
-static int
-_compare_xcb_window (GstGLWindowX11 * window_x11, xcb_window_t * window_id)
-{
- return window_x11->internal_win_id - *window_id;
-}
-
-static GstGLWindowX11 *
-_find_window_from_xcb_window (GstGLDisplayX11 * display_x11,
- xcb_window_t window_id)
-{
- GstGLDisplay *display = GST_GL_DISPLAY (display_x11);
- GstGLWindowX11 *ret = NULL;
- GList *l;
-
- if (!window_id)
- return NULL;
-
- GST_OBJECT_LOCK (display);
- l = g_list_find_custom (display->windows, &window_id,
- (GCompareFunc) _compare_xcb_window);
- if (l)
- ret = gst_object_ref (l->data);
- GST_OBJECT_UNLOCK (display);
-
- return ret;
-}
-
-static GstGLWindowX11 *
-_window_from_event (GstGLDisplayX11 * display_x11, xcb_generic_event_t * event)
-{
- uint8_t event_code = event->response_type & 0x7f;
-
- switch (event_code) {
-/* *INDENT-OFF* */
-#define WIN_FROM_EVENT(case_val,event_type,window_field) \
- case case_val:{ \
- event_type * real_event = (event_type *) event; \
- return _find_window_from_xcb_window (display_x11, real_event->window_field); \
- }
- WIN_FROM_EVENT (XCB_CLIENT_MESSAGE, xcb_client_message_event_t, window)
- WIN_FROM_EVENT (XCB_CONFIGURE_NOTIFY, xcb_configure_notify_event_t, window)
- WIN_FROM_EVENT (XCB_EXPOSE, xcb_expose_event_t, window)
- WIN_FROM_EVENT (XCB_KEY_PRESS, xcb_key_press_event_t, event)
- WIN_FROM_EVENT (XCB_KEY_RELEASE, xcb_key_release_event_t, event)
- WIN_FROM_EVENT (XCB_BUTTON_PRESS, xcb_button_press_event_t, event)
- WIN_FROM_EVENT (XCB_BUTTON_RELEASE, xcb_button_release_event_t, event)
- WIN_FROM_EVENT (XCB_MOTION_NOTIFY, xcb_motion_notify_event_t, event)
-#undef WIN_FROM_EVENT
-/* *INDENT-ON* */
- default:
- return NULL;
- }
-}
-
-gboolean
-gst_gl_display_x11_handle_event (GstGLDisplayX11 * display_x11)
-{
- xcb_connection_t *connection = display_x11->xcb_connection;
- xcb_generic_event_t *event;
- gboolean ret = TRUE;
-
- while ((event = xcb_poll_for_event (connection))) {
- GstGLWindowX11 *window_x11 = _window_from_event (display_x11, event);
-
- GST_TRACE_OBJECT (display_x11, "got event %p to window %" GST_PTR_FORMAT,
- event, window_x11);
-
- if (window_x11) {
- ret = gst_gl_window_x11_handle_event (window_x11, event);
- } else {
- /* unknown window, ignore */
- ret = TRUE;
- }
-
- if (window_x11)
- gst_object_unref (window_x11);
- g_free (event);
- }
-
- return ret;
-}
diff --git a/gst-libs/gst/gl/x11/gstgldisplay_x11.h b/gst-libs/gst/gl/x11/gstgldisplay_x11.h
deleted file mode 100644
index 3ffe251bb..000000000
--- a/gst-libs/gst/gl/x11/gstgldisplay_x11.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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_DISPLAY_X11_H__
-#define __GST_GL_DISPLAY_X11_H__
-
-#include <gst/gst.h>
-
-#include <X11/Xlib-xcb.h>
-
-#include <gst/gl/gstgldisplay.h>
-
-G_BEGIN_DECLS
-
-GST_EXPORT
-GType gst_gl_display_x11_get_type (void);
-
-#define GST_TYPE_GL_DISPLAY_X11 (gst_gl_display_x11_get_type())
-#define GST_GL_DISPLAY_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_X11,GstGLDisplayX11))
-#define GST_GL_DISPLAY_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_X11,GstGLDisplayX11Class))
-#define GST_IS_GL_DISPLAY_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_X11))
-#define GST_IS_GL_DISPLAY_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_X11))
-#define GST_GL_DISPLAY_X11_CAST(obj) ((GstGLDisplayX11*)(obj))
-
-typedef struct _GstGLDisplayX11 GstGLDisplayX11;
-typedef struct _GstGLDisplayX11Class GstGLDisplayX11Class;
-
-/**
- * GstGLDisplayX11:
- *
- * the contents of a #GstGLDisplayX11 are private and should only be accessed
- * through the provided API
- */
-struct _GstGLDisplayX11
-{
- GstGLDisplay parent;
-
- /* <private> */
- gchar *name;
- Display *display;
- xcb_connection_t *xcb_connection;
- gboolean foreign_display;
-
- gpointer _padding[GST_PADDING];
-};
-
-struct _GstGLDisplayX11Class
-{
- GstGLDisplayClass object_class;
-
- gpointer _padding[GST_PADDING];
-};
-
-GST_EXPORT
-GstGLDisplayX11 *gst_gl_display_x11_new (const gchar * name);
-
-GST_EXPORT
-GstGLDisplayX11 *gst_gl_display_x11_new_with_display (Display *display);
-
-G_END_DECLS
-
-#endif /* __GST_GL_DISPLAY_X11_H__ */
diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c
deleted file mode 100644
index 9898e0be7..000000000
--- a/gst-libs/gst/gl/x11/gstglwindow_x11.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <locale.h>
-
-#include "gstglwindow_x11.h"
-#include "gstgldisplay_x11.h"
-
-#include "../gstglwindow_private.h"
-
-/* for XkbKeycodeToKeysym */
-#include <X11/XKBlib.h>
-
-#define GST_GL_WINDOW_X11_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GST_TYPE_GL_WINDOW_X11, GstGLWindowX11Private))
-
-#define GST_CAT_DEFAULT gst_gl_window_debug
-
-#define gst_gl_window_x11_parent_class parent_class
-G_DEFINE_TYPE (GstGLWindowX11, gst_gl_window_x11, GST_TYPE_GL_WINDOW);
-
-G_GNUC_INTERNAL
- gboolean gst_gl_window_x11_handle_event (GstGLWindowX11 * window_x11,
- xcb_generic_event_t * event);
-
-/* X error trap */
-static int TrappedErrorCode = 0;
-static int (*old_error_handler) (Display *, XErrorEvent *);
-
-enum
-{
- ARG_0,
- ARG_DISPLAY
-};
-
-struct _GstGLWindowX11Private
-{
- gboolean activate;
- gboolean activate_result;
-
- gint preferred_width;
- gint preferred_height;
-
- gboolean handle_events;
-
- GstVideoRectangle render_rect;
-};
-
-static guintptr gst_gl_window_x11_get_display (GstGLWindow * window);
-guintptr gst_gl_window_x11_get_gl_context (GstGLWindow * window);
-gboolean gst_gl_window_x11_activate (GstGLWindow * window, gboolean activate);
-static void gst_gl_window_x11_set_window_handle (GstGLWindow * window,
- guintptr handle);
-static gboolean gst_gl_window_x11_set_render_rectangle (GstGLWindow * window,
- int x, int y, int width, int height);
-static guintptr gst_gl_window_x11_get_window_handle (GstGLWindow * window);
-static void gst_gl_window_x11_set_preferred_size (GstGLWindow * window,
- gint width, gint height);
-static void gst_gl_window_x11_show (GstGLWindow * window);
-static void gst_gl_window_x11_draw (GstGLWindow * window);
-gboolean gst_gl_window_x11_create_context (GstGLWindow * window,
- GstGLAPI gl_api, guintptr external_gl_context, GError ** error);
-static gboolean gst_gl_window_x11_open (GstGLWindow * window, GError ** error);
-static void gst_gl_window_x11_close (GstGLWindow * window);
-static void gst_gl_window_x11_handle_events (GstGLWindow * window,
- gboolean handle_events);
-
-static void
-gst_gl_window_x11_finalize (GObject * object)
-{
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_gl_window_x11_class_init (GstGLWindowX11Class * klass)
-{
- GObjectClass *obj_class = G_OBJECT_CLASS (klass);
- GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstGLWindowX11Private));
-
- obj_class->finalize = gst_gl_window_x11_finalize;
-
- window_class->get_display = GST_DEBUG_FUNCPTR (gst_gl_window_x11_get_display);
- window_class->set_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_x11_set_window_handle);
- window_class->set_render_rectangle =
- GST_DEBUG_FUNCPTR (gst_gl_window_x11_set_render_rectangle);
- window_class->get_window_handle =
- GST_DEBUG_FUNCPTR (gst_gl_window_x11_get_window_handle);
- window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_x11_draw);
- window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_x11_open);
- window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_x11_close);
- window_class->handle_events =
- GST_DEBUG_FUNCPTR (gst_gl_window_x11_handle_events);
- window_class->set_preferred_size =
- GST_DEBUG_FUNCPTR (gst_gl_window_x11_set_preferred_size);
- window_class->show = GST_DEBUG_FUNCPTR (gst_gl_window_x11_show);
-}
-
-static void
-gst_gl_window_x11_init (GstGLWindowX11 * window)
-{
- window->priv = GST_GL_WINDOW_X11_GET_PRIVATE (window);
-}
-
-/* Must be called in the gl thread */
-GstGLWindowX11 *
-gst_gl_window_x11_new (GstGLDisplay * display)
-{
- GstGLWindowX11 *window;
-
- if ((gst_gl_display_get_handle_type (display) & GST_GL_DISPLAY_TYPE_X11)
- == GST_GL_DISPLAY_TYPE_NONE) {
- GST_INFO ("Wrong display type %u for this window type %u", display->type,
- GST_GL_DISPLAY_TYPE_X11);
- return NULL;
- }
-
- window = g_object_new (GST_TYPE_GL_WINDOW_X11, NULL);
- gst_object_ref_sink (window);
-
- return window;
-}
-
-static gboolean
-gst_gl_window_x11_open (GstGLWindow * window, GError ** error)
-{
- GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
- GstGLDisplayX11 *display_x11 = (GstGLDisplayX11 *) window->display;
-
- window_x11->device = display_x11->display;
-// window_x11->device = XOpenDisplay (display_x11->name);
- if (window_x11->device == NULL) {
- g_set_error (error, GST_GL_WINDOW_ERROR,
- GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE,
- "Failed to connect to X display server");
- goto failure;
- }
-
- GST_LOG ("gl device id: %ld", (gulong) window_x11->device);
-
- window_x11->screen = DefaultScreenOfDisplay (window_x11->device);
- window_x11->screen_num = DefaultScreen (window_x11->device);
- window_x11->visual =
- DefaultVisual (window_x11->device, window_x11->screen_num);
- window_x11->root = DefaultRootWindow (window_x11->device);
- window_x11->white = XWhitePixel (window_x11->device, window_x11->screen_num);
- window_x11->black = XBlackPixel (window_x11->device, window_x11->screen_num);
- window_x11->depth = DefaultDepthOfScreen (window_x11->screen);
-
- GST_LOG ("gl root id: %lud", (gulong) window_x11->root);
-
- window_x11->device_width =
- DisplayWidth (window_x11->device, window_x11->screen_num);
- window_x11->device_height =
- DisplayHeight (window_x11->device, window_x11->screen_num);
-
- window_x11->allow_extra_expose_events = TRUE;
-
- return GST_GL_WINDOW_CLASS (parent_class)->open (window, error);
-
-failure:
- return FALSE;
-}
-
-gboolean
-gst_gl_window_x11_create_window (GstGLWindowX11 * window_x11)
-{
- XSetWindowAttributes win_attr;
- XTextProperty text_property;
- XWMHints wm_hints;
- unsigned long mask;
- const gchar *title = "OpenGL renderer";
- Atom wm_atoms[1];
- gint x = 0, y = 0, width = 1, height = 1;
-
- if (window_x11->visual_info->visual != window_x11->visual)
- GST_LOG ("selected visual is different from the default");
-
- GST_LOG ("visual XID:%d, screen:%d, visualid:%d, depth:%d, class:%d, "
- "red_mask:%ld, green_mask:%ld, blue_mask:%ld bpp:%d",
- (gint) XVisualIDFromVisual (window_x11->visual_info->visual),
- window_x11->visual_info->screen, (gint) window_x11->visual_info->visualid,
- window_x11->visual_info->depth, window_x11->visual_info->class,
- window_x11->visual_info->red_mask, window_x11->visual_info->green_mask,
- window_x11->visual_info->blue_mask,
- window_x11->visual_info->bits_per_rgb);
-
- win_attr.event_mask =
- StructureNotifyMask | ExposureMask | VisibilityChangeMask;
- win_attr.do_not_propagate_mask = NoEventMask;
-
- win_attr.background_pixmap = None;
- win_attr.background_pixel = 0;
- win_attr.border_pixel = 0;
-
- win_attr.colormap =
- XCreateColormap (window_x11->device, window_x11->root,
- window_x11->visual_info->visual, AllocNone);
-
- mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask;
-
- window_x11->internal_win_id =
- XCreateWindow (window_x11->device,
- window_x11->parent_win ? window_x11->parent_win : window_x11->root,
- x, y, width, height, 0,
- window_x11->visual_info->depth, InputOutput,
- window_x11->visual_info->visual, mask, &win_attr);
-
- gst_gl_window_x11_handle_events (GST_GL_WINDOW (window_x11),
- window_x11->priv->handle_events);
-
- XSync (window_x11->device, FALSE);
-
- XSetWindowBackgroundPixmap (window_x11->device,
- window_x11->internal_win_id, None);
-
- GST_LOG ("gl window id: %lud", (gulong) window_x11->internal_win_id);
- GST_LOG ("gl window props: x:%d y:%d", x, y);
-
- wm_atoms[0] = XInternAtom (window_x11->device, "WM_DELETE_WINDOW", True);
- if (wm_atoms[0] == None)
- GST_DEBUG ("Cannot create WM_DELETE_WINDOW");
-
- XSetWMProtocols (window_x11->device, window_x11->internal_win_id,
- wm_atoms, 1);
-
- wm_hints.flags = StateHint;
- wm_hints.initial_state = NormalState;
- wm_hints.input = False;
-
- XStringListToTextProperty ((char **) &title, 1, &text_property);
-
- XSetWMProperties (window_x11->device, window_x11->internal_win_id,
- &text_property, &text_property, 0, 0, NULL, &wm_hints, NULL);
-
- XFree (text_property.value);
-
- return TRUE;
-}
-
-static void
-gst_gl_window_x11_close (GstGLWindow * window)
-{
- GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
-
- if (window_x11->device) {
- if (window_x11->internal_win_id) {
- XUnmapWindow (window_x11->device, window_x11->internal_win_id);
-
- XDestroyWindow (window_x11->device, window_x11->internal_win_id);
- }
- XFree (window_x11->visual_info);
-
- GST_DEBUG ("display receiver closed");
- }
-
- window_x11->running = FALSE;
-
- GST_GL_WINDOW_CLASS (parent_class)->close (window);
-}
-
-/* called by the gl thread */
-static void
-gst_gl_window_x11_set_window_handle (GstGLWindow * window, guintptr id)
-{
- GstGLWindowX11 *window_x11;
- gint x, y, width, height;
-
- window_x11 = GST_GL_WINDOW_X11 (window);
-
- window_x11->parent_win = (Window) id;
-
- if (window_x11->priv->render_rect.w > 0 &&
- window_x11->priv->render_rect.h > 0) {
- x = window_x11->priv->render_rect.x;
- y = window_x11->priv->render_rect.y;
- width = window_x11->priv->render_rect.w;
- height = window_x11->priv->render_rect.h;
- } else {
- x = y = 0;
- if (window_x11->parent_win) {
- XWindowAttributes attr;
-
- XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr);
- width = attr.width;
- height = attr.height;
- } else {
- width = window_x11->priv->preferred_width;
- height = window_x11->priv->preferred_height;
- }
- }
-
- XResizeWindow (window_x11->device, window_x11->internal_win_id,
- width, height);
-
- XReparentWindow (window_x11->device, window_x11->internal_win_id,
- window_x11->parent_win, x, y);
-
- XSync (window_x11->device, FALSE);
-}
-
-struct SetRenderRectangle
-{
- GstGLWindowX11 *window_x11;
- GstVideoRectangle rect;
-};
-
-static void
-_free_set_render_rectangle (struct SetRenderRectangle *render)
-{
- if (render) {
- if (render->window_x11)
- gst_object_unref (render->window_x11);
- g_free (render);
- }
-}
-
-static void
-_set_render_rectangle (gpointer data)
-{
- struct SetRenderRectangle *render = data;
-
- GST_LOG_OBJECT (render->window_x11, "setting render rectangle %i,%i+%ix%i",
- render->rect.x, render->rect.y, render->rect.w, render->rect.h);
-
- if (render->window_x11->internal_win_id)
- XMoveResizeWindow (render->window_x11->device,
- render->window_x11->internal_win_id, render->rect.x, render->rect.y,
- render->rect.w, render->rect.h);
-
- if (render->window_x11->device)
- XSync (render->window_x11->device, FALSE);
-
- render->window_x11->priv->render_rect = render->rect;
-}
-
-static gboolean
-gst_gl_window_x11_set_render_rectangle (GstGLWindow * window,
- int x, int y, int width, int height)
-{
- GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
- struct SetRenderRectangle *render;
-
- render = g_new0 (struct SetRenderRectangle, 1);
- render->window_x11 = gst_object_ref (window_x11);
- render->rect.x = x;
- render->rect.y = y;
- render->rect.w = width;
- render->rect.h = height;
-
- gst_gl_window_send_message_async (window,
- (GstGLWindowCB) _set_render_rectangle, render,
- (GDestroyNotify) _free_set_render_rectangle);
-
- return TRUE;
-}
-
-static guintptr
-gst_gl_window_x11_get_window_handle (GstGLWindow * window)
-{
- GstGLWindowX11 *window_x11;
-
- window_x11 = GST_GL_WINDOW_X11 (window);
-
- return window_x11->internal_win_id;
-}
-
-static void
-gst_gl_window_x11_set_preferred_size (GstGLWindow * window, gint width,
- gint height)
-{
- GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
-
- window_x11->priv->preferred_width = width;
- window_x11->priv->preferred_height = height;
-}
-
-static void
-_show_window (GstGLWindow * window)
-{
- GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
- guint width = window_x11->priv->preferred_width;
- guint height = window_x11->priv->preferred_height;
-
- if (!window_x11->visible) {
- if (!window_x11->parent_win) {
- XResizeWindow (window_x11->device, window_x11->internal_win_id,
- width, height);
- }
-
- XMapWindow (window_x11->device, window_x11->internal_win_id);
- XSync (window_x11->device, FALSE);
- window_x11->visible = TRUE;
- }
-}
-
-static void
-gst_gl_window_x11_show (GstGLWindow * window)
-{
- gst_gl_window_send_message (window, (GstGLWindowCB) _show_window, window);
-}
-
-static void
-_context_draw (GstGLContext * context, GstGLWindow * window)
-{
- window->draw (window->draw_data);
- gst_gl_context_swap_buffers (context);
-
- gst_object_unref (context);
-}
-
-static void
-draw_cb (gpointer data)
-{
- GstGLWindowX11 *window_x11 = data;
- GstGLWindow *window = GST_GL_WINDOW (window_x11);
- guint width, height;
- XWindowAttributes attr;
-
- if (window_x11->internal_win_id) {
- gboolean need_resize = FALSE;
-
- XGetWindowAttributes (window_x11->device, window_x11->internal_win_id,
- &attr);
- GST_TRACE_OBJECT (window, "window size %ux%u", attr.width, attr.height);
-
- if (window_x11->parent_win &&
- (window_x11->priv->render_rect.w < 0 ||
- window_x11->priv->render_rect.h < 0)) {
- XWindowAttributes attr_parent;
- XGetWindowAttributes (window_x11->device, window_x11->parent_win,
- &attr_parent);
- GST_TRACE_OBJECT (window, "parent window size %ux%u", attr_parent.width,
- attr_parent.height);
-
- if (attr.width != attr_parent.width || attr.height != attr_parent.height) {
- XMoveResizeWindow (window_x11->device, window_x11->internal_win_id,
- 0, 0, attr_parent.width, attr_parent.height);
- XSync (window_x11->device, FALSE);
-
- attr.width = attr_parent.width;
- attr.height = attr_parent.height;
-
- GST_LOG ("parent resize: %d, %d",
- attr_parent.width, attr_parent.height);
- need_resize = TRUE;
- }
- }
-
- gst_gl_window_get_surface_dimensions (window, &width, &height);
- if (attr.width != width || attr.height != height)
- need_resize = TRUE;
-
- if (need_resize)
- gst_gl_window_queue_resize (window);
-
- if (window_x11->allow_extra_expose_events) {
- if (window->queue_resize)
- gst_gl_window_resize (window, width, height);
-
- if (window->draw) {
- GstGLContext *context = gst_gl_window_get_context (window);
-
- _context_draw (context, window);
- }
- }
- }
-}
-
-/* Not called by the gl thread */
-static void
-gst_gl_window_x11_draw (GstGLWindow * window)
-{
- gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
-}
-
-static void
-gst_gl_window_x11_handle_events (GstGLWindow * window, gboolean handle_events)
-{
- GstGLWindowX11 *window_x11;
-
- g_return_if_fail (window != NULL);
-
- window_x11 = GST_GL_WINDOW_X11 (window);
-
- window_x11->priv->handle_events = handle_events;
-
- if (window_x11->internal_win_id) {
- if (handle_events) {
- XSelectInput (window_x11->device, window_x11->internal_win_id,
- StructureNotifyMask | ExposureMask | VisibilityChangeMask |
- PointerMotionMask | KeyPressMask | KeyReleaseMask | ButtonPressMask |
- ButtonReleaseMask);
- } else {
- XSelectInput (window_x11->device, window_x11->internal_win_id,
- StructureNotifyMask | ExposureMask | VisibilityChangeMask);
- }
- }
-}
-
-gboolean
-gst_gl_window_x11_handle_event (GstGLWindowX11 * window_x11,
- xcb_generic_event_t * event)
-{
- GstGLWindow *window = GST_GL_WINDOW (window_x11);
- GstGLDisplayX11 *display_x11 = GST_GL_DISPLAY_X11 (window->display);
- xcb_connection_t *connection = display_x11->xcb_connection;
- uint8_t event_code = event->response_type & 0x7f;
-
- switch (event_code) {
- case XCB_CLIENT_MESSAGE:{
- xcb_client_message_event_t *client_event;
- xcb_intern_atom_cookie_t cookie;
- xcb_intern_atom_reply_t *reply;
-
- client_event = (xcb_client_message_event_t *) event;
- cookie = xcb_intern_atom (connection, 0, 16, "WM_DELETE_WINDOW");
- reply = xcb_intern_atom_reply (connection, cookie, 0);
-
- if (client_event->data.data32[0] == reply->atom) {
- GST_INFO_OBJECT (window_x11, "Close requested");
-
- if (window->close)
- window->close (window->close_data);
-
- gst_gl_display_remove_window (GST_GL_DISPLAY (display_x11),
- GST_GL_WINDOW (window_x11));
- }
-
- g_free (reply);
- break;
- }
- case XCB_CONFIGURE_NOTIFY:{
- xcb_configure_notify_event_t *configure_event;
-
- configure_event = (xcb_configure_notify_event_t *) event;
-
- gst_gl_window_resize (window, configure_event->width,
- configure_event->height);
-
- gst_gl_window_draw (window);
- break;
- }
- case XCB_EXPOSE:{
- xcb_expose_event_t *expose_event = (xcb_expose_event_t *) event;
- /* non-zero means that other Expose follows
- * so just wait for the last one
- * in theory we should not receive non-zero because
- * we have no sub areas here but just in case */
- if (expose_event->count != 0)
- break;
-
- gst_gl_window_draw (window);
- break;
- }
- case XCB_KEY_PRESS:
- case XCB_KEY_RELEASE:{
- xcb_key_press_event_t *kp = (xcb_key_press_event_t *) event;
- const gchar *event_type_str;
- gchar *key_str;
- KeySym keysym;
-
- keysym = XkbKeycodeToKeysym (window_x11->device, kp->detail, 0, 0);
- key_str = XKeysymToString (keysym);
-
- if (event_code == XCB_KEY_PRESS)
- event_type_str = "key-press";
- else
- event_type_str = "key-release";
-
- gst_gl_window_send_key_event (window, event_type_str, key_str);
- break;
- }
- case XCB_BUTTON_PRESS:
- case XCB_BUTTON_RELEASE:{
- xcb_button_press_event_t *bp = (xcb_button_press_event_t *) event;
- const gchar *event_type_str;
-
- if (event_code == XCB_BUTTON_PRESS)
- event_type_str = "mouse-button-press";
- else
- event_type_str = "mouse-button-release";
-
- gst_gl_window_send_mouse_event (window, event_type_str, bp->detail,
- (double) bp->event_x, (double) bp->event_y);
- break;
- }
- case XCB_MOTION_NOTIFY:{
- xcb_motion_notify_event_t *motion = (xcb_motion_notify_event_t *) event;
-
- gst_gl_window_send_mouse_event (window, "mouse-move", 0,
- (double) motion->event_x, (double) motion->event_y);
- break;
- }
- default:
- GST_TRACE ("unhandled XCB event: %u", event_code);
- break;
- }
-
- return TRUE;
-}
-
-static int
-error_handler (Display * xdpy, XErrorEvent * error)
-{
- TrappedErrorCode = error->error_code;
- return 0;
-}
-
-/**
- * gst_gl_window_x11_trap_x_errors:
- *
- * Traps every X error until gst_gl_window_x11_untrap_x_errors() is called.
- */
-void
-gst_gl_window_x11_trap_x_errors (void)
-{
- TrappedErrorCode = 0;
- old_error_handler = XSetErrorHandler (error_handler);
-}
-
-/**
- * gst_gl_window_x11_untrap_x_errors:
- *
- * Removes the X error trap and returns the current status.
- *
- * Return value: the trapped error code, or 0 for success
- */
-gint
-gst_gl_window_x11_untrap_x_errors (void)
-{
- XSetErrorHandler (old_error_handler);
-
- return TrappedErrorCode;
-}
-
-static guintptr
-gst_gl_window_x11_get_display (GstGLWindow * window)
-{
- GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
-
- return (guintptr) window_x11->device;
-}
diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.h b/gst-libs/gst/gl/x11/gstglwindow_x11.h
deleted file mode 100644
index ba6fd16bd..000000000
--- a/gst-libs/gst/gl/x11/gstglwindow_x11.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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_WINDOW_X11_H__
-#define __GST_GL_WINDOW_X11_H__
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#include <gst/video/video.h>
-
-#include <gst/gl/gstgl_fwd.h>
-#include <gst/gl/gstglwindow.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GL_WINDOW_X11 (gst_gl_window_x11_get_type())
-G_GNUC_INTERNAL GType gst_gl_window_x11_get_type (void);
-
-#define GST_GL_WINDOW_X11(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW_X11, GstGLWindowX11))
-#define GST_GL_WINDOW_X11_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_WINDOW_X11, GstGLWindowX11Class))
-#define GST_IS_GL_WINDOW_X11(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW_X11))
-#define GST_IS_GL_WINDOW_X11_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW_X11))
-#define GST_GL_WINDOW_X11_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW_X11, GstGLWindowX11Class))
-
-typedef struct _GstGLWindowX11 GstGLWindowX11;
-typedef struct _GstGLWindowX11Private GstGLWindowX11Private;
-typedef struct _GstGLWindowX11Class GstGLWindowX11Class;
-
-/**
- * GstGLWindowX11:
- *
- * Opaque #GstGLWindowX11 object
- */
-struct _GstGLWindowX11
-{
- /*< private >*/
- GstGLWindow parent;
-
- gboolean running;
- gboolean visible;
- gboolean allow_extra_expose_events;
-
- /* opengl context */
- Display *device;
- Screen *screen;
- gint screen_num;
- Visual *visual;
- Window root;
- gulong white;
- gulong black;
- gint depth;
- gint device_width;
- gint device_height;
- gint connection;
- XVisualInfo *visual_info;
- Window parent_win;
-
- /* X window */
- Window internal_win_id;
-
- GSource *x11_source;
-
- /*< private >*/
- GstGLWindowX11Private *priv;
-
- gpointer _reserved[GST_PADDING];
-};
-
-/**
- * GstGLWindowX11Class:
- *
- * Opaque #GstGLWindowX11Class object
- */
-struct _GstGLWindowX11Class {
- /*< private >*/
- GstGLWindowClass parent_class;
-
- /*< private >*/
- gpointer _reserved[GST_PADDING_LARGE];
-};
-
-G_GNUC_INTERNAL
-GstGLWindowX11 * gst_gl_window_x11_new (GstGLDisplay * display);
-
-G_GNUC_INTERNAL
-void gst_gl_window_x11_trap_x_errors (void);
-
-G_GNUC_INTERNAL
-gint gst_gl_window_x11_untrap_x_errors (void);
-
-G_GNUC_INTERNAL
-gboolean gst_gl_window_x11_create_window (GstGLWindowX11 * window_x11);
-
-G_END_DECLS
-
-#endif /* __GST_GL_WINDOW_X11_H__ */
diff --git a/gst-libs/gst/gl/x11/xcb_event_source.c b/gst-libs/gst/gl/x11/xcb_event_source.c
deleted file mode 100644
index 8dbb15398..000000000
--- a/gst-libs/gst/gl/x11/xcb_event_source.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "xcb_event_source.h"
-#include "gstgldisplay_x11.h"
-#include "gstglwindow_x11.h"
-
-G_GNUC_INTERNAL
- extern gboolean gst_gl_display_x11_handle_event (GstGLDisplayX11 *
- display_x11);
-
-typedef struct _XCBEventSource
-{
- GSource source;
- GPollFD pfd;
- uint32_t mask;
- GstGLDisplayX11 *display_x11;
-} XCBEventSource;
-
-static gboolean
-xcb_event_source_prepare (GSource * base, gint * timeout)
-{
- XCBEventSource *source = (XCBEventSource *) base;
-
- xcb_flush (source->display_x11->xcb_connection);
-
- *timeout = -1;
- return FALSE;
-}
-
-static gboolean
-xcb_event_source_check (GSource * base)
-{
- XCBEventSource *source = (XCBEventSource *) base;
- gboolean retval;
-
- retval = source->pfd.revents;
-
- return retval;
-}
-
-static gboolean
-xcb_event_source_dispatch (GSource * base, GSourceFunc callback, gpointer data)
-{
- XCBEventSource *source = (XCBEventSource *) base;
-
- gboolean ret = gst_gl_display_x11_handle_event (source->display_x11);
-
- source->pfd.revents = 0;
-
- if (callback)
- callback (data);
-
- return ret;
-}
-
-static GSourceFuncs xcb_event_source_funcs = {
- xcb_event_source_prepare,
- xcb_event_source_check,
- xcb_event_source_dispatch,
- NULL
-};
-
-GSource *
-xcb_event_source_new (GstGLDisplayX11 * display_x11)
-{
- xcb_connection_t *connection;
- XCBEventSource *source;
-
- connection = display_x11->xcb_connection;
- g_return_val_if_fail (connection != NULL, NULL);
-
- source = (XCBEventSource *)
- g_source_new (&xcb_event_source_funcs, sizeof (XCBEventSource));
- source->display_x11 = display_x11;
- source->pfd.fd = xcb_get_file_descriptor (connection);
- source->pfd.events = G_IO_IN | G_IO_ERR;
- g_source_add_poll (&source->source, &source->pfd);
-
- return &source->source;
-}
diff --git a/gst-libs/gst/gl/x11/xcb_event_source.h b/gst-libs/gst/gl/x11/xcb_event_source.h
deleted file mode 100644
index ba476352a..000000000
--- a/gst-libs/gst/gl/x11/xcb_event_source.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.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 __XCB_EVENT_SOURCE_H__
-#define __XCB_EVENT_SOURCE_H__
-
-#include <glib-object.h>
-#include "gstgldisplay_x11.h"
-
-GSource * xcb_event_source_new (GstGLDisplayX11 *display_x11);
-
-#endif /* __XCB_EVENT_SOURCE_H__ */
diff --git a/gst-libs/gst/meson.build b/gst-libs/gst/meson.build
index 63267eaa9..32b812667 100644
--- a/gst-libs/gst/meson.build
+++ b/gst-libs/gst/meson.build
@@ -13,4 +13,3 @@ subdir('opencv')
subdir('player')
subdir('video')
subdir('wayland')
-subdir('gl')
diff --git a/meson_options.txt b/meson_options.txt
index fbcf625bf..67c6904a6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,10 +1,4 @@
option('use_orc', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')
-option('with_gl_api', type : 'string', value : 'auto', description : 'A comma separated list of opengl APIs to enable building against. Supported values are opengl and gles2.')
-option('with_gl_platform', type : 'string', value : 'auto', description : 'A comma separated list of opengl platforms to enable building against. Supported values are glx, egl, cgl, wgl and eagl')
-option('with_gl_winsys', type : 'string', value : 'auto', description : 'A comma separated list of opengl windows systems to enable building against. Supported values are x11, wayland, win32, cocoa, and dispmanx')
-option('with_egl_module_name', type : 'string', value : '', description : 'The file to pass to g_module_open to open the libEGL.so library (default: libEGL.so)')
-option('with_opengl_module_name', type : 'string', value : '', description : 'The file to pass to g_module_open to open the libGL.so library (default: libGL.so)')
-option('with_gles2_module_name', type : 'string', value : '', description : 'The file to pass to g_module_open to open the libGLESv2.so library (default: libGLESv2.so)')
option('disable_introspection',
type : 'boolean', value : false,
description : 'Whether to disable the introspection generation')
diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am
index 8fecfa7b5..b5f1d7bb1 100644
--- a/pkgconfig/Makefile.am
+++ b/pkgconfig/Makefile.am
@@ -20,11 +20,6 @@ pcverfiles_uninstalled = \
gstreamer-bad-video-@GST_API_VERSION@-uninstalled.pc \
gstreamer-bad-allocators-@GST_API_VERSION@-uninstalled.pc
-if HAVE_GST_GL
-pcverfiles += gstreamer-gl-@GST_API_VERSION@.pc
-pcverfiles_uninstalled += gstreamer-gl-@GST_API_VERSION@-uninstalled.pc
-endif
-
all-local: $(pcverfiles) $(pcverfiles_uninstalled)
cp_verbose = $(cp_verbose_$(V))
@@ -57,7 +52,6 @@ CLEANFILES = $(pcverfiles) $(pcverfiles_uninstalled)
pcinfiles = \
gstreamer-plugins-bad.pc.in gstreamer-plugins-bad-uninstalled.pc.in \
gstreamer-codecparsers.pc.in gstreamer-codecparsers-uninstalled.pc.in \
- gstreamer-gl.pc.in gstreamer-gl-uninstalled.pc.in \
gstreamer-insertbin.pc.in gstreamer-insertbin-uninstalled.pc.in \
gstreamer-mpegts.pc.in gstreamer-mpegts-uninstalled.pc.in \
gstreamer-player.pc.in gstreamer-player-uninstalled.pc.in \
diff --git a/pkgconfig/gstreamer-plugins-bad-uninstalled.pc.in b/pkgconfig/gstreamer-plugins-bad-uninstalled.pc.in
index 84f2441ea..efd014e97 100644
--- a/pkgconfig/gstreamer-plugins-bad-uninstalled.pc.in
+++ b/pkgconfig/gstreamer-plugins-bad-uninstalled.pc.in
@@ -10,5 +10,5 @@ Name: GStreamer Bad Plugin libraries, Uninstalled
Description: Streaming media framework, bad plugins libraries, uninstalled
Version: @VERSION@
Requires: gstreamer-@GST_API_VERSION@
-Libs: -L@audiolibdir@ -L@basecamerabinsrclibdir@ -L@codecparserslibdir@ -L@gllibdir@ -L@insertbinlibdir@ -L@photographylibdir@ -L@mpegtslibdir@ -L@playerlibdir@ -L@videolibdir@ -L@waylandlibdir@
+Libs: -L@audiolibdir@ -L@basecamerabinsrclibdir@ -L@codecparserslibdir@ -L@insertbinlibdir@ -L@photographylibdir@ -L@mpegtslibdir@ -L@playerlibdir@ -L@videolibdir@ -L@waylandlibdir@
Cflags: -I@abs_top_srcdir@/gst-libs -I@abs_top_builddir@/gst-libs
diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build
index 5f90e0432..01317cb2e 100644
--- a/pkgconfig/meson.build
+++ b/pkgconfig/meson.build
@@ -31,15 +31,6 @@ pkg_libs = [
'plugins-bad',
]
-# XXX: requires the meson.build to be parsed/executed after gst-libs/gl/meson.build
-if build_gstgl
- pkgconf.set('gllibdir', join_paths(meson.build_root(), gstgl.outdir()))
- pkg_libs += 'gl'
- pkgconf.set('GL_APIS', ' '.join(enabled_gl_apis))
- pkgconf.set('GL_WINDOWS', ' '.join(enabled_gl_winsys))
- pkgconf.set('GL_PLATFORMS', ' '.join(enabled_gl_platforms))
-endif
-
#if use_wayland
# pkgconf.set('waylandlibdir', join_paths(meson.build_root(), gstwayland.outdir()))
# pkg_libs += 'wayland'
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a0017b5b4..da6a8b525 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,5 @@
ext/curl/gstcurlhttpsrc.c
ext/dash/gstdashdemux.c
-ext/gl/gstgltestsrc.c
ext/opencv/gsttemplatematch.cpp
ext/resindvd/resindvdsrc.c
ext/smoothstreaming/gstmssdemux.c
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index f3961ed19..3fae4e574 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -204,23 +204,6 @@ else
check_ipcpipeline=
endif
-if USE_GL
-check_gl=libs/gstglcontext \
- libs/gstglmemory \
- libs/gstglupload \
- libs/gstglcolorconvert \
- libs/gstglmatrix \
- libs/gstglquery \
- libs/gstglsl \
- libs/gstglslstage \
- libs/gstglshader \
- libs/gstglheaders \
- elements/glimagesink \
- pipelines/simple-launch-lines
-else
-check_gl=
-endif
-
VALGRIND_TO_FIX = \
elements/mpeg2enc \
elements/mplex \
@@ -297,7 +280,6 @@ check_PROGRAMS = \
$(check_zbar) \
$(check_orc) \
libs/insertbin \
- $(check_gl) \
$(check_hlsdemux_m3u8) \
$(check_hlsdemux) \
$(check_srtp) \
@@ -554,119 +536,6 @@ orc/audiomixer.c: $(top_srcdir)/gst/audiomixer/gstaudiomixerorc.orc
$(MKDIR_P) orc
$(ORCC) --test -o $@ $<
-libs_gstglcontext_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_VIDEO_LIBS) $(GST_BASE_LIBS) \
- $(GST_LIBS) $(LDADD)
-
-libs_gstglcontext_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS)
-
-libs_gstglmemory_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_VIDEO_LIBS) $(GST_BASE_LIBS) \
- $(GST_LIBS) $(LDADD)
-
-libs_gstglmemory_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS)
-
-libs_gstglupload_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS)
-
-libs_gstglupload_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_VIDEO_LIBS) $(GST_BASE_LIBS) \
- $(GST_LIBS) $(LDADD)
-
-libs_gstglcolorconvert_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS)
-
-libs_gstglcolorconvert_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_VIDEO_LIBS) $(GST_BASE_LIBS) \
- $(GST_LIBS) $(LDADD)
-
-libs_gstglmatrix_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
-
-libs_gstglmatrix_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_VIDEO_LIBS) $(GST_BASE_LIBS) \
- $(GST_LIBS) $(LDADD)
-
-libs_gstglquery_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
-
-libs_gstglquery_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS)
-
-libs_gstglsl_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
-
-libs_gstglsl_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS)
-
-libs_gstglslstage_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
-
-libs_gstglslstage_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS)
-
-libs_gstglshader_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
-
-libs_gstglshader_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS)
-
-libs_gstglheaders_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
-
-libs_gstglheaders_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GL_CFLAGS) $(AM_CFLAGS)
-
-elements_glimagesink_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
-
-elements_glimagesink_LDADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_VIDEO_LIBS) $(GST_BASE_LIBS) \
- $(GST_LIBS) $(LDADD)
-
-pipelines_simple_launch_lines_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) \
- -DGST_USE_UNSTABLE_API \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
-
-pipelines_simple_launch_lines_LDADD = \
- $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD)
-
elements_compositor_LDADD = \
$(GST_PLUGINS_BASE_LIBS) $(GST_VIDEO_LIBS) $(GST_BASE_LIBS) $(LDADD)
elements_compositor_CFLAGS = \
diff --git a/tests/check/elements/glimagesink.c b/tests/check/elements/glimagesink.c
deleted file mode 100644
index c536ecd65..000000000
--- a/tests/check/elements/glimagesink.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/* GStreamer
- *
- * Unit tests for glimagesink
- *
- * Copyright (C) 2014 Julien Isorce <j.isorce@samsung.com>
- * Copyright (C) 2016 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.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <gst/check/gstcheck.h>
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("RGBA"))
- );
-
-static GstElement *sinkelement = NULL;
-static GstPad *srcpad = NULL;
-
-#define PAD_FUNC(name, type, param, check) \
- static gpointer do_##name##_func (type * param) { \
- fail_unless (gst_pad_##name (srcpad, param) == check); \
- return NULL; \
-}
-
-/* *INDENT-OFF* */
-PAD_FUNC (peer_query, GstQuery, query, TRUE)
-PAD_FUNC (push, GstBuffer, buf, GST_FLOW_OK)
-/* *INDENT-ON* */
-
-/* On OSX it's required to have a main loop running in the
- * main thread while using the display connection.
- * So the call that use this display connection needs to be
- * done in another thread.
- * On other platforms a direct call can be done. */
-#ifdef __APPLE__
-static GMainLoop *loop;
-static GThread *thread;
-static GMutex lock;
-static GCond cond;
-
-static gboolean
-_unlock_mutex (gpointer * unused)
-{
- g_cond_broadcast (&cond);
- g_mutex_unlock (&lock);
-
- return G_SOURCE_REMOVE;
-}
-
-static gpointer
-_thread_main (gpointer * unused)
-{
- g_mutex_lock (&lock);
- g_idle_add ((GSourceFunc) _unlock_mutex, NULL);
-
- g_main_loop_run (loop);
-
- g_main_loop_unref (loop);
- loop = NULL;
-
- return NULL;
-}
-
-static void
-_start_thread (void)
-{
- loop = g_main_loop_new (NULL, FALSE);
- g_mutex_init (&lock);
- g_cond_init (&cond);
-
- thread = g_thread_new ("GLOSXTestThread", (GThreadFunc) _thread_main, NULL);
-
- g_mutex_lock (&lock);
- while (!loop) {
- g_cond_wait (&cond, &lock);
- }
- g_mutex_unlock (&lock);
-}
-
-static void
-_stop_thread (void)
-{
- g_main_loop_quit (loop);
- g_thread_join (thread);
-
- g_mutex_clear (&lock);
- g_cond_clear (&cond);
-}
-#endif
-
-static void
-setup_glimagesink (void)
-{
- GstCaps *caps = NULL;
-
- sinkelement = gst_check_setup_element ("glimagesink");
- srcpad = gst_check_setup_src_pad (sinkelement, &srctemplate);
- gst_pad_set_active (srcpad, TRUE);
-
- caps =
- gst_caps_from_string
- ("video/x-raw, width=320, height=240, format=RGBA, framerate=30/1");
- gst_check_setup_events (srcpad, sinkelement, caps, GST_FORMAT_TIME);
- gst_caps_unref (caps);
-}
-
-static void
-cleanup_glimagesink (void)
-{
- gst_element_set_state (sinkelement, GST_STATE_NULL);
- gst_element_get_state (sinkelement, NULL, NULL, GST_CLOCK_TIME_NONE);
- gst_pad_set_active (srcpad, FALSE);
- gst_check_teardown_src_pad (sinkelement);
- gst_check_teardown_element (sinkelement);
-}
-
-/* Verify that glimagesink releases the buffers it currently
- * owns, upon a drain query. */
-GST_START_TEST (test_query_drain)
-{
- GstBuffer *buf = NULL;
- GstBufferPool *originpool = NULL;
- GstBufferPool *pool = NULL;
- GstCaps *caps = NULL;
- GstQuery *query = NULL;
- GstStructure *config = NULL;
- gint i = 0;
- guint min = 0;
- guint max = 0;
- guint size = 0;
- const gint maxbuffers = 4;
-
-#ifdef __APPLE__
- _start_thread ();
-#endif
-
- /* GstBaseSink handles the drain query as well. */
- g_object_set (sinkelement, "enable-last-sample", TRUE, NULL);
-
- ASSERT_SET_STATE (sinkelement, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- caps = gst_pad_get_current_caps (srcpad);
- fail_unless (gst_caps_is_fixed (caps));
-
- /* Let's retrieve the GstGLBufferPool to change its min
- * and max nb buffers. For that just send an allocation
- * query and change the pool config. */
- query = gst_query_new_allocation (caps, TRUE);
- do_peer_query_func (query);
-
- fail_unless (gst_query_get_n_allocation_pools (query) == 1);
-
- gst_query_parse_nth_allocation_pool (query, 0, &originpool, &size, &min,
- &max);
- fail_unless (originpool != NULL);
- gst_query_unref (query);
-
- config = gst_buffer_pool_get_config (originpool);
- gst_buffer_pool_config_set_params (config, caps, size, maxbuffers,
- maxbuffers);
- fail_unless (gst_buffer_pool_set_config (originpool, config));
-
- /* The gl pool is setup and ready to be activated. */
- fail_unless (gst_buffer_pool_set_active (originpool, TRUE));
-
- /* Let's build an upstream pool that will be feed with
- * gl buffers. */
- pool = gst_buffer_pool_new ();
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set_params (config, caps, size, maxbuffers,
- maxbuffers);
- fail_unless (gst_buffer_pool_set_config (pool, config));
- gst_caps_unref (caps);
-
- fail_unless (gst_buffer_pool_set_active (pool, TRUE));
-
- /* Unpopulate the pool and forget about its initial buffers
- * It is necessary because the pool has to know there are
- * N outstanding buffers. */
- for (i = 0; i < maxbuffers; ++i) {
- fail_unless (gst_buffer_pool_acquire_buffer (pool, &buf,
- NULL) == GST_FLOW_OK);
- gst_object_replace ((GstObject **) & buf->pool, NULL);
- gst_buffer_unref (buf);
- }
-
- /* Transfer buffers from the gl pool to the upstream pool. */
- for (i = 0; i < maxbuffers; ++i) {
- fail_unless (gst_buffer_pool_acquire_buffer (originpool, &buf,
- NULL) == GST_FLOW_OK);
- gst_object_replace ((GstObject **) & buf->pool, (GstObject *) pool);
- gst_buffer_unref (buf);
- }
-
- /* Push a lot of buffers like if a real pipeline was running. */
- for (i = 0; i < 10 * maxbuffers; ++i) {
- fail_unless (gst_buffer_pool_acquire_buffer (pool, &buf,
- NULL) == GST_FLOW_OK);
- do_push_func (buf);
- }
-
- /* Claim back buffers to the upstream pool. This is the point
- * of this unit test, i.e. this test checks that glimagesink
- * releases the buffers it currently owns, upon drain query. */
- query = gst_query_new_drain ();
- do_peer_query_func (query);
- gst_query_unref (query);
-
- /* Transfer buffers back to the downstream pool to be release
- * properly. This also make sure that all buffers are returned.
- * Indeed gst_buffer_pool_acquire_buffer is blocking here and
- * we have set a maximum. */
- for (i = 0; i < maxbuffers; ++i) {
- fail_unless (gst_buffer_pool_acquire_buffer (pool, &buf,
- NULL) == GST_FLOW_OK);
- gst_object_replace ((GstObject **) & buf->pool, (GstObject *) originpool);
- gst_buffer_unref (buf);
- }
-
- fail_unless (gst_buffer_pool_set_active (originpool, FALSE));
- gst_object_unref (originpool);
-
- /* At this point the gl pool contains all its buffers. We can
- * inactivate it to release the textures. Note that only the gl
- * pool can release the textures properly because it has a
- * reference on the gl context. */
- fail_unless (gst_buffer_pool_set_active (pool, FALSE));
- gst_object_unref (pool);
-
-#ifdef __APPLE__
- _stop_thread ();
-#endif
-}
-
-GST_END_TEST;
-
-static Suite *
-glimagesink_suite (void)
-{
- Suite *s = suite_create ("glimagesink");
- TCase *tc = tcase_create ("general");
-
- tcase_set_timeout (tc, 5);
-
- tcase_add_checked_fixture (tc, setup_glimagesink, cleanup_glimagesink);
- tcase_add_test (tc, test_query_drain);
- suite_add_tcase (s, tc);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- Suite *s;
- g_setenv ("GST_GL_XINITTHREADS", "1", TRUE);
- gst_check_init (&argc, &argv);
- s = glimagesink_suite ();
- return gst_check_run_suite (s, "glimagesink", __FILE__);
-}
diff --git a/tests/check/libs/gstglcolorconvert.c b/tests/check/libs/gstglcolorconvert.c
deleted file mode 100644
index 8553fe5e5..000000000
--- a/tests/check/libs/gstglcolorconvert.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2014 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/gl/gl.h>
-#include <gst/gl/gstglfuncs.h>
-
-#include <stdio.h>
-
-static GstGLDisplay *display;
-static GstGLContext *context;
-static GstGLWindow *window;
-static GstGLColorConvert *convert;
-
-typedef struct _TestFrame
-{
- gint width;
- gint height;
- GstVideoFormat v_format;
- gchar *data[GST_VIDEO_MAX_PLANES];
-} TestFrame;
-
-#define IGNORE_MAGIC 0x05
-
-static const gchar rgba_reorder_data[] = { 0x49, 0x24, 0x72, 0xff };
-static const gchar rgbx_reorder_data[] = { 0x49, 0x24, 0x72, IGNORE_MAGIC };
-static const gchar argb_reorder_data[] = { 0xff, 0x49, 0x24, 0x72 };
-static const gchar xrgb_reorder_data[] = { IGNORE_MAGIC, 0x49, 0x24, 0x72 };
-static const gchar rgb_reorder_data[] = { 0x49, 0x24, 0x72, IGNORE_MAGIC };
-static const gchar bgr_reorder_data[] = { 0x72, 0x24, 0x49, IGNORE_MAGIC };
-static const gchar bgra_reorder_data[] = { 0x72, 0x24, 0x49, 0xff };
-static const gchar bgrx_reorder_data[] = { 0x72, 0x24, 0x49, IGNORE_MAGIC };
-static const gchar abgr_reorder_data[] = { 0xff, 0x72, 0x24, 0x49 };
-static const gchar xbgr_reorder_data[] = { IGNORE_MAGIC, 0x72, 0x24, 0x49 };
-
-static TestFrame test_rgba_reorder[] = {
- {1, 1, GST_VIDEO_FORMAT_RGBA, {(gchar *) & rgba_reorder_data}},
- {1, 1, GST_VIDEO_FORMAT_RGBx, {(gchar *) & rgbx_reorder_data}},
- {1, 1, GST_VIDEO_FORMAT_ARGB, {(gchar *) & argb_reorder_data}},
- {1, 1, GST_VIDEO_FORMAT_xRGB, {(gchar *) & xrgb_reorder_data}},
- {1, 1, GST_VIDEO_FORMAT_BGRA, {(gchar *) & bgra_reorder_data}},
- {1, 1, GST_VIDEO_FORMAT_BGRx, {(gchar *) & bgrx_reorder_data}},
- {1, 1, GST_VIDEO_FORMAT_ABGR, {(gchar *) & abgr_reorder_data}},
- {1, 1, GST_VIDEO_FORMAT_xBGR, {(gchar *) & xbgr_reorder_data}},
- {1, 1, GST_VIDEO_FORMAT_RGB, {(gchar *) & rgb_reorder_data}},
- {1, 1, GST_VIDEO_FORMAT_BGR, {(gchar *) & bgr_reorder_data}},
-};
-
-static void
-setup (void)
-{
- GError *error = NULL;
-
- display = gst_gl_display_new ();
- context = gst_gl_context_new (display);
-
- gst_gl_context_create (context, 0, &error);
- window = gst_gl_context_get_window (context);
-
- fail_if (error != NULL, "Error creating context: %s\n",
- error ? error->message : "Unknown Error");
-
- convert = gst_gl_color_convert_new (context);
-}
-
-static void
-_check_gl_error (GstGLContext * context, gpointer data)
-{
- GLuint error = context->gl_vtable->GetError ();
- fail_if (error != GL_NONE, "GL error 0x%x encountered during processing\n",
- error);
-}
-
-static void
-teardown (void)
-{
- gst_object_unref (convert);
- gst_object_unref (window);
-
- gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _check_gl_error,
- NULL);
- gst_object_unref (context);
- gst_object_unref (display);
-}
-
-static gsize
-_video_info_plane_size (GstVideoInfo * info, guint plane)
-{
- if (GST_VIDEO_INFO_N_PLANES (info) == plane + 1)
- return info->offset[0] + info->size - info->offset[plane];
-
- return info->offset[plane + 1] - info->offset[plane];
-}
-
-static void
-_frame_unref (gpointer user_data)
-{
- gint *ref_count = user_data;
- g_atomic_int_add (ref_count, -1);
-}
-
-static void
-check_conversion (TestFrame * frames, guint size)
-{
- GstGLBaseMemoryAllocator *base_mem_alloc;
- gint i, j, k, l;
- gint ref_count = 0;
-
- base_mem_alloc =
- GST_GL_BASE_MEMORY_ALLOCATOR (gst_allocator_find
- (GST_GL_MEMORY_ALLOCATOR_NAME));
-
- for (i = 0; i < size; i++) {
- GstBuffer *inbuf;
- GstVideoInfo in_info;
- gint in_width = frames[i].width;
- gint in_height = frames[i].height;
- GstVideoFormat in_v_format = frames[i].v_format;
- GstVideoFrame in_frame;
- GstCaps *in_caps;
-
- gst_video_info_set_format (&in_info, in_v_format, in_width, in_height);
- in_caps = gst_video_info_to_caps (&in_info);
- gst_caps_set_features (in_caps, 0,
- gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY));
-
- /* create GL buffer */
- inbuf = gst_buffer_new ();
- for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&in_info); j++) {
- GstGLFormat tex_format = gst_gl_format_from_video_info (context,
- &in_info, j);
- GstGLVideoAllocationParams *params;
- GstGLBaseMemory *mem;
-
- ref_count++;
- params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
- &in_info, j, NULL, GST_GL_TEXTURE_TARGET_2D, tex_format,
- frames[i].data[j], &ref_count, _frame_unref);
-
- mem = gst_gl_base_memory_alloc (base_mem_alloc,
- (GstGLAllocationParams *) params);
- gst_buffer_append_memory (inbuf, GST_MEMORY_CAST (mem));
-
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- }
-
- fail_unless (gst_video_frame_map (&in_frame, &in_info, inbuf,
- GST_MAP_READ));
-
- /* sanity check that the correct values were wrapped */
- for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&in_info); j++) {
- for (k = 0; k < _video_info_plane_size (&in_info, j); k++) {
- if (frames[i].data[j][k] != IGNORE_MAGIC)
- fail_unless (((gchar *) in_frame.data[j])[k] == frames[i].data[j][k]);
- }
- }
-
- for (j = 0; j < size; j++) {
- GstBuffer *outbuf;
- GstVideoInfo out_info;
- gint out_width = frames[j].width;
- gint out_height = frames[j].height;
- GstVideoFormat out_v_format = frames[j].v_format;
- gchar *out_data[GST_VIDEO_MAX_PLANES] = { 0 };
- GstVideoFrame out_frame;
- GstCaps *out_caps;
-
- gst_video_info_set_format (&out_info, out_v_format, out_width,
- out_height);
- out_caps = gst_video_info_to_caps (&out_info);
- gst_caps_set_features (out_caps, 0,
- gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY));
-
- for (k = 0; k < GST_VIDEO_INFO_N_PLANES (&out_info); k++) {
- out_data[k] = frames[j].data[k];
- }
-
- gst_gl_color_convert_set_caps (convert, in_caps, out_caps);
-
- /* convert the data */
- outbuf = gst_gl_color_convert_perform (convert, inbuf);
- if (outbuf == NULL) {
- const gchar *in_str = gst_video_format_to_string (in_v_format);
- const gchar *out_str = gst_video_format_to_string (out_v_format);
- GST_WARNING ("failed to convert from %s to %s", in_str, out_str);
- }
-
- fail_unless (gst_video_frame_map (&out_frame, &out_info, outbuf,
- GST_MAP_READ));
-
- /* check that the converted values are correct */
- for (k = 0; k < GST_VIDEO_INFO_N_PLANES (&out_info); k++) {
- for (l = 0; l < _video_info_plane_size (&out_info, k); l++) {
- gchar out_pixel = ((gchar *) out_frame.data[k])[l];
- if (out_data[k][l] != IGNORE_MAGIC && out_pixel != IGNORE_MAGIC)
- fail_unless (out_pixel == out_data[k][l]);
- /* FIXME: check alpha clobbering */
- }
- }
-
- gst_caps_unref (out_caps);
- gst_video_frame_unmap (&out_frame);
- gst_buffer_unref (outbuf);
- }
-
- gst_caps_unref (in_caps);
- gst_video_frame_unmap (&in_frame);
- gst_buffer_unref (inbuf);
-
- fail_unless_equals_int (ref_count, 0);
- }
-
- gst_object_unref (base_mem_alloc);
-}
-
-GST_START_TEST (test_reorder_buffer)
-{
- guint size = G_N_ELEMENTS (test_rgba_reorder);
-
- /* gles can't download rgb24 textures */
- if (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
- size -= 2;
-
- check_conversion (test_rgba_reorder, size);
-}
-
-GST_END_TEST;
-
-static Suite *
-gst_gl_color_convert_suite (void)
-{
- Suite *s = suite_create ("GstGLColorConvert");
- TCase *tc_chain = tcase_create ("upload");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_checked_fixture (tc_chain, setup, teardown);
- tcase_add_test (tc_chain, test_reorder_buffer);
- /* FIXME add YUV <--> RGB conversion tests */
-
- return s;
-}
-
-GST_CHECK_MAIN (gst_gl_color_convert);
diff --git a/tests/check/libs/gstglcontext.c b/tests/check/libs/gstglcontext.c
deleted file mode 100644
index 37bac2ca5..000000000
--- a/tests/check/libs/gstglcontext.c
+++ /dev/null
@@ -1,662 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2013 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/gl/gl.h>
-#include <gst/gl/gstglfuncs.h>
-
-#include <stdio.h>
-
-static GstGLDisplay *display;
-
-static void
-setup (void)
-{
- display = gst_gl_display_new ();
-}
-
-static void
-teardown (void)
-{
- gst_object_unref (display);
-}
-
-static GstGLMemory *gl_tex, *gl_tex2;
-static GLuint vbo, vbo_indices, vao;
-static GstGLFramebuffer *fbo, *fbo2;
-static GstGLShader *shader;
-static GLint shader_attr_position_loc;
-static GLint shader_attr_texture_loc;
-
-static const GLfloat vertices[] = {
- /* x, y, z, s, t */
- 1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
- -1.0f, 1.0f, 0.0f, 0.0f, 0.0f,
- -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
- 1.0f, -1.0f, 0.0f, 1.0f, 1.0f
-};
-
-static const GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
-static void
-init (gpointer data)
-{
- GstGLContext *context = data;
- GError *error = NULL;
- GstVideoInfo v_info;
- GstGLMemoryAllocator *allocator;
- GstGLVideoAllocationParams *params;
-
- gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, 320, 240);
- allocator = gst_gl_memory_allocator_get_default (context);
- params =
- gst_gl_video_allocation_params_new (context, NULL, &v_info, 0, NULL,
- GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
-
- /* has to be called in the thread that is going to use the framebuffer */
- fbo = gst_gl_framebuffer_new_with_default_depth (context, 320, 240);
-
- fail_if (fbo == NULL, "failed to create framebuffer object");
-
- gl_tex =
- (GstGLMemory *) gst_gl_base_memory_alloc ((GstGLBaseMemoryAllocator *)
- allocator, (GstGLAllocationParams *) params);
- gl_tex2 =
- (GstGLMemory *) gst_gl_base_memory_alloc ((GstGLBaseMemoryAllocator *)
- allocator, (GstGLAllocationParams *) params);
- gst_object_unref (allocator);
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- fail_if (gl_tex == NULL, "failed to create texture");
-
- shader = gst_gl_shader_new_default (context, &error);
- fail_if (shader == NULL, "failed to create shader object: %s",
- error->message);
-
- shader_attr_position_loc =
- gst_gl_shader_get_attribute_location (shader, "a_position");
- shader_attr_texture_loc =
- gst_gl_shader_get_attribute_location (shader, "a_texcoord");
-}
-
-static void
-deinit (gpointer data)
-{
- GstGLContext *context = data;
- GstGLFuncs *gl = context->gl_vtable;
- if (vao)
- gl->DeleteVertexArrays (1, &vao);
- gst_object_unref (fbo);
- gst_object_unref (shader);
- gst_memory_unref (GST_MEMORY_CAST (gl_tex));
- gst_memory_unref (GST_MEMORY_CAST (gl_tex2));
-}
-
-static gboolean
-clear_tex (gpointer data)
-{
- GstGLContext *context = data;
- GstGLFuncs *gl = context->gl_vtable;
- static gfloat r = 0.0, g = 0.0, b = 0.0;
-
- gl->ClearColor (r, g, b, 1.0);
- gl->Clear (GL_COLOR_BUFFER_BIT);
-
- r = r > 1.0 ? 0.0 : r + 0.03;
- g = g > 1.0 ? 0.0 : g + 0.01;
- b = b > 1.0 ? 0.0 : b + 0.015;
-
- return TRUE;
-}
-
-static void
-draw_tex (gpointer data)
-{
- gst_gl_framebuffer_draw_to_texture (fbo, gl_tex,
- (GstGLFramebufferFunc) clear_tex, data);
-}
-
-static void
-_bind_buffer (GstGLContext * context)
-{
- const GstGLFuncs *gl = context->gl_vtable;
-
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, vbo_indices);
- gl->BindBuffer (GL_ARRAY_BUFFER, vbo);
-
- /* Load the vertex position */
- gl->VertexAttribPointer (shader_attr_position_loc, 3, GL_FLOAT, GL_FALSE,
- 5 * sizeof (GLfloat), (void *) 0);
-
- /* Load the texture coordinate */
- gl->VertexAttribPointer (shader_attr_texture_loc, 2, GL_FLOAT, GL_FALSE,
- 5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
-
- gl->EnableVertexAttribArray (shader_attr_position_loc);
- gl->EnableVertexAttribArray (shader_attr_texture_loc);
-}
-
-static void
-_unbind_buffer (GstGLContext * context)
-{
- const GstGLFuncs *gl = context->gl_vtable;
-
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
- gl->BindBuffer (GL_ARRAY_BUFFER, 0);
-
- gl->DisableVertexAttribArray (shader_attr_position_loc);
- gl->DisableVertexAttribArray (shader_attr_texture_loc);
-}
-
-static void
-init_blit (gpointer data)
-{
- GstGLContext *context = data;
- const GstGLFuncs *gl = context->gl_vtable;
-
- if (!vbo) {
- if (gl->GenVertexArrays) {
- gl->GenVertexArrays (1, &vao);
- gl->BindVertexArray (vao);
- }
-
- gl->GenBuffers (1, &vbo);
- gl->BindBuffer (GL_ARRAY_BUFFER, vbo);
- gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices,
- GL_STATIC_DRAW);
-
- gl->GenBuffers (1, &vbo_indices);
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, vbo_indices);
- gl->BufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof (indices), indices,
- GL_STATIC_DRAW);
-
- if (gl->GenVertexArrays) {
- _bind_buffer (context);
- gl->BindVertexArray (0);
- }
-
- gl->BindBuffer (GL_ARRAY_BUFFER, 0);
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
- }
- /* has to be called in the thread that is going to use the framebuffer */
- fbo2 = gst_gl_framebuffer_new_with_default_depth (context, 320, 240);
-
- fail_if (fbo2 == NULL, "failed to create framebuffer object");
-}
-
-static void
-deinit_blit (gpointer data)
-{
- GstGLContext *context = data;
- const GstGLFuncs *gl = context->gl_vtable;
-
- if (vbo)
- gl->DeleteBuffers (1, &vbo);
- vbo = 0;
- if (vbo_indices)
- gl->DeleteBuffers (1, &vbo_indices);
- vbo_indices = 0;
- if (vao)
- gl->DeleteVertexArrays (1, &vao);
- vao = 0;
- gst_object_unref (fbo2);
- fbo2 = NULL;
-}
-
-static gboolean
-blit_tex (gpointer data)
-{
- GstGLContext *context = data;
- const GstGLFuncs *gl = context->gl_vtable;
-
- gl->Clear (GL_COLOR_BUFFER_BIT);
-
- gst_gl_shader_use (shader);
-
- gl->ActiveTexture (GL_TEXTURE0);
- gl->BindTexture (GL_TEXTURE_2D, gst_gl_memory_get_texture_id (gl_tex));
- gst_gl_shader_set_uniform_1i (shader, "s_texture", 0);
-
- if (gl->GenVertexArrays)
- gl->BindVertexArray (vao);
- _bind_buffer (context);
-
- gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);
-
- if (gl->GenVertexArrays)
- gl->BindVertexArray (0);
- _unbind_buffer (context);
-
- return TRUE;
-}
-
-static void
-draw_render (gpointer data)
-{
- gst_gl_framebuffer_draw_to_texture (fbo2, gl_tex2,
- (GstGLFramebufferFunc) blit_tex, data);
-}
-
-GST_START_TEST (test_share)
-{
- GstGLContext *context;
- GstGLWindow *window;
- GstGLContext *other_context;
- GstGLWindow *other_window;
- GError *error = NULL;
- gint i = 0;
-
- context = gst_gl_context_new (display);
-
- window = gst_gl_window_new (display);
- gst_gl_context_set_window (context, window);
-
- gst_gl_context_create (context, 0, &error);
-
- fail_if (error != NULL, "Error creating master context %s\n",
- error ? error->message : "Unknown Error");
-
- other_window = gst_gl_window_new (display);
-
- other_context = gst_gl_context_new (display);
- gst_gl_context_set_window (other_context, other_window);
-
- gst_gl_context_create (other_context, context, &error);
-
- fail_if (error != NULL, "Error creating secondary context %s\n",
- error ? error->message : "Unknown Error");
-
- /* make the window visible */
- gst_gl_window_set_preferred_size (window, 320, 240);
- gst_gl_window_draw (window);
-
- gst_gl_window_send_message (other_window, GST_GL_WINDOW_CB (init),
- other_context);
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (init_blit), context);
-
- while (i < 10) {
- gst_gl_window_send_message (other_window, GST_GL_WINDOW_CB (draw_tex),
- context);
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (draw_render),
- context);
- i++;
- }
-
- gst_gl_window_send_message (other_window, GST_GL_WINDOW_CB (deinit),
- other_context);
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (deinit_blit), context);
-
- gst_object_unref (window);
- gst_object_unref (other_window);
- gst_object_unref (other_context);
- gst_object_unref (context);
-}
-
-GST_END_TEST;
-
-static void
-accum_true (GstGLContext * context, gpointer data)
-{
- gint *i = data;
- *i = 1;
-}
-
-static void
-check_wrapped (gpointer data)
-{
- GstGLContext *wrapped_context = data;
- GError *error = NULL;
- gint i = 0;
- gboolean ret;
-
- /* check that scheduling on an unactivated wrapped context asserts */
- ASSERT_CRITICAL (gst_gl_context_thread_add (wrapped_context,
- (GstGLContextThreadFunc) accum_true, &i));
- fail_if (i != 0);
-
- /* check that scheduling on an activated context succeeds */
- gst_gl_context_activate (wrapped_context, TRUE);
- gst_gl_context_thread_add (wrapped_context,
- (GstGLContextThreadFunc) accum_true, &i);
- fail_if (i != 1);
-
- /* check filling out the wrapped context's info */
- fail_if (wrapped_context->gl_vtable->TexImage2D != NULL);
- ret = gst_gl_context_fill_info (wrapped_context, &error);
- fail_if (!ret, "error received %s\n",
- error ? error->message : "Unknown error");
- fail_if (wrapped_context->gl_vtable->TexImage2D == NULL);
- gst_gl_context_activate (wrapped_context, FALSE);
-}
-
-GST_START_TEST (test_wrapped_context)
-{
- GstGLContext *context, *other_context, *wrapped_context;
- GstGLWindow *window, *other_window;
- GError *error = NULL;
- gint i = 0;
- guintptr handle, handle2;
- GstGLPlatform platform, platform2;
- GstGLAPI apis, apis2;
-
- context = gst_gl_context_new (display);
-
- window = gst_gl_window_new (display);
- gst_gl_context_set_window (context, window);
-
- gst_gl_context_create (context, 0, &error);
-
- fail_if (error != NULL, "Error creating master context %s\n",
- error ? error->message : "Unknown Error");
-
- handle = gst_gl_context_get_gl_context (context);
- platform = gst_gl_context_get_gl_platform (context);
- apis = gst_gl_context_get_gl_api (context);
-
- wrapped_context =
- gst_gl_context_new_wrapped (display, handle, platform, apis);
-
- handle2 = gst_gl_context_get_gl_context (wrapped_context);
- platform2 = gst_gl_context_get_gl_platform (wrapped_context);
- apis2 = gst_gl_context_get_gl_api (wrapped_context);
-
- fail_if (handle != handle2);
- fail_if (platform != platform2);
- fail_if (apis != apis2);
-
- other_context = gst_gl_context_new (display);
- other_window = gst_gl_window_new (display);
- gst_gl_context_set_window (other_context, other_window);
-
- gst_gl_context_create (other_context, wrapped_context, &error);
-
- fail_if (error != NULL, "Error creating secondary context %s\n",
- error ? error->message : "Unknown Error");
-
- gst_gl_window_set_preferred_size (window, 320, 240);
- gst_gl_window_draw (window);
-
- gst_gl_window_send_message (other_window, GST_GL_WINDOW_CB (init),
- other_context);
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (init_blit), context);
-
- while (i < 10) {
- gst_gl_window_send_message (other_window, GST_GL_WINDOW_CB (draw_tex),
- context);
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (draw_render),
- context);
- i++;
- }
-
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (check_wrapped),
- wrapped_context);
-
- gst_gl_window_send_message (other_window, GST_GL_WINDOW_CB (deinit),
- other_context);
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (deinit_blit), context);
-
- gst_object_unref (other_context);
- gst_object_unref (other_window);
- gst_object_unref (window);
- gst_object_unref (context);
- gst_object_unref (wrapped_context);
-}
-
-GST_END_TEST;
-
-struct context_info
-{
- GstGLAPI api;
- guint major;
- guint minor;
- GstGLPlatform platform;
- guintptr handle;
-};
-
-static void
-_fill_context_info (GstGLContext * context, struct context_info *info)
-{
- info->handle = gst_gl_context_get_current_gl_context (info->platform);
- info->api =
- gst_gl_context_get_current_gl_api (info->platform, &info->major,
- &info->minor);
-}
-
-GST_START_TEST (test_current_context)
-{
- GstGLContext *context;
- GError *error = NULL;
- guintptr handle;
- GstGLPlatform platform;
- GstGLAPI api;
- gint major, minor;
- struct context_info info;
-
- context = gst_gl_context_new (display);
-
- gst_gl_context_create (context, 0, &error);
-
- fail_if (error != NULL, "Error creating master context %s\n",
- error ? error->message : "Unknown Error");
-
- handle = gst_gl_context_get_gl_context (context);
- platform = gst_gl_context_get_gl_platform (context);
- api = gst_gl_context_get_gl_api (context);
- gst_gl_context_get_gl_version (context, &major, &minor);
-
- info.platform = platform;
-
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _fill_context_info, &info);
-
- fail_if (info.platform != platform);
- fail_if (info.api != api);
- fail_if (info.major != major);
- fail_if (info.minor != minor);
- fail_if (info.handle != handle);
-
- gst_object_unref (context);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_context_can_share)
-{
- GstGLContext *c1, *c2, *c3;
- GError *error = NULL;
-
- c1 = gst_gl_context_new (display);
- gst_gl_context_create (c1, NULL, &error);
- fail_if (error != NULL, "Error creating context %s\n",
- error ? error->message : "Unknown Error");
-
- c2 = gst_gl_context_new (display);
- gst_gl_context_create (c2, c1, &error);
- fail_if (error != NULL, "Error creating context %s\n",
- error ? error->message : "Unknown Error");
-
- fail_unless (gst_gl_context_can_share (c1, c2));
- fail_unless (gst_gl_context_can_share (c2, c1));
-
- c3 = gst_gl_context_new (display);
- gst_gl_context_create (c3, c2, &error);
- fail_if (error != NULL, "Error creating context %s\n",
- error ? error->message : "Unknown Error");
-
- fail_unless (gst_gl_context_can_share (c1, c3));
- fail_unless (gst_gl_context_can_share (c3, c1));
- fail_unless (gst_gl_context_can_share (c2, c3));
- fail_unless (gst_gl_context_can_share (c3, c2));
-
- /* destroy the middle context */
- gst_object_unref (c2);
- c2 = NULL;
-
- fail_unless (gst_gl_context_can_share (c1, c3));
- fail_unless (gst_gl_context_can_share (c3, c1));
-
- gst_object_unref (c1);
- gst_object_unref (c3);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_is_shared)
-{
- GstGLContext *c1, *c2;
- GError *error = NULL;
-
- c1 = gst_gl_context_new (display);
- gst_gl_context_create (c1, NULL, &error);
- fail_if (error != NULL, "Error creating context %s\n",
- error ? error->message : "Unknown Error");
-
- c2 = gst_gl_context_new (display);
- gst_gl_context_create (c2, c1, &error);
- fail_if (error != NULL, "Error creating context %s\n",
- error ? error->message : "Unknown Error");
-
- fail_unless (gst_gl_context_is_shared (c1));
- fail_unless (gst_gl_context_is_shared (c2));
-
- gst_object_unref (c2);
- c2 = NULL;
-
- fail_unless (!gst_gl_context_is_shared (c1));
-
- gst_object_unref (c1);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_display_list)
-{
- GstGLContext *c1, *c2;
- GError *error = NULL;
-
- c1 = gst_gl_context_new (display);
- gst_gl_context_create (c1, NULL, &error);
- fail_if (error != NULL, "Error creating context %s\n",
- error ? error->message : "Unknown Error");
-
- GST_OBJECT_LOCK (display);
- {
- /* no context added so get should return NULL */
- GstGLContext *tmp =
- gst_gl_display_get_gl_context_for_thread (display, NULL);
- fail_unless (tmp == NULL);
- }
-
- fail_unless (gst_gl_display_add_context (display, c1));
- /* re-adding the same context is a no-op */
- fail_unless (gst_gl_display_add_context (display, c1));
-
- {
- GThread *thread;
- GstGLContext *tmp;
-
- thread = gst_gl_context_get_thread (c1);
- fail_unless (thread != NULL);
-
- tmp = gst_gl_display_get_gl_context_for_thread (display, thread);
- fail_unless (tmp == c1);
- g_thread_unref (thread);
- gst_object_unref (tmp);
-
- tmp = gst_gl_display_get_gl_context_for_thread (display, NULL);
- fail_unless (tmp == c1);
- gst_object_unref (tmp);
- }
-
- c2 = gst_gl_context_new (display);
- gst_gl_context_create (c2, c1, &error);
- fail_if (error != NULL, "Error creating context %s\n",
- error ? error->message : "Unknown Error");
-
- fail_unless (gst_gl_display_add_context (display, c2));
- /* re-adding the same context is a no-op */
- fail_unless (gst_gl_display_add_context (display, c2));
-
- {
- GThread *thread;
- GstGLContext *tmp;
-
- thread = gst_gl_context_get_thread (c2);
- fail_unless (thread != NULL);
-
- tmp = gst_gl_display_get_gl_context_for_thread (display, thread);
- fail_unless (tmp == c2);
- g_thread_unref (thread);
- gst_object_unref (tmp);
-
- /* undefined which context will be returned for the NULL thread */
- tmp = gst_gl_display_get_gl_context_for_thread (display, NULL);
- fail_unless (tmp != NULL);
- gst_object_unref (tmp);
- }
-
- gst_object_unref (c1);
- /* c1 is now dead */
-
- {
- GstGLContext *tmp;
-
- tmp = gst_gl_display_get_gl_context_for_thread (display, NULL);
- fail_unless (tmp == c2);
- gst_object_unref (tmp);
- }
- GST_OBJECT_UNLOCK (display);
-
- gst_object_unref (c2);
- /* c2 is now dead */
-
- {
- /* no more contexts alive */
- GstGLContext *tmp =
- gst_gl_display_get_gl_context_for_thread (display, NULL);
- fail_unless (tmp == NULL);
- }
-}
-
-GST_END_TEST;
-
-static Suite *
-gst_gl_context_suite (void)
-{
- Suite *s = suite_create ("GstGLContext");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_checked_fixture (tc_chain, setup, teardown);
- tcase_add_test (tc_chain, test_share);
- tcase_add_test (tc_chain, test_wrapped_context);
- tcase_add_test (tc_chain, test_current_context);
- tcase_add_test (tc_chain, test_context_can_share);
- tcase_add_test (tc_chain, test_is_shared);
- tcase_add_test (tc_chain, test_display_list);
-
- return s;
-}
-
-GST_CHECK_MAIN (gst_gl_context);
diff --git a/tests/check/libs/gstglheaders.c b/tests/check/libs/gstglheaders.c
deleted file mode 100644
index 5c359368c..000000000
--- a/tests/check/libs/gstglheaders.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* GStreamer
- *
- * unit test for state changes on all elements
- *
- * Copyright (C) <2017> Julien Isorce <julien.isorce@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-/* This test check that public gstgl headers does not include any
- * GL headers. Except for gst/gl/gstglfuncs.h */
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/gl/gstgl_enums.h>
-#include <gst/gl/gstglapi.h>
-#include <gst/gl/gstglbasefilter.h>
-#include <gst/gl/gstglbuffer.h>
-#include <gst/gl/gstglbufferpool.h>
-#include <gst/gl/gstglcolorconvert.h>
-#include <gst/gl/gstglconfig.h>
-#include <gst/gl/gstglcontext.h>
-#include <gst/gl/gstgldebug.h>
-#include <gst/gl/gstgldisplay.h>
-#include <gst/gl/gstglfeature.h>
-#include <gst/gl/gstglfilter.h>
-#include <gst/gl/gstglformat.h>
-#include <gst/gl/gstglframebuffer.h>
-#include <gst/gl/gstglsl.h>
-#include <gst/gl/gstglslstage.h>
-#include <gst/gl/gstglmemory.h>
-#include <gst/gl/gstglmemorypbo.h>
-#include <gst/gl/gstglquery.h>
-#include <gst/gl/gstgloverlaycompositor.h>
-#include <gst/gl/gstglrenderbuffer.h>
-#include <gst/gl/gstglshader.h>
-#include <gst/gl/gstglshaderstrings.h>
-#include <gst/gl/gstglsyncmeta.h>
-#include <gst/gl/gstglupload.h>
-#include <gst/gl/gstglutils.h>
-#include <gst/gl/gstglviewconvert.h>
-#include <gst/gl/gstglwindow.h>
-
-#if GST_GL_HAVE_PLATFORM_EGL
-#include <gst/gl/egl/gstgldisplay_egl.h>
-#include <gst/gl/egl/gstglcontext_egl.h>
-#include <gst/gl/egl/gstglmemoryegl.h>
-#endif
-
-#if GST_GL_HAVE_PLATFORM_X11
-#include <gst/gl/x11/gstgldisplay_x11.h>
-#include <gst/gl/x11/gstglwindow_x11.h>
-#endif
-
-#include <gst/gl/gl.h>
-
-#if defined(GLint) || defined(GLAPI) || defined(GL_GLEXT_VERSION)
-#error gl headers should not be included
-#endif
-
-#if defined(EGLint) || defined(EGLBoolean) || defined(EGLAPI)
-#error egl headers should not be included
-#endif
-
-static GstGLDisplay *display;
-static GstGLContext *context;
-
-static void
-setup (void)
-{
- display = gst_gl_display_new ();
- context = gst_gl_context_new (display);
- gst_gl_context_create (context, 0, NULL);
- gst_gl_buffer_init_once ();
- gst_gl_memory_init_once ();
- gst_gl_memory_pbo_init_once ();
- gst_gl_renderbuffer_init_once ();
-}
-
-static void
-teardown (void)
-{
- gst_object_unref (context);
- gst_object_unref (display);
-}
-
-GST_START_TEST (test_constructors)
-{
- GstBufferPool *pool = NULL;
- GstGLShader *shader = NULL;
- GstGLSLStage *stage = NULL;
- GstGLColorConvert *convert = NULL;
- GstGLOverlayCompositor *compositor = NULL;
- GstGLUpload *upload = NULL;
-
- pool = gst_gl_buffer_pool_new (context);
- fail_if (pool == NULL);
- gst_object_unref (pool);
-
- shader = gst_gl_shader_new (context);
- fail_if (shader == NULL);
- gst_object_unref (shader);
-
- stage = gst_glsl_stage_new_default_fragment (context);
- fail_if (stage == NULL);
- gst_object_unref (stage);
-
- convert = gst_gl_color_convert_new (context);
- fail_if (convert == NULL);
- gst_object_unref (convert);
-
- compositor = gst_gl_overlay_compositor_new (context);
- fail_if (compositor == NULL);
- gst_object_unref (compositor);
-
- upload = gst_gl_upload_new (context);
- fail_if (upload == NULL);
- gst_object_unref (upload);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_constructors_require_activated_context)
-{
- gboolean ret = FALSE;
- GstGLFramebuffer *framebuffer = NULL;
-
- ret = gst_gl_context_activate (context, TRUE);
- fail_if (!ret);
-
- framebuffer = gst_gl_framebuffer_new (context);
- fail_if (framebuffer == NULL);
- gst_object_unref (framebuffer);
-
- ret = gst_gl_context_activate (context, FALSE);
- fail_if (!ret);
-}
-
-GST_END_TEST;
-
-
-static Suite *
-gst_gl_headers_suite (void)
-{
- Suite *s = suite_create ("Gst GL Headers");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_checked_fixture (tc_chain, setup, teardown);
- tcase_add_test (tc_chain, test_constructors);
- tcase_add_test (tc_chain, test_constructors_require_activated_context);
-
- return s;
-}
-
-GST_CHECK_MAIN (gst_gl_headers);
diff --git a/tests/check/libs/gstglmatrix.c b/tests/check/libs/gstglmatrix.c
deleted file mode 100644
index eb7a57e97..000000000
--- a/tests/check/libs/gstglmatrix.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/gl/gstglutils.c>
-#undef GST_CAT_DEFAULT
-#include <gst/check/gstcheck.h>
-
-#define EPSILON 0.0001f
-#define FEQ(a,b) (fabs(a-b) < EPSILON)
-
-static void
-debug_matrix (const float *m)
-{
- int i;
- for (i = 0; i < 4; i++) {
- GST_DEBUG ("%10.4f %10.4f %10.4f %10.4f", m[i * 4 + 0], m[i * 4 + 1],
- m[i * 4 + 2], m[i * 4 + 3]);
- }
-}
-
-GST_START_TEST (test_matrix_multiply)
-{
- /* A * B == C */
- const float A[] = {
- 1., 1., 2., 5.,
- 0., 3., 0., 1.,
- 2., 0., 3., 1.,
- 3., 2., 1., 0.,
- };
-
- const float B[] = {
- 3., 1., 0., 2.,
- 1., 0., 3., 2.,
- 0., 1., 2., 3.,
- 3., 2., 1., 0.,
- };
-
- const float C[] = {
- 19., 13., 12., 10.,
- 6., 2., 10., 6.,
- 9., 7., 7., 13.,
- 11., 4., 8., 13.,
- };
-
- float res[16];
- int i;
-
- gst_gl_multiply_matrix4 (A, B, res);
- GST_DEBUG ("result");
- debug_matrix (res);
-
- for (i = 0; i < G_N_ELEMENTS (res); i++) {
- fail_unless (FEQ (res[i], C[i]), "value %f at index %u does not match "
- "expected value %f", res[i], i, C[i]);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_matrix_ndc)
-{
- GstBuffer *buffer = gst_buffer_new ();
- GstVideoAffineTransformationMeta *aff_meta;
- float res[16];
- int i;
-
- const float m[] = {
- 1., 0., 0., 0.,
- 0., 1., 0., 0.,
- 0., 0., 1., 0.,
- 0., 0., 0., 1.,
- };
-
- const float n[] = {
- 4., 6., 4., 9.,
- 1., 5., 8., 2.,
- 9., 3., 5., 8.,
- 3., 7., 9., 1.,
- };
-
- aff_meta = gst_buffer_add_video_affine_transformation_meta (buffer);
-
- /* test default identity matrix */
- gst_gl_get_affine_transformation_meta_as_ndc (aff_meta, res);
- GST_DEBUG ("result");
- debug_matrix (res);
-
- for (i = 0; i < G_N_ELEMENTS (res); i++) {
- fail_unless (FEQ (res[i], m[i]), "value %f at index %u does not match "
- "expected value %f", res[i], i, m[i]);
- }
-
- /* test setting and receiving the same values */
- gst_gl_set_affine_transformation_meta_from_ndc (aff_meta, n);
- gst_gl_get_affine_transformation_meta_as_ndc (aff_meta, res);
-
- GST_DEBUG ("result");
- debug_matrix (res);
-
- for (i = 0; i < G_N_ELEMENTS (res); i++) {
- fail_unless (FEQ (res[i], n[i]), "value %f at index %u does not match "
- "expected value %f", res[i], i, n[i]);
- }
-
- gst_buffer_unref (buffer);
-}
-
-GST_END_TEST;
-#if 0
-static void
-transpose_matrix4 (float *m, float *res)
-{
- int i, j;
-
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 4; j++) {
- int idx = i + (j * 4);
- int swapped_idx = j + (i * 4);
-
- if (i == j)
- fail_unless (idx == swapped_idx);
-
- res[swapped_idx] = m[idx];
- }
- }
-}
-
-static float
-dot4 (float *v1, float *v2)
-{
- GST_TRACE ("%.4f * %.4f + %.4f * %.4f + %.4f * %.4f + %.4f * %.4f",
- v1[0], v2[0], v1[1], v2[1], v1[2], v2[2], v1[3], v2[3]);
- return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2] + v1[3] * v2[3];
-}
-
-/* m * v */
-static void
-_matrix_mult_vertex4 (float *m, float *v, float *res)
-{
- res[0] = dot4 (&m[0], v);
- res[1] = dot4 (&m[4], v);
- res[2] = dot4 (&m[8], v);
- res[3] = dot4 (&m[12], v);
-}
-
-/* v * m */
-static void
-_vertex_mult_matrix4 (float *v, float *m, float *res)
-{
- float tmp[16] = { 0., };
-
- transpose_matrix4 (m, tmp);
- _matrix_mult_vertex4 (tmp, v, res);
-}
-
-GST_START_TEST (test_matrix_vertex_identity)
-{
- float identity[] = {
- 1., 0., 0., 0.,
- 0., 1., 0., 0.,
- 0., 0., 1., 0.,
- 0., 0., 0., 1.,
- };
-
- float v[] = { 1., 1., 1., 1. };
- float res[4] = { 0., };
- int i;
-
- _vertex_mult_matrix4 (v, identity, res);
- GST_DEBUG ("vertex: %.4f %.4f %.4f %.4f", v[0], v[1], v[2], v[3]);
- GST_DEBUG ("result: %.4f %.4f %.4f %.4f", res[0], res[1], res[2], res[3]);
-
- for (i = 0; i < 4; i++) {
- fail_unless (FEQ (res[i], v[i]), "value %f at index %u does not match "
- "expected value %f", res[i], i, v[i]);
- }
-
- _matrix_mult_vertex4 (identity, v, res);
- GST_DEBUG ("vertex: %.4f %.4f %.4f %.4f", v[0], v[1], v[2], v[3]);
- GST_DEBUG ("result: %.4f %.4f %.4f %.4f", res[0], res[1], res[2], res[3]);
-
- for (i = 0; i < 4; i++) {
- fail_unless (FEQ (res[i], v[i]), "value %f at index %u does not match "
- "expected value %f", res[i], i, v[i]);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_matrix_vertex_scale)
-{
- float scale[] = {
- 1.5, 0., 0., 0.,
- 0., 2.5, 0., 0.,
- 0., 0., 3., 0.,
- 0., 0., 0., 1.,
- };
-
- float v[] = { 1., 1., 1., 1. };
- float expected[] = { 1.5, 2.5, 3., 1. };
- float res[4] = { 0., };
- int i;
-
- _vertex_mult_matrix4 (v, scale, res);
- GST_DEBUG ("vertex: %.4f %.4f %.4f %.4f", v[0], v[1], v[2], v[3]);
- GST_DEBUG ("result: %.4f %.4f %.4f %.4f", res[0], res[1], res[2], res[3]);
-
- for (i = 0; i < 4; i++) {
- fail_unless (FEQ (res[i], expected[i]),
- "value %f at index %u does not match " "expected value %f", res[i], i,
- expected[i]);
- }
-
- _matrix_mult_vertex4 (scale, v, res);
- GST_DEBUG ("vertex: %.4f %.4f %.4f %.4f", v[0], v[1], v[2], v[3]);
- GST_DEBUG ("result: %.4f %.4f %.4f %.4f", res[0], res[1], res[2], res[3]);
-
- for (i = 0; i < 4; i++) {
- fail_unless (FEQ (res[i], expected[i]),
- "value %f at index %u does not match " "expected value %f", res[i], i,
- expected[i]);
- }
-}
-
-GST_END_TEST;
-#endif
-
-static Suite *
-gst_gl_upload_suite (void)
-{
- Suite *s = suite_create ("GstGLMatrix");
- TCase *tc_chain = tcase_create ("matrix");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_matrix_multiply);
- tcase_add_test (tc_chain, test_matrix_ndc);
-
- return s;
-}
-
-GST_CHECK_MAIN (gst_gl_upload);
diff --git a/tests/check/libs/gstglmemory.c b/tests/check/libs/gstglmemory.c
deleted file mode 100644
index f1c3203a4..000000000
--- a/tests/check/libs/gstglmemory.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/* GStreamer
- *
- * unit test for state changes on all elements
- *
- * Copyright (C) <2012> Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/gl/gl.h>
-
-#include <stdio.h>
-
-static GstGLDisplay *display;
-static GstGLContext *context;
-
-static void
-setup (void)
-{
- display = gst_gl_display_new ();
- context = gst_gl_context_new (display);
- gst_gl_context_create (context, 0, NULL);
- gst_gl_memory_init_once ();
-}
-
-static void
-teardown (void)
-{
- gst_object_unref (display);
- gst_object_unref (context);
-}
-
-GST_START_TEST (test_basic)
-{
- GstMemory *mem, *mem2;
- GstGLMemory *gl_mem, *gl_mem2;
- GstAllocator *gl_allocator;
- GstGLBaseMemoryAllocator *base_mem_alloc;
- gint i, j;
- static GstVideoFormat formats[] = {
- GST_VIDEO_FORMAT_RGBA, GST_VIDEO_FORMAT_RGB,
- GST_VIDEO_FORMAT_YUY2, GST_VIDEO_FORMAT_I420
- };
-
- gl_allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME);
- fail_if (gl_allocator == NULL);
- base_mem_alloc = GST_GL_BASE_MEMORY_ALLOCATOR (gl_allocator);
-
- /* test allocator creation */
- ASSERT_WARNING (mem = gst_allocator_alloc (gl_allocator, 0, NULL));
-
- for (i = 0; i < G_N_ELEMENTS (formats); i++) {
- GstVideoInfo v_info;
- gsize width = 320, height = 240;
-
- gst_video_info_set_format (&v_info, formats[i], width, height);
-
- for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&v_info); j++) {
- GstGLFormat tex_format = gst_gl_format_from_video_info (context,
- &v_info, j);
- GstGLVideoAllocationParams *params;
-
- params = gst_gl_video_allocation_params_new (context, NULL, &v_info, j,
- NULL, GST_GL_TEXTURE_TARGET_2D, tex_format);
-
- mem = (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
- (GstGLAllocationParams *) params);
- fail_if (mem == NULL);
- gl_mem = (GstGLMemory *) mem;
-
- /* test init params */
- fail_if (gst_video_info_is_equal (&v_info, &gl_mem->info) == FALSE);
- fail_if (gl_mem->mem.context != context);
- fail_if (gl_mem->tex_id == 0);
-
- /* copy the memory */
- mem2 = gst_memory_copy (mem, 0, -1);
- fail_if (mem2 == NULL);
- gl_mem2 = (GstGLMemory *) mem2;
-
- /* test params */
- fail_if (gst_video_info_is_equal (&gl_mem2->info,
- &gl_mem->info) == FALSE);
- fail_if (gl_mem->mem.context != gl_mem2->mem.context);
-
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- gst_memory_unref (mem);
- gst_memory_unref (mem2);
- }
- }
-
- gst_object_unref (gl_allocator);
-}
-
-GST_END_TEST;
-
-/* one red rgba pixel */
-static gchar rgba_pixel[] = {
- 0xff, 0x00, 0x00, 0xff,
-};
-
-static void
-test_transfer_allocator (const gchar * allocator_name)
-{
- GstAllocator *gl_allocator;
- GstGLBaseMemoryAllocator *base_mem_alloc;
- GstVideoInfo v_info;
- GstMemory *mem, *mem2, *mem3;
- GstMapInfo map_info;
- GstGLVideoAllocationParams *params;
-
- gl_allocator = gst_allocator_find (allocator_name);
- fail_if (gl_allocator == NULL);
- base_mem_alloc = GST_GL_BASE_MEMORY_ALLOCATOR (gl_allocator);
-
- gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, 1, 1);
-
- params = gst_gl_video_allocation_params_new (context, NULL, &v_info, 0,
- NULL, GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
-
- /* texture creation */
- mem = (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
- (GstGLAllocationParams *) params);
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- /* test wrapping raw data */
- params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
- &v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
- GST_GL_RGBA, rgba_pixel, NULL, NULL);
- mem2 =
- (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
- (GstGLAllocationParams *) params);
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- fail_if (mem == NULL);
-
- fail_unless (GST_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- /* wrapped texture creation */
- params = gst_gl_video_allocation_params_new_wrapped_texture (context, NULL,
- &v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
- GST_GL_RGBA, ((GstGLMemory *) mem)->tex_id, NULL, NULL);
- mem3 =
- (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
- (GstGLAllocationParams *) params);
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (GST_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- /* check data/flags are correct */
- fail_unless (gst_memory_map (mem2, &map_info, GST_MAP_READ));
-
- fail_unless (GST_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- fail_unless (memcmp (map_info.data, rgba_pixel,
- G_N_ELEMENTS (rgba_pixel)) == 0,
- "0x%02x%02x%02x%02x != 0x%02x%02x%02x%02x", map_info.data[0],
- map_info.data[1], map_info.data[2], map_info.data[3],
- (guint8) rgba_pixel[0], (guint8) rgba_pixel[1], (guint8) rgba_pixel[2],
- (guint8) rgba_pixel[3]);
-
- gst_memory_unmap (mem2, &map_info);
-
- fail_unless (GST_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- fail_unless (gst_memory_map (mem2, &map_info, GST_MAP_READ | GST_MAP_GL));
-
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- /* test texture copy */
- fail_unless (gst_gl_memory_copy_into ((GstGLMemory *) mem2,
- ((GstGLMemory *) mem)->tex_id, GST_GL_TEXTURE_TARGET_2D,
- GST_GL_RGBA, 1, 1));
- GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
-
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem2,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (GST_MEMORY_FLAG_IS_SET (mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- gst_memory_unmap (mem2, &map_info);
-
- /* test download of copied texture */
- fail_unless (gst_memory_map (mem, &map_info, GST_MAP_READ));
-
- fail_unless (memcmp (map_info.data, rgba_pixel,
- G_N_ELEMENTS (rgba_pixel)) == 0,
- "0x%02x%02x%02x%02x != 0x%02x%02x%02x%02x", (guint8) map_info.data[0],
- (guint8) map_info.data[1], (guint8) map_info.data[2],
- (guint8) map_info.data[3], (guint8) rgba_pixel[0], (guint8) rgba_pixel[1],
- (guint8) rgba_pixel[2], (guint8) rgba_pixel[3]);
-
- gst_memory_unmap (mem, &map_info);
-
- /* test download of wrapped copied texture */
- fail_unless (gst_memory_map (mem3, &map_info, GST_MAP_READ));
-
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- fail_unless (memcmp (map_info.data, rgba_pixel,
- G_N_ELEMENTS (rgba_pixel)) == 0,
- "0x%02x%02x%02x%02x != 0x%02x%02x%02x%02x", (guint8) map_info.data[0],
- (guint8) map_info.data[1], (guint8) map_info.data[2],
- (guint8) map_info.data[3], (guint8) rgba_pixel[0], (guint8) rgba_pixel[1],
- (guint8) rgba_pixel[2], (guint8) rgba_pixel[3]);
-
- gst_memory_unmap (mem3, &map_info);
-
- /* test upload flag */
- fail_unless (gst_memory_map (mem3, &map_info, GST_MAP_WRITE));
- gst_memory_unmap (mem3, &map_info);
-
- fail_unless (GST_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- /* test download flag */
- fail_unless (gst_memory_map (mem3, &map_info, GST_MAP_WRITE | GST_MAP_GL));
- gst_memory_unmap (mem3, &map_info);
-
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD));
- fail_unless (GST_MEMORY_FLAG_IS_SET (mem3,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- gst_memory_unref (mem);
- gst_memory_unref (mem2);
- gst_memory_unref (mem3);
- gst_object_unref (gl_allocator);
-}
-
-
-GST_START_TEST (test_transfer)
-{
- test_transfer_allocator (GST_GL_MEMORY_ALLOCATOR_NAME);
- test_transfer_allocator (GST_GL_MEMORY_PBO_ALLOCATOR_NAME);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_separate_transfer)
-{
- GstGLBaseMemoryAllocator *base_mem_alloc;
- GstGLVideoAllocationParams *params;
- GstAllocator *gl_allocator;
- GstVideoInfo v_info;
- GstMemory *mem;
- GstMapInfo info;
-
- gl_allocator = gst_allocator_find (GST_GL_MEMORY_PBO_ALLOCATOR_NAME);
- fail_if (gl_allocator == NULL);
- base_mem_alloc = GST_GL_BASE_MEMORY_ALLOCATOR (gl_allocator);
-
- gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, 1, 1);
-
- params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
- &v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
- GST_GL_RGBA, rgba_pixel, NULL, NULL);
- mem =
- (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
- (GstGLAllocationParams *) params);
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- fail_if (mem == NULL);
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- gst_gl_memory_pbo_upload_transfer ((GstGLMemoryPBO *) mem);
-
- fail_unless (!GST_MEMORY_FLAG_IS_SET (mem,
- GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD));
-
- fail_unless (gst_memory_map (mem, &info, GST_MAP_READ));
-
- fail_unless (memcmp (info.data, rgba_pixel, G_N_ELEMENTS (rgba_pixel)) == 0,
- "0x%02x%02x%02x%02x != 0x%02x%02x%02x%02x", (guint8) info.data[0],
- (guint8) info.data[1], (guint8) info.data[2],
- (guint8) info.data[3], (guint8) rgba_pixel[0], (guint8) rgba_pixel[1],
- (guint8) rgba_pixel[2], (guint8) rgba_pixel[3]);
-
- gst_memory_unmap (mem, &info);
-
- /* FIXME: add download transfer */
-
- gst_memory_unref (mem);
- gst_object_unref (gl_allocator);
-}
-
-GST_END_TEST;
-
-static Suite *
-gst_gl_memory_suite (void)
-{
- Suite *s = suite_create ("GstGLMemory");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_checked_fixture (tc_chain, setup, teardown);
- tcase_add_test (tc_chain, test_basic);
- tcase_add_test (tc_chain, test_transfer);
- tcase_add_test (tc_chain, test_separate_transfer);
-
- return s;
-}
-
-GST_CHECK_MAIN (gst_gl_memory);
diff --git a/tests/check/libs/gstglquery.c b/tests/check/libs/gstglquery.c
deleted file mode 100644
index 8563abbe5..000000000
--- a/tests/check/libs/gstglquery.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/* GStreamer
- * Copyright (C) 2016 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/gl/gl.h>
-
-#include <stdio.h>
-
-static GstGLDisplay *display;
-static GstGLContext *context;
-
-GST_DEBUG_CATEGORY_STATIC (gst_test_debug_cat);
-
-static void
-setup (void)
-{
- GError *error = NULL;
-
- display = gst_gl_display_new ();
- context = gst_gl_context_new (display);
-
- gst_gl_context_create (context, NULL, &error);
-
- fail_if (error != NULL, "Error creating context: %s\n",
- error ? error->message : "Unknown Error");
-}
-
-static void
-teardown (void)
-{
- gst_object_unref (display);
- gst_object_unref (context);
-}
-
-static void
-_test_query_init_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery q1;
-
- /* no usage */
- gst_gl_query_init (&q1, context, GST_GL_QUERY_TIMESTAMP);
- gst_gl_query_unset (&q1);
-}
-
-GST_START_TEST (test_query_init)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_init_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_init_invalid_query_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery q1;
-
- /* no usage */
- ASSERT_CRITICAL (gst_gl_query_init (&q1, context, GST_GL_QUERY_NONE));
-}
-
-GST_START_TEST (test_query_init_invalid_query)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_init_invalid_query_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_new_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery *q1;
-
- /* no usage */
- q1 = gst_gl_query_new (context, GST_GL_QUERY_TIMESTAMP);
- gst_gl_query_free (q1);
-}
-
-GST_START_TEST (test_query_new)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_new_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_time_elapsed_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery *q1;
-
- q1 = gst_gl_query_new (context, GST_GL_QUERY_TIME_ELAPSED);
- fail_if (q1 == NULL);
-
- gst_gl_query_start (q1);
- gst_gl_query_end (q1);
- /* GST_GL_QUERY_TIME_ELAPSED doesn't supported counter() */
- ASSERT_CRITICAL (gst_gl_query_counter (q1));
- gst_gl_query_result (q1);
-
- gst_gl_query_free (q1);
-}
-
-GST_START_TEST (test_query_time_elapsed)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_time_elapsed_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_start_log_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery *q1;
-
- q1 = gst_gl_query_new (context, GST_GL_QUERY_TIME_ELAPSED);
- fail_if (q1 == NULL);
-
- gst_gl_query_start_log (q1, NULL, GST_LEVEL_ERROR, NULL, "%s",
- "testing query proxy-logging for gst_gl_query_start_log()");
- gst_gl_query_end (q1);
- gst_gl_query_result (q1);
-
- gst_gl_query_free (q1);
-}
-
-GST_START_TEST (test_query_start_log)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_start_log_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_timestamp_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery q2;
-
- gst_gl_query_init (&q2, context, GST_GL_QUERY_TIMESTAMP);
-
- /* GST_GL_QUERY_TIMESTAMP doesn't supported start()/end() */
- ASSERT_CRITICAL (gst_gl_query_start (&q2));
- ASSERT_CRITICAL (gst_gl_query_end (&q2));
-
- gst_gl_query_counter (&q2);
- gst_gl_query_result (&q2);
-
- gst_gl_query_unset (&q2);
-}
-
-GST_START_TEST (test_query_timestamp)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_timestamp_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_counter_log_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery q2;
-
- gst_gl_query_init (&q2, context, GST_GL_QUERY_TIMESTAMP);
-
- gst_gl_query_counter_log (&q2, gst_test_debug_cat, GST_LEVEL_ERROR, NULL,
- "%s",
- "testing query proxy-logging works from gst_gl_query_counter_log()");
- gst_gl_query_result (&q2);
-
- gst_gl_query_unset (&q2);
-}
-
-GST_START_TEST (test_query_counter_log)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_counter_log_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_start_free_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery *q1;
-
- /* test mismatched start()/free() */
- q1 = gst_gl_query_new (context, GST_GL_QUERY_TIME_ELAPSED);
- fail_if (q1 == NULL);
-
- gst_gl_query_start (q1);
-
- ASSERT_CRITICAL (gst_gl_query_free (q1));
-}
-
-GST_START_TEST (test_query_start_free)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_start_free_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_start_result_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery *q1;
-
- /* test mismatched start()/result() */
- q1 = gst_gl_query_new (context, GST_GL_QUERY_TIME_ELAPSED);
- fail_if (q1 == NULL);
-
- gst_gl_query_start (q1);
- ASSERT_CRITICAL (gst_gl_query_result (q1));
- gst_gl_query_end (q1);
-
- gst_gl_query_free (q1);
-}
-
-GST_START_TEST (test_query_start_result)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_start_result_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_start_start_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery *q1;
-
- /* test double end() */
- q1 = gst_gl_query_new (context, GST_GL_QUERY_TIME_ELAPSED);
- fail_if (q1 == NULL);
-
- gst_gl_query_start (q1);
- ASSERT_CRITICAL (gst_gl_query_start (q1));
- gst_gl_query_end (q1);
-
- gst_gl_query_free (q1);
-}
-
-GST_START_TEST (test_query_start_start)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_start_start_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_end_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery *q1;
-
- /* test mismatched end() */
- q1 = gst_gl_query_new (context, GST_GL_QUERY_TIME_ELAPSED);
- fail_if (q1 == NULL);
- ASSERT_CRITICAL (gst_gl_query_end (q1));
- gst_gl_query_free (q1);
-}
-
-GST_START_TEST (test_query_end)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_end_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_query_end_end_gl (GstGLContext * context, gpointer data)
-{
- GstGLQuery *q1;
-
- /* test double end() */
- q1 = gst_gl_query_new (context, GST_GL_QUERY_TIME_ELAPSED);
- fail_if (q1 == NULL);
-
- gst_gl_query_start (q1);
- gst_gl_query_end (q1);
- ASSERT_CRITICAL (gst_gl_query_end (q1));
-
- gst_gl_query_free (q1);
-}
-
-GST_START_TEST (test_query_end_end)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_query_end_end_gl, NULL);
-}
-
-GST_END_TEST;
-
-static Suite *
-gst_gl_upload_suite (void)
-{
- Suite *s = suite_create ("GstGLQuery");
- TCase *tc_chain = tcase_create ("glquery");
-
- GST_DEBUG_CATEGORY_INIT (gst_test_debug_cat, "test-debug", 0,
- "proxy-logging test debug");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_checked_fixture (tc_chain, setup, teardown);
- tcase_add_test (tc_chain, test_query_init);
- tcase_add_test (tc_chain, test_query_init_invalid_query);
- tcase_add_test (tc_chain, test_query_new);
- tcase_add_test (tc_chain, test_query_time_elapsed);
- tcase_add_test (tc_chain, test_query_timestamp);
- tcase_add_test (tc_chain, test_query_counter_log);
- tcase_add_test (tc_chain, test_query_start_log);
- tcase_add_test (tc_chain, test_query_start_free);
- tcase_add_test (tc_chain, test_query_start_result);
- tcase_add_test (tc_chain, test_query_start_start);
- tcase_add_test (tc_chain, test_query_end);
- tcase_add_test (tc_chain, test_query_end_end);
-
- return s;
-}
-
-GST_CHECK_MAIN (gst_gl_upload);
diff --git a/tests/check/libs/gstglshader.c b/tests/check/libs/gstglshader.c
deleted file mode 100644
index 791872655..000000000
--- a/tests/check/libs/gstglshader.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/* GStreamer
- * Copyright (C) 2016 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/gl/gl.h>
-
-#include <stdio.h>
-
-static GstGLDisplay *display;
-static GstGLContext *context;
-
-static void
-setup (void)
-{
- GError *error = NULL;
-
- display = gst_gl_display_new ();
- context = gst_gl_context_new (display);
-
- gst_gl_context_create (context, NULL, &error);
-
- fail_if (error != NULL, "Error creating context: %s\n",
- error ? error->message : "Unknown Error");
-}
-
-static void
-teardown (void)
-{
- gst_object_unref (display);
- gst_object_unref (context);
-}
-
-static void
-_test_compile_attach_gl (GstGLContext * context, gpointer data)
-{
- GstGLShader *shader;
- GstGLSLStage *vert;
- GError *error = NULL;
-
- shader = gst_gl_shader_new (context);
- vert = gst_glsl_stage_new_default_vertex (context);
-
- fail_unless (gst_gl_shader_compile_attach_stage (shader, vert, &error));
-
- gst_object_unref (shader);
-}
-
-GST_START_TEST (test_compile_attach)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_compile_attach_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_separate_compile_attach_gl (GstGLContext * context, gpointer data)
-{
- GstGLShader *shader;
- GstGLSLStage *vert;
- GError *error = NULL;
-
- shader = gst_gl_shader_new (context);
- vert = gst_glsl_stage_new_default_vertex (context);
-
- fail_unless (gst_glsl_stage_compile (vert, &error));
- fail_unless (gst_gl_shader_attach (shader, vert));
- fail_unless (gst_gl_shader_attach (shader, vert));
-
- gst_object_unref (shader);
-}
-
-GST_START_TEST (test_separate_compile_attach)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_separate_compile_attach_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_detach_gl (GstGLContext * context, gpointer data)
-{
- GstGLShader *shader;
- GstGLSLStage *vert;
- GError *error = NULL;
-
- shader = gst_gl_shader_new (context);
- vert = gst_glsl_stage_new_default_vertex (context);
-
- fail_unless (gst_glsl_stage_compile (vert, &error));
- fail_unless (gst_gl_shader_attach (shader, vert));
- gst_gl_shader_detach (shader, vert);
-
- gst_object_unref (shader);
-}
-
-GST_START_TEST (test_detach)
-{
- gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _test_detach_gl,
- NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_link_gl (GstGLContext * context, gpointer data)
-{
- GstGLShader *shader;
- GstGLSLStage *vert, *frag;
- GError *error = NULL;
-
- shader = gst_gl_shader_new (context);
- vert = gst_glsl_stage_new_default_vertex (context);
- frag = gst_glsl_stage_new_default_fragment (context);
-
- fail_unless (gst_gl_shader_compile_attach_stage (shader, vert, &error));
- fail_unless (gst_gl_shader_compile_attach_stage (shader, frag, &error));
- fail_unless (gst_gl_shader_link (shader, &error));
- fail_unless (gst_gl_shader_is_linked (shader));
-
- gst_object_unref (shader);
-}
-
-GST_START_TEST (test_link)
-{
- gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _test_link_gl,
- NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_default_shader_gl (GstGLContext * context, gpointer data)
-{
- GstGLShader *shader;
- GError *error = NULL;
-
- shader = gst_gl_shader_new_default (context, &error);
- fail_unless (shader != NULL);
- fail_unless (error == NULL);
-
- gst_gl_shader_use (shader);
- gst_gl_context_clear_shader (context);
-
- gst_object_unref (shader);
-}
-
-GST_START_TEST (test_default_shader)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_default_shader_gl, NULL);
-}
-
-GST_END_TEST;
-
-static void
-_test_get_attribute_location_gl (GstGLContext * context, gpointer data)
-{
- GstGLShader *shader;
- GError *error = NULL;
- gint loc;
-
- shader = gst_gl_shader_new_default (context, &error);
-
- gst_gl_shader_use (shader);
-
- loc = gst_gl_shader_get_attribute_location (shader, "a_position");
- fail_unless (loc != -1);
- loc = gst_gl_shader_get_attribute_location (shader, "a_texcoord");
- fail_unless (loc != -1);
- loc = gst_gl_shader_get_attribute_location (shader, "unused_value_1928374");
- fail_unless (loc == -1);
-
- gst_object_unref (shader);
-}
-
-GST_START_TEST (test_get_attribute_location)
-{
- gst_gl_context_thread_add (context,
- (GstGLContextThreadFunc) _test_get_attribute_location_gl, NULL);
-}
-
-GST_END_TEST;
-
-static Suite *
-gst_gl_shader_suite (void)
-{
- Suite *s = suite_create ("GstGLShader");
- TCase *tc_chain = tcase_create ("glshader");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_checked_fixture (tc_chain, setup, teardown);
- tcase_add_test (tc_chain, test_compile_attach);
- tcase_add_test (tc_chain, test_separate_compile_attach);
- tcase_add_test (tc_chain, test_detach);
- tcase_add_test (tc_chain, test_link);
- tcase_add_test (tc_chain, test_default_shader);
- tcase_add_test (tc_chain, test_get_attribute_location);
-
- return s;
-}
-
-GST_CHECK_MAIN (gst_gl_shader);
diff --git a/tests/check/libs/gstglsl.c b/tests/check/libs/gstglsl.c
deleted file mode 100644
index 969d73d07..000000000
--- a/tests/check/libs/gstglsl.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/* 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/gl/gstglsl.h>
-
-#include <stdio.h>
-
-static void
-setup (void)
-{
-}
-
-static void
-teardown (void)
-{
-}
-
-/* *INDENT-OFF* */
-static const struct {GstGLSLVersion version; const gchar * name;} glsl_versions[] = {
- {GST_GLSL_VERSION_100, "100"},
- {GST_GLSL_VERSION_110, "110"},
- {GST_GLSL_VERSION_120, "120"},
- {GST_GLSL_VERSION_130, "130"},
- {GST_GLSL_VERSION_140, "140"},
- {GST_GLSL_VERSION_150, "150"},
- {GST_GLSL_VERSION_300, "300"},
- {GST_GLSL_VERSION_310, "310"},
- {GST_GLSL_VERSION_320, "320"},
- {GST_GLSL_VERSION_330, "330"},
- {GST_GLSL_VERSION_400, "400"},
- {GST_GLSL_VERSION_410, "410"},
- {GST_GLSL_VERSION_420, "420"},
- {GST_GLSL_VERSION_430, "430"},
- {GST_GLSL_VERSION_440, "440"},
- {GST_GLSL_VERSION_450, "450"},
-};
-
-static const struct {GstGLSLProfile profile; const gchar * name;} glsl_profiles[] = {
- {GST_GLSL_PROFILE_ES, "es"},
- {GST_GLSL_PROFILE_CORE, "core"},
- {GST_GLSL_PROFILE_COMPATIBILITY, "compatibility"},
-};
-
-struct version_profile_s
-{
- GstGLSLVersion version;
- GstGLSLProfile profile;
- const gchar * name;
-};
-
-static const struct version_profile_s glsl_version_profiles_valid[] = {
- {GST_GLSL_VERSION_100, GST_GLSL_PROFILE_ES, "100"},
- {GST_GLSL_VERSION_110, GST_GLSL_PROFILE_COMPATIBILITY, "110"},
- {GST_GLSL_VERSION_120, GST_GLSL_PROFILE_COMPATIBILITY, "120"},
- {GST_GLSL_VERSION_130, GST_GLSL_PROFILE_COMPATIBILITY, "130"},
- {GST_GLSL_VERSION_140, GST_GLSL_PROFILE_COMPATIBILITY, "140"},
- {GST_GLSL_VERSION_150, GST_GLSL_PROFILE_CORE, "150 core"},
- {GST_GLSL_VERSION_150, GST_GLSL_PROFILE_COMPATIBILITY, "150 compatibility"},
- {GST_GLSL_VERSION_300, GST_GLSL_PROFILE_ES, "300 es"},
- {GST_GLSL_VERSION_310, GST_GLSL_PROFILE_ES, "310 es"},
- {GST_GLSL_VERSION_320, GST_GLSL_PROFILE_ES, "320 es"},
- {GST_GLSL_VERSION_330, GST_GLSL_PROFILE_CORE, "330 core"},
- {GST_GLSL_VERSION_330, GST_GLSL_PROFILE_COMPATIBILITY, "330 compatibility"},
- {GST_GLSL_VERSION_400, GST_GLSL_PROFILE_CORE, "400 core"},
- {GST_GLSL_VERSION_400, GST_GLSL_PROFILE_COMPATIBILITY, "400 compatibility"},
- {GST_GLSL_VERSION_410, GST_GLSL_PROFILE_CORE, "410 core"},
- {GST_GLSL_VERSION_410, GST_GLSL_PROFILE_COMPATIBILITY, "410 compatibility"},
- {GST_GLSL_VERSION_420, GST_GLSL_PROFILE_CORE, "420 core"},
- {GST_GLSL_VERSION_420, GST_GLSL_PROFILE_COMPATIBILITY, "420 compatibility"},
- {GST_GLSL_VERSION_430, GST_GLSL_PROFILE_CORE, "430 core"},
- {GST_GLSL_VERSION_430, GST_GLSL_PROFILE_COMPATIBILITY, "430 compatibility"},
- {GST_GLSL_VERSION_440, GST_GLSL_PROFILE_CORE, "440 core"},
- {GST_GLSL_VERSION_440, GST_GLSL_PROFILE_COMPATIBILITY, "440 compatibility"},
- {GST_GLSL_VERSION_450, GST_GLSL_PROFILE_CORE, "450 core"},
- {GST_GLSL_VERSION_450, GST_GLSL_PROFILE_COMPATIBILITY, "450 compatibility"},
-};
-
-/* combinations that produce different results between serializing/deserializing
- * due to default values being imposed */
-static const struct version_profile_s glsl_version_profiles_valid_serialize[] = {
- {GST_GLSL_VERSION_100, GST_GLSL_PROFILE_NONE, "100"},
- {GST_GLSL_VERSION_110, GST_GLSL_PROFILE_NONE, "110"},
- {GST_GLSL_VERSION_120, GST_GLSL_PROFILE_NONE, "120"},
- {GST_GLSL_VERSION_130, GST_GLSL_PROFILE_NONE, "130"},
- {GST_GLSL_VERSION_140, GST_GLSL_PROFILE_NONE, "140"},
- {GST_GLSL_VERSION_150, GST_GLSL_PROFILE_NONE, "150"},
- {GST_GLSL_VERSION_330, GST_GLSL_PROFILE_NONE, "330"},
- {GST_GLSL_VERSION_400, GST_GLSL_PROFILE_NONE, "400"},
- {GST_GLSL_VERSION_410, GST_GLSL_PROFILE_NONE, "410"},
- {GST_GLSL_VERSION_420, GST_GLSL_PROFILE_NONE, "420"},
- {GST_GLSL_VERSION_430, GST_GLSL_PROFILE_NONE, "430"},
- {GST_GLSL_VERSION_440, GST_GLSL_PROFILE_NONE, "440"},
- {GST_GLSL_VERSION_450, GST_GLSL_PROFILE_NONE, "450"},
-};
-static const struct version_profile_s glsl_version_profiles_valid_deserialize[] = {
- {GST_GLSL_VERSION_100, GST_GLSL_PROFILE_ES, "100"},
- {GST_GLSL_VERSION_110, GST_GLSL_PROFILE_COMPATIBILITY, "110"},
- {GST_GLSL_VERSION_120, GST_GLSL_PROFILE_COMPATIBILITY, "120"},
- {GST_GLSL_VERSION_130, GST_GLSL_PROFILE_COMPATIBILITY, "130"},
- {GST_GLSL_VERSION_140, GST_GLSL_PROFILE_COMPATIBILITY, "140"},
- {GST_GLSL_VERSION_150, GST_GLSL_PROFILE_CORE, "150"},
- {GST_GLSL_VERSION_330, GST_GLSL_PROFILE_CORE, "330"},
- {GST_GLSL_VERSION_400, GST_GLSL_PROFILE_CORE, "400"},
- {GST_GLSL_VERSION_410, GST_GLSL_PROFILE_CORE, "410"},
- {GST_GLSL_VERSION_420, GST_GLSL_PROFILE_CORE, "420"},
- {GST_GLSL_VERSION_430, GST_GLSL_PROFILE_CORE, "430"},
- {GST_GLSL_VERSION_440, GST_GLSL_PROFILE_CORE, "440"},
- {GST_GLSL_VERSION_450, GST_GLSL_PROFILE_CORE, "450"},
-};
-
-static const gchar * invalid_deserialize_glsl[] = {
- "",
- " \t\r\n",
- "ael dja",
- "es",
- "core",
- "compatibility",
- "1000",
- "100 es",
- "100 core",
- "100 compatibility",
- "150 es",
- "300 core",
- "300 compatibility",
- "310 core",
- "310 compatibility",
- "320 core",
- "320 compatibility",
- "330 es",
-};
-
-static const struct {GstGLSLVersion version; GstGLSLProfile profile;} invalid_serialize_glsl[] = {
- {GST_GLSL_VERSION_100, GST_GLSL_PROFILE_CORE},
- {GST_GLSL_VERSION_100, GST_GLSL_PROFILE_COMPATIBILITY},
- {GST_GLSL_VERSION_110, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_110, GST_GLSL_PROFILE_CORE},
- {GST_GLSL_VERSION_120, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_120, GST_GLSL_PROFILE_CORE},
- {GST_GLSL_VERSION_130, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_130, GST_GLSL_PROFILE_CORE},
- {GST_GLSL_VERSION_140, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_140, GST_GLSL_PROFILE_CORE},
- {GST_GLSL_VERSION_150, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_300, GST_GLSL_PROFILE_NONE},
- {GST_GLSL_VERSION_300, GST_GLSL_PROFILE_CORE},
- {GST_GLSL_VERSION_300, GST_GLSL_PROFILE_COMPATIBILITY},
- {GST_GLSL_VERSION_310, GST_GLSL_PROFILE_NONE},
- {GST_GLSL_VERSION_310, GST_GLSL_PROFILE_CORE},
- {GST_GLSL_VERSION_310, GST_GLSL_PROFILE_COMPATIBILITY},
- {GST_GLSL_VERSION_320, GST_GLSL_PROFILE_NONE},
- {GST_GLSL_VERSION_320, GST_GLSL_PROFILE_CORE},
- {GST_GLSL_VERSION_320, GST_GLSL_PROFILE_COMPATIBILITY},
- {GST_GLSL_VERSION_330, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_400, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_410, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_420, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_430, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_440, GST_GLSL_PROFILE_ES},
- {GST_GLSL_VERSION_450, GST_GLSL_PROFILE_ES},
-};
-
-static const struct {const gchar *name; gboolean succeed; GstGLSLVersion version; GstGLSLProfile profile;} glsl_str_map[] = {
- {"//#version 100\n", FALSE, GST_GLSL_VERSION_NONE, GST_GLSL_PROFILE_NONE},
- {"/*\n#version 100*/\n", FALSE, GST_GLSL_VERSION_NONE, GST_GLSL_PROFILE_NONE},
- {"/*\r#version 100*/", FALSE, GST_GLSL_VERSION_NONE, GST_GLSL_PROFILE_NONE},
- {"#\rversion 100", FALSE, GST_GLSL_VERSION_NONE, GST_GLSL_PROFILE_NONE},
- {"#\nversion 100", FALSE, GST_GLSL_VERSION_NONE, GST_GLSL_PROFILE_NONE},
- {"\t#version 100", FALSE, GST_GLSL_VERSION_NONE, GST_GLSL_PROFILE_NONE},
- {"//\r#version 100", TRUE, GST_GLSL_VERSION_100, GST_GLSL_PROFILE_ES},
- {"//\n#version 100", TRUE, GST_GLSL_VERSION_100, GST_GLSL_PROFILE_ES},
- {"# \tversion 100", TRUE, GST_GLSL_VERSION_100, GST_GLSL_PROFILE_ES},
- {"\n#version 100", TRUE, GST_GLSL_VERSION_100, GST_GLSL_PROFILE_ES},
- {"\r#version 100", TRUE, GST_GLSL_VERSION_100, GST_GLSL_PROFILE_ES},
-};
-/* *INDENT-ON* */
-
-GST_START_TEST (test_serialization)
-{
- gint i;
-
- /* versions */
- for (i = 0; i < G_N_ELEMENTS (glsl_versions); i++) {
- GstGLSLVersion version;
- const gchar *version_s;
-
- version_s = gst_glsl_version_to_string (glsl_versions[i].version);
- fail_unless (g_strcmp0 (version_s, glsl_versions[i].name) == 0, "%s != %s",
- version_s, glsl_versions[i].name);
- version = gst_glsl_version_from_string (glsl_versions[i].name);
- fail_unless (version == glsl_versions[i].version, "%s != %s",
- gst_glsl_version_to_string (glsl_versions[i].version),
- gst_glsl_version_to_string (version));
- }
-
- /* profiles */
- for (i = 0; i < G_N_ELEMENTS (glsl_profiles); i++) {
- GstGLSLProfile profile;
- const gchar *profile_s;
-
- profile_s = gst_glsl_profile_to_string (glsl_profiles[i].profile);
- fail_unless (g_strcmp0 (profile_s, glsl_profiles[i].name) == 0, "%s != %s",
- profile_s, glsl_profiles[i].name);
- profile = gst_glsl_profile_from_string (glsl_profiles[i].name);
- fail_unless (profile == glsl_profiles[i].profile, "%s != %s",
- gst_glsl_profile_to_string (glsl_profiles[i].profile),
- gst_glsl_profile_to_string (profile));
- }
-
- for (i = 0; i < G_N_ELEMENTS (glsl_version_profiles_valid); i++) {
- gchar *version_profile_s;
- GstGLSLVersion version;
- GstGLSLProfile profile;
-
- version_profile_s =
- gst_glsl_version_profile_to_string (glsl_version_profiles_valid
- [i].version, glsl_version_profiles_valid[i].profile);
- fail_unless (g_strcmp0 (version_profile_s,
- glsl_version_profiles_valid[i].name) == 0, "%s != %s",
- version_profile_s, glsl_version_profiles_valid[i].name);
- fail_unless (gst_glsl_version_profile_from_string
- (glsl_version_profiles_valid[i].name, &version, &profile),
- "Failed to parse %s", glsl_version_profiles_valid[i].name);
- fail_unless (profile == glsl_version_profiles_valid[i].profile
- && version == glsl_version_profiles_valid[i].version, "%s != %s %s",
- glsl_version_profiles_valid[i].name,
- gst_glsl_version_to_string (version),
- gst_glsl_profile_to_string (profile));
- g_free (version_profile_s);
- }
-
- for (i = 0; i < G_N_ELEMENTS (glsl_version_profiles_valid_serialize); i++) {
- gchar *version_profile_s;
-
- version_profile_s =
- gst_glsl_version_profile_to_string
- (glsl_version_profiles_valid_serialize[i].version,
- glsl_version_profiles_valid_serialize[i].profile);
- fail_unless (g_strcmp0 (version_profile_s,
- glsl_version_profiles_valid_serialize[i].name) == 0, "%s != %s",
- version_profile_s, glsl_version_profiles_valid_serialize[i].name);
- g_free (version_profile_s);
- }
-
- for (i = 0; i < G_N_ELEMENTS (glsl_version_profiles_valid_deserialize); i++) {
- GstGLSLVersion version;
- GstGLSLProfile profile;
-
- fail_unless (gst_glsl_version_profile_from_string
- (glsl_version_profiles_valid_deserialize[i].name, &version, &profile),
- "Failed to parse %s", glsl_version_profiles_valid_deserialize[i].name);
- fail_unless (profile == glsl_version_profiles_valid_deserialize[i].profile
- && version == glsl_version_profiles_valid_deserialize[i].version,
- "%s != %s %s", glsl_version_profiles_valid_deserialize[i].name,
- gst_glsl_version_to_string (version),
- gst_glsl_profile_to_string (profile));
- }
-
- /* failures */
- for (i = 0; i < G_N_ELEMENTS (invalid_deserialize_glsl); i++) {
- GstGLSLVersion version;
- GstGLSLProfile profile;
-
- fail_if (gst_glsl_version_profile_from_string (invalid_deserialize_glsl[i],
- &version, &profile),
- "successfully deserialized %s into %s %s (should have failed)",
- invalid_deserialize_glsl[i], gst_glsl_version_to_string (version),
- gst_glsl_profile_to_string (profile));
- }
-
- /* failures */
- for (i = 0; i < G_N_ELEMENTS (invalid_serialize_glsl); i++) {
- gchar *version_profile_s;
-
- version_profile_s =
- gst_glsl_version_profile_to_string (invalid_serialize_glsl[i].version,
- invalid_serialize_glsl[i].profile);
-
- fail_if (version_profile_s != NULL,
- "successfully serialized %s from %s %s (should have failed)",
- version_profile_s,
- gst_glsl_version_to_string (invalid_serialize_glsl[i].version),
- gst_glsl_profile_to_string (invalid_serialize_glsl[i].profile));
-
- g_free (version_profile_s);
- }
-
- /* map strings to version/profile */
- for (i = 0; i < G_N_ELEMENTS (glsl_str_map); i++) {
- GstGLSLVersion version;
- GstGLSLProfile profile;
-
- fail_unless (glsl_str_map[i].succeed ==
- gst_glsl_string_get_version_profile (glsl_str_map[i].name, &version,
- &profile), "Incorrect result for parsing \'%s\': %s",
- glsl_str_map[i].name, glsl_str_map[i].succeed ? "false" : "true");
- if (glsl_str_map[i].succeed) {
- fail_unless (version == glsl_str_map[i].version, "With %s: %s != %s",
- glsl_str_map[i].name,
- gst_glsl_version_to_string (glsl_str_map[i].version),
- gst_glsl_version_to_string (version));
- fail_unless (profile == glsl_str_map[i].profile, "With %s: %s != %s",
- glsl_str_map[i].name,
- gst_glsl_profile_to_string (glsl_str_map[i].profile),
- gst_glsl_profile_to_string (profile));
- }
- }
-
- /* special ones */
- {
- GstGLSLVersion version;
- GstGLSLProfile profile;
- gchar *version_profile_s;
-
- version_profile_s =
- gst_glsl_version_profile_to_string (GST_GLSL_VERSION_100,
- GST_GLSL_PROFILE_ES);
- fail_unless (g_strcmp0 (version_profile_s, "100") == 0, "%s != 100",
- version_profile_s);
- g_free (version_profile_s);
-
- version_profile_s =
- gst_glsl_version_profile_to_string (GST_GLSL_VERSION_100,
- GST_GLSL_PROFILE_NONE);
- fail_unless (g_strcmp0 (version_profile_s, "100") == 0, "%s != 100",
- version_profile_s);
- g_free (version_profile_s);
-
- fail_unless (gst_glsl_version_profile_from_string ("100", &version,
- &profile));
- fail_unless (version == GST_GLSL_VERSION_100
- && profile == GST_GLSL_PROFILE_ES, "100 != %s %s",
- gst_glsl_version_to_string (version),
- gst_glsl_profile_to_string (profile));
- }
-}
-
-GST_END_TEST;
-
-static Suite *
-gst_gl_upload_suite (void)
-{
- Suite *s = suite_create ("GstGLSL");
- TCase *tc_chain = tcase_create ("glsl");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_checked_fixture (tc_chain, setup, teardown);
- tcase_add_test (tc_chain, test_serialization);
-
- return s;
-}
-
-GST_CHECK_MAIN (gst_gl_upload);
diff --git a/tests/check/libs/gstglslstage.c b/tests/check/libs/gstglslstage.c
deleted file mode 100644
index d497328b8..000000000
--- a/tests/check/libs/gstglslstage.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/gl/gl.h>
-#include <gst/gl/gstglfuncs.h>
-
-#include <stdio.h>
-
-static GstGLDisplay *display;
-static GstGLContext *context;
-
-static void
-setup (void)
-{
- GError *error = NULL;
-
- display = gst_gl_display_new ();
- context = gst_gl_context_new (display);
-
- gst_gl_context_create (context, NULL, &error);
-
- fail_if (error != NULL, "Error creating context: %s\n",
- error ? error->message : "Unknown Error");
-}
-
-static void
-teardown (void)
-{
- gst_object_unref (display);
- gst_object_unref (context);
-}
-
-GST_START_TEST (test_default_vertex)
-{
- GstGLSLStage *stage;
- GError *error = NULL;
-
- stage = gst_glsl_stage_new_default_vertex (context);
- fail_unless (stage != NULL);
- fail_unless (GL_VERTEX_SHADER == gst_glsl_stage_get_shader_type (stage));
-
- fail_unless (gst_glsl_stage_compile (stage, &error));
-
- gst_object_unref (stage);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_default_fragment)
-{
- GstGLSLStage *stage;
- GError *error = NULL;
-
- stage = gst_glsl_stage_new_default_fragment (context);
- fail_unless (stage != NULL);
- fail_unless (GL_FRAGMENT_SHADER == gst_glsl_stage_get_shader_type (stage));
-
- fail_unless (gst_glsl_stage_compile (stage, &error));
-
- gst_object_unref (stage);
-}
-
-GST_END_TEST;
-
-static Suite *
-gst_gl_upload_suite (void)
-{
- Suite *s = suite_create ("GstGLSL");
- TCase *tc_chain = tcase_create ("glsl");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_checked_fixture (tc_chain, setup, teardown);
- tcase_add_test (tc_chain, test_default_vertex);
- tcase_add_test (tc_chain, test_default_fragment);
-
- return s;
-}
-
-GST_CHECK_MAIN (gst_gl_upload);
diff --git a/tests/check/libs/gstglupload.c b/tests/check/libs/gstglupload.c
deleted file mode 100644
index 94320b556..000000000
--- a/tests/check/libs/gstglupload.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <gst/gl/gstglfuncs.h>
-
-#include <gst/gl/gl.h>
-
-#include <stdio.h>
-
-static GstGLDisplay *display;
-static GstGLContext *context;
-static GstGLWindow *window;
-static GstGLUpload *upload;
-static guint tex_id;
-static GstGLShader *shader;
-static GLint shader_attr_position_loc;
-static GLint shader_attr_texture_loc;
-static guint vbo, vbo_indices, vao;
-static GstGLFramebuffer *fbo;
-static GstGLMemory *fbo_tex;
-
-static const GLfloat vertices[] = {
- 1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
- -1.0f, 1.0f, 0.0f, 0.0f, 0.0f,
- -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
- 1.0f, -1.0f, 0.0f, 1.0f, 1.0f
-};
-
-static GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
-
-#define FORMAT GST_GL_RGBA
-#define WIDTH 10
-#define HEIGHT 10
-#define RED 0xff, 0x00, 0x00, 0xff
-#define GREEN 0x00, 0xff, 0x00, 0xff
-#define BLUE 0x00, 0x00, 0xff, 0xff
-
-static gchar rgba_data[] =
- { RED, GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE, RED,
- GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN,
- BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE,
- RED, RED, RED, RED, RED, RED, RED, RED, RED, RED,
- GREEN, GREEN, GREEN, GREEN, GREEN, GREEN, GREEN, GREEN, GREEN, GREEN,
- BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE,
- RED, GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE, RED,
- RED, GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE, RED,
- RED, GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE, RED,
- RED, GREEN, BLUE, RED, GREEN, BLUE, RED, GREEN, BLUE, RED
-};
-
-static void
-setup (void)
-{
- GError *error = NULL;
-
- display = gst_gl_display_new ();
- context = gst_gl_context_new (display);
-
- gst_gl_context_create (context, 0, &error);
- window = gst_gl_context_get_window (context);
-
- fail_if (error != NULL, "Error creating context: %s\n",
- error ? error->message : "Unknown Error");
-
- upload = gst_gl_upload_new (context);
-}
-
-static void
-_check_gl_error (GstGLContext * context, gpointer data)
-{
- GLuint error = context->gl_vtable->GetError ();
- fail_if (error != GL_NONE, "GL error 0x%x encountered during processing\n",
- error);
-}
-
-static void
-teardown (void)
-{
- gst_object_unref (upload);
- gst_object_unref (window);
-
- gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _check_gl_error,
- NULL);
- gst_object_unref (context);
- gst_object_unref (display);
- if (shader)
- gst_object_unref (shader);
-}
-
-static void
-_bind_buffer (GstGLContext * context)
-{
- const GstGLFuncs *gl = context->gl_vtable;
-
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, vbo_indices);
- gl->BindBuffer (GL_ARRAY_BUFFER, vbo);
-
- /* Load the vertex position */
- gl->VertexAttribPointer (shader_attr_position_loc, 3, GL_FLOAT, GL_FALSE,
- 5 * sizeof (GLfloat), (void *) 0);
-
- /* Load the texture coordinate */
- gl->VertexAttribPointer (shader_attr_texture_loc, 2, GL_FLOAT, GL_FALSE,
- 5 * sizeof (GLfloat), (void *) (3 * sizeof (GLfloat)));
-
- gl->EnableVertexAttribArray (shader_attr_position_loc);
- gl->EnableVertexAttribArray (shader_attr_texture_loc);
-}
-
-static void
-_unbind_buffer (GstGLContext * context)
-{
- const GstGLFuncs *gl = context->gl_vtable;
-
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
- gl->BindBuffer (GL_ARRAY_BUFFER, 0);
-
- gl->DisableVertexAttribArray (shader_attr_position_loc);
- gl->DisableVertexAttribArray (shader_attr_texture_loc);
-}
-
-static void
-init (gpointer data)
-{
- const GstGLFuncs *gl = context->gl_vtable;
- GError *error = NULL;
-
- shader = gst_gl_shader_new_default (context, &error);
- fail_if (shader == NULL, "failed to create shader object %s", error->message);
-
- shader_attr_position_loc =
- gst_gl_shader_get_attribute_location (shader, "a_position");
- shader_attr_texture_loc =
- gst_gl_shader_get_attribute_location (shader, "a_texcoord");
-
- fbo = gst_gl_framebuffer_new_with_default_depth (context, WIDTH, HEIGHT);
-
- {
- GstGLMemoryAllocator *allocator;
- GstGLVideoAllocationParams *params;
- GstVideoInfo v_info;
-
- allocator = gst_gl_memory_allocator_get_default (context);
- gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, WIDTH, HEIGHT);
- params =
- gst_gl_video_allocation_params_new (context, NULL, &v_info, 0, NULL,
- GST_GL_TEXTURE_TARGET_2D, FORMAT);
- fbo_tex =
- (GstGLMemory *) gst_gl_base_memory_alloc ((GstGLBaseMemoryAllocator *)
- allocator, (GstGLAllocationParams *) params);
- gst_object_unref (allocator);
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
- }
-
- if (!vbo) {
- if (gl->GenVertexArrays) {
- gl->GenVertexArrays (1, &vao);
- gl->BindVertexArray (vao);
- }
-
- gl->GenBuffers (1, &vbo);
- gl->BindBuffer (GL_ARRAY_BUFFER, vbo);
- gl->BufferData (GL_ARRAY_BUFFER, 4 * 5 * sizeof (GLfloat), vertices,
- GL_STATIC_DRAW);
-
- gl->GenBuffers (1, &vbo_indices);
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, vbo_indices);
- gl->BufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof (indices), indices,
- GL_STATIC_DRAW);
-
- if (gl->GenVertexArrays) {
- _bind_buffer (context);
- gl->BindVertexArray (0);
- }
-
- gl->BindBuffer (GL_ARRAY_BUFFER, 0);
- gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
- }
-}
-
-static void
-deinit (gpointer data)
-{
- GstGLContext *context = data;
- const GstGLFuncs *gl = context->gl_vtable;
-
- if (vbo)
- gl->DeleteBuffers (1, &vbo);
- vbo = 0;
- if (vbo_indices)
- gl->DeleteBuffers (1, &vbo_indices);
- vbo_indices = 0;
- if (vao)
- gl->DeleteVertexArrays (1, &vao);
- vao = 0;
-
- if (fbo)
- gst_object_unref (fbo);
- fbo = NULL;
-
- if (fbo_tex)
- gst_memory_unref (GST_MEMORY_CAST (fbo_tex));
- fbo_tex = NULL;
-}
-
-static gboolean
-blit_tex (gpointer data)
-{
- GstGLContext *context = data;
- const GstGLFuncs *gl = context->gl_vtable;
-
- gl->Clear (GL_COLOR_BUFFER_BIT);
-
- gst_gl_shader_use (shader);
-
- if (gl->GenVertexArrays)
- gl->BindVertexArray (vao);
- _bind_buffer (context);
-
- gl->ActiveTexture (GL_TEXTURE0);
- gl->BindTexture (GL_TEXTURE_2D, tex_id);
- gst_gl_shader_set_uniform_1i (shader, "s_texture", 0);
-
- gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
-
- if (gl->GenVertexArrays)
- gl->BindVertexArray (0);
- _unbind_buffer (context);
-
- return TRUE;
-}
-
-static void
-draw_render (gpointer data)
-{
- gst_gl_framebuffer_draw_to_texture (fbo, fbo_tex,
- (GstGLFramebufferFunc) blit_tex, data);
-}
-
-GST_START_TEST (test_upload_data)
-{
- GstCaps *in_caps, *out_caps;
- GstBuffer *inbuf, *outbuf;
- GstMapInfo map_info;
- gboolean res;
- gint i = 0;
-
- in_caps = gst_caps_from_string ("video/x-raw,format=RGBA,"
- "width=10,height=10");
- out_caps = gst_caps_from_string ("video/x-raw(memory:GLMemory),"
- "format=RGBA,width=10,height=10");
-
- gst_gl_upload_set_caps (upload, in_caps, out_caps);
-
- inbuf = gst_buffer_new_wrapped_full (0, rgba_data, WIDTH * HEIGHT * 4,
- 0, WIDTH * HEIGHT * 4, NULL, NULL);
-
- res = gst_gl_upload_perform_with_buffer (upload, inbuf, &outbuf);
- fail_if (res == FALSE, "Failed to upload buffer");
- fail_unless (GST_IS_BUFFER (outbuf));
-
- res = gst_buffer_map (outbuf, &map_info, GST_MAP_READ | GST_MAP_GL);
- fail_if (res == FALSE, "Failed to map gl memory");
-
- tex_id = *(guint *) map_info.data;
-
- gst_buffer_unmap (outbuf, &map_info);
-
- gst_gl_window_set_preferred_size (window, WIDTH, HEIGHT);
- gst_gl_window_draw (window);
-
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (init), context);
-
- while (i < 2) {
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (draw_render),
- context);
- i++;
- }
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (deinit), context);
-
- gst_caps_unref (in_caps);
- gst_caps_unref (out_caps);
- gst_buffer_unref (inbuf);
- gst_buffer_unref (outbuf);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_upload_gl_memory)
-{
- GstGLBaseMemoryAllocator *base_mem_alloc;
- GstGLVideoAllocationParams *params;
- GstBuffer *buffer, *outbuf;
- GstGLMemory *gl_mem;
- GstCaps *in_caps, *out_caps;
- GstStructure *out_s;
- GstVideoInfo in_info;
- GstMapInfo map_info;
- gint i = 0;
- gboolean res;
-
- base_mem_alloc =
- GST_GL_BASE_MEMORY_ALLOCATOR (gst_allocator_find
- (GST_GL_MEMORY_ALLOCATOR_NAME));
-
- in_caps = gst_caps_from_string ("video/x-raw,format=RGBA,width=10,height=10");
- gst_video_info_from_caps (&in_info, in_caps);
-
- /* create GL buffer */
- buffer = gst_buffer_new ();
- params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
- &in_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
- GST_GL_RGBA, rgba_data, NULL, NULL);
- gl_mem = (GstGLMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
- (GstGLAllocationParams *) params);
- gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
-
- res =
- gst_memory_map ((GstMemory *) gl_mem, &map_info,
- GST_MAP_READ | GST_MAP_GL);
- fail_if (res == FALSE, "Failed to map gl memory\n");
- tex_id = *(guint *) map_info.data;
- gst_memory_unmap ((GstMemory *) gl_mem, &map_info);
-
- gst_buffer_append_memory (buffer, (GstMemory *) gl_mem);
-
- /* at this point glupload hasn't received any buffers so can output anything */
- out_caps = gst_gl_upload_transform_caps (upload, context,
- GST_PAD_SINK, in_caps, NULL);
- out_s = gst_caps_get_structure (out_caps, 0);
- fail_unless (gst_structure_has_field_typed (out_s, "texture-target",
- GST_TYPE_LIST));
- gst_caps_unref (out_caps);
-
- /* set some output caps without setting texture-target: this should trigger RECONFIGURE */
- out_caps = gst_caps_from_string ("video/x-raw(memory:GLMemory),"
- "format=RGBA,width=10,height=10");
-
- /* set caps with texture-target not fixed. This should trigger RECONFIGURE. */
- gst_gl_upload_set_caps (upload, in_caps, out_caps);
- gst_caps_unref (out_caps);
-
- /* push a texture-target=2D buffer */
- res = gst_gl_upload_perform_with_buffer (upload, buffer, &outbuf);
- fail_unless (res == GST_GL_UPLOAD_RECONFIGURE);
- fail_if (outbuf);
-
- /* now glupload has seen a 2D buffer and so wants to transform to that */
- out_caps = gst_gl_upload_transform_caps (upload, context,
- GST_PAD_SINK, in_caps, NULL);
- out_s = gst_caps_get_structure (out_caps, 0);
- fail_unless_equals_string (gst_structure_get_string (out_s, "texture-target"),
- "2D");
- gst_caps_unref (out_caps);
-
- /* try setting the wrong type first tho */
- out_caps = gst_caps_from_string ("video/x-raw(memory:GLMemory),"
- "format=RGBA,width=10,height=10,texture-target=RECTANGLE");
- gst_gl_upload_set_caps (upload, in_caps, out_caps);
- gst_caps_unref (out_caps);
-
- res = gst_gl_upload_perform_with_buffer (upload, buffer, &outbuf);
- fail_unless (res == GST_GL_UPLOAD_RECONFIGURE);
- fail_if (outbuf);
-
- /* finally do set the correct texture-target */
- out_caps = gst_caps_from_string ("video/x-raw(memory:GLMemory),"
- "format=RGBA,width=10,height=10,texture-target=2D");
- gst_gl_upload_set_caps (upload, in_caps, out_caps);
- gst_caps_unref (out_caps);
-
- res = gst_gl_upload_perform_with_buffer (upload, buffer, &outbuf);
- fail_unless (res == GST_GL_UPLOAD_DONE, "Failed to upload buffer");
- fail_unless (GST_IS_BUFFER (outbuf));
-
- gst_gl_window_set_preferred_size (window, WIDTH, HEIGHT);
- gst_gl_window_draw (window);
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (init), context);
-
- while (i < 2) {
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (draw_render),
- context);
- i++;
- }
- gst_gl_window_send_message (window, GST_GL_WINDOW_CB (deinit), context);
-
- gst_caps_unref (in_caps);
- gst_buffer_unref (buffer);
- gst_buffer_unref (outbuf);
- gst_object_unref (base_mem_alloc);
-}
-
-GST_END_TEST;
-
-
-static Suite *
-gst_gl_upload_suite (void)
-{
- Suite *s = suite_create ("GstGLUpload");
- TCase *tc_chain = tcase_create ("upload");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_checked_fixture (tc_chain, setup, teardown);
- tcase_add_test (tc_chain, test_upload_data);
- tcase_add_test (tc_chain, test_upload_gl_memory);
-
- return s;
-}
-
-GST_CHECK_MAIN (gst_gl_upload);
diff --git a/tests/check/meson.build b/tests/check/meson.build
index d2c7a0dc6..68a770504 100644
--- a/tests/check/meson.build
+++ b/tests/check/meson.build
@@ -57,14 +57,6 @@ base_tests = [
[['elements/voaacenc.c'], not voaac_dep.found(), [voaac_dep]],
[['elements/x265enc.c'], not x265_dep.found(), [x265_dep]],
[['elements/zbar.c'], not zbar_dep.found(), [zbar_dep]],
- [['libs/gstglcolorconvert.c'], not build_gstgl, [gstgl_dep]],
- [['libs/gstglcontext.c'], not build_gstgl, [gstgl_dep]],
- [['libs/gstglheaders.c'], not build_gstgl, [gstgl_dep]],
- [['libs/gstglmatrix.c'], not build_gstgl, [gstgl_dep]],
- [['libs/gstglmemory.c'], not build_gstgl, [gstgl_dep]],
- [['libs/gstglquery.c'], not build_gstgl, [gstgl_dep]],
- [['libs/gstglsl.c'], not build_gstgl, [gstgl_dep]],
- [['libs/gstglupload.c'], not build_gstgl, [gstgl_dep]],
[['libs/h264parser.c'], false, [gstcodecparsers_dep]],
[['libs/insertbin.c'], false, [gstinsertbin_dep]],
[['libs/isoff.c'], not xml2_dep.found(), [gstisoff_dep, xml2_dep]],
diff --git a/tests/check/pipelines/simple-launch-lines.c b/tests/check/pipelines/simple-launch-lines.c
deleted file mode 100644
index f03fc94b5..000000000
--- a/tests/check/pipelines/simple-launch-lines.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
- *
- * simple_launch_lines.c: Unit test for simple pipelines
- *
- * 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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <gst/gl/gstglconfig.h>
-
-#ifndef GST_DISABLE_PARSE
-
-static GstElement *
-setup_pipeline (const gchar * pipe_descr)
-{
- GstElement *pipeline;
-
- pipeline = gst_parse_launch (pipe_descr, NULL);
- g_return_val_if_fail (GST_IS_PIPELINE (pipeline), NULL);
- return pipeline;
-}
-
-/*
- * run_pipeline:
- * @pipe: the pipeline to run
- * @desc: the description for use in messages
- * @events: is a mask of expected events
- * @tevent: is the expected terminal event.
- *
- * the poll call will time out after half a second.
- */
-static void
-run_pipeline (GstElement * pipe, const gchar * descr,
- GstMessageType events, GstMessageType tevent, GstState target_state)
-{
- GstBus *bus;
- GstMessage *message;
- GstMessageType revent;
- GstStateChangeReturn ret;
-
- g_assert (pipe);
- bus = gst_element_get_bus (pipe);
- g_assert (bus);
-
- fail_if (gst_element_set_state (pipe, target_state) ==
- GST_STATE_CHANGE_FAILURE, "Could not set pipeline %s to playing", descr);
- ret = gst_element_get_state (pipe, NULL, NULL, 10 * GST_SECOND);
- if (ret == GST_STATE_CHANGE_ASYNC) {
- g_critical ("Pipeline '%s' failed to go to PAUSED fast enough", descr);
- goto done;
- } else if ((ret != GST_STATE_CHANGE_SUCCESS)
- && (ret != GST_STATE_CHANGE_NO_PREROLL)) {
- g_critical ("Pipeline '%s' failed to go into PAUSED state (%s)", descr,
- gst_element_state_change_return_get_name (ret));
- goto done;
- }
-
- while (1) {
- message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 2);
-
- /* always have to pop the message before getting back into poll */
- if (message) {
- revent = GST_MESSAGE_TYPE (message);
- gst_message_unref (message);
- } else {
- revent = GST_MESSAGE_UNKNOWN;
- }
-
- if (revent == tevent) {
- break;
- } else if (revent == GST_MESSAGE_UNKNOWN) {
- g_critical ("Unexpected timeout in gst_bus_poll, looking for %d: %s",
- tevent, descr);
- break;
- } else if (revent & events) {
- continue;
- }
- g_critical
- ("Unexpected message received of type %d, '%s', looking for %d: %s",
- revent, gst_message_type_get_name (revent), tevent, descr);
- }
-
-done:
- fail_if (gst_element_set_state (pipe, GST_STATE_NULL) ==
- GST_STATE_CHANGE_FAILURE, "Could not set pipeline %s to NULL", descr);
- gst_element_get_state (pipe, NULL, NULL, GST_CLOCK_TIME_NONE);
- gst_object_unref (pipe);
-
- gst_bus_set_flushing (bus, TRUE);
- gst_object_unref (bus);
-}
-
-GST_START_TEST (test_glimagesink)
-{
- const gchar *s;
- GstState target_state = GST_STATE_PLAYING;
-
- s = "videotestsrc num-buffers=10 ! glimagesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-}
-
-GST_END_TEST
-GST_START_TEST (test_glfiltercube)
-{
- const gchar *s;
- GstState target_state = GST_STATE_PLAYING;
-
- s = "videotestsrc num-buffers=10 ! glupload ! glfiltercube ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-}
-
-GST_END_TEST
-#define N_EFFECTS 18
-GST_START_TEST (test_gleffects)
-{
- gchar *s;
- GstState target_state = GST_STATE_PLAYING;
- guint i;
-
- for (i = 0; i < N_EFFECTS; i++) {
- s = g_strdup_printf ("videotestsrc num-buffers=10 ! glupload ! "
- "gleffects effect=%i ! fakesink", i);
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
- g_free (s);
- }
-}
-
-GST_END_TEST
-#undef N_EFFECTS
-GST_START_TEST (test_glshader)
-{
- const gchar *s;
- GstState target_state = GST_STATE_PLAYING;
-
- s = "videotestsrc num-buffers=10 ! glupload ! glshader ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-
-#if GST_GL_HAVE_OPENGL
- s = "gltestsrc num-buffers=10 ! glshader ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-#endif
-}
-
-GST_END_TEST
-GST_START_TEST (test_glfilterapp)
-{
- const gchar *s;
- GstState target_state = GST_STATE_PLAYING;
-
- s = "videotestsrc num-buffers=10 ! glupload ! glfilterapp ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-
-#if GST_GL_HAVE_OPENGL
- s = "gltestsrc num-buffers=10 ! glfilterapp ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-#endif
-}
-
-GST_END_TEST
-#ifdef HAVE_PNG
-#if HAVE_JPEG
-GST_START_TEST (test_gloverlay)
-{
- const gchar *s;
- GstState target_state = GST_STATE_PLAYING;
-
- s = "videotestsrc num-buffers=10 ! glupload ! gloverlay ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-
-#if GST_GL_HAVE_OPENGL
- s = "gltestsrc num-buffers=10 ! gloverlay ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-#endif
-}
-
-GST_END_TEST
-#endif
-#endif
-#if GST_GL_HAVE_OPENGL
-#define N_SRCS 13
-GST_START_TEST (test_gltestsrc)
-{
- gchar *s;
- GstState target_state = GST_STATE_PLAYING;
- guint i;
-
- for (i = 0; i < N_SRCS; i++) {
- s = g_strdup_printf ("gltestsrc pattern=%i num-buffers=10 ! fakesink", i);
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
- g_free (s);
- }
-}
-
-GST_END_TEST
-#undef N_SRCS
-GST_START_TEST (test_glfilterglass)
-{
- const gchar *s;
- GstState target_state = GST_STATE_PLAYING;
-
- s = "videotestsrc num-buffers=10 ! glupload ! glfilterglass ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-
- s = "gltestsrc num-buffers=10 ! glfilterglass ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-}
-
-GST_END_TEST
-#if 0
-GST_START_TEST (test_glfilterreflectedscreen)
-{
- const gchar *s;
- GstState target_state = GST_STATE_PLAYING;
-
- s = "videotestsrc num-buffers=10 ! glupload ! glfilterreflectedscreen ! "
- "fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-
- s = "gltestsrc num-buffers=10 ! glfilterreflectedscreen ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-}
-
-GST_END_TEST
-#endif
-GST_START_TEST (test_gldeinterlace)
-{
- const gchar *s;
- GstState target_state = GST_STATE_PLAYING;
-
- s = "videotestsrc num-buffers=10 ! glupload ! gldeinterlace ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-
- s = "gltestsrc num-buffers=10 ! gldeinterlace ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-}
-
-GST_END_TEST
-GST_START_TEST (test_glmosaic)
-{
- const gchar *s;
- GstState target_state = GST_STATE_PLAYING;
-
- s = "videotestsrc num-buffers=10 ! glupload ! glmosaic ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-
- s = "gltestsrc num-buffers=10 ! glmosaic ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-}
-
-GST_END_TEST
-GST_START_TEST (test_gldifferencematte)
-{
- const gchar *s;
- GstState target_state = GST_STATE_PLAYING;
-
- s = "videotestsrc num-buffers=10 ! glupload ! gldifferencematte ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-
- s = "gltestsrc num-buffers=10 ! gldifferencematte ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN, target_state);
-}
-
-GST_END_TEST
-#endif /* GST_GL_HAVE_OPENGL */
-#endif /* !GST_DISABLE_PARSE */
-static Suite *
-simple_launch_lines_suite (void)
-{
- Suite *s = suite_create ("Pipelines");
- TCase *tc_chain = tcase_create ("linear");
-
- /* time out after 60s, not the default 3 */
- tcase_set_timeout (tc_chain, 60);
-
- suite_add_tcase (s, tc_chain);
-#ifndef GST_DISABLE_PARSE
- tcase_add_test (tc_chain, test_glimagesink);
- tcase_add_test (tc_chain, test_glfiltercube);
- tcase_add_test (tc_chain, test_gleffects);
- tcase_add_test (tc_chain, test_glshader);
- tcase_add_test (tc_chain, test_glfilterapp);
-#ifdef HAVE_PNG
-#if HAVE_JPEG
- tcase_add_test (tc_chain, test_gloverlay);
-#endif
-#endif
-#if GST_GL_HAVE_OPENGL
- tcase_add_test (tc_chain, test_gltestsrc);
- tcase_add_test (tc_chain, test_glfilterglass);
-/* tcase_add_test (tc_chain, test_glfilterreflectedscreen);*/
- tcase_add_test (tc_chain, test_glmosaic);
- tcase_add_test (tc_chain, test_gldeinterlace);
-#ifdef HAVE_PNG
- tcase_add_test (tc_chain, test_gldifferencematte);
-/* tcase_add_test (tc_chain, test_glbumper);*/
-#if HAVE_JPEG
-#endif /* HAVE_JPEG */
-#endif /* HAVE_PNG */
-#endif /* GST_GL_HAVE_OPENGL */
-#endif /* !GST_DISABLE_PARSE */
- return s;
-}
-
-GST_CHECK_MAIN (simple_launch_lines);
diff --git a/tests/examples/Makefile.am b/tests/examples/Makefile.am
index 6bf9a2e58..220254c6c 100644
--- a/tests/examples/Makefile.am
+++ b/tests/examples/Makefile.am
@@ -20,12 +20,6 @@ OPENCV_EXAMPLES=opencv
MATRIXMIX_DIR=audiomixmatrix
-if USE_OPENGL
-GL_DIR=gl
-else
-GL_DIR=
-endif
-
if HAVE_AVFOUNDATION
if HAVE_IOS
AVSAMPLE_DIR=
@@ -65,9 +59,9 @@ playout_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
playout_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) $(GST_LIBS)
SUBDIRS= codecparsers mpegts $(DIRECTFB_DIR) $(GTK_EXAMPLES) $(OPENCV_EXAMPLES) \
- $(GL_DIR) $(GTK3_DIR) $(AVSAMPLE_DIR) $(WAYLAND_DIR) $(MATRIXMIX_DIR) \
+ $(GTK3_DIR) $(AVSAMPLE_DIR) $(WAYLAND_DIR) $(MATRIXMIX_DIR) \
$(IPCPIPELINE_DIR)
-DIST_SUBDIRS= codecparsers mpegts camerabin2 directfb mxf opencv uvch264 gl gtk \
+DIST_SUBDIRS= codecparsers mpegts camerabin2 directfb mxf opencv uvch264 gtk \
avsamplesink waylandsink audiomixmatrix ipcpipeline
include $(top_srcdir)/common/parallel-subdirs.mak
diff --git a/tests/examples/gl/Makefile.am b/tests/examples/gl/Makefile.am
deleted file mode 100644
index b48d59221..000000000
--- a/tests/examples/gl/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-
-SUBDIRS =
-
-if USE_OPENGL
-
-if HAVE_WINDOW_COCOA
-SUBDIRS += cocoa
-else
-
-SUBDIRS += generic qt
-
-if HAVE_CLUTTER
-SUBDIRS += clutter
-endif
-
-if HAVE_SDL
-SUBDIRS += sdl
-endif
-
-if HAVE_GTK3
-SUBDIRS += gtk
-endif
-
-endif
-
-endif
-
-DIST_SUBDIRS=cocoa generic qt clutter sdl gtk
diff --git a/tests/examples/gl/clutter/.gitignore b/tests/examples/gl/clutter/.gitignore
deleted file mode 100644
index 9b1eb5393..000000000
--- a/tests/examples/gl/clutter/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-clutteractor
-clutteractortee
-cluttershare
diff --git a/tests/examples/gl/clutter/Makefile.am b/tests/examples/gl/clutter/Makefile.am
deleted file mode 100644
index a8e31159a..000000000
--- a/tests/examples/gl/clutter/Makefile.am
+++ /dev/null
@@ -1,48 +0,0 @@
-noinst_PROGRAMS = ##
-
-#works on win32 and X
-if HAVE_CLUTTER
-
-noinst_PROGRAMS += cluttershare
-
-cluttershare_SOURCES = cluttershare.c
-
-cluttershare_CFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_CFLAGS) $(GL_CFLAGS) $(CLUTTER_CFLAGS)
-cluttershare_LDADD=$(CLUTTER_LIBS) $(GST_PLUGINS_BASE_LIBS) \
- $(GST_LIBS) $(GL_LIBS) \
- -lgstvideo-$(GST_API_VERSION) $(top_builddir)/gst-libs/gst/gl/libgstgl-@GST_API_VERSION@.la
-
-endif
-
-
-if HAVE_CLUTTER_GLX
-if HAVE_CLUTTER_X11
-if HAVE_XCOMPOSITE
-
-noinst_PROGRAMS += clutteractor clutteractortee
-
-clutteractor_SOURCES = clutteractor.c
-
-clutteractor_CFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
- $(GL_CFLAGS) $(CLUTTER_CFLAGS) \
- $(CLUTTER_GLX_CFLAGS) $(CLUTTER_X11_CFLAGS) $(XCOMPOSITE_CFLAGS)
-clutteractor_LDADD=$(CLUTTER_LIBS) $(CLUTTER_GLX_LIBS) $(CLUTTER_X11_LIBS) \
- $(GST_PLUGINS_BASE_LIBS) $(GST_LIBS) \
- $(GL_LIBS) $(XCOMPOSITE_LIBS) -lgstvideo-$(GST_API_VERSION)
-
-clutteractortee_SOURCES = clutteractortee.c
-
-clutteractortee_CFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
- $(GL_CFLAGS) $(CLUTTER_CFLAGS) \
- $(CLUTTER_GLX_CFLAGS) $(CLUTTER_X11_CFLAGS) $(XCOMPOSITE_CFLAGS)
-clutteractortee_LDADD=$(CLUTTER_LIBS) $(CLUTTER_GLX_LIBS) $(CLUTTER_X11_LIBS) \
- $(GST_PLUGINS_BASE_LIBS) $(GST_LIBS) \
- $(GL_LIBS) $(XCOMPOSITE_LIBS) -lgstvideo-$(GST_API_VERSION)
-
-endif
-endif
-endif
diff --git a/tests/examples/gl/clutter/clutteractor.c b/tests/examples/gl/clutter/clutteractor.c
deleted file mode 100644
index 3bcd4b0ea..000000000
--- a/tests/examples/gl/clutter/clutteractor.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define CLUTTER_VERSION_MIN_REQUIRED CLUTTER_VERSION_1_8
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xcomposite.h>
-#include <clutter/clutter.h>
-#include <clutter/x11/clutter-x11.h>
-#include <clutter/glx/clutter-glx.h>
-#include <gst/gst.h>
-#include <gst/video/videooverlay.h>
-
-#define W 320
-#define H 240
-
-struct GstGLClutterActor_
-{
- Window win;
- Window root;
- ClutterActor *texture;
- ClutterActor *stage;
-};
-
-typedef struct GstGLClutterActor_ GstGLClutterActor;
-
-static gboolean
-create_actor (GstGLClutterActor * actor)
-{
- //ClutterKnot knot[2];
- //ClutterTimeline *timeline;
- ClutterAnimation *animation = NULL;
-
- actor->texture = g_object_new (CLUTTER_X11_TYPE_TEXTURE_PIXMAP,
- "window", actor->win, "automatic-updates", TRUE, NULL);
- clutter_container_add_actor (CLUTTER_CONTAINER (actor->stage),
- actor->texture);
- clutter_actor_set_scale (actor->texture, 0.2, 0.2);
- clutter_actor_set_opacity (actor->texture, 0);
- clutter_actor_show (actor->texture);
-
- //timeline =
- // clutter_timeline_new (120 /* frames */ , 50 /* frames per second. */ );
- //clutter_timeline_set_loop (timeline, TRUE);
- //clutter_timeline_start (timeline);
-
- /* Instead of our custom callback,
- * we could use a standard callback. For instance, CLUTTER_ALPHA_SINE_INC.
- */
- /*effect_template =
- clutter_effect_template_new (timeline, CLUTTER_ALPHA_SINE_INC); */
- animation =
- clutter_actor_animate (actor->texture, CLUTTER_LINEAR, 2400,
- "x", 100.0, "y", 100.0, "opacity", 0, NULL);
-
- /* knot[0].x = -10;
- knot[0].y = -10;
- knot[1].x = 160;
- knot[1].y = 120; */
-
- // Move the actor along the path:
- /* clutter_effect_path (effect_template, actor->texture, knot,
- sizeof (knot) / sizeof (ClutterKnot), NULL, NULL);
- clutter_effect_scale (effect_template, actor->texture, 1.0, 1.0, NULL, NULL);
- clutter_effect_rotate (effect_template, actor->texture,
- CLUTTER_Z_AXIS, 360.0, W / 2.0, H / 2.0, 0.0,
- CLUTTER_ROTATE_CW, NULL, NULL);
- clutter_effect_rotate (effect_template, actor->texture,
- CLUTTER_X_AXIS, 360.0, 0.0, W / 4.0, 0.0, CLUTTER_ROTATE_CW, NULL, NULL); */
-
- // Also change the actor's opacity while moving it along the path:
- // (You would probably want to use a different ClutterEffectTemplate,
- // so you could use a different alpha callback for this.)
- //clutter_effect_fade (effect_template, actor->texture, 255, NULL, NULL);
-
- g_object_unref (animation);
- //g_object_unref (timeline);
-
- return FALSE;
-}
-
-static GstBusSyncReply
-create_window (GstBus * bus, GstMessage * message, gpointer data)
-{
- GstGLClutterActor *actor = (GstGLClutterActor *) data;
- // ignore anything but 'prepare-window-handle' element messages
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- g_debug ("CREATING WINDOW");
-
- gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC
- (message)), actor->win);
- clutter_threads_add_idle ((GSourceFunc) create_actor, actor);
-
- gst_message_unref (message);
- return GST_BUS_DROP;
-}
-
-int
-main (int argc, char *argv[])
-{
- GstPipeline *pipeline;
- GstBus *bus;
- ClutterActor *stage;
- GstGLClutterActor *actor;
- Display *disp;
- Window stage_win;
- ClutterInitError clutter_err = CLUTTER_INIT_ERROR_UNKNOWN;
-
- clutter_err = clutter_init (&argc, &argv);
- if (clutter_err != CLUTTER_INIT_SUCCESS)
- g_warning ("Failed to initalize clutter: %d\n", clutter_err);
-
- gst_init (&argc, &argv);
-
- disp = clutter_x11_get_default_display ();
- if (!clutter_x11_has_composite_extension ()) {
- g_error ("XComposite extension missing");
- }
-
-
- stage = clutter_stage_get_default ();
-// clutter_actor_set_size (CLUTTER_ACTOR (stage), W*3+2, H);
-
- stage_win = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
-
- actor = g_new0 (GstGLClutterActor, 1);
- actor->stage = stage;
- actor->win = XCreateSimpleWindow (disp, stage_win, 0, 0, W, H, 0, 0, 0);
- XCompositeRedirectWindow (disp, actor->win, CompositeRedirectManual);
- XMapRaised (disp, actor->win);
- XSync (disp, FALSE);
-
- pipeline =
- GST_PIPELINE (gst_parse_launch
- ("videotestsrc ! video/x-raw, width=320, height=240, framerate=(fraction)30/1 ! "
- "gleffects effect=twirl ! glimagesink", NULL));
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
-
- gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, actor,
- NULL);
- gst_object_unref (bus);
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
- clutter_actor_show_all (stage);
-
- clutter_main ();
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/gl/clutter/clutteractortee.c b/tests/examples/gl/clutter/clutteractortee.c
deleted file mode 100644
index b05020f2d..000000000
--- a/tests/examples/gl/clutter/clutteractortee.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-#define CLUTTER_VERSION_MIN_REQUIRED CLUTTER_VERSION_1_8
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xcomposite.h>
-#include <clutter/clutter.h>
-#include <clutter/x11/clutter-x11.h>
-#include <clutter/glx/clutter-glx.h>
-#include <gst/gst.h>
-#include <gst/video/videooverlay.h>
-
-#define ROWS 3
-#define COLS 3
-#define N_ACTORS ROWS*COLS
-#define W 160
-#define H 120
-
-struct GstGLClutterActor_
-{
- Window win;
- Window root;
- ClutterActor *texture;
- ClutterActor *stage;
-};
-
-typedef struct GstGLClutterActor_ GstGLClutterActor;
-
-static gboolean
-create_actor (GstGLClutterActor * actor)
-{
- static gint xpos = 0;
- static gint ypos = 0;
- actor->texture = g_object_new (CLUTTER_X11_TYPE_TEXTURE_PIXMAP,
- "window", actor->win, "automatic-updates", TRUE, NULL);
- clutter_container_add_actor (CLUTTER_CONTAINER (actor->stage),
- actor->texture);
- clutter_actor_set_position (actor->texture, xpos, ypos);
-
- if (xpos > (COLS - 1) * W) {
- xpos = 0;
- ypos += H + 1;
- } else
- xpos += W + 1;
- clutter_actor_show (actor->texture);
-
- return FALSE;
-}
-
-static GstBusSyncReply
-create_window (GstBus * bus, GstMessage * message, gpointer data)
-{
- GstGLClutterActor **actor = (GstGLClutterActor **) data;
- static gint count = 0;
- static GMutex mutex;
- // ignore anything but 'prepare-window-handle' element messages
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- g_mutex_lock (&mutex);
-
- if (count < N_ACTORS) {
- g_message ("adding actor %d", count);
- gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC
- (message)), actor[count]->win);
- clutter_threads_add_idle ((GSourceFunc) create_actor, actor[count]);
- count++;
- }
-
- g_mutex_unlock (&mutex);
-
- gst_message_unref (message);
- return GST_BUS_DROP;
-}
-
-#if 0
-void
-apply_fx (GstElement * element, const gchar * fx)
-{
- GEnumClass *p_class;
-
- /* from fxtest ;) */
- /* heeeellppppp!! */
- p_class =
- G_PARAM_SPEC_ENUM (g_object_class_find_property (G_OBJECT_GET_CLASS
- (G_OBJECT (data)), "effect")
- )->enum_class;
-
- g_print ("setting: %s - %s\n", fx, g_enum_get_value_by_nick (p_class,
- fx)->value_name);
- g_object_set (G_OBJECT (element), "effect", g_enum_get_value_by_nick (p_class,
- fx)->value, NULL);
-}
-#endif
-
-int
-main (int argc, char *argv[])
-{
- GstPipeline *pipeline;
- GstBus *bus;
-
- GstElement *srcbin;
- GstElement *tee;
- GstElement *queue[N_ACTORS], *sink[N_ACTORS];
- GstElement *upload[N_ACTORS];
-/*
- GstElement *effect[N_ACTORS];
-*/
- ClutterActor *stage;
- GstGLClutterActor *actor[N_ACTORS];
- Display *disp;
- Window stage_win;
- const gchar *desc;
- gint i;
- gint ok = FALSE;
- ClutterInitError clutter_err = CLUTTER_INIT_ERROR_UNKNOWN;
-
- clutter_err = clutter_init (&argc, &argv);
- if (clutter_err != CLUTTER_INIT_SUCCESS)
- g_warning ("Failed to initalize clutter: %d\n", clutter_err);
-
- gst_init (&argc, &argv);
-
- disp = clutter_x11_get_default_display ();
- if (!clutter_x11_has_composite_extension ()) {
- g_error ("XComposite extension missing");
- }
-
- stage = clutter_stage_get_default ();
- clutter_actor_set_size (CLUTTER_ACTOR (stage),
- W * COLS + (COLS - 1), H * ROWS + (ROWS - 1));
-
- stage_win = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
- XCompositeRedirectSubwindows (disp, stage_win, CompositeRedirectManual);
-
- for (i = 0; i < N_ACTORS; i++) {
- actor[i] = g_new0 (GstGLClutterActor, 1);
- actor[i]->stage = stage;
- actor[i]->win = XCreateSimpleWindow (disp, stage_win, 0, 0, W, H, 0, 0, 0);
- XMapRaised (disp, actor[i]->win);
- XSync (disp, FALSE);
- }
-/*
- desc = g_strdup_printf ("v4l2src ! "
- "video/x-raw, width=640, height=480, framerate=30/1 ! "
- "videoscale !"
- "video/x-raw, width=%d, height=%d ! "
- "identity", W, H);
-*/
- desc = g_strdup_printf ("videotestsrc ! "
- "video/x-raw, format=RGB, width=%d, height=%d !" "identity", W, H);
- pipeline = GST_PIPELINE (gst_pipeline_new (NULL));
-
- srcbin = gst_parse_bin_from_description (desc, TRUE, NULL);
- if (!srcbin)
- g_error ("Source bin creation failed");
-
- tee = gst_element_factory_make ("tee", NULL);
-
- gst_bin_add_many (GST_BIN (pipeline), srcbin, tee, NULL);
-
- for (i = 0; i < N_ACTORS; i++) {
- queue[i] = gst_element_factory_make ("queue", NULL);
- upload[i] = gst_element_factory_make ("glupload", NULL);
-/* effect[i] = gst_element_factory_make ("gleffects", NULL); */
- sink[i] = gst_element_factory_make ("glimagesink", NULL);
-/* gst_bin_add_many (GST_BIN (pipeline),
- queue[i], upload[i], effect[i], sink[i], NULL); */
- gst_bin_add_many (GST_BIN (pipeline), queue[i], upload[i], sink[i], NULL);
- }
-
- gst_element_link_many (srcbin, tee, NULL);
-
- for (i = 0; i < N_ACTORS; i++) {
- ok |=
-// gst_element_link_many (tee, queue[i], upload[i], effect[i], sink[i],
- gst_element_link_many (tee, queue[i], upload[i], sink[i], NULL);
- }
-
- if (!ok)
- g_error ("Failed to link one or more elements");
-
-/*
- for (i = 0; i < N_ACTORS; i++) {
- g_message ("setting effect %d on %s", i + 1,
- gst_element_get_name (effect[i]));
- g_object_set (G_OBJECT (effect[i]), "effect", i + 1, NULL);
- }
-*/
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
-
- gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, actor,
- NULL);
- gst_object_unref (bus);
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
- clutter_actor_show_all (stage);
-
- clutter_main ();
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/gl/clutter/cluttershare.c b/tests/examples/gl/clutter/cluttershare.c
deleted file mode 100644
index ee4eb7d31..000000000
--- a/tests/examples/gl/clutter/cluttershare.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <GL/gl.h>
-
-#define CLUTTER_VERSION_MIN_REQUIRED CLUTTER_VERSION_1_8
-#define CLUTTER_VERSION_MAX_ALLOWED CLUTTER_VERSION_1_10
-#define COGL_VERSION_MIN_REQUIRED COGL_VERSION_ENCODE (1, 16, 0)
-#define COGL_VERSION_MAX_ALLOWED COGL_VERSION_ENCODE (1, 18, 0)
-#include <clutter/clutter.h>
-#ifndef WIN32
-#include <clutter/x11/clutter-x11.h>
-#include <GL/glx.h>
-#endif
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <gst/video/gstvideometa.h>
-#include <gst/gl/gl.h>
-
-/* This example shows how to use textures that come from a
- * gst-plugins-gl pipeline, into the clutter framework
- * It requires at least clutter 0.8.6
- */
-
-/* rotation */
-static void
-on_new_frame (ClutterTimeline * timeline, gint msecs, gpointer data)
-{
- ClutterActor *rect_actor = CLUTTER_ACTOR (data);
- ClutterActor *texture_actor =
- g_object_get_data (G_OBJECT (timeline), "texture_actor");
-
- clutter_actor_set_rotation (rect_actor, CLUTTER_Z_AXIS,
- 60.0 * (gdouble) msecs / 1000.0, clutter_actor_get_width (rect_actor) / 2,
- clutter_actor_get_height (rect_actor) / 2, 0);
-
- clutter_actor_set_rotation (texture_actor, CLUTTER_Z_AXIS,
- 60.0 * (gdouble) msecs / 1000.0,
- clutter_actor_get_width (texture_actor) / 6,
- clutter_actor_get_height (texture_actor) / 6, 0);
-}
-
-
-/* clutter scene */
-static ClutterActor *
-setup_stage (ClutterStage * stage)
-{
- ClutterTimeline *timeline = NULL;
- ClutterActor *texture_actor = NULL;
- ClutterColor rect_color = { 125, 50, 200, 255 };
- ClutterActor *rect_actor = NULL;
-
- /* texture actor */
-
- texture_actor = clutter_texture_new ();
- clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture_actor);
- clutter_actor_set_position (texture_actor, 300, 170);
- clutter_actor_set_scale (texture_actor, 0.6, 0.6);
- clutter_actor_show (texture_actor);
- g_object_set_data (G_OBJECT (texture_actor), "stage", stage);
-
- /* rectangle actor */
-
- rect_actor = clutter_rectangle_new_with_color (&rect_color);
- clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect_actor);
- clutter_actor_set_size (rect_actor, 50, 50);
- clutter_actor_set_position (rect_actor, 300, 300);
- clutter_actor_show (rect_actor);
-
- /* timeline */
-
- timeline = clutter_timeline_new (6000);
- g_object_set_data (G_OBJECT (timeline), "texture_actor", texture_actor);
- clutter_timeline_set_loop (timeline, TRUE);
- clutter_timeline_start (timeline);
- g_signal_connect (timeline, "new-frame", G_CALLBACK (on_new_frame),
- rect_actor);
-
- return texture_actor;
-}
-
-/* put a gst gl buffer in the texture actor */
-static gboolean
-update_texture_actor (gpointer data)
-{
- ClutterTexture *texture_actor = (ClutterTexture *) data;
- GAsyncQueue *queue_input_buf =
- g_object_get_data (G_OBJECT (texture_actor), "queue_input_buf");
- GAsyncQueue *queue_output_buf =
- g_object_get_data (G_OBJECT (texture_actor), "queue_output_buf");
- GstBuffer *inbuf = g_async_queue_pop (queue_input_buf);
- ClutterActor *stage = g_object_get_data (G_OBJECT (texture_actor), "stage");
- CoglHandle cogl_texture = 0;
- GstVideoMeta *v_meta;
- GstVideoInfo info;
- GstVideoFrame frame;
- guint tex_id;
-
- v_meta = gst_buffer_get_video_meta (inbuf);
- if (!v_meta) {
- g_warning ("Required Meta was not found on buffers");
- return FALSE;
- }
-
- gst_video_info_set_format (&info, v_meta->format, v_meta->width,
- v_meta->height);
-
- if (!gst_video_frame_map (&frame, &info, inbuf, GST_MAP_READ | GST_MAP_GL)) {
- g_warning ("Failed to map video frame");
- return FALSE;
- }
-
- if (!gst_is_gl_memory (frame.map[0].memory)) {
- g_warning ("Input buffer does not have GLMemory");
- gst_video_frame_unmap (&frame);
- return FALSE;
- }
-
- tex_id = *(guint *) frame.data[0];
-
- /* Create a cogl texture from the gst gl texture */
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, tex_id);
- if (glGetError () != GL_NO_ERROR)
- g_debug ("failed to bind texture that comes from gst-gl\n");
- cogl_texture = cogl_texture_new_from_foreign (tex_id,
- GL_TEXTURE_2D, v_meta->width, v_meta->height, 0, 0,
- COGL_PIXEL_FORMAT_RGBA_8888);
- glBindTexture (GL_TEXTURE_2D, 0);
-
- gst_video_frame_unmap (&frame);
-
- /* Previous cogl texture is replaced and so its ref counter discreases to 0.
- * According to the source code, glDeleteTexture is not called when the previous
- * ref counter of the previous cogl texture is reaching 0 because is_foreign is TRUE */
- clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (texture_actor),
- cogl_texture);
- cogl_handle_unref (cogl_texture);
-
- /* we can now show the clutter scene if not yet visible */
- if (!CLUTTER_ACTOR_IS_VISIBLE (stage))
- clutter_actor_show_all (stage);
-
- /* push buffer so it can be unref later */
- g_async_queue_push (queue_output_buf, inbuf);
-
- return FALSE;
-}
-
-
-/* fakesink handoff callback */
-static void
-on_gst_buffer (GstElement * element, GstBuffer * buf, GstPad * pad,
- ClutterActor * texture_actor)
-{
- GAsyncQueue *queue_input_buf = NULL;
- GAsyncQueue *queue_output_buf = NULL;
-
- /* ref then push buffer to use it in clutter */
- gst_buffer_ref (buf);
- queue_input_buf =
- g_object_get_data (G_OBJECT (texture_actor), "queue_input_buf");
- g_async_queue_push (queue_input_buf, buf);
- if (g_async_queue_length (queue_input_buf) > 2)
- clutter_threads_add_idle_full (G_PRIORITY_HIGH, update_texture_actor,
- texture_actor, NULL);
-
- /* pop then unref buffer we have finished to use in clutter */
- queue_output_buf =
- g_object_get_data (G_OBJECT (texture_actor), "queue_output_buf");
- if (g_async_queue_length (queue_output_buf) > 2) {
- GstBuffer *buf_old = g_async_queue_pop (queue_output_buf);
- gst_buffer_unref (buf_old);
- }
-}
-
-/* gst bus signal watch callback */
-static void
-end_stream_cb (GstBus * bus, GstMessage * msg, gpointer data)
-{
- switch (GST_MESSAGE_TYPE (msg)) {
-
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_print
- ("For more information, try to run: GST_DEBUG=gldisplay:2 ./cluttershare\n");
- break;
-
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, &debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- if (debug) {
- g_print ("Debug deails: %s\n", debug);
- g_free (debug);
- }
-
- break;
- }
-
- default:
- break;
- }
-
- clutter_main_quit ();
-}
-
-int
-main (int argc, char *argv[])
-{
- ClutterInitError clutter_err = CLUTTER_INIT_ERROR_UNKNOWN;
-#ifdef WIN32
- HGLRC clutter_gl_context = 0;
- HDC clutter_dc = 0;
-#else
- Display *clutter_display = NULL;
- Window clutter_win = 0;
- GLXContext clutter_gl_context = NULL;
-#endif
- GstPipeline *pipeline = NULL;
- GstBus *bus = NULL;
- GstElement *glfilter = NULL;
- GstState state = 0;
- ClutterActor *stage = NULL;
- ClutterActor *clutter_texture = NULL;
- GAsyncQueue *queue_input_buf = NULL;
- GAsyncQueue *queue_output_buf = NULL;
- GstElement *fakesink = NULL;
-
- /* init gstreamer then clutter */
-
- gst_init (&argc, &argv);
- clutter_threads_init ();
- clutter_err = clutter_init (&argc, &argv);
- if (clutter_err != CLUTTER_INIT_SUCCESS)
- g_warning ("Failed to initalize clutter: %d\n", clutter_err);
- clutter_threads_enter ();
- g_print ("clutter version: %s\n", CLUTTER_VERSION_S);
- clutter_set_default_frame_rate (2);
-
- /* avoid to dispatch unecesary events */
- clutter_ungrab_keyboard ();
- clutter_ungrab_pointer ();
-
- /* retrieve and turn off clutter opengl context */
- stage = clutter_stage_get_default ();
-
-#ifdef WIN32
- clutter_gl_context = wglGetCurrentContext ();
- clutter_dc = wglGetCurrentDC ();
- wglMakeCurrent (0, 0);
-#else
- clutter_display = clutter_x11_get_default_display ();
- clutter_win = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
- clutter_gl_context = glXGetCurrentContext ();
- glXMakeCurrent (clutter_display, None, 0);
-#endif
-
- /* setup gstreamer pipeline */
-
- pipeline =
- GST_PIPELINE (gst_parse_launch
- ("videotestsrc ! video/x-raw, width=320, height=240, framerate=(fraction)30/1 ! "
- "gleffects effect=5 ! glfiltercube ! fakesink sync=1", NULL));
-
- /* setup bus */
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch (bus);
- g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb), NULL);
- g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb), NULL);
- g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), NULL);
- gst_object_unref (bus);
-
- /* clutter_gl_context is an external OpenGL context with which gst-plugins-gl want to share textures */
- glfilter = gst_bin_get_by_name (GST_BIN (pipeline), "glfiltercube0");
- g_object_set (G_OBJECT (glfilter), "external-opengl-context",
- clutter_gl_context, NULL);
- gst_object_unref (glfilter);
-
- /* NULL to PAUSED state pipeline to make sure the gst opengl context is created and
- * shared with the clutter one */
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
- state = GST_STATE_PAUSED;
- if (gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL,
- GST_CLOCK_TIME_NONE) != GST_STATE_CHANGE_SUCCESS) {
- g_debug ("failed to pause pipeline\n");
- return -1;
- }
-
- /* turn on back clutter opengl context */
-#ifdef WIN32
- wglMakeCurrent (clutter_dc, clutter_gl_context);
-#else
- glXMakeCurrent (clutter_display, clutter_win, clutter_gl_context);
-#endif
-
- /* clutter stage */
- clutter_actor_set_size (stage, 640, 480);
- clutter_actor_set_position (stage, 0, 0);
- clutter_stage_set_title (CLUTTER_STAGE (stage), "clutter and gst-plugins-gl");
- clutter_texture = setup_stage (CLUTTER_STAGE (stage));
-
- /* append a gst-gl texture to this queue when you do not need it no more */
- queue_input_buf = g_async_queue_new ();
- queue_output_buf = g_async_queue_new ();
- g_object_set_data (G_OBJECT (clutter_texture), "queue_input_buf",
- queue_input_buf);
- g_object_set_data (G_OBJECT (clutter_texture), "queue_output_buf",
- queue_output_buf);
-
- /* set a callback to retrieve the gst gl textures */
- fakesink = gst_bin_get_by_name (GST_BIN (pipeline), "fakesink0");
- g_object_set (G_OBJECT (fakesink), "signal-handoffs", TRUE, NULL);
- g_signal_connect (fakesink, "handoff", G_CALLBACK (on_gst_buffer),
- clutter_texture);
- gst_object_unref (fakesink);
-
- /* play gst */
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
- /* main loop */
- clutter_main ();
-
- /* before to deinitialize the gst-gl-opengl context,
- * no shared context (here the clutter one) must be current
- */
-#ifdef WIN32
- wglMakeCurrent (0, 0);
-#else
- glXMakeCurrent (clutter_display, None, 0);
-#endif
-
- clutter_threads_leave ();
-
- /* stop and clean up the pipeline */
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- /* make sure there is no pending gst gl buffer in the communication queues
- * between clutter and gst-gl
- */
- while (g_async_queue_length (queue_input_buf) > 0) {
- GstBuffer *buf = g_async_queue_pop (queue_input_buf);
- gst_buffer_unref (buf);
- }
-
- while (g_async_queue_length (queue_output_buf) > 0) {
- GstBuffer *buf = g_async_queue_pop (queue_output_buf);
- gst_buffer_unref (buf);
- }
-
- g_print ("END\n");
-
- return 0;
-}
diff --git a/tests/examples/gl/clutter/cluttershare.cbp b/tests/examples/gl/clutter/cluttershare.cbp
deleted file mode 100644
index cb4907e6d..000000000
--- a/tests/examples/gl/clutter/cluttershare.cbp
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="cluttershare" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\cluttershare" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\cluttershare" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-ansi" />
- <Add option="-std=c89" />
- <Add option="-DWIN32" />
- <Add directory="..\..\..\..\clutter\include\clutter-0.8" />
- <Add directory="C:\gstreamer\include\glib-2.0" />
- <Add directory="C:\gstreamer\lib\glib-2.0\include" />
- <Add directory="C:\gstreamer\include\gstreamer-1.0" />
- <Add directory="C:\gstreamer\include\pango-1.0" />
- <Add directory="C:\gstreamer\include\cairo" />
- <Add directory="C:\gstreamer\include\libxml2" />
- <Add directory="C:\gstreamer\include" />
- </Compiler>
- <Linker>
- <Add library="clutter-win32-0.8" />
- <Add library="gio-2.0" />
- <Add library="gthread-2.0" />
- <Add library="gobject-2.0" />
- <Add library="gstreamer-1.0" />
- <Add library="gmodule-2.0" />
- <Add library="gstvideo-1.0" />
- <Add library="glib-2.0" />
- <Add library="pangocairo-1.0" />
- <Add library="pangowin32-1.0" />
- <Add library="pango-1.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="cairo" />
- <Add library="glu32" />
- <Add library="opengl32" />
- <Add library="gdi32" />
- <Add library="winmm" />
- <Add directory="..\..\..\..\clutter\lib" />
- <Add directory="C:\gstreamer\lib" />
- <Add directory="C:\gstreamer\bin" />
- <Add directory="..\..\..\..\gtk+\lib" />
- </Linker>
- <Unit filename="cluttershare.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/tests/examples/gl/cocoa/.gitignore b/tests/examples/gl/cocoa/.gitignore
deleted file mode 100644
index 5cfb85ef2..000000000
--- a/tests/examples/gl/cocoa/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-cocoa-videooverlay
diff --git a/tests/examples/gl/cocoa/Makefile.am b/tests/examples/gl/cocoa/Makefile.am
deleted file mode 100755
index 9148f8a4a..000000000
--- a/tests/examples/gl/cocoa/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-if HAVE_WINDOW_COCOA
-
-noinst_PROGRAMS = cocoa-videooverlay
-
-cocoa_videooverlay_SOURCES = cocoa-videooverlay.m
-
-cocoa_videooverlay_OBJCFLAGS=-Wno-error=unused-command-line-argument \
- -fobjc-arc \
- -I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
- $(GL_CFLAGS) $(GL_OBJCFLAGS)
-
-cocoa_videooverlay_LDADD=$(GST_PLUGINS_BASE_LIBS) $(GST_LIBS) \
- $(GL_LIBS) -lgstvideo-$(GST_API_VERSION)
-
-endif
diff --git a/tests/examples/gl/cocoa/cocoa-videooverlay.m b/tests/examples/gl/cocoa/cocoa-videooverlay.m
deleted file mode 100755
index 3151726bc..000000000
--- a/tests/examples/gl/cocoa/cocoa-videooverlay.m
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include <Cocoa/Cocoa.h>
-#include <gst/gst.h>
-#include <gst/video/videooverlay.h>
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
-#define NSEventMaskAny NSAnyEventMask
-#define NSWindowStyleMaskTitled NSTitledWindowMask
-#define NSWindowStyleMaskClosable NSClosableWindowMask
-#define NSWindowStyleMaskResizable NSResizableWindowMask
-#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
-#endif
-
-/* ============================================================= */
-/* */
-/* MainWindow */
-/* */
-/* ============================================================= */
-
-@interface MainWindow: NSWindow <NSApplicationDelegate> {
- GMainLoop *m_loop;
- GstElement *m_pipeline;
- gboolean m_isClosed;
-}
-- (id) initWithContentRect:(NSRect) contentRect Loop:(GMainLoop*)loop Pipeline:(GstElement*)pipeline;
-- (GMainLoop*) loop;
-- (GstElement*) pipeline;
-- (gboolean) isClosed;
-@end
-
-@implementation MainWindow
-
-- (id) initWithContentRect:(NSRect)contentRect Loop:(GMainLoop*)loop Pipeline:(GstElement*)pipeline
-{
- m_loop = loop;
- m_pipeline = pipeline;
- m_isClosed = FALSE;
-
- self = [super initWithContentRect: contentRect
- styleMask: (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
- NSWindowStyleMaskResizable | NSWindowStyleMaskMiniaturizable)
- backing: NSBackingStoreBuffered defer: NO screen: nil];
-
- [self setReleasedWhenClosed:NO];
- [[NSApplication sharedApplication] setDelegate:self];
-
- [self setTitle:@"gst-plugins-gl implements videooverlay interface"];
-
- return self;
-}
-
-- (GMainLoop*) loop {
- return m_loop;
-}
-
-- (GstElement*) pipeline {
- return m_pipeline;
-}
-
-- (gboolean) isClosed {
- return m_isClosed;
-}
-
-- (void) customClose {
- m_isClosed = TRUE;
-}
-
-- (BOOL) windowShouldClose:(id)sender {
- gst_element_send_event (m_pipeline, gst_event_new_eos ());
- return YES;
-}
-
-- (void) applicationDidFinishLaunching: (NSNotification *) not {
- [self makeMainWindow];
- [self center];
- [self orderFront:self];
-}
-
-- (BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app {
- return NO;
-}
-
-@end
-
-
-/* ============================================================= */
-/* */
-/* gstreamer callbacks */
-/* */
-/* ============================================================= */
-
-
-static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, MainWindow* window)
-{
- // ignore anything but 'prepare-window-handle' element messages
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- g_print ("setting window handle %lud\n", (gulong) window);
-
- gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), (guintptr) [window contentView]);
-
- gst_message_unref (message);
-
- return GST_BUS_DROP;
-}
-
-
-static void end_stream_cb(GstBus* bus, GstMessage* message, MainWindow* window)
-{
- g_print ("end of stream\n");
-
- gst_element_set_state ([window pipeline], GST_STATE_NULL);
- gst_object_unref ([window pipeline]);
- g_main_loop_quit ([window loop]);
-
- [window performSelectorOnMainThread:@selector(customClose) withObject:nil waitUntilDone:YES];
-}
-
-static gpointer thread_func (MainWindow* window)
-{
- g_main_loop_run ([window loop]);
-
- return NULL;
-}
-
-
-/* ============================================================= */
-/* */
-/* application */
-/* */
-/* ============================================================= */
-
-int main(int argc, char **argv)
-{
- int width = 640;
- int height = 480;
-
- GMainLoop *loop = NULL;
- GstElement *pipeline = NULL;
-
- GstElement *videosrc = NULL;
- GstElement *videosink = NULL;
- GstCaps *caps=NULL;
- gboolean ok=FALSE;
- GstBus *bus=NULL;
- GThread *loop_thread=NULL;
- NSRect rect;
- MainWindow *window=nil;
-
- [NSApplication sharedApplication];
-
- g_print("app created\n");
-
- gst_init (&argc, &argv);
-
- loop = g_main_loop_new (NULL, FALSE);
- pipeline = gst_pipeline_new ("pipeline");
-
- videosrc = gst_element_factory_make ("videotestsrc", "videotestsrc");
- videosink = gst_element_factory_make ("glimagesink", "glimagesink");
-
- g_object_set(G_OBJECT(videosrc), "num-buffers", 500, NULL);
-
- gst_bin_add_many (GST_BIN (pipeline), videosrc, videosink, NULL);
-
- caps = gst_caps_new_simple("video/x-raw",
- "width", G_TYPE_INT, width,
- "height", G_TYPE_INT, height,
- "framerate", GST_TYPE_FRACTION, 25, 1,
- "format", G_TYPE_STRING, "I420",
- NULL);
-
- ok = gst_element_link_filtered(videosrc, videosink, caps);
- gst_caps_unref(caps);
- if (!ok)
- g_warning("could not link videosrc to videosink\n");
-
- rect.origin.x = 0; rect.origin.y = 0;
- rect.size.width = width; rect.size.height = height;
-
- window = [[MainWindow alloc] initWithContentRect:rect Loop:loop Pipeline:pipeline];
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch (bus);
- /* NOTE: window is not bridge_retained because its lifetime is just this function */
- g_signal_connect(bus, "message::error", G_CALLBACK(end_stream_cb), (__bridge gpointer)window);
- g_signal_connect(bus, "message::warning", G_CALLBACK(end_stream_cb), (__bridge gpointer)window);
- g_signal_connect(bus, "message::eos", G_CALLBACK(end_stream_cb), (__bridge gpointer)window);
- gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, (__bridge gpointer)window, NULL);
- gst_object_unref (bus);
-
- loop_thread = g_thread_new (NULL,
- (GThreadFunc) thread_func, (__bridge gpointer)window);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- [window orderFront:window];
-
- while (![window isClosed]) {
- NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny
- untilDate:[NSDate dateWithTimeIntervalSinceNow:1]
- inMode:NSDefaultRunLoopMode dequeue:YES];
- if (event)
- [NSApp sendEvent:event];
- }
-
- g_thread_join (loop_thread);
-
- return 0;
-}
diff --git a/tests/examples/gl/generic/Makefile.am b/tests/examples/gl/generic/Makefile.am
deleted file mode 100644
index a334e12e3..000000000
--- a/tests/examples/gl/generic/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-
-SUBDIRS = cube cubeyuv doublecube recordgraphic
diff --git a/tests/examples/gl/generic/README b/tests/examples/gl/generic/README
deleted file mode 100644
index a91d6bffe..000000000
--- a/tests/examples/gl/generic/README
+++ /dev/null
@@ -1,21 +0,0 @@
---- Description of the generic (no GUI) examples ---
-
-- cube:
-Show how to have a graphic FPS greater than the input video frame rate.
-The source is the videotestsrc rgb.
-
-- cubeyuv:
-Show how to have a graphic FPS greater than the input video frame rate.
-The source is a local video file needed in argument.
-The colorspace conversion is maded by the glupload element.
-
-- doublecube:
-A local video source is displayed into two renderers.
-The first one is a normal 2D screen, the second is a 3D cube.
-We can visually check that the video is displayed at the same speed
-in the two renderers.
-
-- recordgraphic:
-Show how to use the glfilterapp to define the draw callback in a gstreamer client code.
-The scene is recorded into an avi file using mpeg4 encoder.
-The colorspace conversion is made by the gldownload element.
diff --git a/tests/examples/gl/generic/cube/.gitignore b/tests/examples/gl/generic/cube/.gitignore
deleted file mode 100644
index 3c088ddc8..000000000
--- a/tests/examples/gl/generic/cube/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-cube
diff --git a/tests/examples/gl/generic/cube/Makefile.am b/tests/examples/gl/generic/cube/Makefile.am
deleted file mode 100644
index e1b0cef6f..000000000
--- a/tests/examples/gl/generic/cube/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-
-noinst_PROGRAMS = cube
-
-cube_SOURCES = main.cpp
-
-cube_CXXFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) $(GL_CFLAGS)
-cube_LDADD=$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) $(GST_LIBS) $(GL_LIBS)
-
diff --git a/tests/examples/gl/generic/cube/main.cpp b/tests/examples/gl/generic/cube/main.cpp
deleted file mode 100644
index 730d952cb..000000000
--- a/tests/examples/gl/generic/cube/main.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-#include <gst/gl/gstglfuncs.h>
-
-
-#include <iostream>
-#include <string>
-
-static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data)
-{
- GMainLoop *loop = (GMainLoop*)data;
-
- switch (GST_MESSAGE_TYPE (msg))
- {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, &debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- if (debug)
- {
- g_print ("Debug deails: %s\n", debug);
- g_free (debug);
- }
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-//client reshape callback
-static gboolean reshapeCallback (void *gl_sink, void *context, GLuint width, GLuint height, gpointer data)
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
-
- return TRUE;
-}
-
-//client draw callback
-static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSample * sample, gpointer data)
-{
- static GLfloat xrot = 0;
- static GLfloat yrot = 0;
- static GLfloat zrot = 0;
- static GTimeVal current_time;
- static glong last_sec = current_time.tv_sec;
- static gint nbFrames = 0;
-
- GstVideoFrame v_frame;
- GstVideoInfo v_info;
- guint texture = 0;
- GstBuffer *buf = gst_sample_get_buffer (sample);
- GstCaps *caps = gst_sample_get_caps (sample);
-
- gst_video_info_from_caps (&v_info, caps);
-
- if (!gst_video_frame_map (&v_frame, &v_info, buf, (GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
- g_warning ("Failed to map the video buffer");
- return TRUE;
- }
-
- texture = *(guint *) v_frame.data[0];
-
- g_get_current_time (&current_time);
- nbFrames++ ;
-
- if ((current_time.tv_sec - last_sec) >= 1)
- {
- std::cout << "GRPHIC FPS = " << nbFrames << std::endl;
- nbFrames = 0;
- last_sec = current_time.tv_sec;
- }
-
- glEnable(GL_DEPTH_TEST);
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, texture);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- /* invert the y-axis to get the front face the correct way up */
- glScalef (0.5f, -0.5f, 0.5f);
-
- glRotatef(xrot,1.0f,0.0f,0.0f);
- glRotatef(yrot,0.0f,1.0f,0.0f);
- glRotatef(zrot,0.0f,0.0f,1.0f);
-
- glBegin(GL_QUADS);
- // Front Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- // Back Face
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- // Top Face
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- // Bottom Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- // Right face
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- // Left Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glEnd();
-
- gst_video_frame_unmap (&v_frame);
-
- xrot+=0.3f;
- yrot+=0.2f;
- zrot+=0.4f;
-
- glDisable (GL_DEPTH_TEST);
- glDisable (GL_TEXTURE_2D);
-
- return TRUE;
-}
-
-
-//gst-launch-1.0 videotestsrc num_buffers=400 ! video/x-raw, width=320, height=240 !
-//glgraphicmaker ! glfiltercube ! video/x-raw, width=800, height=600 ! glimagesink
-gint main (gint argc, gchar *argv[])
-{
- GstStateChangeReturn ret;
- GstElement *pipeline, *videosrc, *glimagesink;
-
- GMainLoop *loop;
- GstBus *bus;
-
- /* FIXME: remove once the example supports gl3 and/or gles2 */
- g_setenv ("GST_GL_API", "opengl", FALSE);
-
- /* initialization */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* create elements */
- pipeline = gst_pipeline_new ("pipeline");
-
- /* watch for messages on the pipeline's bus (note that this will only
- * work like this when a GLib main loop is running) */
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* create elements */
- videosrc = gst_element_factory_make ("videotestsrc", "videotestsrc0");
- glimagesink = gst_element_factory_make ("glimagesink", "glimagesink0");
-
-
- if (!videosrc || !glimagesink)
- {
- g_print ("one element could not be found \n");
- return -1;
- }
-
- /* change video source caps */
- GstCaps *caps = gst_caps_new_simple("video/x-raw",
- "format", G_TYPE_STRING, "RGB",
- "width", G_TYPE_INT, 320,
- "height", G_TYPE_INT, 240,
- "framerate", GST_TYPE_FRACTION, 25, 1,
- NULL) ;
-
- /* configure elements */
- g_object_set(G_OBJECT(videosrc), "num-buffers", 400, NULL);
- g_signal_connect(G_OBJECT(glimagesink), "client-reshape", G_CALLBACK (reshapeCallback), NULL);
- g_signal_connect(G_OBJECT(glimagesink), "client-draw", G_CALLBACK (drawCallback), NULL);
-
- /* add elements */
- gst_bin_add_many (GST_BIN (pipeline), videosrc, glimagesink, NULL);
-
- /* link elements */
- gboolean link_ok = gst_element_link_filtered(videosrc, glimagesink, caps) ;
- gst_caps_unref(caps) ;
- if(!link_ok)
- {
- g_warning("Failed to link videosrc to glimagesink!\n") ;
- return -1 ;
- }
-
- /* run */
- ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- g_print ("Failed to start up pipeline!\n");
-
- /* check if there is an error message with details on the bus */
- GstMessage* msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);
- if (msg)
- {
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, NULL);
- g_print ("ERROR: %s\n", err->message);
- g_error_free (err);
- gst_message_unref (msg);
- }
- return -1;
- }
-
- g_main_loop_run (loop);
-
- /* clean up */
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/gl/generic/cubeyuv/.gitignore b/tests/examples/gl/generic/cubeyuv/.gitignore
deleted file mode 100644
index bd5c0cee3..000000000
--- a/tests/examples/gl/generic/cubeyuv/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-cubeyuv
diff --git a/tests/examples/gl/generic/cubeyuv/Makefile.am b/tests/examples/gl/generic/cubeyuv/Makefile.am
deleted file mode 100644
index b23287127..000000000
--- a/tests/examples/gl/generic/cubeyuv/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-
-noinst_PROGRAMS = cubeyuv
-
-cubeyuv_SOURCES = main.cpp
-
-cubeyuv_CXXFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) $(GL_CFLAGS)
-cubeyuv_LDADD=$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) $(GST_LIBS) $(GL_LIBS)
diff --git a/tests/examples/gl/generic/cubeyuv/main.cpp b/tests/examples/gl/generic/cubeyuv/main.cpp
deleted file mode 100644
index e1f843ec4..000000000
--- a/tests/examples/gl/generic/cubeyuv/main.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-#include <gst/gl/gstglfuncs.h>
-
-#include <iostream>
-#include <sstream>
-#include <string>
-
-static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data)
-{
- GMainLoop *loop = (GMainLoop*)data;
-
- switch (GST_MESSAGE_TYPE (msg))
- {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, &debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- if (debug)
- {
- g_print ("Debug deails: %s\n", debug);
- g_free (debug);
- }
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-//display video framerate
-static void identityCallback (GstElement *src, GstBuffer *buffer, GstElement* textoverlay)
-{
- static GstClockTime last_timestamp = 0;
- static gint nbFrames = 0 ;
-
- //display estimated video FPS
- nbFrames++ ;
- if (GST_BUFFER_TIMESTAMP(buffer) - last_timestamp >= 1000000000)
- {
- std::ostringstream oss ;
- oss << "video framerate = " << nbFrames ;
- std::string s(oss.str()) ;
- g_object_set(G_OBJECT(textoverlay), "text", s.c_str(), NULL);
- last_timestamp = GST_BUFFER_TIMESTAMP(buffer) ;
- nbFrames = 0 ;
- }
-}
-
-
-//client reshape callback
-static gboolean reshapeCallback (void * gl_sink, void *context, GLuint width, GLuint height, gpointer data)
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
-
- return TRUE;
-}
-
-
-//client draw callback
-static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSample * sample, gpointer data)
-{
- static GLfloat xrot = 0;
- static GLfloat yrot = 0;
- static GLfloat zrot = 0;
- static GTimeVal current_time;
- static glong last_sec = current_time.tv_sec;
- static gint nbFrames = 0;
-
- GstVideoFrame v_frame;
- GstVideoInfo v_info;
- guint texture = 0;
- GstBuffer *buf = gst_sample_get_buffer (sample);
- GstCaps *caps = gst_sample_get_caps (sample);
-
- gst_video_info_from_caps (&v_info, caps);
-
- if (!gst_video_frame_map (&v_frame, &v_info, buf, (GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
- g_warning ("Failed to map the video buffer");
- return TRUE;
- }
-
- texture = *(guint *) v_frame.data[0];
-
- g_get_current_time (&current_time);
- nbFrames++ ;
-
- if ((current_time.tv_sec - last_sec) >= 1)
- {
- std::cout << "GRPHIC FPS = " << nbFrames << std::endl;
- nbFrames = 0;
- last_sec = current_time.tv_sec;
- }
-
- glEnable(GL_DEPTH_TEST);
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, texture);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glRotatef(xrot,1.0f,0.0f,0.0f);
- glRotatef(yrot,0.0f,1.0f,0.0f);
- glRotatef(zrot,0.0f,0.0f,1.0f);
-
- /* invert the y-axis to get the front face the correct way up */
- glScalef (0.5f, -0.5f, 0.5f);
-
- glBegin(GL_QUADS);
- // Front Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- // Back Face
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- // Top Face
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- // Bottom Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- // Right face
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- // Left Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glEnd();
-
- glDisable(GL_DEPTH_TEST);
-
- gst_video_frame_unmap (&v_frame);
-
- xrot+=0.03f;
- yrot+=0.02f;
- zrot+=0.04f;
-
- return TRUE;
-}
-
-
-static void cb_new_pad (GstElement* decodebin, GstPad* pad, GstElement* identity)
-{
- GstPad* identity_pad = gst_element_get_static_pad (identity, "sink");
-
- //only link once
- if (GST_PAD_IS_LINKED (identity_pad))
- {
- gst_object_unref (identity_pad);
- return;
- }
-
- GstCaps* caps = gst_pad_get_current_caps (pad);
- GstStructure* str = gst_caps_get_structure (caps, 0);
- if (!g_strrstr (gst_structure_get_name (str), "video"))
- {
- gst_caps_unref (caps);
- gst_object_unref (identity_pad);
- return;
- }
- gst_caps_unref (caps);
-
- GstPadLinkReturn ret = gst_pad_link (pad, identity_pad);
- if (ret != GST_PAD_LINK_OK)
- g_warning ("Failed to link with decodebin!\n");
-}
-
-
-gint main (gint argc, gchar *argv[])
-{
- if (argc != 2)
- {
- g_warning ("usage: cubeyuv.exe videolocation\n");
- return -1;
- }
-
- /* FIXME: remove once the example supports gl3 and/or gles2 */
- g_setenv ("GST_GL_API", "opengl", FALSE);
-
- std::string video_location(argv[1]);
-
- /* initialization */
- gst_init (&argc, &argv);
- GMainLoop* loop = g_main_loop_new (NULL, FALSE);
-
- /* create elements */
- GstElement* pipeline = gst_pipeline_new ("pipeline");
-
- /* watch for messages on the pipeline's bus (note that this will only
- * work like this when a GLib main loop is running) */
- GstBus* bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* create elements */
- GstElement* videosrc = gst_element_factory_make ("filesrc", "filesrc0");
- GstElement* decodebin = gst_element_factory_make ("decodebin", "decodebin");
- GstElement* identity = gst_element_factory_make ("identity", "identity0");
- GstElement* textoverlay = gst_element_factory_make ("textoverlay", "textoverlay0");
- GstElement* glimagesink = gst_element_factory_make ("glimagesink", "glimagesink0");
-
-
- if (!videosrc || !decodebin || !identity || !textoverlay || !glimagesink)
- {
- g_print ("one element could not be found \n");
- return -1;
- }
-
- /* configure elements */
- g_object_set(G_OBJECT(videosrc), "num-buffers", 800, NULL);
- g_object_set(G_OBJECT(videosrc), "location", video_location.c_str(), NULL);
- g_signal_connect(identity, "handoff", G_CALLBACK(identityCallback), textoverlay) ;
- g_object_set(G_OBJECT(textoverlay), "font_desc", "Ahafoni CLM Bold 30", NULL);
- g_signal_connect(G_OBJECT(glimagesink), "client-reshape", G_CALLBACK (reshapeCallback), NULL);
- g_signal_connect(G_OBJECT(glimagesink), "client-draw", G_CALLBACK (drawCallback), NULL);
-
- /* add elements */
- gst_bin_add_many (GST_BIN (pipeline), videosrc, decodebin, identity,
- textoverlay, glimagesink, NULL);
-
- /* link elements */
- gst_element_link_pads (videosrc, "src", decodebin, "sink");
-
- g_signal_connect (decodebin, "pad-added", G_CALLBACK (cb_new_pad), identity);
-
- if (!gst_element_link_pads(identity, "src", textoverlay, "video_sink"))
- {
- g_print ("Failed to link identity to textoverlay!\n");
- return -1;
- }
-
- gboolean link_ok = gst_element_link (textoverlay, glimagesink);
- if(!link_ok)
- {
- g_warning("Failed to link textoverlay to glimagesink!\n") ;
- return -1 ;
- }
-
- /* run */
- GstStateChangeReturn ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- g_print ("Failed to start up pipeline!\n");
-
- /* check if there is an error message with details on the bus */
- GstMessage* msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);
- if (msg)
- {
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, NULL);
- g_print ("ERROR: %s\n", err->message);
- g_error_free (err);
- gst_message_unref (msg);
- }
- return -1;
- }
-
- g_main_loop_run (loop);
-
- /* clean up */
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/gl/generic/doublecube/.gitignore b/tests/examples/gl/generic/doublecube/.gitignore
deleted file mode 100644
index e9f4f133b..000000000
--- a/tests/examples/gl/generic/doublecube/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-doublecube
diff --git a/tests/examples/gl/generic/doublecube/Makefile.am b/tests/examples/gl/generic/doublecube/Makefile.am
deleted file mode 100644
index 7f1489561..000000000
--- a/tests/examples/gl/generic/doublecube/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-
-noinst_PROGRAMS = doublecube
-
-doublecube_SOURCES = main.cpp
-
-doublecube_CXXFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) $(GL_CFLAGS)
-doublecube_LDADD=$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) $(GST_LIBS) $(GL_LIBS)
-
diff --git a/tests/examples/gl/generic/doublecube/main.cpp b/tests/examples/gl/generic/doublecube/main.cpp
deleted file mode 100644
index 631a28581..000000000
--- a/tests/examples/gl/generic/doublecube/main.cpp
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-#include <gst/gl/gstglfuncs.h>
-
-#include <iostream>
-#include <sstream>
-#include <string>
-
-static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data)
-{
- GMainLoop *loop = (GMainLoop*)data;
-
- switch (GST_MESSAGE_TYPE (msg))
- {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, &debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- if (debug)
- {
- g_print ("Debug details: %s\n", debug);
- g_free (debug);
- }
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-//display video framerate
-static GstPadProbeReturn textoverlay_sink_pad_probe_cb (GstPad *pad, GstPadProbeInfo *info, GstElement* textoverlay)
-{
- static GstClockTime last_timestamp = 0;
- static gint nbFrames = 0 ;
-
- //display estimated video FPS
- nbFrames++ ;
- if (GST_BUFFER_TIMESTAMP(info->data) - last_timestamp >= 1000000000)
- {
- std::ostringstream oss;
- oss << "video framerate = " << nbFrames ;
- std::string s(oss.str());
- g_object_set(G_OBJECT(textoverlay), "text", s.c_str(), NULL);
- last_timestamp = GST_BUFFER_TIMESTAMP(info->data) ;
- nbFrames = 0;
- }
-
- return GST_PAD_PROBE_OK;
-}
-
-
-//client reshape callback
-static gboolean reshapeCallback (void *gl_sink, void *context, GLuint width, GLuint height)
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
-
- return TRUE;
-}
-
-
-//client draw callback
-static gboolean drawCallback (GstElement * gl_sink, GstGLContext *context, GstSample * sample, gpointer data)
-{
- static GLfloat xrot = 0;
- static GLfloat yrot = 0;
- static GLfloat zrot = 0;
- static GTimeVal current_time;
- static glong last_sec = current_time.tv_sec;
- static gint nbFrames = 0;
-
- GstVideoFrame v_frame;
- GstVideoInfo v_info;
- guint texture = 0;
- GstBuffer *buf = gst_sample_get_buffer (sample);
- GstCaps *caps = gst_sample_get_caps (sample);
-
- gst_video_info_from_caps (&v_info, caps);
-
- if (!gst_video_frame_map (&v_frame, &v_info, buf, (GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
- g_warning ("Failed to map the video buffer");
- return TRUE;
- }
-
- texture = *(guint *) v_frame.data[0];
-
- g_get_current_time (&current_time);
- nbFrames++ ;
-
- if ((current_time.tv_sec - last_sec) >= 1)
- {
- std::cout << "GRAPHIC FPS of the scene which contains the custom cube) = " << nbFrames << std::endl;
- nbFrames = 0;
- last_sec = current_time.tv_sec;
- }
-
- glEnable(GL_DEPTH_TEST);
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, texture);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glTranslatef(0.0f,0.0f,-5.0f);
-
- glRotatef(xrot,1.0f,0.0f,0.0f);
- glRotatef(yrot,0.0f,1.0f,0.0f);
- glRotatef(zrot,0.0f,0.0f,1.0f);
-
- glBegin(GL_QUADS);
- // Front Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- // Back Face
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- // Top Face
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- // Bottom Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- // Right face
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- // Left Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glEnd();
-
- gst_video_frame_unmap (&v_frame);
-
- xrot+=0.03f;
- yrot+=0.02f;
- zrot+=0.04f;
-
- return TRUE;
-}
-
-
-static void cb_new_pad (GstElement* decodebin, GstPad* pad, GstElement* element)
-{
- GstPad* element_pad = gst_element_get_static_pad (element, "sink");
-
- //only link once
- if (!element_pad || GST_PAD_IS_LINKED (element_pad))
- {
- gst_object_unref (element_pad);
- return;
- }
-
- GstCaps* caps = gst_pad_get_current_caps (pad);
- GstStructure* str = gst_caps_get_structure (caps, 0);
-
- GstCaps* caps2 = gst_pad_query_caps (element_pad, NULL);
- gst_caps_unref (caps2);
-
- if (!g_strrstr (gst_structure_get_name (str), "video"))
- {
- gst_caps_unref (caps);
- gst_object_unref (element_pad);
- return;
- }
- gst_caps_unref (caps);
-
- GstPadLinkReturn ret = gst_pad_link (pad, element_pad);
- if (ret != GST_PAD_LINK_OK)
- g_warning ("Failed to link with decodebin %d!\n", ret);
- gst_object_unref (element_pad);
-}
-
-
-gint main (gint argc, gchar *argv[])
-{
- if (argc != 2)
- {
- g_warning ("usage: doublecube.exe videolocation\n");
- return -1;
- }
-
- std::string video_location(argv[1]);
-
- /* initialization */
- gst_init (&argc, &argv);
- GMainLoop* loop = g_main_loop_new (NULL, FALSE);
-
- /* create elements */
- GstElement* pipeline = gst_pipeline_new ("pipeline");
-
- /* watch for messages on the pipeline's bus (note that this will only
- * work like this when a GLib main loop is running) */
- GstBus* bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* create elements */
- GstElement* videosrc = gst_element_factory_make ("filesrc", "filesrc0");
- GstElement* decodebin = gst_element_factory_make ("decodebin", "decodebin0");
- GstElement* videoconvert = gst_element_factory_make ("videoscale", "videoconvert0");
- GstElement* textoverlay = gst_element_factory_make ("textoverlay", "textoverlay0"); //textoverlay required I420
- GstElement* tee = gst_element_factory_make ("tee", "tee0");
-
- GstElement* queue0 = gst_element_factory_make ("queue", "queue0");
- GstElement* glimagesink0 = gst_element_factory_make ("glimagesink", "glimagesink0");
-
- GstElement* queue1 = gst_element_factory_make ("queue", "queue1");
- GstElement* glfiltercube = gst_element_factory_make ("glfiltercube", "glfiltercube");
- GstElement* glimagesink1 = gst_element_factory_make ("glimagesink", "glimagesink1");
-
- GstElement* queue2 = gst_element_factory_make ("queue", "queue2");
- GstElement* glimagesink2 = gst_element_factory_make ("glimagesink", "glimagesink2");
-
-
- if (!videosrc || !decodebin || !videoconvert || !textoverlay || !tee ||
- !queue0 || !glimagesink0 ||
- !queue1 || !glfiltercube || !glimagesink1 ||
- !queue2 || !glimagesink2)
- {
- g_warning ("one element could not be found \n");
- return -1;
- }
-
- GstCaps* cubecaps = gst_caps_new_simple("video/x-raw",
- "width", G_TYPE_INT, 600,
- "height", G_TYPE_INT, 400,
- NULL);
-
- /* configure elements */
- g_object_set(G_OBJECT(videosrc), "num-buffers", 1000, NULL);
- g_object_set(G_OBJECT(videosrc), "location", video_location.c_str(), NULL);
- g_object_set(G_OBJECT(textoverlay), "font_desc", "Ahafoni CLM Bold 30", NULL);
- g_signal_connect(G_OBJECT(glimagesink0), "client-reshape", G_CALLBACK (reshapeCallback), NULL);
- g_signal_connect(G_OBJECT(glimagesink0), "client-draw", G_CALLBACK (drawCallback), NULL);
-
- /* add elements */
- gst_bin_add_many (GST_BIN (pipeline), videosrc, decodebin, videoconvert, textoverlay, tee,
- queue0, glimagesink0,
- queue1, glfiltercube, glimagesink1,
- queue2, glimagesink2, NULL);
-
- GstPad* textoverlay_sink_pad = gst_element_get_static_pad (textoverlay, "video_sink");
- gst_pad_add_probe (textoverlay_sink_pad, GST_PAD_PROBE_TYPE_BUFFER,
- (GstPadProbeCallback) textoverlay_sink_pad_probe_cb, (gpointer)textoverlay, NULL);
- gst_object_unref (textoverlay_sink_pad);
-
- if (!gst_element_link_many(videoconvert, textoverlay, tee, NULL))
- {
- g_print ("Failed to link videoconvert to tee!\n");
- return -1;
- }
-
- if (!gst_element_link(videosrc, decodebin))
- {
- g_print ("Failed to link videosrc to decodebin!\n");
- return -1;
- }
-
- g_signal_connect (decodebin, "pad-added", G_CALLBACK (cb_new_pad), videoconvert);
-
- if (!gst_element_link_many(tee, queue0, NULL))
- {
- g_warning ("Failed to link one or more elements bettween tee and queue0!\n");
- return -1;
- }
-
- gboolean link_ok = gst_element_link_filtered(queue0, glimagesink0, cubecaps) ;
- gst_caps_unref(cubecaps) ;
- if(!link_ok)
- {
- g_warning("Failed to link queue0 to glimagesink0!\n") ;
- return -1 ;
- }
-
- if (!gst_element_link_many(tee, queue1, glfiltercube, glimagesink1, NULL))
- {
- g_warning ("Failed to link one or more elements bettween tee and glimagesink1!\n");
- return -1;
- }
-
- if (!gst_element_link_many(tee, queue2, glimagesink2, NULL))
- {
- g_warning ("Failed to link one or more elements bettween tee and glimagesink2!\n");
- return -1;
- }
-
- /* run */
- GstStateChangeReturn ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- g_print ("Failed to start up pipeline!\n");
-
- /* check if there is an error message with details on the bus */
- GstMessage* msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);
- if (msg)
- {
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, NULL);
- g_print ("ERROR: %s\n", err->message);
- g_error_free (err);
- gst_message_unref (msg);
- }
- return -1;
- }
-
- g_main_loop_run (loop);
-
- /* clean up */
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/gl/generic/generic.sln b/tests/examples/gl/generic/generic.sln
deleted file mode 100644
index 22e86f64e..000000000
--- a/tests/examples/gl/generic/generic.sln
+++ /dev/null
@@ -1,38 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cube", "cube\cube.vcproj", "{DA41FBFF-E1DE-4DA1-BB96-C56C63D5CDBE}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cubeyuv", "cubeyuv\cubeyuv.vcproj", "{6C94B86A-8E34-4163-840A-BFD5C80B1F2E}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doublecube", "doublecube\doublecube.vcproj", "{4EC968E0-5B6C-418A-8A75-F390D56DFFE8}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recordgraphic", "recordgraphic\recordgraphic.vcproj", "{E9A5E91B-5F8B-4322-9531-00CCFCB29A2D}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {DA41FBFF-E1DE-4DA1-BB96-C56C63D5CDBE}.Debug|Win32.ActiveCfg = Debug|Win32
- {DA41FBFF-E1DE-4DA1-BB96-C56C63D5CDBE}.Debug|Win32.Build.0 = Debug|Win32
- {DA41FBFF-E1DE-4DA1-BB96-C56C63D5CDBE}.Release|Win32.ActiveCfg = Release|Win32
- {DA41FBFF-E1DE-4DA1-BB96-C56C63D5CDBE}.Release|Win32.Build.0 = Release|Win32
- {6C94B86A-8E34-4163-840A-BFD5C80B1F2E}.Debug|Win32.ActiveCfg = Debug|Win32
- {6C94B86A-8E34-4163-840A-BFD5C80B1F2E}.Debug|Win32.Build.0 = Debug|Win32
- {6C94B86A-8E34-4163-840A-BFD5C80B1F2E}.Release|Win32.ActiveCfg = Release|Win32
- {6C94B86A-8E34-4163-840A-BFD5C80B1F2E}.Release|Win32.Build.0 = Release|Win32
- {4EC968E0-5B6C-418A-8A75-F390D56DFFE8}.Debug|Win32.ActiveCfg = Debug|Win32
- {4EC968E0-5B6C-418A-8A75-F390D56DFFE8}.Debug|Win32.Build.0 = Debug|Win32
- {4EC968E0-5B6C-418A-8A75-F390D56DFFE8}.Release|Win32.ActiveCfg = Release|Win32
- {4EC968E0-5B6C-418A-8A75-F390D56DFFE8}.Release|Win32.Build.0 = Release|Win32
- {E9A5E91B-5F8B-4322-9531-00CCFCB29A2D}.Debug|Win32.ActiveCfg = Debug|Win32
- {E9A5E91B-5F8B-4322-9531-00CCFCB29A2D}.Debug|Win32.Build.0 = Debug|Win32
- {E9A5E91B-5F8B-4322-9531-00CCFCB29A2D}.Release|Win32.ActiveCfg = Release|Win32
- {E9A5E91B-5F8B-4322-9531-00CCFCB29A2D}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/tests/examples/gl/generic/recordgraphic/.gitignore b/tests/examples/gl/generic/recordgraphic/.gitignore
deleted file mode 100644
index 8127d8360..000000000
--- a/tests/examples/gl/generic/recordgraphic/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-recordgraphic
diff --git a/tests/examples/gl/generic/recordgraphic/Makefile.am b/tests/examples/gl/generic/recordgraphic/Makefile.am
deleted file mode 100644
index 6a25c281f..000000000
--- a/tests/examples/gl/generic/recordgraphic/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-
-noinst_PROGRAMS = recordgraphic
-
-recordgraphic_SOURCES = main.cpp
-
-recordgraphic_CXXFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_CXXFLAGS) $(GL_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
-recordgraphic_LDADD=$(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_API_VERSION@ $(GST_LIBS) $(GL_LIBS)
-
diff --git a/tests/examples/gl/generic/recordgraphic/main.cpp b/tests/examples/gl/generic/recordgraphic/main.cpp
deleted file mode 100644
index 9cac1e974..000000000
--- a/tests/examples/gl/generic/recordgraphic/main.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include <GL/gl.h>
-#if __WIN32__ || _WIN32
-# include <GL/glext.h>
-#endif
-#include <gst/gst.h>
-#include <gst/video/video.h>
-
-#include <iostream>
-#include <string>
-
-static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data)
-{
- GMainLoop *loop = (GMainLoop*)data;
-
- switch (GST_MESSAGE_TYPE (msg))
- {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, &debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- if (debug)
- {
- g_print ("Debug details: %s\n", debug);
- g_free (debug);
- }
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-//client draw callback
-static gboolean drawCallback (void *filter, void *context, GLuint texture, GLuint width, GLuint height, gpointer data)
-{
- static GLfloat xrot = 0;
- static GLfloat yrot = 0;
- static GLfloat zrot = 0;
- static GTimeVal current_time;
- static glong last_sec = current_time.tv_sec;
- static gint nbFrames = 0;
-
- g_get_current_time (&current_time);
- nbFrames++ ;
-
- if ((current_time.tv_sec - last_sec) >= 1)
- {
- std::cout << "GRPHIC FPS = " << nbFrames << std::endl;
- nbFrames = 0;
- last_sec = current_time.tv_sec;
- }
-
- glEnable(GL_DEPTH_TEST);
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, texture);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glTranslatef(0.0f,0.0f,-5.0f);
-
- glRotatef(xrot,1.0f,0.0f,0.0f);
- glRotatef(yrot,0.0f,1.0f,0.0f);
- glRotatef(zrot,0.0f,0.0f,1.0f);
-
- //cube
- glBegin(GL_QUADS);
- // Front Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- // Back Face
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- // Top Face
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- // Bottom Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- // Right face
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- // Left Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glEnd();
-
- xrot+=0.3f;
- yrot+=0.2f;
- zrot+=0.4f;
-
- //return TRUE because we dealt with the texture
- return TRUE;
-}
-
-
-//equivalent command line:
-//gst-launch-1.0 videotestsrc num_buffers=400 ! gleffects effect=0 !
-//avenc_mpeg4 ! avimux ! filesink location="record.avi"
-// or
-//gst-launch-1.0 videotestsrc num_buffers=400 ! gleffects effect=0 ! "video/x-raw, width=320, height=240" ! glfiltercube ! "video/x-raw, width=720, height=576" !
-//avenc_mpeg4 ! avimux ! filesink location="record.avi"
-gint main (gint argc, gchar *argv[])
-{
- GstStateChangeReturn ret;
- GstElement *pipeline, *videosrc, *glfilterapp, *avenc_mpeg4, *avimux, *filesink;
- GMainLoop *loop;
- GstBus *bus;
-
- /* initialization */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* create elements */
- pipeline = gst_pipeline_new ("pipeline");
-
- /* watch for messages on the pipeline's bus (note that this will only
- * work like this when a GLib main loop is running) */
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* create elements */
- videosrc = gst_element_factory_make ("videotestsrc", "videotestsrc0");
- glfilterapp = gst_element_factory_make ("glfilterapp", "glfilterapp0");
- avenc_mpeg4 = gst_element_factory_make ("avenc_mpeg4", "avenc_mpeg40");
- avimux = gst_element_factory_make ("avimux", "avimux0");
- filesink = gst_element_factory_make ("filesink", "filesink0");
-
-
- if (!videosrc || !glfilterapp || !avenc_mpeg4 || !avimux || !filesink)
- {
- g_print ("one element could not be found \n");
- return -1;
- }
-
- /* change video source caps */
- GstCaps *caps = gst_caps_new_simple("video/x-raw",
- "format", G_TYPE_STRING, "UYVY",
- "width", G_TYPE_INT, 320,
- "height", G_TYPE_INT, 240,
- "framerate", GST_TYPE_FRACTION, 25, 1,
- NULL);
-
- /* change video source caps */
- GstCaps *outcaps = gst_caps_new_simple("video/x-raw",
- "width", G_TYPE_INT, 640,
- "height", G_TYPE_INT, 480,
- NULL);
-
- /* configure elements */
- g_object_set(G_OBJECT(videosrc), "num-buffers", 400, NULL);
- g_signal_connect(G_OBJECT(glfilterapp), "client-draw", G_CALLBACK (drawCallback), NULL);
- g_object_set(G_OBJECT(filesink), "location", "record.avi", NULL);
-
- /* add elements */
- gst_bin_add_many (GST_BIN (pipeline), videosrc, glfilterapp,
- avenc_mpeg4, avimux, filesink, NULL);
-
- /* link elements */
- gboolean link_ok = gst_element_link_filtered(videosrc, glfilterapp, caps) ;
- gst_caps_unref(caps) ;
- if(!link_ok)
- {
- g_warning("Failed to link videosrc to glfilterapp!\n") ;
- return -1 ;
- }
-
- link_ok = gst_element_link_filtered(glfilterapp, avenc_mpeg4, outcaps) ;
- gst_caps_unref(outcaps) ;
- if(!link_ok)
- {
- g_warning("Failed to link glfilterapp to avenc_mpeg4!\n") ;
- return -1 ;
- }
- if (!gst_element_link_many(avenc_mpeg4, avimux, filesink, NULL))
- {
- g_print ("Failed to link one or more elements!\n");
- return -1;
- }
-
-
- /* run */
- ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- g_print ("Failed to start up pipeline!\n");
-
- /* check if there is an error message with details on the bus */
- GstMessage* msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);
- if (msg)
- {
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, NULL);
- g_print ("ERROR: %s\n", err->message);
- g_error_free (err);
- gst_message_unref (msg);
- }
- return -1;
- }
-
- g_main_loop_run (loop);
-
- /* clean up */
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/gl/gtk/3dvideo/.gitignore b/tests/examples/gl/gtk/3dvideo/.gitignore
deleted file mode 100644
index 7c46573b5..000000000
--- a/tests/examples/gl/gtk/3dvideo/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-3dvideo
diff --git a/tests/examples/gl/gtk/3dvideo/Makefile.am b/tests/examples/gl/gtk/3dvideo/Makefile.am
deleted file mode 100644
index 94c8d1619..000000000
--- a/tests/examples/gl/gtk/3dvideo/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-noinst_PROGRAMS = 3dvideo
-
-noinst_HEADERS = mviewwidget.h
-
-3dvideo_SOURCES = mviewwidget.c main.cpp
-
-3dvideo_CXXFLAGS=$(GST_CXXFLAGS)
-
-3dvideo_CPPFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GL_CFLAGS) $(GTK3_CFLAGS)
-3dvideo_LDADD=../libgstgtkhelper.la \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la \
- $(GTK3_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_LIBS) \
- $(GL_LIBS) -lgstvideo-$(GST_API_VERSION)
-
diff --git a/tests/examples/gl/gtk/3dvideo/main.cpp b/tests/examples/gl/gtk/3dvideo/main.cpp
deleted file mode 100644
index 4f12b11cc..000000000
--- a/tests/examples/gl/gtk/3dvideo/main.cpp
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2014-2015 Jan Schmidt <jan@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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include <gdk/gdk.h>
-#if defined (GDK_WINDOWING_X11)
-#include <X11/Xlib.h>
-#endif
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-#include <gst/video/video-info.h>
-
-#include "../gstgtk.h"
-#include "mviewwidget.h"
-
-/* Until playbin properties support dynamic changes,
- * use our own glviewconvert */
-#define USE_GLCONVERT_FOR_INPUT 1
-
-typedef struct _localstate
-{
- GstVideoMultiviewFramePacking in_mode;
- GstVideoMultiviewFlags out_mode;
- GstVideoMultiviewFlags in_flags, out_flags;
-} LocalState;
-
-static GstBusSyncReply
-create_window (GstBus * bus, GstMessage * message, GtkWidget * widget)
-{
- if (gst_gtk_handle_need_context (bus, message, NULL))
- return GST_BUS_DROP;
-
- /* ignore anything but 'prepare-window-handle' element messages */
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- /* do not call gdk_window_ensure_native for the first time here because
- * we are in a different thread than the main thread */
- gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC
- (message)), widget);
-
- gst_message_unref (message);
-
- return GST_BUS_DROP;
-}
-
-static void
-end_stream_cb (GstBus * bus, GstMessage * message, GstElement * pipeline)
-{
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_EOS:
- g_print ("End of stream\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- gtk_main_quit ();
- break;
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
-
- gst_message_parse_error (message, &err, &debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- if (debug) {
- g_print ("Debug details: %s\n", debug);
- g_free (debug);
- }
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- gtk_main_quit ();
- break;
- }
- default:
- break;
- }
-}
-
-static gboolean
-draw_cb (GtkWidget * widget, cairo_t * cr, GstElement * videosink)
-{
- gst_video_overlay_expose (GST_VIDEO_OVERLAY (videosink));
- return FALSE;
-}
-
-static gboolean
-resize_cb (GtkWidget * widget, GdkEvent * event, gpointer sink)
-{
- GtkAllocation allocation;
- gint scale = 1;
-
-#if GTK_CHECK_VERSION(3, 10, 0)
- scale = gtk_widget_get_scale_factor (widget);
-#endif
-
- gtk_widget_get_allocation (widget, &allocation);
- gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (sink),
- allocation.x * scale, allocation.y * scale, allocation.width * scale,
- allocation.height * scale);
-
- return G_SOURCE_CONTINUE;
-}
-
-static void
-destroy_cb (GtkWidget * widget, GdkEvent * event, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- gtk_main_quit ();
-}
-
-static void
-button_state_ready_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_READY);
-}
-
-static void
-button_state_paused_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
-}
-
-static void
-button_state_playing_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-}
-
-static gboolean
-set_mview_mode (GtkWidget * combo, GObject * target, const gchar * prop_name)
-{
- gchar *mview_mode = NULL;
- GEnumClass *p_class;
- GEnumValue *v;
- GParamSpec *p =
- g_object_class_find_property (G_OBJECT_GET_CLASS (target), prop_name);
-
- g_return_val_if_fail (p != NULL, FALSE);
-
- p_class = G_PARAM_SPEC_ENUM (p)->enum_class;
- g_return_val_if_fail (p_class != NULL, FALSE);
-
- g_object_get (G_OBJECT (combo), "active-id", &mview_mode, NULL);
- g_return_val_if_fail (mview_mode != NULL, FALSE);
-
- v = g_enum_get_value_by_nick (p_class, mview_mode);
- g_return_val_if_fail (v != NULL, FALSE);
-
- g_object_set (target, prop_name, v->value, NULL);
-
- return FALSE;
-}
-
-static gboolean
-set_mview_input_mode (GtkWidget * widget, gpointer data)
-{
-#if USE_GLCONVERT_FOR_INPUT
- return set_mview_mode (widget, G_OBJECT (data), "input-mode-override");
-#else
- return set_mview_mode (widget, G_OBJECT (data), "video-multiview-mode");
-#endif
-}
-
-static gboolean
-set_mview_output_mode (GtkWidget * widget, gpointer data)
-{
- GstElement *sink = gst_bin_get_by_name (GST_BIN (data), "sink");
- set_mview_mode (widget, G_OBJECT (sink), "output-multiview-mode");
- gst_object_unref (GST_OBJECT (sink));
- return FALSE;
-}
-
-static void
-input_flags_changed (GObject * gobject, GParamSpec * pspec, gpointer user_data)
-{
- GObject *target = G_OBJECT (user_data);
- GstVideoMultiviewFlags flags;
-
- g_object_get (gobject, "flags", &flags, NULL);
-#if USE_GLCONVERT_FOR_INPUT
- g_object_set (target, "input-flags-override", flags, NULL);
-#else
- g_object_set (target, "video-multiview-flags", flags, NULL);
-#endif
-}
-
-static void
-output_flags_changed (GObject * gobject, GParamSpec * pspec, gpointer user_data)
-{
- GObject *target = G_OBJECT (user_data);
- GstVideoMultiviewFlags flags;
- GstElement *sink = gst_bin_get_by_name (GST_BIN (target), "sink");
-
- g_object_get (gobject, "flags", &flags, NULL);
- g_object_set (G_OBJECT (sink), "output-multiview-flags", flags, NULL);
-
- gst_object_unref (GST_OBJECT (sink));
-}
-
-static void
-downmix_method_changed (GObject * gobject, GParamSpec * pspec, gpointer user_data)
-{
- GObject *target = G_OBJECT (user_data);
- GstGLStereoDownmix downmix_method;
- GstElement *sink = gst_bin_get_by_name (GST_BIN (target), "sink");
-
- g_object_get (gobject, "downmix-mode", &downmix_method, NULL);
- g_object_set (sink, "output-multiview-downmix-mode", downmix_method, NULL);
- gst_object_unref (GST_OBJECT (sink));
-}
-
-static const gchar *
-enum_value_to_nick (GType enum_type, guint value)
-{
- GEnumClass *enum_info;
- GEnumValue *v;
- const gchar *nick;
-
- enum_info = (GEnumClass *) (g_type_class_ref (enum_type));
- g_return_val_if_fail (enum_info != NULL, NULL);
-
- v = g_enum_get_value (enum_info, value);
- g_return_val_if_fail (v != NULL, NULL);
-
- nick = v->value_nick;
-
- g_type_class_unref (enum_info);
-
- return nick;
-}
-
-static void
-detect_mode_from_uri (LocalState * state, const gchar * uri)
-{
- if (strstr (uri, "HSBS")) {
- state->in_mode = GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE;
- state->in_flags = GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT;
- } else if (strstr (uri, "SBS")) {
- state->in_mode = GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE;
- if (g_regex_match_simple ("half", uri, G_REGEX_CASELESS,
- (GRegexMatchFlags) 0)) {
- state->in_flags = GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT;
- }
- }
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- LocalState state;
- GtkWidget *area, *combo, *w;
- const gchar *uri;
-
-#if defined (GDK_WINDOWING_X11)
- XInitThreads ();
-#endif
-
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- if (argc < 2) {
- g_print ("Usage: 3dvideo <uri-to-play>\n");
- return 1;
- }
-
- uri = argv[1];
-
- GstElement *pipeline = gst_element_factory_make ("playbin", NULL);
- GstBin *sinkbin = (GstBin *) gst_parse_bin_from_description ("glupload ! glcolorconvert ! glviewconvert name=viewconvert ! glimagesink name=sink", TRUE, NULL);
-#if USE_GLCONVERT_FOR_INPUT
- GstElement *glconvert = gst_bin_get_by_name (sinkbin, "viewconvert");
-#endif
- GstElement *videosink = gst_bin_get_by_name (sinkbin, "sink");
-
- /* Get defaults */
- g_object_get (pipeline, "video-multiview-mode", &state.in_mode,
- "video-multiview-flags", &state.in_flags, NULL);
- gst_child_proxy_get (GST_CHILD_PROXY (videosink), "sink::output-multiview-mode", &state.out_mode,
- "sink::output-multiview-flags", &state.out_flags, NULL);
-
- detect_mode_from_uri (&state, uri);
-
- g_return_val_if_fail (pipeline != NULL, 1);
- g_return_val_if_fail (videosink != NULL, 1);
-
- g_object_set (G_OBJECT (pipeline), "video-sink", sinkbin, NULL);
- g_object_set (G_OBJECT (pipeline), "uri", uri, NULL);
-
-#if USE_GLCONVERT_FOR_INPUT
- g_object_set (G_OBJECT (glconvert), "input-mode-override", state.in_mode,
- NULL);
- g_object_set (G_OBJECT (glconvert), "input-flags-override", state.in_flags,
- NULL);
-#else
- g_object_set (G_OBJECT (pipeline), "video-multiview-mode", state.in_mode,
- NULL);
- g_object_set (G_OBJECT (pipeline), "video-multiview-flags", state.in_flags,
- NULL);
-#endif
-
- /* Connect to bus for signal handling */
- GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch (bus);
- g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb),
- pipeline);
- g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb),
- pipeline);
- g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), pipeline);
-
- gst_element_set_state (pipeline, GST_STATE_READY);
-
- area = gtk_drawing_area_new ();
- gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, area, NULL);
- gst_object_unref (bus);
-
- /* Toplevel window */
- GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
- gtk_window_set_title (GTK_WINDOW (window), "Stereoscopic video demo");
- GdkGeometry geometry;
- geometry.min_width = 1;
- geometry.min_height = 1;
- geometry.max_width = -1;
- geometry.max_height = -1;
- gtk_window_set_geometry_hints (GTK_WINDOW (window), window, &geometry,
- GDK_HINT_MIN_SIZE);
-
- GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- /* area where the video is drawn */
- gtk_box_pack_start (GTK_BOX (vbox), area, TRUE, TRUE, 0);
-
- /* Buttons to control the pipeline state */
- GtkWidget *table = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (vbox), table);
-
- GtkWidget *button_state_ready = gtk_button_new_with_label ("Stop");
- g_signal_connect (G_OBJECT (button_state_ready), "clicked",
- G_CALLBACK (button_state_ready_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_ready, 1, 0, 1, 1);
- gtk_widget_show (button_state_ready);
-
- //control state paused
- GtkWidget *button_state_paused = gtk_button_new_with_label ("Pause");
- g_signal_connect (G_OBJECT (button_state_paused), "clicked",
- G_CALLBACK (button_state_paused_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_paused, 2, 0, 1, 1);
- gtk_widget_show (button_state_paused);
-
- //control state playing
- GtkWidget *button_state_playing = gtk_button_new_with_label ("Play");
- g_signal_connect (G_OBJECT (button_state_playing), "clicked",
- G_CALLBACK (button_state_playing_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_playing, 3, 0, 1, 1);
- //gtk_widget_show (button_state_playing);
-
- w = gst_mview_widget_new (FALSE);
- combo = GST_MVIEW_WIDGET (w)->mode_selector;
- gtk_combo_box_set_active_id (GTK_COMBO_BOX (combo),
- enum_value_to_nick (GST_TYPE_VIDEO_MULTIVIEW_FRAME_PACKING,
- state.in_mode));
-#if USE_GLCONVERT_FOR_INPUT
- g_signal_connect (G_OBJECT (combo), "changed",
- G_CALLBACK (set_mview_input_mode), glconvert);
-#else
- g_signal_connect (G_OBJECT (combo), "changed",
- G_CALLBACK (set_mview_input_mode), pipeline);
-#endif
-
- g_object_set (G_OBJECT (w), "flags", state.in_flags, NULL);
-#if USE_GLCONVERT_FOR_INPUT
- g_signal_connect (G_OBJECT (w), "notify::flags",
- G_CALLBACK (input_flags_changed), glconvert);
-#else
- g_signal_connect (G_OBJECT (w), "notify::flags",
- G_CALLBACK (input_flags_changed), pipeline);
-#endif
- gtk_container_add (GTK_CONTAINER (vbox), w);
-
- w = gst_mview_widget_new (TRUE);
- combo = GST_MVIEW_WIDGET (w)->mode_selector;
- gtk_combo_box_set_active_id (GTK_COMBO_BOX (combo),
- enum_value_to_nick (GST_TYPE_VIDEO_MULTIVIEW_MODE, state.out_mode));
- g_signal_connect (G_OBJECT (combo), "changed",
- G_CALLBACK (set_mview_output_mode), videosink);
-
- g_object_set (G_OBJECT (w), "flags", state.out_flags, NULL);
- g_signal_connect (G_OBJECT (w), "notify::flags",
- G_CALLBACK (output_flags_changed), videosink);
- g_signal_connect (G_OBJECT (w), "notify::downmix-mode",
- G_CALLBACK (downmix_method_changed), videosink);
- gtk_container_add (GTK_CONTAINER (vbox), w);
-
- //configure the pipeline
- g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (destroy_cb),
- pipeline);
-
- gtk_widget_realize (area);
-
- /* Redraw needed when paused or stopped (PAUSED or READY) */
- g_signal_connect (area, "draw", G_CALLBACK (draw_cb), videosink);
- g_signal_connect(area, "configure-event", G_CALLBACK(resize_cb), videosink);
-
- gtk_widget_show_all (window);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/tests/examples/gl/gtk/3dvideo/mviewwidget.c b/tests/examples/gl/gtk/3dvideo/mviewwidget.c
deleted file mode 100644
index b74409c13..000000000
--- a/tests/examples/gl/gtk/3dvideo/mviewwidget.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014-2015 Jan Schmidt <jan@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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "mviewwidget.h"
-
-G_DEFINE_TYPE (GstMViewWidget, gst_mview_widget, GTK_TYPE_GRID);
-
-static void gst_mview_widget_constructed (GObject * o);
-static void gst_mview_widget_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_mview_widget_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-#define DEFAULT_DOWNMIX GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS
-
-enum
-{
- PROP_0,
- PROP_IS_OUTPUT,
- PROP_MODE_SELECTOR,
- PROP_FLAGS,
- PROP_DOWNMIX_MODE
-};
-
-typedef struct _ToggleClosure
-{
- GstMViewWidget *mv;
- GstVideoMultiviewFlags flag;
-} ToggleClosure;
-
-static GtkWidget *combo_box_from_enum (GType enum_type);
-
-static void
-gst_mview_widget_class_init (GstMViewWidgetClass * klass)
-{
- GObjectClass *object_klass = (GObjectClass *) (klass);
-
- object_klass->constructed = gst_mview_widget_constructed;
- object_klass->set_property = gst_mview_widget_set_property;
- object_klass->get_property = gst_mview_widget_get_property;
-
- g_object_class_install_property (object_klass, PROP_IS_OUTPUT,
- g_param_spec_boolean ("is-output", "Is an Output widget",
- "TRUE if the widget should have downmix mode", FALSE,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (object_klass, PROP_MODE_SELECTOR,
- g_param_spec_object ("mode-selector", "Multiview Mode selector",
- "Multiview Mode selector widget",
- GTK_TYPE_WIDGET, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_klass, PROP_FLAGS,
- g_param_spec_flags ("flags", "Multiview Flags",
- "multiview flags", GST_TYPE_VIDEO_MULTIVIEW_FLAGS,
- GST_VIDEO_MULTIVIEW_FLAGS_NONE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_klass, PROP_DOWNMIX_MODE,
- g_param_spec_enum ("downmix-mode",
- "Mode for mono downmixed output",
- "Output anaglyph type to generate when downmixing to mono",
- GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE, DEFAULT_DOWNMIX,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_mview_widget_init (GstMViewWidget * mv)
-{
-}
-
-static void
-flag_changed (GObject * w, ToggleClosure * c)
-{
- GstMViewWidget *mv = GST_MVIEW_WIDGET (c->mv);
- gboolean flag_set;
-
- g_object_get (w, "active", &flag_set, NULL);
-
- if (flag_set)
- mv->flags |= c->flag;
- else
- mv->flags &= ~(c->flag);
- if (!mv->synching)
- g_object_notify (G_OBJECT (mv), "flags");
-}
-
-static void
-link_button_to_flag (GstMViewWidget * mv, GtkWidget * w,
- GstVideoMultiviewFlags flag)
-{
- ToggleClosure *c = g_new0 (ToggleClosure, 1);
-
- c->mv = mv;
- c->flag = flag;
-
- g_signal_connect_data (G_OBJECT (w), "toggled", G_CALLBACK (flag_changed),
- c, (GClosureNotify) g_free, 0);
-}
-
-static void
-sync_flags (GstMViewWidget * mv)
-{
- mv->synching = TRUE;
- g_object_set (G_OBJECT (mv->lflip), "active",
- ! !(mv->flags & GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED), NULL);
- g_object_set (G_OBJECT (mv->lflop), "active",
- ! !(mv->flags & GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED), NULL);
- g_object_set (G_OBJECT (mv->rflip), "active",
- ! !(mv->flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED), NULL);
- g_object_set (G_OBJECT (mv->rflop), "active",
- ! !(mv->flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED), NULL);
- g_object_set (G_OBJECT (mv->right_first), "active",
- ! !(mv->flags & GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST), NULL);
- g_object_set (G_OBJECT (mv->half_aspect), "active",
- ! !(mv->flags & GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT), NULL);
- mv->synching = FALSE;
-}
-
-static const gchar *
-enum_value_to_nick (GType enum_type, guint value)
-{
- GEnumClass *enum_info;
- GEnumValue *v;
- const gchar *nick;
-
- enum_info = (GEnumClass *) (g_type_class_ref (enum_type));
- g_return_val_if_fail (enum_info != NULL, NULL);
-
- v = g_enum_get_value (enum_info, value);
- g_return_val_if_fail (v != NULL, NULL);
-
- nick = v->value_nick;
-
- g_type_class_unref (enum_info);
-
- return nick;
-}
-
-static void
-sync_downmix (GstMViewWidget * mv)
-{
- mv->synching = TRUE;
- gtk_combo_box_set_active_id (GTK_COMBO_BOX (mv->downmix_combo),
- enum_value_to_nick (GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE,
- mv->downmix_mode));
- mv->synching = FALSE;
-}
-
-static gboolean
-set_downmix_mode (GtkWidget * widget, gpointer data)
-{
- GstMViewWidget *mv = GST_MVIEW_WIDGET (data);
- gchar *downmix_mode = NULL;
- GEnumClass *p_class;
- GEnumValue *v;
- GParamSpec *p =
- g_object_class_find_property (G_OBJECT_GET_CLASS (mv), "downmix-mode");
-
- g_return_val_if_fail (p != NULL, FALSE);
-
- p_class = G_PARAM_SPEC_ENUM (p)->enum_class;
- g_return_val_if_fail (p_class != NULL, FALSE);
-
- g_object_get (G_OBJECT (widget), "active-id", &downmix_mode, NULL);
- g_return_val_if_fail (downmix_mode != NULL, FALSE);
-
- v = g_enum_get_value_by_nick (p_class, downmix_mode);
- g_return_val_if_fail (v != NULL, FALSE);
-
- mv->downmix_mode = v->value;
- if (!mv->synching)
- g_object_notify (G_OBJECT (mv), "downmix-mode");
-
- return FALSE;
-}
-
-static void
-gst_mview_widget_constructed (GObject * o)
-{
- GstMViewWidget *mv = GST_MVIEW_WIDGET (o);
- GtkGrid *g = GTK_GRID (mv);
- GtkWidget *w;
-
- gtk_widget_set_has_window (GTK_WIDGET (mv), FALSE);
-
- if (mv->is_output) {
- mv->mode_selector = w = combo_box_from_enum (GST_TYPE_VIDEO_MULTIVIEW_MODE);
- gtk_grid_attach (g, gtk_label_new ("Output:"), 0, 0, 1, 1);
- } else {
- mv->mode_selector = w =
- combo_box_from_enum (GST_TYPE_VIDEO_MULTIVIEW_FRAME_PACKING);
- gtk_grid_attach (g, gtk_label_new ("Input:"), 0, 0, 1, 1);
- }
- gtk_grid_attach (g, mv->mode_selector, 1, 0, 3, 1);
-
- gtk_grid_attach (g, gtk_label_new (" Left "), 4, 0, 1, 1);
- mv->lflip = w = gtk_toggle_button_new_with_label ("Flip");
- link_button_to_flag (mv, w, GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED);
- gtk_grid_attach (g, w, 5, 0, 1, 1);
- mv->lflop = w = gtk_toggle_button_new_with_label ("Flop");
- link_button_to_flag (mv, w, GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED);
- gtk_grid_attach (g, w, 6, 0, 1, 1);
-
- gtk_grid_attach (g, gtk_label_new (" Right "), 4, 1, 1, 1);
- mv->rflip = w = gtk_toggle_button_new_with_label ("Flip");
- link_button_to_flag (mv, w, GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED);
- gtk_grid_attach (g, w, 5, 1, 1, 1);
- mv->rflop = w = gtk_toggle_button_new_with_label ("Flop");
- link_button_to_flag (mv, w, GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED);
- gtk_grid_attach (g, w, 6, 1, 1, 1);
-
- mv->right_first = w = gtk_toggle_button_new_with_label ("Left/Right swap");
- link_button_to_flag (mv, w, GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST);
- gtk_grid_attach (g, w, 1, 1, 1, 1);
- mv->half_aspect = w = gtk_toggle_button_new_with_label ("Half-Aspect");
- link_button_to_flag (mv, w, GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT);
- gtk_grid_attach (g, w, 2, 1, 1, 1);
-
- if (mv->is_output) {
- mv->downmix_combo = w =
- combo_box_from_enum (GST_TYPE_GL_STEREO_DOWNMIX_MODE_TYPE);
- gtk_grid_attach (g, w, 1, 2, 3, 1);
- sync_downmix (mv);
- g_signal_connect (G_OBJECT (w), "changed",
- G_CALLBACK (set_downmix_mode), mv);
- }
-}
-
-static void
-gst_mview_widget_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstMViewWidget *mv = GST_MVIEW_WIDGET (object);
- switch (prop_id) {
- case PROP_IS_OUTPUT:
- mv->is_output = g_value_get_boolean (value);
- break;
- case PROP_FLAGS:
- mv->flags = (GstVideoMultiviewFlags) g_value_get_flags (value);
- sync_flags (mv);
- break;
- case PROP_DOWNMIX_MODE:
- mv->downmix_mode = g_value_get_enum (value);
- sync_downmix (mv);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_mview_widget_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstMViewWidget *mv = GST_MVIEW_WIDGET (object);
- switch (prop_id) {
- case PROP_IS_OUTPUT:
- g_value_set_boolean (value, mv->is_output);
- break;
- case PROP_MODE_SELECTOR:
- g_value_set_object (value, mv->mode_selector);
- break;
- case PROP_FLAGS:
- g_value_set_flags (value, mv->flags);
- break;
- case PROP_DOWNMIX_MODE:
- g_value_set_enum (value, mv->downmix_mode);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GtkWidget *
-combo_box_from_enum (GType enum_type)
-{
- GEnumClass *enum_info;
- GtkWidget *combo;
- guint i;
-
- enum_info = (GEnumClass *) (g_type_class_ref (enum_type));
- g_return_val_if_fail (enum_info != NULL, NULL);
-
- combo = gtk_combo_box_text_new ();
- for (i = 0; i < enum_info->n_values; i++) {
- GEnumValue *v = enum_info->values + i;
- gtk_combo_box_text_insert (GTK_COMBO_BOX_TEXT (combo),
- i, v->value_nick, v->value_name);
- }
-
- g_type_class_unref (enum_info);
-
- return combo;
-}
-
-GtkWidget *
-gst_mview_widget_new (gboolean is_output)
-{
- GtkWidget *ret;
-
- ret = g_object_new (GST_TYPE_MVIEW_WIDGET, "is-output", is_output, NULL);
-
- return ret;
-}
diff --git a/tests/examples/gl/gtk/3dvideo/mviewwidget.h b/tests/examples/gl/gtk/3dvideo/mviewwidget.h
deleted file mode 100644
index b63d7a944..000000000
--- a/tests/examples/gl/gtk/3dvideo/mviewwidget.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014-2015 Jan Schmidt <jan@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.
- */
-#include <string.h>
-
-#define GST_USE_UNSTABLE_API 1
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include <gst/video/video-info.h>
-#include <gst/gl/gstglviewconvert.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_MVIEW_WIDGET (gst_mview_widget_get_type())
-#define GST_MVIEW_WIDGET(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MVIEW_WIDGET, GstMViewWidget))
-#define GST_MVIEW_WIDGET_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MVIEW_WIDGET, GstMViewWidgetClass))
-#define GST_IS_MVIEW_WIDGET(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MVIEW_WIDGET))
-#define GST_IS_MVIEW_WIDGET_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MVIEW_WIDGET))
-#define GST_MVIEW_WIDGET_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_MVIEW_WIDGET,GstMViewWidgetClass))
-
-typedef struct _GstMViewWidget GstMViewWidget;
-typedef struct _GstMViewWidgetClass GstMViewWidgetClass;
-
-struct _GstMViewWidget {
- GtkGrid parent;
-
- gboolean is_output;
-
- GtkWidget *mode_selector;
-
- GstVideoMultiviewMode mode;
- GstVideoMultiviewFlags flags;
- GstGLStereoDownmix downmix_mode;
-
- /* Array of toggle buttons for flags */
- GtkWidget *lflip;
- GtkWidget *lflop;
- GtkWidget *rflip;
- GtkWidget *rflop;
- GtkWidget *half_aspect;
- GtkWidget *right_first;
-
- GtkWidget *downmix_combo;
-
- gboolean synching;
-};
-
-struct _GstMViewWidgetClass {
- GtkGridClass parent;
-};
-
-GType gst_mview_widget_get_type ();
-GtkWidget *gst_mview_widget_new (gboolean is_output);
-
-G_END_DECLS
diff --git a/tests/examples/gl/gtk/Makefile.am b/tests/examples/gl/gtk/Makefile.am
deleted file mode 100644
index 572890523..000000000
--- a/tests/examples/gl/gtk/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-
-SUBDIRS = . filternovideooverlay filtervideooverlay fxtest switchvideooverlay 3dvideo
-
-noinst_LTLIBRARIES = libgstgtkhelper.la
-
-libgstgtkhelper_la_SOURCES = gstgtk.c gstgtk.h
-libgstgtkhelper_la_CFLAGS = -I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(GTK3_CFLAGS)
-
-if HAVE_WINDOW_COCOA
-libgstgtkhelper_la_CFLAGS += -x objective-c
-endif
-
diff --git a/tests/examples/gl/gtk/README b/tests/examples/gl/gtk/README
deleted file mode 100644
index 76595c6bf..000000000
--- a/tests/examples/gl/gtk/README
+++ /dev/null
@@ -1,27 +0,0 @@
---- Description of the GTK examples ---
-
-- gtkvideooverlay:
-Show how to use the videooverlay interface through GTK.
-It's possible to switch bettween GST_STATE through four buttons.
-
--filternovideooverlay:
-A more complex pipeline is switched bettween the GST states
-without using the videooverlay interface.
-
--filtervideooverlay:
-A more complex pipeline is switched bettween the GST states.
-using the videooverlay interface.
-
--fxtest:
-switch bettween effects of the gleffects filter.
-
--pixbufdrop:
-drag and drop a png file and overlay it using alpha channel.
-It uses gloverlay filter.
-
--switchvideooverlay:
-change the videooverlay window while the stream is playing.
-
---- How to build the GTK examples ---
-
-Using autotools or using tests/examples/gtk/gtk.sln
diff --git a/tests/examples/gl/gtk/filternovideooverlay/.gitignore b/tests/examples/gl/gtk/filternovideooverlay/.gitignore
deleted file mode 100644
index f6e41625b..000000000
--- a/tests/examples/gl/gtk/filternovideooverlay/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-filternovideooverlay
diff --git a/tests/examples/gl/gtk/filternovideooverlay/Makefile.am b/tests/examples/gl/gtk/filternovideooverlay/Makefile.am
deleted file mode 100644
index 61526c544..000000000
--- a/tests/examples/gl/gtk/filternovideooverlay/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-noinst_PROGRAMS = filternovideooverlay
-
-filternovideooverlay_SOURCES = main.cpp
-
-filternovideooverlay_CXXFLAGS= \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_CXXFLAGS) \
- $(GL_CFLAGS) \
- $(GTK3_CFLAGS)
-
-filternovideooverlay_LDADD= \
- $(GTK3_LIBS) \
- $(GST_PLUGINS_BASE_LIBS) \
- $(GST_LIBS) \
- $(GL_LIBS)
-
diff --git a/tests/examples/gl/gtk/filternovideooverlay/main.cpp b/tests/examples/gl/gtk/filternovideooverlay/main.cpp
deleted file mode 100644
index dc9e04b68..000000000
--- a/tests/examples/gl/gtk/filternovideooverlay/main.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.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.
- */
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-
-static void end_stream_cb(GstBus* bus, GstMessage* message, GstElement* pipeline)
-{
- g_print("End of stream\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref(pipeline);
-
- gtk_main_quit();
-}
-
-static void button_state_null_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("GST_STATE_NULL\n");
-}
-
-
-static void button_state_ready_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_READY);
- g_print ("GST_STATE_READY\n");
-}
-
-
-static void button_state_paused_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- g_print ("GST_STATE_PAUSED\n");
-}
-
-
-static void button_state_playing_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("GST_STATE_PLAYING\n");
-}
-
-
-static gchar* slider_fps_cb (GtkScale* scale, gdouble value, GstElement* pipeline)
-{
- //change the video frame rate dynamically
- return g_strdup_printf ("video framerate: %0.*g", gtk_scale_get_digits (scale), value);
-}
-
-
-
-gint main (gint argc, gchar *argv[])
-{
- gtk_init (&argc, &argv);
- gst_init (&argc, &argv);
-
- GstElement* pipeline = gst_pipeline_new ("pipeline");
-
- //window to control the states
- GtkWidget* window_control = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- GdkGeometry geometry;
- geometry.min_width = 1;
- geometry.min_height = 1;
- geometry.max_width = -1;
- geometry.max_height = -1;
- gtk_window_set_geometry_hints (GTK_WINDOW (window_control), window_control, &geometry, GDK_HINT_MIN_SIZE);
- gtk_window_set_resizable (GTK_WINDOW (window_control), FALSE);
- gtk_window_move (GTK_WINDOW (window_control), 10, 10);
- GtkWidget* table = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (window_control), table);
-
- //control state null
- GtkWidget* button_state_null = gtk_button_new_with_label ("GST_STATE_NULL");
- g_signal_connect (G_OBJECT (button_state_null), "clicked",
- G_CALLBACK (button_state_null_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_null, 0, 0, 1, 1);
- gtk_widget_show (button_state_null);
-
- //control state ready
- GtkWidget* button_state_ready = gtk_button_new_with_label ("GST_STATE_READY");
- g_signal_connect (G_OBJECT (button_state_ready), "clicked",
- G_CALLBACK (button_state_ready_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_ready, 0, 1, 1, 1);
- gtk_widget_show (button_state_ready);
-
- //control state paused
- GtkWidget* button_state_paused = gtk_button_new_with_label ("GST_STATE_PAUSED");
- g_signal_connect (G_OBJECT (button_state_paused), "clicked",
- G_CALLBACK (button_state_paused_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_paused, 0, 2, 1, 1);
- gtk_widget_show (button_state_paused);
-
- //control state playing
- GtkWidget* button_state_playing = gtk_button_new_with_label ("GST_STATE_PLAYING");
- g_signal_connect (G_OBJECT (button_state_playing), "clicked",
- G_CALLBACK (button_state_playing_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_playing, 0, 3, 1, 1);
- gtk_widget_show (button_state_playing);
-
- //change framerate
- GtkWidget* slider_fps = gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL,
- 1, 30, 2);
- g_signal_connect (G_OBJECT (slider_fps), "format-value",
- G_CALLBACK (slider_fps_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), slider_fps, 1, 0, 1, 3);
- gtk_widget_show (slider_fps);
-
- gtk_widget_show (table);
- gtk_widget_show (window_control);
-
- GstElement* videosrc = gst_element_factory_make ("videotestsrc", "videotestsrc");
- GstElement* upload = gst_element_factory_make ("glupload", "glupload");
- GstElement* glfiltercube = gst_element_factory_make ("glfiltercube", "glfiltercube");
- GstElement* videosink = gst_element_factory_make ("glimagesink", "glimagesink");
-
- GstCaps *caps = gst_caps_new_simple("video/x-raw",
- "width", G_TYPE_INT, 640,
- "height", G_TYPE_INT, 480,
- "framerate", GST_TYPE_FRACTION, 25, 1,
- "format", G_TYPE_STRING, "RGBA",
- NULL) ;
-
- gst_bin_add_many (GST_BIN (pipeline), videosrc, upload, glfiltercube, videosink, NULL);
-
- gboolean link_ok = gst_element_link_filtered(videosrc, upload, caps) ;
- gst_caps_unref(caps) ;
- if(!link_ok)
- {
- g_warning("Failed to link videosrc to glfiltercube!\n") ;
- return -1;
- }
-
- if(!gst_element_link_many(upload, glfiltercube, videosink, NULL))
- {
- g_warning("Failed to link glfiltercube to videosink!\n") ;
- return -1;
- }
-
- //set window id on this event
- GstBus* bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch (bus);
- g_signal_connect(bus, "message::error", G_CALLBACK(end_stream_cb), pipeline);
- g_signal_connect(bus, "message::warning", G_CALLBACK(end_stream_cb), pipeline);
- g_signal_connect(bus, "message::eos", G_CALLBACK(end_stream_cb), pipeline);
- gst_object_unref (bus);
-
- //start
- GstStateChangeReturn ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- g_print ("Failed to start up pipeline!\n");
- return -1;
- }
-
- gtk_main();
-
- return 0;
-}
-
diff --git a/tests/examples/gl/gtk/filtervideooverlay/.gitignore b/tests/examples/gl/gtk/filtervideooverlay/.gitignore
deleted file mode 100644
index c5e1611f6..000000000
--- a/tests/examples/gl/gtk/filtervideooverlay/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-filtervideooverlay
diff --git a/tests/examples/gl/gtk/filtervideooverlay/Makefile.am b/tests/examples/gl/gtk/filtervideooverlay/Makefile.am
deleted file mode 100644
index 301b2aae6..000000000
--- a/tests/examples/gl/gtk/filtervideooverlay/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-noinst_PROGRAMS = filtervideooverlay
-
-filtervideooverlay_SOURCES = main.cpp
-
-filtervideooverlay_CXXFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) \
- $(GL_CFLAGS) $(GTK3_CFLAGS) $(X11_CFLAGS)
-filtervideooverlay_LDADD=../libgstgtkhelper.la \
- $(GTK3_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_LIBS) \
- $(GL_LIBS) -lgstvideo-$(GST_API_VERSION) $(X11_LIBS)
-
diff --git a/tests/examples/gl/gtk/filtervideooverlay/main.cpp b/tests/examples/gl/gtk/filtervideooverlay/main.cpp
deleted file mode 100644
index 6850a7da2..000000000
--- a/tests/examples/gl/gtk/filtervideooverlay/main.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "../gstgtk.h"
-
-#ifdef HAVE_X11
-#include <X11/Xlib.h>
-#endif
-
-static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, GtkWidget* widget)
-{
- GtkAllocation allocation;
-
- if (gst_gtk_handle_need_context (bus, message, NULL))
- return GST_BUS_DROP;
-
- // ignore anything but 'prepare-window-handle' element messages
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- g_print ("setting window handle %p\n", widget);
-
- gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), widget);
-
- gtk_widget_get_allocation (widget, &allocation);
- gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), allocation.x, allocation.y, allocation.width, allocation.height);
-
- gst_message_unref (message);
-
- return GST_BUS_DROP;
-}
-
-static gboolean
-resize_cb (GtkWidget * widget, GdkEvent * event, gpointer sink)
-{
- GtkAllocation allocation;
-
- gtk_widget_get_allocation (widget, &allocation);
- gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (sink), allocation.x, allocation.y, allocation.width, allocation.height);
-
- return G_SOURCE_CONTINUE;
-}
-
-static void end_stream_cb(GstBus* bus, GstMessage* message, GstElement* pipeline)
-{
- GError *error = NULL;
- gchar *details;
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ERROR:
- gst_message_parse_error (message, &error, &details);
-
- g_print("Error %s\n", error->message);
- g_print("Details %s\n", details);
- /* fallthrough */
- case GST_MESSAGE_EOS:
- g_print("End of stream\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref(pipeline);
-
- gtk_main_quit();
- break;
- case GST_MESSAGE_WARNING:
- gst_message_parse_warning (message, &error, &details);
-
- g_print("Warning %s\n", error->message);
- g_print("Details %s\n", details);
- break;
- default:
- break;
- }
-}
-
-static gboolean expose_cb(GtkWidget* widget, cairo_t *cr, GstElement* videosink)
-{
- gst_video_overlay_expose (GST_VIDEO_OVERLAY (videosink));
- return FALSE;
-}
-
-
-static void destroy_cb(GtkWidget* widget, GdkEvent* event, GstElement* pipeline)
-{
- g_print("Close\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref(pipeline);
-
- gtk_main_quit();
-}
-
-
-static void button_state_null_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("GST_STATE_NULL\n");
-}
-
-
-static void button_state_ready_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_READY);
- g_print ("GST_STATE_READY\n");
-}
-
-
-static void button_state_paused_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- g_print ("GST_STATE_PAUSED\n");
-}
-
-
-static void button_state_playing_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("GST_STATE_PLAYING\n");
-}
-
-
-static gchar* slider_fps_cb (GtkScale* scale, gdouble value, GstElement* pipeline)
-{
- //change the video frame rate dynamically
- return g_strdup_printf ("video framerate: %0.*g", gtk_scale_get_digits (scale), value);
-}
-
-
-
-gint main (gint argc, gchar *argv[])
-{
-#ifdef HAVE_X11
- XInitThreads ();
-#endif
-
- gtk_init (&argc, &argv);
- gst_init (&argc, &argv);
-
- GstElement* pipeline = gst_pipeline_new ("pipeline");
-
- //window that contains an area where the video is drawn
- GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_size_request (window, 640, 480);
- gtk_window_move (GTK_WINDOW (window), 300, 10);
- gtk_window_set_title (GTK_WINDOW (window), "glimagesink implement the gstvideooverlay interface");
- GdkGeometry geometry;
- geometry.min_width = 1;
- geometry.min_height = 1;
- geometry.max_width = -1;
- geometry.max_height = -1;
- gtk_window_set_geometry_hints (GTK_WINDOW (window), window, &geometry, GDK_HINT_MIN_SIZE);
-
- //window to control the states
- GtkWidget* window_control = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- geometry.min_width = 1;
- geometry.min_height = 1;
- geometry.max_width = -1;
- geometry.max_height = -1;
- gtk_window_set_geometry_hints (GTK_WINDOW (window_control), window_control, &geometry, GDK_HINT_MIN_SIZE);
- gtk_window_set_resizable (GTK_WINDOW (window_control), FALSE);
- gtk_window_move (GTK_WINDOW (window_control), 10, 10);
- GtkWidget* grid = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (window_control), grid);
-
- //control state null
- GtkWidget* button_state_null = gtk_button_new_with_label ("GST_STATE_NULL");
- g_signal_connect (G_OBJECT (button_state_null), "clicked",
- G_CALLBACK (button_state_null_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_null, 0, 1, 1, 1);
- gtk_widget_show (button_state_null);
-
- //control state ready
- GtkWidget* button_state_ready = gtk_button_new_with_label ("GST_STATE_READY");
- g_signal_connect (G_OBJECT (button_state_ready), "clicked",
- G_CALLBACK (button_state_ready_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_ready, 0, 2, 1, 1);
- gtk_widget_show (button_state_ready);
-
- //control state paused
- GtkWidget* button_state_paused = gtk_button_new_with_label ("GST_STATE_PAUSED");
- g_signal_connect (G_OBJECT (button_state_paused), "clicked",
- G_CALLBACK (button_state_paused_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_paused, 0, 3, 1, 1);
- gtk_widget_show (button_state_paused);
-
- //control state playing
- GtkWidget* button_state_playing = gtk_button_new_with_label ("GST_STATE_PLAYING");
- g_signal_connect (G_OBJECT (button_state_playing), "clicked",
- G_CALLBACK (button_state_playing_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_playing, 0, 4, 1, 1);
- gtk_widget_show (button_state_playing);
-
- //change framerate
- GtkWidget* slider_fps = gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL, 1, 30, 2);
- g_signal_connect (G_OBJECT (slider_fps), "format-value",
- G_CALLBACK (slider_fps_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), slider_fps, 1, 0, 1, 5);
- gtk_widget_show (slider_fps);
-
- gtk_widget_show (grid);
- gtk_widget_show (window_control);
-
- //configure the pipeline
- g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(destroy_cb), pipeline);
-
- GstElement* videosrc = gst_element_factory_make ("videotestsrc", "videotestsrc");
- GstElement* upload = gst_element_factory_make ("glupload", "glupload");
- GstElement* glfiltercube = gst_element_factory_make ("glfiltercube", "glfiltercube");
- GstElement* videosink = gst_element_factory_make ("glimagesink", "glimagesink");
-
- GstCaps *caps = gst_caps_new_simple("video/x-raw",
- "width", G_TYPE_INT, 640,
- "height", G_TYPE_INT, 480,
- "framerate", GST_TYPE_FRACTION, 25, 1,
- "format", G_TYPE_STRING, "RGBA",
- NULL) ;
-
- gst_bin_add_many (GST_BIN (pipeline), videosrc, upload, glfiltercube, videosink, NULL);
-
- gboolean link_ok = gst_element_link_filtered(videosrc, upload, caps) ;
- gst_caps_unref(caps) ;
- if(!link_ok)
- {
- g_warning("Failed to link videosrc to glfiltercube!\n") ;
- return -1;
- }
-
- if(!gst_element_link_many(upload, glfiltercube, videosink, NULL))
- {
- g_warning("Failed to link glfiltercube to videosink!\n") ;
- return -1;
- }
-
- //area where the video is drawn
- GtkWidget* area = gtk_drawing_area_new();
- gtk_widget_set_redraw_on_allocate (area, TRUE);
- gtk_container_add (GTK_CONTAINER (window), area);
-
- gtk_widget_realize(area);
-
- //set window id on this event
- GstBus* bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, area, NULL);
- gst_bus_add_signal_watch (bus);
- g_signal_connect(bus, "message::error", G_CALLBACK(end_stream_cb), pipeline);
- g_signal_connect(bus, "message::warning", G_CALLBACK(end_stream_cb), pipeline);
- g_signal_connect(bus, "message::eos", G_CALLBACK(end_stream_cb), pipeline);
- gst_object_unref (bus);
-
- //needed when being in GST_STATE_READY, GST_STATE_PAUSED
- //or resizing/obscuring the window
- g_signal_connect(area, "draw", G_CALLBACK(expose_cb), videosink);
- g_signal_connect(area, "configure-event", G_CALLBACK(resize_cb), videosink);
-
- //start
- GstStateChangeReturn ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- g_print ("Failed to start up pipeline!\n");
- return -1;
- }
-
- gtk_widget_show_all (window);
-
- gtk_main();
-
- return 0;
-}
-
diff --git a/tests/examples/gl/gtk/fxtest/.gitignore b/tests/examples/gl/gtk/fxtest/.gitignore
deleted file mode 100644
index c35569775..000000000
--- a/tests/examples/gl/gtk/fxtest/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-fxtest
-pixbufdrop
diff --git a/tests/examples/gl/gtk/fxtest/Makefile.am b/tests/examples/gl/gtk/fxtest/Makefile.am
deleted file mode 100644
index e078906f5..000000000
--- a/tests/examples/gl/gtk/fxtest/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-noinst_PROGRAMS = fxtest
-noinst_PROGRAMS += pixbufdrop
-
-fxtest_SOURCES = fxtest.c
-
-fxtest_CFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
- $(GL_CFLAGS) $(GTK3_CFLAGS) $(X11_CFLAGS)
-fxtest_LDADD=../libgstgtkhelper.la \
- $(GTK3_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_LIBS) \
- $(GL_LIBS) -lgstvideo-$(GST_API_VERSION) $(X11_LIBS)
-
-pixbufdrop_SOURCES = pixbufdrop.c
-
-pixbufdrop_CFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
- $(GL_CFLAGS) $(GTK3_CFLAGS) $(X11_CFLAGS)
-pixbufdrop_LDADD=../libgstgtkhelper.la \
- $(GTK3_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_LIBS) \
- $(GL_LIBS) -lgstvideo-$(GST_API_VERSION) $(X11_LIBS)
diff --git a/tests/examples/gl/gtk/fxtest/fxtest.c b/tests/examples/gl/gtk/fxtest/fxtest.c
deleted file mode 100644
index 8b56b969f..000000000
--- a/tests/examples/gl/gtk/fxtest/fxtest.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Filippo Argiolas <filippo.argiolas@gmail.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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include "../gstgtk.h"
-
-#include <gst/video/videooverlay.h>
-
-#ifdef HAVE_X11
-#include <X11/Xlib.h>
-#endif
-
-
-static GstBusSyncReply
-create_window (GstBus * bus, GstMessage * message, GtkWidget * widget)
-{
- if (gst_gtk_handle_need_context (bus, message, NULL))
- return GST_BUS_DROP;
-
- /* ignore anything but 'prepare-window-handle' element messages */
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- g_print ("setting window handle\n");
-
- /* do not call gdk_window_ensure_native for the first time here because
- * we are in a different thread than the main thread
- * (and the main thread the one) */
- gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC
- (message)), widget);
-
- gst_message_unref (message);
-
- return GST_BUS_DROP;
-}
-
-
-static void
-end_stream_cb (GstBus * bus, GstMessage * message, GstElement * pipeline)
-{
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_EOS:
- g_print ("End of stream\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- gtk_main_quit ();
- break;
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
-
- gst_message_parse_error (message, &err, &debug);
-
- g_print ("Error: %s\n", err->message);
- g_clear_error (&err);
-
- if (debug) {
- g_print ("Debug details: %s\n", debug);
- g_free (debug);
- }
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- gtk_main_quit ();
- break;
- }
- default:
- break;
- }
-}
-
-static gboolean
-resize_cb (GtkWidget * widget, GdkEvent * event, gpointer data)
-{
- GtkAllocation allocation;
- GstVideoOverlay *overlay =
- GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (data),
- GST_TYPE_VIDEO_OVERLAY));
-
- gtk_widget_get_allocation (widget, &allocation);
- gst_video_overlay_set_render_rectangle (overlay, allocation.x, allocation.y,
- allocation.width, allocation.height);
- gst_object_unref (overlay);
-
- return G_SOURCE_CONTINUE;
-}
-
-static gboolean
-expose_cb (GtkWidget * widget, gpointer unused, gpointer data)
-{
- GstVideoOverlay *overlay =
- GST_VIDEO_OVERLAY (gst_bin_get_by_interface (GST_BIN (data),
- GST_TYPE_VIDEO_OVERLAY));
-
- gst_video_overlay_expose (overlay);
- gst_object_unref (overlay);
-
- return FALSE;
-}
-
-static void
-destroy_cb (GtkWidget * widget, GdkEvent * event, GstElement * pipeline)
-{
- g_message ("destroy callback");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- gtk_main_quit ();
-}
-
-static gboolean
-apply_fx (GtkWidget * widget, gpointer data)
-{
- gchar *fx;
- GEnumClass *p_class;
-
-/* heeeellppppp!! */
- p_class =
- G_PARAM_SPEC_ENUM (g_object_class_find_property (G_OBJECT_GET_CLASS
- (G_OBJECT (data)), "effect")
- )->enum_class;
-
- fx = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget));
- g_print ("setting: %s - %s\n", fx, g_enum_get_value_by_nick (p_class,
- fx)->value_name);
- g_object_set (G_OBJECT (data), "effect", g_enum_get_value_by_nick (p_class,
- fx)->value, NULL);
- return FALSE;
-}
-
-static gboolean
-play_cb (GtkWidget * widget, gpointer data)
-{
- g_message ("playing");
- gst_element_set_state (GST_ELEMENT (data), GST_STATE_PLAYING);
- return FALSE;
-}
-
-static gboolean
-null_cb (GtkWidget * widget, gpointer data)
-{
- g_message ("nulling");
- gst_element_set_state (GST_ELEMENT (data), GST_STATE_NULL);
- return FALSE;
-}
-
-static gboolean
-ready_cb (GtkWidget * widget, gpointer data)
-{
- g_message ("readying");
- gst_element_set_state (GST_ELEMENT (data), GST_STATE_READY);
- return FALSE;
-}
-
-static gboolean
-pause_cb (GtkWidget * widget, gpointer data)
-{
- g_message ("pausing");
- gst_element_set_state (GST_ELEMENT (data), GST_STATE_PAUSED);
- return FALSE;
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstStateChangeReturn ret;
- GstElement *pipeline;
- GstElement *upload, *filter, *sink;
- GstElement *sourcebin;
- GstBus *bus;
- GError *error = NULL;
-
- GtkWidget *window;
- GtkWidget *screen;
- GtkWidget *vbox, *combo;
- GtkWidget *hbox;
- GtkWidget *play, *pause, *null, *ready;
-
- gchar **source_desc_array = NULL;
- gchar *source_desc = NULL;
-
- GOptionContext *context;
- GOptionEntry options[] = {
- {"source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array,
- "Use a custom source bin description (gst-launch style)", NULL}
- ,
- {NULL}
- };
-
-#ifdef HAVE_X11
- XInitThreads ();
-#endif
-
- context = g_option_context_new (NULL);
- g_option_context_add_main_entries (context, options, NULL);
- g_option_context_add_group (context, gst_init_get_option_group ());
- g_option_context_add_group (context, gtk_get_option_group (TRUE));
- if (!g_option_context_parse (context, &argc, &argv, &error)) {
- g_print ("Inizialization error: %s\n", GST_STR_NULL (error->message));
- g_option_context_free (context);
- g_clear_error (&error);
- return -1;
- }
- g_option_context_free (context);
-
- if (source_desc_array != NULL) {
- source_desc = g_strjoinv (" ", source_desc_array);
- g_strfreev (source_desc_array);
- }
- if (source_desc == NULL) {
- source_desc =
- g_strdup
- ("videotestsrc ! video/x-raw, width=352, height=288 ! identity");
- }
-
- sourcebin =
- gst_parse_bin_from_description (g_strdup (source_desc), TRUE, &error);
- g_free (source_desc);
- if (error) {
- g_print ("Error while parsing source bin description: %s\n",
- GST_STR_NULL (error->message));
- return -1;
- }
-
- g_set_application_name ("gst-gl-effects test app");
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_container_set_border_width (GTK_CONTAINER (window), 3);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- upload = gst_element_factory_make ("glupload", NULL);
- filter = gst_element_factory_make ("gleffects", "flt");
- sink = gst_element_factory_make ("glimagesink", "glsink");
-
- gst_bin_add_many (GST_BIN (pipeline), sourcebin, upload, filter, sink, NULL);
-
- if (!gst_element_link_many (sourcebin, upload, filter, sink, NULL)) {
- g_print ("Failed to link one or more elements!\n");
- return -1;
- }
-
- g_signal_connect (G_OBJECT (window), "delete-event",
- G_CALLBACK (destroy_cb), pipeline);
- g_signal_connect (G_OBJECT (window), "destroy-event",
- G_CALLBACK (destroy_cb), pipeline);
-
- screen = gtk_drawing_area_new ();
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch (bus);
- g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb),
- pipeline);
- g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb),
- pipeline);
- g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), pipeline);
-
- gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, screen,
- NULL);
- gst_object_unref (bus);
-
- gtk_widget_set_size_request (screen, 640, 480); // 500 x 376
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
-
- gtk_box_pack_start (GTK_BOX (vbox), screen, TRUE, TRUE, 0);
-
- combo = gtk_combo_box_text_new ();
-
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "identity");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "mirror");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "squeeze");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "stretch");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "fisheye");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "twirl");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "bulge");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "tunnel");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "square");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "heat");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "xpro");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "lumaxpro");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "sepia");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "xray");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "sin");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "glow");
-
- g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (apply_fx), filter);
-
- gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-
- play = gtk_button_new_with_label ("PLAY");
-
- g_signal_connect (G_OBJECT (play), "clicked", G_CALLBACK (play_cb), pipeline);
-
- pause = gtk_button_new_with_label ("PAUSE");
-
- g_signal_connect (G_OBJECT (pause), "clicked",
- G_CALLBACK (pause_cb), pipeline);
-
- null = gtk_button_new_with_label ("NULL");
-
- g_signal_connect (G_OBJECT (null), "clicked", G_CALLBACK (null_cb), pipeline);
-
- ready = gtk_button_new_with_label ("READY");
-
- g_signal_connect (G_OBJECT (ready), "clicked",
- G_CALLBACK (ready_cb), pipeline);
-
- gtk_box_pack_start (GTK_BOX (hbox), null, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), ready, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), play, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), pause, TRUE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- g_signal_connect (screen, "draw", G_CALLBACK (expose_cb), pipeline);
- g_signal_connect (screen, "configure-event", G_CALLBACK (resize_cb),
- pipeline);
- gtk_widget_realize (screen);
-
- ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE) {
- g_print ("Failed to start up pipeline!\n");
- return -1;
- }
-
- gtk_widget_show_all (GTK_WIDGET (window));
-
- gtk_main ();
-
- return 0;
-}
diff --git a/tests/examples/gl/gtk/fxtest/pixbufdrop.c b/tests/examples/gl/gtk/fxtest/pixbufdrop.c
deleted file mode 100644
index 3a43de2e0..000000000
--- a/tests/examples/gl/gtk/fxtest/pixbufdrop.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Filippo Argiolas <filippo.argiolas@gmail.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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include "../gstgtk.h"
-
-#include <gst/video/videooverlay.h>
-
-#ifdef HAVE_X11
-#include <X11/Xlib.h>
-#endif
-
-static gint delay = 0;
-static gint saveddelay = 0;
-static gint method = 1;
-
-struct _SourceData
-{
- gpointer data;
- gpointer nick;
- gpointer value;
-};
-typedef struct _SourceData SourceData;
-
-static GstBusSyncReply
-create_window (GstBus * bus, GstMessage * message, GtkWidget * widget)
-{
- // ignore anything but 'prepare-window-handle' element messages
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC
- (message)), widget);
-
- gst_message_unref (message);
-
- return GST_BUS_DROP;
-}
-
-static void
-message_cb (GstBus * bus, GstMessage * message, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- gtk_main_quit ();
-}
-
-static gboolean
-expose_cb (GtkWidget * widget, cairo_t * cr, GstElement * videosink)
-{
- gst_video_overlay_expose (GST_VIDEO_OVERLAY (videosink));
- return FALSE;
-}
-
-static void
-destroy_cb (GtkWidget * widget, GdkEvent * event, GstElement * pipeline)
-{
- g_message ("destroy callback");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- gtk_main_quit ();
-}
-
-static gboolean
-play_cb (GtkWidget * widget, gpointer data)
-{
- g_message ("playing");
- gst_element_set_state (GST_ELEMENT (data), GST_STATE_PLAYING);
- return FALSE;
-}
-
-static gboolean
-null_cb (GtkWidget * widget, gpointer data)
-{
- g_message ("nulling");
- gst_element_set_state (GST_ELEMENT (data), GST_STATE_NULL);
- return FALSE;
-}
-
-static gboolean
-ready_cb (GtkWidget * widget, gpointer data)
-{
- g_message ("readying");
- gst_element_set_state (GST_ELEMENT (data), GST_STATE_READY);
- return FALSE;
-}
-
-static gboolean
-pause_cb (GtkWidget * widget, gpointer data)
-{
- g_message ("pausing");
- gst_element_set_state (GST_ELEMENT (data), GST_STATE_PAUSED);
- return FALSE;
-}
-
-static gboolean
-set_location_delayed (gpointer data)
-{
- SourceData *sdata = (SourceData *) data;
- delay--;
- g_print ("%d\n", delay);
- if (delay > 0) {
- return TRUE;
- }
- g_object_set (G_OBJECT (sdata->data), sdata->nick, sdata->value, NULL);
- delay = saveddelay;
- return FALSE;
-}
-
-static void
-on_drag_data_received (GtkWidget * widget,
- GdkDragContext * context, int x, int y,
- GtkSelectionData * seldata, guint inf, guint time, gpointer data)
-{
- SourceData *userdata = g_new0 (SourceData, 1);
- GdkPixbufFormat *format;
- gchar **uris = gtk_selection_data_get_uris (seldata);
- gchar *filename = NULL;
-
- g_return_if_fail (uris != NULL);
- filename = g_filename_from_uri (uris[0], NULL, NULL);
- g_return_if_fail (filename != NULL);
- format = gdk_pixbuf_get_file_info (filename, NULL, NULL);
- g_return_if_fail (format);
- g_print ("received %s image: %s\n", filename,
- gdk_pixbuf_format_get_name (format));
-
- userdata->nick = (gchar *) "location";
- userdata->value = g_strdup (filename);
- userdata->data = data;
- saveddelay = delay;
- if (delay > 0) {
- g_print ("%d\n", delay);
- g_timeout_add_seconds (1, set_location_delayed, userdata);
- } else
- g_object_set (G_OBJECT (userdata->data), userdata->nick, userdata->value,
- NULL);
- g_free (filename);
-}
-
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline;
- GstElement *filter, *sink;
- GstElement *sourcebin;
- GstBus *bus;
- GError *error = NULL;
-
- GtkWidget *window;
- GtkWidget *screen;
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *play, *pause, *null, *ready;
-
- gchar **source_desc_array = NULL;
- gchar *source_desc = NULL;
-
- GOptionContext *context;
- GOptionEntry options[] = {
- {"source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array,
- "Use a custom source bin description (gst-launch style)", NULL}
- ,
- {"method", 'm', 0, G_OPTION_ARG_INT, &method,
- "1 for gstdifferencematte, 2 for gloverlay", "M"}
- ,
- {"delay", 'd', 0, G_OPTION_ARG_INT, &delay,
- "Wait N seconds before to send the image to gstreamer (useful with differencematte)",
- "N"}
- ,
- {NULL}
- };
-
-#ifdef HAVE_X11
- XInitThreads ();
-#endif
-
- context = g_option_context_new (NULL);
- g_option_context_add_main_entries (context, options, NULL);
- g_option_context_add_group (context, gst_init_get_option_group ());
- g_option_context_add_group (context, gtk_get_option_group (TRUE));
- if (!g_option_context_parse (context, &argc, &argv, &error)) {
- g_print ("Inizialization error: %s\n", GST_STR_NULL (error->message));
- g_option_context_free (context);
- g_clear_error (&error);
- return -1;
- }
- g_option_context_free (context);
-
- if (source_desc_array != NULL) {
- source_desc = g_strjoinv (" ", source_desc_array);
- g_strfreev (source_desc_array);
- }
- if (source_desc == NULL) {
- source_desc =
- g_strdup
- ("videotestsrc ! video/x-raw, width=352, height=288 ! identity ! glupload");
- }
-
- sourcebin =
- gst_parse_bin_from_description (g_strdup (source_desc), TRUE, &error);
- g_free (source_desc);
- if (error) {
- g_print ("Error while parsing source bin description: %s\n",
- GST_STR_NULL (error->message));
- return -1;
- }
-
- g_set_application_name ("gst-gl-effects test app");
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_container_set_border_width (GTK_CONTAINER (window), 3);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- if (method == 2) {
- filter = gst_element_factory_make ("gloverlay", "flt");
- } else {
- filter = gst_element_factory_make ("gldifferencematte", "flt");
- }
- sink = gst_element_factory_make ("glimagesink", "glsink");
-
- gst_bin_add_many (GST_BIN (pipeline), sourcebin, filter, sink, NULL);
-
- if (!gst_element_link_many (sourcebin, filter, sink, NULL)) {
- g_print ("Failed to link one or more elements!\n");
- return -1;
- }
-
- g_signal_connect (G_OBJECT (window), "delete-event",
- G_CALLBACK (destroy_cb), pipeline);
- g_signal_connect (G_OBJECT (window), "destroy-event",
- G_CALLBACK (destroy_cb), pipeline);
-
- screen = gtk_drawing_area_new ();
-
- gtk_widget_set_size_request (screen, 640, 480); // 500 x 376
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
-
- gtk_box_pack_start (GTK_BOX (vbox), screen, TRUE, TRUE, 0);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-
- play = gtk_button_new_with_label ("PLAY");
-
- g_signal_connect (G_OBJECT (play), "clicked", G_CALLBACK (play_cb), pipeline);
-
- pause = gtk_button_new_with_label ("PAUSE");
-
- g_signal_connect (G_OBJECT (pause), "clicked",
- G_CALLBACK (pause_cb), pipeline);
-
- null = gtk_button_new_with_label ("NULL");
-
- g_signal_connect (G_OBJECT (null), "clicked", G_CALLBACK (null_cb), pipeline);
-
- ready = gtk_button_new_with_label ("READY");
-
- g_signal_connect (G_OBJECT (ready), "clicked",
- G_CALLBACK (ready_cb), pipeline);
-
- gtk_box_pack_start (GTK_BOX (hbox), null, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), ready, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), play, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), pause, TRUE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- gtk_widget_realize (screen);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, screen,
- NULL);
- gst_bus_add_signal_watch (bus);
- g_signal_connect (bus, "message::error", G_CALLBACK (message_cb), pipeline);
- g_signal_connect (bus, "message::warning", G_CALLBACK (message_cb), pipeline);
- g_signal_connect (bus, "message::eos", G_CALLBACK (message_cb), pipeline);
- gst_object_unref (bus);
- g_signal_connect (screen, "draw", G_CALLBACK (expose_cb), sink);
-
- gtk_drag_dest_set (screen, GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_COPY);
- gtk_drag_dest_add_uri_targets (screen);
-
- g_signal_connect (screen, "drag-data-received",
- G_CALLBACK (on_drag_data_received), filter);
-
- gtk_widget_show_all (GTK_WIDGET (window));
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/tests/examples/gl/gtk/gstgtk.c b/tests/examples/gl/gtk/gstgtk.c
deleted file mode 100644
index 40caa8da6..000000000
--- a/tests/examples/gl/gtk/gstgtk.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 David A. Schleef <ds@schleef.org>
- *
- * 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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gl/gl.h>
-#include "gstgtk.h"
-
-#if GST_GL_HAVE_WINDOW_WIN32 && defined(GDK_WINDOWING_WIN32)
-#include <gdk/gdkwin32.h>
-#endif
-#if GST_GL_HAVE_WINDOW_X11 && defined(GDK_WINDOWING_X11)
-#include <gdk/gdkx.h>
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND && defined(GDK_WINDOWING_WAYLAND)
-#include <gdk/gdkwayland.h>
-#endif
-#if GST_GL_HAVE_WINDOW_COCOA && defined(GDK_WINDOWING_QUARTZ)
-#include <gdk/gdkquartz.h>
-#endif
-
-gboolean
-gst_gtk_handle_need_context (GstBus * bus, GstMessage * msg, gpointer data)
-{
- gboolean ret = FALSE;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_NEED_CONTEXT:
- {
- const gchar *context_type;
-
- gst_message_parse_context_type (msg, &context_type);
- g_print ("got need context %s\n", context_type);
-
- if (g_strcmp0 (context_type, "GstWaylandDisplayHandleContextType") == 0) {
-#if GST_GL_HAVE_WINDOW_WAYLAND && defined(GDK_WINDOWING_WAYLAND)
- GstContext *context = NULL;
- GdkDisplay *gdk_display = gdk_display_get_default ();
- if (GDK_IS_WAYLAND_DISPLAY (gdk_display)) {
- struct wl_display *wayland_display =
- gdk_wayland_display_get_wl_display (gdk_display);
- if (wayland_display) {
- GstStructure *s;
-
- context =
- gst_context_new ("GstWaylandDisplayHandleContextType", TRUE);
-
- s = gst_context_writable_structure (context);
- gst_structure_set (s, "display", G_TYPE_POINTER, wayland_display,
- NULL);
-
- gst_element_set_context (GST_ELEMENT (msg->src), context);
-
- ret = TRUE;
- }
- }
-#else
- GST_ERROR
- ("Asked for wayland display context, but compiled without wayland support");
-#endif
- }
- }
- default:
- break;
- }
-
- return ret;
-}
-
-void
-gst_video_overlay_set_gtk_window (GstVideoOverlay * videooverlay,
- GtkWidget * widget)
-{
- GdkWindow *window;
- GdkDisplay *display;
- const gchar *user_choice = g_getenv ("GST_GL_WINDOW");
-
- window = gtk_widget_get_window (widget);
- display = gdk_window_get_display (window);
-
-#if GST_GL_HAVE_WINDOW_WIN32 && defined(GDK_WINDOWING_WIN32)
- if (GDK_IS_WIN32_DISPLAY (display) && (!user_choice
- || g_strcmp0 (user_choice, "win32") == 0)) {
- gst_video_overlay_set_window_handle (videooverlay,
- (guintptr) GDK_WINDOW_HWND (window));
- } else
-#endif
-#if GST_GL_HAVE_WINDOW_COCOA && defined(GDK_WINDOWING_QUARTZ)
- if (GDK_IS_QUARTZ_DISPLAY (display) && (!user_choice
- || g_strcmp0 (user_choice, "cocoa") == 0)) {
- gst_video_overlay_set_window_handle (videooverlay, (guintptr)
- gdk_quartz_window_get_nsview (window));
- } else
-#endif
-#if GST_GL_HAVE_WINDOW_X11 && defined(GDK_WINDOWING_X11)
- if (GDK_IS_X11_DISPLAY (display) && (!user_choice
- || g_strcmp0 (user_choice, "x11") == 0)) {
- gst_video_overlay_set_window_handle (videooverlay, GDK_WINDOW_XID (window));
- } else
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND && defined(GDK_WINDOWING_WAYLAND)
- if (GDK_IS_WAYLAND_DISPLAY (display) && (!user_choice
- || g_strcmp0 (user_choice, "wayland") == 0)) {
- gst_video_overlay_set_window_handle (videooverlay,
- (guintptr) gdk_wayland_window_get_wl_surface (window));
- } else
-#endif
- g_error ("Unsupported Gtk+ backend");
-}
diff --git a/tests/examples/gl/gtk/gstgtk.h b/tests/examples/gl/gtk/gstgtk.h
deleted file mode 100644
index 2aeec5960..000000000
--- a/tests/examples/gl/gtk/gstgtk.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 David A. Schleef <ds@schleef.org>
- *
- * 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_GTK_H__
-#define __GST_GTK_H__
-
-#include <gst/video/videooverlay.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-void gst_video_overlay_set_gtk_window (GstVideoOverlay *videooverlay, GtkWidget *window);
-gboolean gst_gtk_handle_need_context (GstBus *bus, GstMessage *msg, gpointer data);
-
-G_END_DECLS
-
-#endif
-
diff --git a/tests/examples/gl/gtk/gtk.sln b/tests/examples/gl/gtk/gtk.sln
deleted file mode 100644
index 5bf66dcfe..000000000
--- a/tests/examples/gl/gtk/gtk.sln
+++ /dev/null
@@ -1,50 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filtervideooverlay", "filtervideooverlay\filtervideooverlay.vcproj", "{F9CC027E-CC9F-4B34-AA8F-58852EC32CD0}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtkvideooverlay", "gtkvideooverlay\gtkvideooverlay.vcproj", "{E83070C2-58E4-48AE-AEB3-A4580EDE1212}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fxtest", "fxtest\fxtest.vcproj", "{59075FDD-68CD-4F1A-948B-46D142800798}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pixbufdrop", "pixbufdrop\pixbufdrop.vcproj", "{09F68B62-1D4C-4C24-A6AD-AA76A9F3237C}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filternovideooverlay", "filternovideooverlay\filternovideooverlay.vcproj", "{F41F3034-3E0B-4630-8D1E-35E14C606863}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "switchvideooverlay", "switchvideooverlay\switchvideooverlay.vcproj", "{BA78B4B4-3268-483E-9676-911E29FD2C69}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {F9CC027E-CC9F-4B34-AA8F-58852EC32CD0}.Debug|Win32.ActiveCfg = Debug|Win32
- {F9CC027E-CC9F-4B34-AA8F-58852EC32CD0}.Debug|Win32.Build.0 = Debug|Win32
- {F9CC027E-CC9F-4B34-AA8F-58852EC32CD0}.Release|Win32.ActiveCfg = Release|Win32
- {F9CC027E-CC9F-4B34-AA8F-58852EC32CD0}.Release|Win32.Build.0 = Release|Win32
- {E83070C2-58E4-48AE-AEB3-A4580EDE1212}.Debug|Win32.ActiveCfg = Debug|Win32
- {E83070C2-58E4-48AE-AEB3-A4580EDE1212}.Debug|Win32.Build.0 = Debug|Win32
- {E83070C2-58E4-48AE-AEB3-A4580EDE1212}.Release|Win32.ActiveCfg = Release|Win32
- {E83070C2-58E4-48AE-AEB3-A4580EDE1212}.Release|Win32.Build.0 = Release|Win32
- {59075FDD-68CD-4F1A-948B-46D142800798}.Debug|Win32.ActiveCfg = Debug|Win32
- {59075FDD-68CD-4F1A-948B-46D142800798}.Debug|Win32.Build.0 = Debug|Win32
- {59075FDD-68CD-4F1A-948B-46D142800798}.Release|Win32.ActiveCfg = Release|Win32
- {59075FDD-68CD-4F1A-948B-46D142800798}.Release|Win32.Build.0 = Release|Win32
- {09F68B62-1D4C-4C24-A6AD-AA76A9F3237C}.Debug|Win32.ActiveCfg = Debug|Win32
- {09F68B62-1D4C-4C24-A6AD-AA76A9F3237C}.Debug|Win32.Build.0 = Debug|Win32
- {09F68B62-1D4C-4C24-A6AD-AA76A9F3237C}.Release|Win32.ActiveCfg = Release|Win32
- {09F68B62-1D4C-4C24-A6AD-AA76A9F3237C}.Release|Win32.Build.0 = Release|Win32
- {F41F3034-3E0B-4630-8D1E-35E14C606863}.Debug|Win32.ActiveCfg = Debug|Win32
- {F41F3034-3E0B-4630-8D1E-35E14C606863}.Debug|Win32.Build.0 = Debug|Win32
- {F41F3034-3E0B-4630-8D1E-35E14C606863}.Release|Win32.ActiveCfg = Release|Win32
- {F41F3034-3E0B-4630-8D1E-35E14C606863}.Release|Win32.Build.0 = Release|Win32
- {BA78B4B4-3268-483E-9676-911E29FD2C69}.Debug|Win32.ActiveCfg = Debug|Win32
- {BA78B4B4-3268-483E-9676-911E29FD2C69}.Debug|Win32.Build.0 = Debug|Win32
- {BA78B4B4-3268-483E-9676-911E29FD2C69}.Release|Win32.ActiveCfg = Release|Win32
- {BA78B4B4-3268-483E-9676-911E29FD2C69}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/tests/examples/gl/gtk/switchvideooverlay/.gitignore b/tests/examples/gl/gtk/switchvideooverlay/.gitignore
deleted file mode 100644
index 64c6de420..000000000
--- a/tests/examples/gl/gtk/switchvideooverlay/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-switchvideooverlay
diff --git a/tests/examples/gl/gtk/switchvideooverlay/Makefile.am b/tests/examples/gl/gtk/switchvideooverlay/Makefile.am
deleted file mode 100644
index e6ebf70bf..000000000
--- a/tests/examples/gl/gtk/switchvideooverlay/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-noinst_PROGRAMS = switchvideooverlay
-
-switchvideooverlay_SOURCES = main.cpp
-
-switchvideooverlay_CXXFLAGS=-I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) \
- $(GL_CFLAGS) $(GTK3_CFLAGS) $(X_CFLAGS)
-switchvideooverlay_LDADD=../libgstgtkhelper.la \
- $(GTK3_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_LIBS) \
- $(GL_LIBS) -lgstvideo-$(GST_API_VERSION) $(X_LIBS)
-
diff --git a/tests/examples/gl/gtk/switchvideooverlay/main.cpp b/tests/examples/gl/gtk/switchvideooverlay/main.cpp
deleted file mode 100644
index 476478d75..000000000
--- a/tests/examples/gl/gtk/switchvideooverlay/main.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "../gstgtk.h"
-
-#ifdef HAVE_X11
-#include <X11/Xlib.h>
-#endif
-
-static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, GtkWidget* widget)
-{
- GtkAllocation allocation;
-
- if (gst_gtk_handle_need_context (bus, message, NULL))
- return GST_BUS_DROP;
-
- // ignore anything but 'prepare-window-handle' element messages
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- g_print ("setting window handle %p\n", widget);
-
- gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), widget);
-
- gtk_widget_get_allocation (widget, &allocation);
- gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), allocation.x, allocation.y, allocation.width, allocation.height);
-
- gst_message_unref (message);
-
- return GST_BUS_DROP;
-}
-
-static gboolean
-resize_cb (GtkWidget * widget, GdkEvent * event, gpointer sink)
-{
- GtkAllocation allocation;
-
- gtk_widget_get_allocation (widget, &allocation);
- gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (sink), allocation.x, allocation.y, allocation.width, allocation.height);
-
- return FALSE;
-}
-
-static void end_stream_cb(GstBus* bus, GstMessage* message, GstElement* pipeline)
-{
- GError *error = NULL;
- gchar *details;
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ERROR:
- gst_message_parse_error (message, &error, &details);
-
- g_print("Error %s\n", error->message);
- g_print("Details %s\n", details);
- /* fallthrough */
- case GST_MESSAGE_EOS:
- g_print("End of stream\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref(pipeline);
-
- gtk_main_quit();
- break;
- case GST_MESSAGE_WARNING:
- gst_message_parse_warning (message, &error, &details);
-
- g_print("Warning %s\n", error->message);
- g_print("Details %s\n", details);
- break;
- default:
- break;
- }
-}
-
-static gboolean expose_cb(GtkWidget* widget, cairo_t *cr, GstElement* videosink)
-{
- g_print ("expose %p\n", widget);
- g_print ("event mask: 0x%x, button_press 0x%x\n", gtk_widget_get_events (widget), GDK_BUTTON_PRESS_MASK);
- gst_video_overlay_expose (GST_VIDEO_OVERLAY (videosink));
- return FALSE;
-}
-
-static gboolean on_click_drawing_area(GtkWidget* widget, GdkEventButton* event, GstElement* videosink)
-{
- GtkAllocation allocation;
- GtkWidget *parent = gtk_widget_get_parent (widget);
-
- g_print ("switch the drawing area %p\n", widget);
- gst_video_overlay_set_gtk_window (GST_VIDEO_OVERLAY (videosink), widget);
-
- gtk_widget_get_allocation (widget, &allocation);
- gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (videosink), allocation.x, allocation.y, allocation.width, allocation.height);
-
- /* XXX: required on wayland as changing the window handle (subsurface)
- * requires a wl_surface::commit from the parent */
- if (parent)
- gtk_widget_queue_draw (parent);
-
- return FALSE;
-}
-
-
-static void destroy_cb(GtkWidget* widget, GdkEvent* event, GstElement* pipeline)
-{
- g_print("Close\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref(pipeline);
-
- gtk_main_quit();
-}
-
-
-static void button_state_null_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("GST_STATE_NULL\n");
-}
-
-
-static void button_state_ready_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_READY);
- g_print ("GST_STATE_READY\n");
-}
-
-
-static void button_state_paused_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- g_print ("GST_STATE_PAUSED\n");
-}
-
-
-static void button_state_playing_cb(GtkWidget* widget, GstElement* pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("GST_STATE_PLAYING\n");
-}
-
-gint main (gint argc, gchar *argv[])
-{
-#ifdef HAVE_X11
- XInitThreads();
-#endif
-
- gtk_init (&argc, &argv);
- gst_init (&argc, &argv);
-
- GstElement* pipeline = gst_pipeline_new ("pipeline");
-
- //window that contains several ares where the video is drawn
- GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_size_request (window, 640, 240);
- gtk_window_move (GTK_WINDOW (window), 300, 10);
- gtk_window_set_title (GTK_WINDOW (window), "click on left, right or outside the main window to switch the drawing area");
- GdkGeometry geometry;
- geometry.min_width = 1;
- geometry.min_height = 1;
- geometry.max_width = -1;
- geometry.max_height = -1;
- gtk_window_set_geometry_hints (GTK_WINDOW (window), window, &geometry, GDK_HINT_MIN_SIZE);
-
- //window to control the states
- GtkWidget* window_control = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- geometry.min_width = 1;
- geometry.min_height = 1;
- geometry.max_width = -1;
- geometry.max_height = -1;
- gtk_window_set_geometry_hints (GTK_WINDOW (window_control), window_control, &geometry, GDK_HINT_MIN_SIZE);
- gtk_window_set_resizable (GTK_WINDOW (window_control), FALSE);
- gtk_window_move (GTK_WINDOW (window_control), 10, 10);
- GtkWidget* table = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (window_control), table);
-
- //control state null
- GtkWidget* button_state_null = gtk_button_new_with_label ("GST_STATE_NULL");
- g_signal_connect (G_OBJECT (button_state_null), "clicked",
- G_CALLBACK (button_state_null_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_null, 0, 0, 1, 1);
- gtk_widget_show (button_state_null);
-
- //control state ready
- GtkWidget* button_state_ready = gtk_button_new_with_label ("GST_STATE_READY");
- g_signal_connect (G_OBJECT (button_state_ready), "clicked",
- G_CALLBACK (button_state_ready_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_ready, 0, 1, 1, 1);
- gtk_widget_show (button_state_ready);
-
- //control state paused
- GtkWidget* button_state_paused = gtk_button_new_with_label ("GST_STATE_PAUSED");
- g_signal_connect (G_OBJECT (button_state_paused), "clicked",
- G_CALLBACK (button_state_paused_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_paused, 0, 2, 1, 1);
- gtk_widget_show (button_state_paused);
-
- //control state playing
- GtkWidget* button_state_playing = gtk_button_new_with_label ("GST_STATE_PLAYING");
- g_signal_connect (G_OBJECT (button_state_playing), "clicked",
- G_CALLBACK (button_state_playing_cb), pipeline);
- gtk_grid_attach (GTK_GRID (table), button_state_playing, 0, 3, 1, 1);
- gtk_widget_show (button_state_playing);
-
- gtk_widget_show (table);
- gtk_widget_show (window_control);
-
- //configure the pipeline
- g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(destroy_cb), pipeline);
-
- GstElement* videosrc = gst_element_factory_make ("videotestsrc", "videotestsrc");
- GstElement* videosink = gst_element_factory_make ("glimagesink", "glimagesink");
-
- gst_bin_add_many (GST_BIN (pipeline), videosrc, videosink, NULL);
-
- gboolean link_ok = gst_element_link_many(videosrc, videosink, NULL);
- if(!link_ok)
- {
- g_warning("Failed to link videosrc to videosink!\n") ;
- return -1;
- }
-
- //areas where the video is drawn
- GtkWidget* table_areas = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (window), table_areas);
- GtkWidget* area_top_left = gtk_drawing_area_new();
- gtk_widget_add_events(area_top_left, GDK_BUTTON_PRESS_MASK);
- gtk_widget_set_size_request (area_top_left, 320, 240);
- gtk_grid_attach (GTK_GRID (table_areas), area_top_left, 0, 0, 1, 1);
- GtkWidget* area_top_right = gtk_drawing_area_new();
- gtk_widget_add_events(area_top_right, GDK_BUTTON_PRESS_MASK);
- gtk_widget_set_size_request (area_top_right, 320, 240);
- gtk_grid_attach (GTK_GRID (table_areas), area_top_right, 1, 0, 1, 1);
-
- gtk_widget_set_redraw_on_allocate (area_top_left, TRUE);
- gtk_widget_set_redraw_on_allocate (area_top_right, TRUE);
- gtk_widget_realize(area_top_left);
- gtk_widget_realize(area_top_right);
-
- GstBus* bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, area_top_right, NULL);
- gst_bus_add_signal_watch (bus);
- g_signal_connect(bus, "message::error", G_CALLBACK(end_stream_cb), pipeline);
- g_signal_connect(bus, "message::warning", G_CALLBACK(end_stream_cb), pipeline);
- g_signal_connect(bus, "message::eos", G_CALLBACK(end_stream_cb), pipeline);
- gst_object_unref (bus);
-
- //needed when being in GST_STATE_READY, GST_STATE_PAUSED
- //or resizing/obscuring the window
- g_signal_connect(area_top_left, "draw", G_CALLBACK(expose_cb), videosink);
- g_signal_connect(area_top_left, "configure-event", G_CALLBACK(resize_cb), videosink);
- g_signal_connect(area_top_right, "draw", G_CALLBACK(expose_cb), videosink);
- g_signal_connect(area_top_right, "configure-event", G_CALLBACK(resize_cb), videosink);
-
- //switch the drawing area
- g_signal_connect(area_top_left, "button-press-event", G_CALLBACK(on_click_drawing_area), videosink);
- g_signal_connect(area_top_right, "button-press-event", G_CALLBACK(on_click_drawing_area), videosink);
-
- gtk_widget_show_all (window);
-
- gst_element_set_state(pipeline, GST_STATE_PLAYING);
-
- gtk_main();
-
- return 0;
-}
-
diff --git a/tests/examples/gl/meson.build b/tests/examples/gl/meson.build
deleted file mode 100644
index a1f4889fa..000000000
--- a/tests/examples/gl/meson.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# FIXME - Add other missing examples!
-#subdir('clutter')
-#subdir('cocoa')
-#subdir('generic')
-#subdir('gtk')
-#subdir('qt')
-subdir('sdl')
diff --git a/tests/examples/gl/qt/.gitignore b/tests/examples/gl/qt/.gitignore
deleted file mode 100644
index 6be72a266..000000000
--- a/tests/examples/gl/qt/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-GeneratedFiles/
-debug/
diff --git a/tests/examples/gl/qt/Makefile.am b/tests/examples/gl/qt/Makefile.am
deleted file mode 100644
index 629415b29..000000000
--- a/tests/examples/gl/qt/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-
-#SUBDIRS = videooverlay qglwidgetvideooverlay mousevideooverlay
diff --git a/tests/examples/gl/qt/README b/tests/examples/gl/qt/README
deleted file mode 100644
index a050fc2fd..000000000
--- a/tests/examples/gl/qt/README
+++ /dev/null
@@ -1,24 +0,0 @@
---- Description of the Qt examples ---
-
-- videooverlay:
-Show how to use the videooverlay interface through Qt.
-The video is displayed as normal 2D scene.
-The window is dynamically resized to have the same size as the original video.
-
-- mousevideooverlay:
-Show how to use the videooverlay interface through Qt.
-The cube is rotating when moving the mouse (+ click maintained)
-
-- qglwidgetvideooverlay:
-Show how to use the videooverlay interface through Qt.
-The cube is rotating automatically into a QGLWidget
-
-
---- How to build the Qt examples ---
-
-sudo apt-get install g++ libqt5-dev
-
-cd qglvideooverlay
-qmake
-make
-./debug/qglvideooverlay
diff --git a/tests/examples/gl/qt/mousevideooverlay/gstthread.cpp b/tests/examples/gl/qt/mousevideooverlay/gstthread.cpp
deleted file mode 100644
index ce14a4715..000000000
--- a/tests/examples/gl/qt/mousevideooverlay/gstthread.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include "gstthread.h"
-
-GstThread::GstThread(const WId winId, const QString videoLocation, QObject *parent):
- QThread(parent),
- m_winId(winId),
- m_videoLocation(videoLocation)
-{
-}
-
-GstThread::~GstThread()
-{
-}
-
-void GstThread::exposeRequested()
-{
- m_pipeline->exposeRequested();
-}
-
-void GstThread::onMouseMove()
-{
- m_pipeline->rotateRequested();
-}
-
-void GstThread::show()
-{
- emit showRequested();
-}
-
-void GstThread::stop()
-{
- m_pipeline->stop();
-}
-
-void GstThread::run()
-{
- m_pipeline = new Pipeline(m_winId, m_videoLocation);
- connect(m_pipeline, SIGNAL(showRequested()), this, SLOT(show()));
- m_pipeline->start(); //it runs the gmainloop on win32
-
-#ifndef WIN32
- //works like the gmainloop on linux (GstEvent are handled)
- connect(m_pipeline, SIGNAL(stopRequested()), this, SLOT(quit()));
- exec();
-#endif
-
- m_pipeline->unconfigure();
-}
diff --git a/tests/examples/gl/qt/mousevideooverlay/gstthread.h b/tests/examples/gl/qt/mousevideooverlay/gstthread.h
deleted file mode 100644
index 74f1322c7..000000000
--- a/tests/examples/gl/qt/mousevideooverlay/gstthread.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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 GSTTHREAD_H
-#define GSTTHREAD_H
-
-#include <QtGui>
-#include <QtCore/QThread>
-
-#include "pipeline.h"
-
-class GstThread : public QThread
-{
- Q_OBJECT
-
-public:
- GstThread(const WId winId, const QString videoLocation, QObject *parent = 0);
- ~GstThread();
-
-public slots:
- void exposeRequested();
- void onMouseMove();
- void show();
- void stop();
-
-signals:
- void showRequested();
-
-protected:
- void run();
-
-private:
- const WId m_winId;
- const QString m_videoLocation;
- Pipeline* m_pipeline;
-
-};
-
-#endif
diff --git a/tests/examples/gl/qt/mousevideooverlay/main.cpp b/tests/examples/gl/qt/mousevideooverlay/main.cpp
deleted file mode 100644
index 52c539d00..000000000
--- a/tests/examples/gl/qt/mousevideooverlay/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include <QApplication>
-#include <QFileDialog>
-#include "qrenderer.h"
-
-int main(int argc, char *argv[])
-{
- /* FIXME: port the example to shaders and remove this */
- g_setenv ("GST_GL_API", "opengl", FALSE);
-
- QApplication a(argc, argv);
- a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
-
- QString videolocation = QFileDialog::getOpenFileName(0, "Select a video file",
- ".", "Format (*.avi *.mkv *.ogg *.asf *.mov *.mp4)");
-
- if (videolocation.isEmpty())
- return -1;
-
- QRenderer w(videolocation);
- w.setWindowTitle("glimagesink implements the gstvideooverlay interface");
-
- return a.exec();
-}
diff --git a/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pri b/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pri
deleted file mode 100644
index 75b23cdd7..000000000
--- a/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pri
+++ /dev/null
@@ -1,10 +0,0 @@
-#Header files
-HEADERS += ./gstthread.h \
- ./pipeline.h \
- ./qrenderer.h
-
-#Source files
-SOURCES += ./gstthread.cpp \
- ./main.cpp \
- ./pipeline.cpp \
- ./qrenderer.cpp
diff --git a/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pro b/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pro
deleted file mode 100644
index 14fb48df6..000000000
--- a/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pro
+++ /dev/null
@@ -1,44 +0,0 @@
-TEMPLATE = app
-TARGET = mousevideooverlay
-DESTDIR = ./debug
-QT += gui widgets opengl
-CONFIG += debug link_pkgconfig
-DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB
-PKGCONFIG = gstreamer-1.0 gstreamer-video-1.0
-
-win32 {
-DEFINES += WIN32
-INCLUDEPATH += ./GeneratedFiles \
- ./GeneratedFiles/Debug \
- C:/gstreamer/include \
- C:/gstreamer/include/libxml2 \
- C:/gstreamer/include/glib-2.0 \
- C:/gstreamer/lib/glib-2.0/include \
- C:/gstreamer/include/gstreamer-1.0
-LIBS += -L"C:/gstreamer/lib" \
- -L"C:/gstreamer/bin" \
- -lgstreamer-1.0 \
- -lgstvideo-1.0 \
- -lglib-2.0 \
- -lgmodule-2.0 \
- -lgobject-2.0 \
- -lgthread-2.0 \
- -lopengl32 \
- -lglu32
-}
-
-unix {
-DEFINES += UNIX
-INCLUDEPATH += GeneratedFiles \
- GeneratedFiles/Debug
-LIBS += -lGLU -lGL
-}
-
-DEPENDPATH += .
-MOC_DIR += ./GeneratedFiles/debug
-OBJECTS_DIR += debug
-UI_DIR += ./GeneratedFiles
-RCC_DIR += ./GeneratedFiles
-
-#Include file(s)
-include(mousevideooverlay.pri)
diff --git a/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.sln b/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.sln
deleted file mode 100644
index 8d310d810..000000000
--- a/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.sln
+++ /dev/null
@@ -1,26 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mousevideooverlay", "mousevideooverlay.vcproj", "{E94F8CAA-628F-4872-8E73-AD56D34899CB}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {E94F8CAA-628F-4872-8E73-AD56D34899CB}.Debug|Win32.ActiveCfg = Debug|Win32
- {E94F8CAA-628F-4872-8E73-AD56D34899CB}.Debug|Win32.Build.0 = Debug|Win32
- {E94F8CAA-628F-4872-8E73-AD56D34899CB}.Release|Win32.ActiveCfg = Release|Win32
- {E94F8CAA-628F-4872-8E73-AD56D34899CB}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(Qt) = preSolution
- Integration = True
- EndGlobalSection
- GlobalSection(Qt) = preSolution
- Integration = True
- EndGlobalSection
-EndGlobal
diff --git a/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp b/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp
deleted file mode 100644
index 28d8cf814..000000000
--- a/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include <gst/video/videooverlay.h>
-#include <gst/video/video.h>
-#include <GL/gl.h>
-#include "pipeline.h"
-
-#define GST_MAP_GL (GST_MAP_FLAG_LAST << 1)
-
-Pipeline::Pipeline(const WId id, const QString videoLocation):
- m_winId(id),
- m_videoLocation(videoLocation),
- m_loop(NULL),
- m_bus(NULL),
- m_pipeline(NULL),
- m_glimagesink(NULL)
-{
- create();
-}
-
-Pipeline::~Pipeline()
-{
-}
-
-void Pipeline::create()
-{
- qDebug("Loading video: %s", m_videoLocation.toLatin1().data());
-
- gst_init (NULL, NULL);
-
-#ifdef WIN32
- m_loop = g_main_loop_new (NULL, FALSE);
-#endif
- m_pipeline = gst_pipeline_new ("pipeline");
-
- m_bus = gst_pipeline_get_bus (GST_PIPELINE (m_pipeline));
- gst_bus_add_watch (m_bus, (GstBusFunc) bus_call, this);
- gst_bus_set_sync_handler (m_bus, (GstBusSyncHandler) create_window, this, NULL);
- gst_object_unref (m_bus);
-
- GstElement* videosrc = gst_element_factory_make ("filesrc", "filesrc0");
- GstElement* decodebin = gst_element_factory_make ("decodebin", "decodebin0");
- m_glimagesink = gst_element_factory_make ("glimagesink", "sink0");
-
- if (!videosrc || !decodebin || !m_glimagesink )
- {
- qDebug ("one element could not be found");
- return;
- }
-
- g_object_set(G_OBJECT(videosrc), "num-buffers", 800, NULL);
- g_object_set(G_OBJECT(videosrc), "location", m_videoLocation.toLatin1().data(), NULL);
- g_signal_connect(G_OBJECT(m_glimagesink), "client-reshape", G_CALLBACK (reshapeCallback), NULL);
- g_signal_connect(G_OBJECT(m_glimagesink), "client-draw", G_CALLBACK (drawCallback), NULL);
-
- gst_bin_add_many (GST_BIN (m_pipeline), videosrc, decodebin, m_glimagesink, NULL);
-
- gst_element_link_pads (videosrc, "src", decodebin, "sink");
-
- g_signal_connect (decodebin, "pad-added", G_CALLBACK (cb_new_pad), this);
-}
-
-void Pipeline::start()
-{
- GstStateChangeReturn ret = gst_element_set_state (m_pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- qDebug ("Failed to start up pipeline!");
-
- /* check if there is an error message with details on the bus */
- GstMessage* msg = gst_bus_poll (m_bus, GST_MESSAGE_ERROR, 0);
- if (msg)
- {
- GError *err = NULL;
- gst_message_parse_error (msg, &err, NULL);
- qDebug ("ERROR: %s", err->message);
- g_error_free (err);
- gst_message_unref (msg);
- }
- return;
- }
-
-#ifdef WIN32
- g_main_loop_run(m_loop);
-#endif
-}
-
-//we don't want a thread safe stop in this example
-void Pipeline::stop()
-{
-#ifdef WIN32
- g_main_loop_quit(m_loop);
-#else
- emit stopRequested();
-#endif
-}
-
-void Pipeline::unconfigure() const
-{
- gst_element_set_state (m_pipeline, GST_STATE_NULL);
- gst_object_unref (m_pipeline);
-}
-
-void Pipeline::show()
-{
- emit showRequested();
-}
-
-//redraw the current frame in the drawable
-void Pipeline::doExpose() const
-{
- if (m_pipeline && m_glimagesink)
- gst_video_overlay_expose (GST_VIDEO_OVERLAY (m_glimagesink));
-}
-
-//post message to g_main_loop in order to call expose
-//in the gt thread
-void Pipeline::exposeRequested()
-{
- g_idle_add(cb_expose, this);
-}
-
-//rotate the cube
-void Pipeline::doRotate()
-{
- m_xrot += 3.0f;
- m_yrot += 2.0f;
- m_zrot += 4.0f;
-}
-
-//post message to g_main_loop in order to call rotate
-//in the gt thread
-void Pipeline::rotateRequested()
-{
- g_idle_add(cb_rotate, this);
-}
-
-//-----------------------------------------------------------------------
-//----------------------------- static members --------------------------
-//-----------------------------------------------------------------------
-
-float Pipeline::m_xrot = 0;
-float Pipeline::m_yrot = 0;
-float Pipeline::m_zrot = 0;
-
-//client reshape callback
-gboolean Pipeline::reshapeCallback (void *sink, void *context, guint width, guint height, gpointer data)
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
-
- return TRUE;
-}
-
-//client draw callback
-gboolean Pipeline::drawCallback (void * sink, void *context, GstSample * sample, gpointer data)
-{
- static GTimeVal current_time;
- static glong last_sec = current_time.tv_sec;
- static gint nbFrames = 0;
-
- GstVideoFrame v_frame;
- GstVideoInfo v_info;
- guint texture = 0;
- GstBuffer *buf = gst_sample_get_buffer (sample);
- GstCaps *caps = gst_sample_get_caps (sample);
-
- gst_video_info_from_caps (&v_info, caps);
-
- if (!gst_video_frame_map (&v_frame, &v_info, buf, (GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
- g_warning ("Failed to map the video buffer");
- return TRUE;
- }
-
- texture = *(guint *) v_frame.data[0];
-
- g_get_current_time (&current_time);
- nbFrames++ ;
-
- if ((current_time.tv_sec - last_sec) >= 1)
- {
- qDebug ("GRAPHIC FPS = %d", nbFrames);
- nbFrames = 0;
- last_sec = current_time.tv_sec;
- }
-
- glEnable(GL_DEPTH_TEST);
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, texture);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glScalef(0.5f,0.5f,0.5f);
-
- glRotatef(m_xrot,1.0f,0.0f,0.0f);
- glRotatef(m_yrot,0.0f,1.0f,0.0f);
- glRotatef(m_zrot,0.0f,0.0f,1.0f);
-
- glBegin(GL_QUADS);
- // Front Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- // Back Face
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- // Top Face
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- // Bottom Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- // Right face
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- // Left Face
- glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glEnd();
-
- glLoadIdentity();
- glDisable(GL_DEPTH_TEST);
- glBindTexture (GL_TEXTURE_2D, 0);
-
- gst_video_frame_unmap (&v_frame);
-
- return TRUE;
-}
-
-gboolean Pipeline::bus_call (GstBus *bus, GstMessage *msg, Pipeline* p)
-{
- switch (GST_MESSAGE_TYPE (msg))
- {
- case GST_MESSAGE_EOS:
- qDebug ("End-of-stream");
- p->stop();
- break;
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
- gst_message_parse_error (msg, &err, &debug);
- qDebug ("Error: %s", err->message);
- g_error_free (err);
- if (debug)
- {
- qDebug ("Debug deails: %s", debug);
- g_free (debug);
- }
- p->stop();
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p)
-{
- GstElement* glimagesink = p->getVideoSink();
- GstPad* glpad = gst_element_get_static_pad (glimagesink, "sink");
-
- //only link once
- if (GST_PAD_IS_LINKED (glpad))
- {
- gst_object_unref (glpad);
- return;
- }
-
- GstCaps* caps = gst_pad_get_current_caps (pad);
- GstStructure* str = gst_caps_get_structure (caps, 0);
- if (!g_strrstr (gst_structure_get_name (str), "video"))
- {
- gst_caps_unref (caps);
- gst_object_unref (glpad);
- return;
- }
- gst_caps_unref (caps);
-
- GstPadLinkReturn ret = gst_pad_link (pad, glpad);
- if (ret != GST_PAD_LINK_OK)
- g_warning ("Failed to link with decodebin!\n");
-
- p->show();
-}
-
-gboolean Pipeline::cb_expose (gpointer data)
-{
- ((Pipeline*)data)->doExpose();
- return FALSE;
-}
-
-gboolean Pipeline::cb_rotate (gpointer data)
-{
- ((Pipeline*)data)->doRotate();
- return FALSE;
-}
-
-GstBusSyncReply Pipeline::create_window (GstBus* bus, GstMessage* message, const Pipeline* p)
-{
- // ignore anything but 'prepare-window-handle' element messages
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- qDebug ("setting window handle");
-
- //Passing 0 as the window_handle will tell the overlay to stop using that window and create an internal one.
- //In the directdrawsink's gst_video_overlay_set_window_handle implementation, window_handle (parameter 2) is casted to HWND before it used.
- gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), (guintptr)p->winId());
-
- gst_message_unref (message);
-
- return GST_BUS_DROP;
-}
diff --git a/tests/examples/gl/qt/mousevideooverlay/pipeline.h b/tests/examples/gl/qt/mousevideooverlay/pipeline.h
deleted file mode 100644
index b2fe97be1..000000000
--- a/tests/examples/gl/qt/mousevideooverlay/pipeline.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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 PIPELINE_H
-#define PIPELINE_H
-
-#include <QObject>
-#include <QtGui>
-#include <gst/gst.h>
-//#include <QtCore/private/qeventdispatcher_glib_p.h>
-
-class Pipeline : public QObject
-{
- Q_OBJECT
-
-public:
- Pipeline(const WId windId, const QString videoLocation);
- ~Pipeline();
- void start();
- void exposeRequested();
- void rotateRequested();
- void stop();
- void unconfigure() const;
- void show();
- GstElement* getVideoSink() { return m_glimagesink; } ;
-
-signals:
- void showRequested();
- void stopRequested();
-
-private:
- const WId m_winId;
- const QString m_videoLocation;
- GMainLoop* m_loop;
- GstBus* m_bus;
- GstElement* m_pipeline;
- GstElement* m_glimagesink;
- static float m_xrot;
- static float m_yrot;
- static float m_zrot;
-
- void create();
- WId winId() const { return m_winId; }
- void doExpose() const;
- void doRotate();
-
- static gboolean reshapeCallback (void *sink, void *context, guint width, guint height, gpointer data);
- static gboolean drawCallback (void * sink, void *context, GstSample * sample, gpointer data);
- static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p);
- static void cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p);
- static gboolean cb_expose (gpointer data);
- static gboolean cb_rotate (gpointer data);
- static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, const Pipeline* pipeline);
-};
-
-#endif
diff --git a/tests/examples/gl/qt/mousevideooverlay/qrenderer.cpp b/tests/examples/gl/qt/mousevideooverlay/qrenderer.cpp
deleted file mode 100644
index b5187bda5..000000000
--- a/tests/examples/gl/qt/mousevideooverlay/qrenderer.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include "qrenderer.h"
-
-QRenderer::QRenderer(const QString videoLocation, QWidget *parent, Qt::WindowFlags flags)
- : QWidget(parent, flags),
- m_gt(winId(), videoLocation)
-{
- setAttribute(Qt::WA_NoSystemBackground);
- setVisible(false);
- move(20, 10);
- resize(640, 480);
-
- QObject::connect(&m_gt, SIGNAL(finished()), this, SLOT(close()));
- QObject::connect(this, SIGNAL(exposeRequested()), &m_gt, SLOT(exposeRequested()));
- QObject::connect(this, SIGNAL(closeRequested()), &m_gt, SLOT(stop()), Qt::DirectConnection);
- QObject::connect(&m_gt, SIGNAL(showRequested()), this, SLOT(show()));
- QObject::connect(this, SIGNAL(mouseMoved()), &m_gt, SLOT(onMouseMove()));
- m_gt.start();
-}
-
-QRenderer::~QRenderer()
-{
-}
-
-void QRenderer::paintEvent(QPaintEvent* event)
-{
- emit exposeRequested();
-}
-
-void QRenderer::mouseMoveEvent(QMouseEvent* event)
-{
- emit mouseMoved();
-}
-
-void QRenderer::closeEvent(QCloseEvent* event)
-{
- emit closeRequested();
- m_gt.wait();
-}
diff --git a/tests/examples/gl/qt/mousevideooverlay/qrenderer.h b/tests/examples/gl/qt/mousevideooverlay/qrenderer.h
deleted file mode 100644
index 90e85fffd..000000000
--- a/tests/examples/gl/qt/mousevideooverlay/qrenderer.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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 QRENDERER_H
-#define QRENDERER_H
-
-#include <QWidget>
-#include <QString>
-#include "gstthread.h"
-
-class QRenderer : public QWidget
-{
- Q_OBJECT
-
-public:
- QRenderer(const QString videoLocation, QWidget *parent = 0, Qt::WindowFlags flags = 0);
- ~QRenderer();
- void paintEvent(QPaintEvent* event);
- void mouseMoveEvent(QMouseEvent* event);
- void closeEvent (QCloseEvent* event);
-
-signals:
- void exposeRequested();
- void closeRequested();
- void mouseMoved();
-
-private:
- GstThread m_gt;
-};
-
-#endif // QRENDERER_H
diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/gstthread.cpp b/tests/examples/gl/qt/qglwidgetvideooverlay/gstthread.cpp
deleted file mode 100644
index a31f8d634..000000000
--- a/tests/examples/gl/qt/qglwidgetvideooverlay/gstthread.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include "gstthread.h"
-
-GstThread::GstThread(const WId winId, const QString videoLocation, QObject *parent):
- QThread(parent),
- m_winId(winId),
- m_videoLocation(videoLocation)
-{
-}
-
-GstThread::~GstThread()
-{
-}
-
-void GstThread::exposeRequested()
-{
- m_pipeline->exposeRequested();
-}
-
-void GstThread::show()
-{
- emit showRequested();
-}
-
-void GstThread::stop()
-{
- m_pipeline->stop();
-}
-
-void GstThread::run()
-{
- m_pipeline = new Pipeline(m_winId, m_videoLocation);
- connect(m_pipeline, SIGNAL(showRequested()), this, SLOT(show()));
- m_pipeline->start(); //it runs the gmainloop on win32
-
-#ifndef WIN32
- //works like the gmainloop on linux (GstEvent are handled)
- connect(m_pipeline, SIGNAL(stopRequested()), this, SLOT(quit()));
- exec();
-#endif
-
- m_pipeline->unconfigure();
-}
diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/gstthread.h b/tests/examples/gl/qt/qglwidgetvideooverlay/gstthread.h
deleted file mode 100644
index 676b9870d..000000000
--- a/tests/examples/gl/qt/qglwidgetvideooverlay/gstthread.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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 GSTTHREAD_H
-#define GSTTHREAD_H
-
-#include <QtGui>
-#include <QtCore/QThread>
-
-#include "pipeline.h"
-
-class GstThread : public QThread
-{
- Q_OBJECT
-
-public:
- GstThread(const WId winId, const QString videoLocation, QObject *parent = 0);
- ~GstThread();
-
-public slots:
- void exposeRequested();
- void show();
- void stop();
-
-signals:
- void showRequested();
-
-protected:
- void run();
-
-private:
- const WId m_winId;
- const QString m_videoLocation;
- Pipeline* m_pipeline;
-
-};
-
-#endif
diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/main.cpp b/tests/examples/gl/qt/qglwidgetvideooverlay/main.cpp
deleted file mode 100644
index f782baa8b..000000000
--- a/tests/examples/gl/qt/qglwidgetvideooverlay/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include <QApplication>
-#include <QFileDialog>
-#include "qglrenderer.h"
-
-int main(int argc, char *argv[])
-{
- /* FIXME: port the example to shaders and remove this */
- g_setenv ("GST_GL_API", "opengl", FALSE);
-
- QApplication a(argc, argv);
- a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
-
- QString videolocation = QFileDialog::getOpenFileName(0, "Select a video file",
- ".", "Format (*.avi *.mkv *.ogg *.asf *.mov *.mp4)");
-
- if (videolocation.isEmpty())
- return -1;
-
- QGLRenderer w(videolocation);
- w.setWindowTitle("glimagesink implements the gstvideooverlay interface");
-
- return a.exec();
-}
diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp
deleted file mode 100644
index 301d3b614..000000000
--- a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include <gst/video/videooverlay.h>
-#include <gst/video/video.h>
-#include <GL/gl.h>
-#include "pipeline.h"
-
-#define GST_MAP_GL (GST_MAP_FLAG_LAST << 1)
-
-Pipeline::Pipeline(const WId id, const QString videoLocation):
- m_winId(id),
- m_videoLocation(videoLocation),
- m_loop(NULL),
- m_bus(NULL),
- m_pipeline(NULL),
- m_glimagesink(NULL)
-{
- create();
-}
-
-Pipeline::~Pipeline()
-{
-}
-
-void Pipeline::create()
-{
- qDebug("Loading video: %s", m_videoLocation.toLatin1().data());
-
- gst_init (NULL, NULL);
-
-#ifdef WIN32
- m_loop = g_main_loop_new (NULL, FALSE);
-#endif
- m_pipeline = gst_pipeline_new ("pipeline");
-
- m_bus = gst_pipeline_get_bus (GST_PIPELINE (m_pipeline));
- gst_bus_add_watch (m_bus, (GstBusFunc) bus_call, this);
- gst_bus_set_sync_handler (m_bus, (GstBusSyncHandler) create_window, this, NULL);
- gst_object_unref (m_bus);
-
- GstElement* videosrc = gst_element_factory_make ("filesrc", "filesrc0");
- GstElement* decodebin = gst_element_factory_make ("decodebin", "decodebin0");
- m_glimagesink = gst_element_factory_make ("glimagesink", "sink0");
-
- if (!videosrc || !decodebin || !m_glimagesink )
- {
- qDebug ("one element could not be found");
- return;
- }
-
- g_object_set(G_OBJECT(videosrc), "num-buffers", 800, NULL);
- g_object_set(G_OBJECT(videosrc), "location", m_videoLocation.toLatin1().data(), NULL);
- g_signal_connect_object (G_OBJECT(m_glimagesink), "client-reshape", (GCallback) reshapeCallback, NULL, G_CONNECT_AFTER);
- g_signal_connect_object (G_OBJECT(m_glimagesink), "client-draw", (GCallback) drawCallback, NULL, G_CONNECT_AFTER);
-
- gst_bin_add_many (GST_BIN (m_pipeline), videosrc, decodebin, m_glimagesink, NULL);
-
- gst_element_link_pads (videosrc, "src", decodebin, "sink");
-
- g_signal_connect (decodebin, "pad-added", G_CALLBACK (cb_new_pad), this);
-}
-
-void Pipeline::start()
-{
- GstStateChangeReturn ret = gst_element_set_state (m_pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- qDebug ("Failed to start up pipeline!");
-
- /* check if there is an error message with details on the bus */
- GstMessage* msg = gst_bus_poll (m_bus, GST_MESSAGE_ERROR, 0);
- if (msg)
- {
- GError *err = NULL;
- gst_message_parse_error (msg, &err, NULL);
- qDebug ("ERROR: %s", err->message);
- g_error_free (err);
- gst_message_unref (msg);
- }
- return;
- }
-
-#ifdef WIN32
- g_main_loop_run(m_loop);
-#endif
-}
-
-//we don't want a thread safe stop in this example
-void Pipeline::stop()
-{
-#ifdef WIN32
- g_main_loop_quit(m_loop);
-#else
- emit stopRequested();
-#endif
-}
-
-void Pipeline::unconfigure() const
-{
- gst_element_set_state (m_pipeline, GST_STATE_NULL);
- gst_object_unref (m_pipeline);
-}
-
-void Pipeline::show()
-{
- emit showRequested();
-}
-
-//redraw the current frame in the drawable
-void Pipeline::doExpose() const
-{
- if (m_pipeline && m_glimagesink)
- gst_video_overlay_expose (GST_VIDEO_OVERLAY (m_glimagesink));
-}
-
-//post message to g_main_loop in order to call expose
-//in the gt thread
-void Pipeline::exposeRequested()
-{
- g_idle_add(cb_expose, this);
-}
-
-
-//-----------------------------------------------------------------------
-//----------------------------- static members --------------------------
-//-----------------------------------------------------------------------
-
-//client reshape callback
-gboolean Pipeline::reshapeCallback (GstElement *sink, void *context, guint width, guint height, gpointer data)
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
-
- return TRUE;
-}
-
-//client draw callback
-gboolean Pipeline::drawCallback (GstElement * gl_sink, void *context, GstSample * sample, gpointer data)
-{
- static GLfloat xrot = 0;
- static GLfloat yrot = 0;
- static GLfloat zrot = 0;
- static GTimeVal current_time;
- static glong last_sec = current_time.tv_sec;
- static gint nbFrames = 0;
-
- GstVideoFrame v_frame;
- GstVideoInfo v_info;
- guint texture = 0;
- GstBuffer *buf = gst_sample_get_buffer (sample);
- GstCaps *caps = gst_sample_get_caps (sample);
-
- gst_video_info_from_caps (&v_info, caps);
-
- if (!gst_video_frame_map (&v_frame, &v_info, buf, (GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
- g_warning ("Failed to map the video buffer");
- return TRUE;
- }
-
- texture = *(guint *) v_frame.data[0];
-
- g_get_current_time (&current_time);
- nbFrames++ ;
-
- if ((current_time.tv_sec - last_sec) >= 1)
- {
- qDebug ("GRPHIC FPS = %d", nbFrames);
- nbFrames = 0;
- last_sec = current_time.tv_sec;
- }
-
- glEnable(GL_DEPTH_TEST);
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, texture);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
- glScalef (0.5, 0.5, 0.5);
-
- glRotatef(xrot,1.0f,0.0f,0.0f);
- glRotatef(yrot,0.0f,1.0f,0.0f);
- glRotatef(zrot,0.0f,0.0f,1.0f);
-
- glBegin(GL_QUADS);
- // Front Face
- glTexCoord2f(1.0, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- // Back Face
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- // Top Face
- glTexCoord2f(1.0, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- // Bottom Face
- glTexCoord2f(1.0, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- glTexCoord2f(1.0,1.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- // Right face
- glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
- glTexCoord2f(1.0, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
- // Left Face
- glTexCoord2f(1.0, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
- glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
- glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
- glTexCoord2f(1.0, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
- glEnd();
-
- glLoadIdentity();
- glDisable(GL_DEPTH_TEST);
- glBindTexture (GL_TEXTURE_2D, 0);
-
- gst_video_frame_unmap (&v_frame);
-
- xrot+=0.03f;
- yrot+=0.02f;
- zrot+=0.04f;
-
- return TRUE;
-}
-
-gboolean Pipeline::bus_call (GstBus *bus, GstMessage *msg, Pipeline* p)
-{
- switch (GST_MESSAGE_TYPE (msg))
- {
- case GST_MESSAGE_EOS:
- qDebug ("End-of-stream");
- p->stop();
- break;
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
- gst_message_parse_error (msg, &err, &debug);
- qDebug ("Error: %s", err->message);
- g_error_free (err);
- if (debug)
- {
- qDebug ("Debug deails: %s", debug);
- g_free (debug);
- }
- p->stop();
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p)
-{
- GstElement* sink = p->getVideoSink();
- GstPad* glpad = gst_element_get_static_pad (sink, "sink");
-
- //only link once
- if (GST_PAD_IS_LINKED (glpad))
- {
- gst_object_unref (glpad);
- return;
- }
-
- GstCaps* caps = gst_pad_get_current_caps (pad);
- GstStructure* str = gst_caps_get_structure (caps, 0);
- if (!g_strrstr (gst_structure_get_name (str), "video"))
- {
- gst_caps_unref (caps);
- gst_object_unref (glpad);
- return;
- }
- gst_caps_unref (caps);
-
- GstPadLinkReturn ret = gst_pad_link (pad, glpad);
- if (ret != GST_PAD_LINK_OK)
- g_warning ("Failed to link with decodebin!\n");
-
- p->show();
-}
-
-gboolean Pipeline::cb_expose (gpointer data)
-{
- ((Pipeline*)data)->doExpose();
- return FALSE;
-}
-
-GstBusSyncReply Pipeline::create_window (GstBus* bus, GstMessage* message, const Pipeline* p)
-{
- // ignore anything but 'prepare-window-handle' element messages
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- qDebug ("setting window handle");
-
- //Passing 0 as the window_handle will tell the overlay to stop using that window and create an internal one.
- //In the directdrawsink's gst_video_overlay_set_window_handle implementation, window_handle (parameter 2) is casted to HWND before it used.
- gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), (guintptr)p->winId());
-
- gst_message_unref (message);
-
- return GST_BUS_DROP;
-}
diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h
deleted file mode 100644
index 294cb8fe5..000000000
--- a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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 PIPELINE_H
-#define PIPELINE_H
-
-#include <QtGui>
-#include <gst/gst.h>
-//#include <QtCore/private/qeventdispatcher_glib_p.h>
-
-class Pipeline : public QObject
-{
- Q_OBJECT
-
-public:
- Pipeline(const WId windId, const QString videoLocation);
- ~Pipeline();
- void start();
- void exposeRequested();
- void stop();
- void unconfigure() const;
- void show();
- GstElement* getVideoSink() { return m_glimagesink; } ;
-
-signals:
- void showRequested();
- void stopRequested();
-
-private:
- const WId m_winId;
- const QString m_videoLocation;
- GMainLoop* m_loop;
- GstBus* m_bus;
- GstElement* m_pipeline;
- GstElement* m_glimagesink;
- static float m_xrot;
- static float m_yrot;
- static float m_zrot;
-
- void create();
- WId winId() const { return m_winId; }
- void doExpose() const;
-
- static gboolean reshapeCallback (GstElement *sink, void *context, guint width, guint height, gpointer data);
- static gboolean drawCallback (GstElement *sink, void *context, GstSample * sample, gpointer data);
- static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p);
- static void cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p);
- static gboolean cb_expose (gpointer data);
- static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, const Pipeline* pipeline);
-};
-
-#endif
diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.cpp b/tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.cpp
deleted file mode 100644
index a54625efd..000000000
--- a/tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#include "qglrenderer.h"
-
-QGLRenderer::QGLRenderer(const QString videoLocation, QWidget *parent)
- : QGLWidget(parent),
- m_gt(winId(), videoLocation)
-{
- setAttribute(Qt::WA_NoSystemBackground);
- setVisible(false);
- move(20, 10);
- resize(640, 480);
-
- QObject::connect(&m_gt, SIGNAL(finished()), this, SLOT(close()));
- QObject::connect(this, SIGNAL(exposeRequested()), &m_gt, SLOT(exposeRequested()));
- QObject::connect(this, SIGNAL(closeRequested()), &m_gt, SLOT(stop()), Qt::DirectConnection);
- QObject::connect(&m_gt, SIGNAL(showRequested()), this, SLOT(show()));
- m_gt.start();
-}
-
-QGLRenderer::~QGLRenderer()
-{
-}
-
-void QGLRenderer::paintEvent(QPaintEvent* event)
-{
- emit exposeRequested();
-}
-
-void QGLRenderer::closeEvent(QCloseEvent* event)
-{
- emit closeRequested();
- m_gt.wait();
-}
diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.h b/tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.h
deleted file mode 100644
index aaf0d029e..000000000
--- a/tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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 QGLRENDERER_H
-#define QGLRENDERER_H
-
-#include <QGLWidget>
-#include "gstthread.h"
-
-class QGLRenderer : public QGLWidget
-{
- Q_OBJECT
-
-public:
- QGLRenderer(const QString videoLocation, QWidget *parent = 0);
- ~QGLRenderer();
- void paintEvent(QPaintEvent* event);
- void closeEvent (QCloseEvent* event);
-
-signals:
- void exposeRequested();
- void closeRequested();
-
-private:
- GstThread m_gt;
-};
-
-#endif // QGLRENDERER_H
diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pri b/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pri
deleted file mode 100644
index 772d1d4ec..000000000
--- a/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pri
+++ /dev/null
@@ -1,10 +0,0 @@
-#Header files
-HEADERS += ./gstthread.h \
- ./pipeline.h \
- ./qglrenderer.h
-
-#Source files
-SOURCES += ./gstthread.cpp \
- ./main.cpp \
- ./pipeline.cpp \
- ./qglrenderer.cpp
diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pro b/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pro
deleted file mode 100644
index 45837b200..000000000
--- a/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pro
+++ /dev/null
@@ -1,47 +0,0 @@
-TEMPLATE = app
-TARGET = qglwidgetvideooverlay
-DESTDIR = ./debug
-QT += opengl
-CONFIG += debug
-CONFIG += link_pkgconfig
-DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB
-PKGCONFIG = gstreamer-1.0 gstreamer-video-1.0
-
-win32 {
-DEFINES += WIN32
-INCLUDEPATH += ./GeneratedFiles \
- ./GeneratedFiles/Debug \
- C:/gstreamer/include \
- C:/gstreamer/include/libxml2 \
- C:/gstreamer/include/glib-2.0 \
- C:/gstreamer/lib/glib-2.0/include \
- C:/gstreamer/include/gstreamer-1.0
-LIBS += -L"C:/gstreamer/lib" \
- -L"C:/gstreamer/bin" \
- -lgstreamer-1.0 \
- -lgstvideo-1.0 \
- -lglib-2.0 \
- -lgmodule-2.0 \
- -lgobject-2.0 \
- -lgthread-2.0 \
- -lopengl32 \
- -lglu32
-}
-
-unix {
-DEFINES += UNIX
-INCLUDEPATH += GeneratedFiles \
- GeneratedFiles/Debug
-LIBS += \
- -lGLU \
- -lGL
-}
-
-DEPENDPATH += .
-MOC_DIR += ./GeneratedFiles/debug
-OBJECTS_DIR += debug
-UI_DIR += ./GeneratedFiles
-RCC_DIR += ./GeneratedFiles
-
-#Include file(s)
-include(qglwidgetvideooverlay.pri)
diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.sln b/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.sln
deleted file mode 100644
index 3842be042..000000000
--- a/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.sln
+++ /dev/null
@@ -1,26 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qglwidgetvideooverlay", "qglwidgetvideooverlay.vcproj", "{F40D2D98-281E-465F-B63F-2D473E1C2616}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {F40D2D98-281E-465F-B63F-2D473E1C2616}.Debug|Win32.ActiveCfg = Debug|Win32
- {F40D2D98-281E-465F-B63F-2D473E1C2616}.Debug|Win32.Build.0 = Debug|Win32
- {F40D2D98-281E-465F-B63F-2D473E1C2616}.Release|Win32.ActiveCfg = Release|Win32
- {F40D2D98-281E-465F-B63F-2D473E1C2616}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(Qt) = preSolution
- Integration = True
- EndGlobalSection
- GlobalSection(Qt) = preSolution
- Integration = True
- EndGlobalSection
-EndGlobal
diff --git a/tests/examples/gl/qt/qglwtextureshare/.gitignore b/tests/examples/gl/qt/qglwtextureshare/.gitignore
deleted file mode 100644
index 091c6f073..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-moc_*.cpp
-qglwtextureshare
diff --git a/tests/examples/gl/qt/qglwtextureshare/AsyncQueue.h b/tests/examples/gl/qt/qglwtextureshare/AsyncQueue.h
deleted file mode 100644
index 4582bcbbe..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/AsyncQueue.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Andrey Nechypurenko <andreynech@gmail.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 __ASYNCQUEUE_H
-#define __ASYNCQUEUE_H
-
-#include <QMutex>
-#include <QWaitCondition>
-#include <QList>
-
-/**
- * This is the thread safe implementation of the Queue. It can be
- * used in classical producers/consumers multithreaded scenario. The
- * template parameter is the class which can be put/get to/from the
- * queue.
- */
-template<class T>
-class AsyncQueue
-{
-public:
- AsyncQueue() : waitingReaders(0) {}
-
- int size()
- {
- QMutexLocker locker(&mutex);
- return this->buffer.size();
- }
-
- void put(const T& item)
- {
- QMutexLocker locker(&mutex);
- this->buffer.push_back(item);
- if(this->waitingReaders)
- this->bufferIsNotEmpty.wakeOne();
- }
-
- T get()
- {
- QMutexLocker locker(&mutex);
- while(this->buffer.size() == 0)
- {
- ++(this->waitingReaders);
- this->bufferIsNotEmpty.wait(&mutex);
- --(this->waitingReaders);
- }
- T item = this->buffer.front();
- this->buffer.pop_front();
- return item;
- }
-
-private:
- typedef QList<T> Container;
- QMutex mutex;
- QWaitCondition bufferIsNotEmpty;
- Container buffer;
- short waitingReaders;
-};
-
-
-#endif // __ASYNCQUEUE_H
diff --git a/tests/examples/gl/qt/qglwtextureshare/README b/tests/examples/gl/qt/qglwtextureshare/README
deleted file mode 100644
index 9a97c56e9..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/README
+++ /dev/null
@@ -1,32 +0,0 @@
-Requires: >= Qt 5.1 for the x11extras module (or else you need to
-get x11extras from gitorious yourself)
-
-This example illustrates how to integrate Gstreamer GL plugin with
-Qt. In particular it uses glupload with fakesink elements to create
-texture with decoded video frame. This texture is shared with
-QGLWidget derived class, which paints a cube with video texture on
-each face.
-
-To compile the example, include and library paths might be adjusted in
-.pro file according to your installation of the gstreamer and
-corresponding development files. Most probably, the adjustments will
-be necessary on Windows.
-
-To run the example simply start executable file after compilation. If
-there is no command line arguments provided, then videotestsrc element
-will be used to generate video. The following pipeline will be created
-in this case:
-
-videotestsrc ! video/x-raw, width=640, height=480, framerate=(fraction)30/1 ! glupload ! fakesink sync=1
-
-It is also possible to provide the video file name as a first command
-line parameter, i.e. ./qglwtextureshare myvideo.ogv . In this case,
-the following pipeline will be executed:
-
-filesrc location=myvideo.ogv ! decodebin2 ! glupload ! fakesink sync=1
-
-I would appreciate any feedback and improvement suggestions for this
-example.
-
-Have fun :-)
-Andrey Nechypurenko (andreynech@gmail.com)
diff --git a/tests/examples/gl/qt/qglwtextureshare/cocoa_utils.mm b/tests/examples/gl/qt/qglwtextureshare/cocoa_utils.mm
deleted file mode 100644
index 245ec0fe4..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/cocoa_utils.mm
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2010 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2010 Nuno Santos <nunosantos@imaginando.net>
- *
- * 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.
- */
-
-#import <Cocoa/Cocoa.h>
-void *qt_current_nsopengl_context()
-{
- return CGLGetCurrentContext ();
-}
diff --git a/tests/examples/gl/qt/qglwtextureshare/gstthread.cpp b/tests/examples/gl/qt/qglwtextureshare/gstthread.cpp
deleted file mode 100644
index 25d1890bd..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/gstthread.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2009 Andrey Nechypurenko <andreynech@gmail.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.
- */
-
-#include "pipeline.h"
-#include "gstthread.h"
-
-
-GstThread::GstThread(GstGLDisplay *display,
- GstGLContext *context,
- const QString &videoLocation,
- const char *renderer_slot,
- QObject *parent):
- QThread(parent),
- m_videoLocation(videoLocation)
-{
- m_pipeline = new Pipeline(display, context, m_videoLocation, this);
- QObject::connect(m_pipeline, SIGNAL(newFrameReady()), this->parent(), renderer_slot, Qt::QueuedConnection);
-}
-
-GstThread::~GstThread()
-{
-}
-
-void GstThread::stop()
-{
- if(m_pipeline)
- m_pipeline->stop();
-}
-
-void GstThread::run()
-{
- qDebug("Starting gst pipeline");
- m_pipeline->start(); //it runs the gmainloop on win32
-
-#ifndef Q_WS_WIN
- //works like the gmainloop on linux (GstEvent are handled)
- connect(m_pipeline, SIGNAL(stopRequested()), this, SLOT(quit()));
- exec();
-#endif
-
- m_pipeline->unconfigure();
-
- m_pipeline = NULL;
- // This is not a memory leak. Pipeline will be deleted
- // when the parent object (this) will be destroyed.
- // We set m_pipeline to NULL to prevent further attempts
- // to stop already stopped pipeline
-}
diff --git a/tests/examples/gl/qt/qglwtextureshare/gstthread.h b/tests/examples/gl/qt/qglwtextureshare/gstthread.h
deleted file mode 100644
index bd34dd551..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/gstthread.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2009 Andrey Nechypurenko <andreynech@gmail.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 GSTTHREAD_H
-#define GSTTHREAD_H
-
-#include <QThread>
-
-#include <gst/gl/gstglcontext.h>
-
-
-class Pipeline;
-
-class GstThread : public QThread
-{
- Q_OBJECT
-
-public:
- GstThread(GstGLDisplay *display,
- GstGLContext *context,
- const QString &videoLocation,
- const char *renderer_slot,
- QObject *parent = 0);
-
- ~GstThread();
-
- Pipeline *getPipeline() {return this->m_pipeline;}
-
-public Q_SLOTS:
- void stop();
-
-protected:
- void run();
-
-private:
- const QString m_videoLocation;
- Pipeline* m_pipeline;
-};
-
-#endif
diff --git a/tests/examples/gl/qt/qglwtextureshare/main.cpp b/tests/examples/gl/qt/qglwtextureshare/main.cpp
deleted file mode 100644
index ebe81cf86..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/main.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2009 Andrey Nechypurenko <andreynech@gmail.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.
- */
-
-#include <QApplication>
-#include "qglrenderer.h"
-
-#include <gst/gst.h>
-
-int
-main(int argc, char *argv[])
-{
- /* FIXME: port the example to shaders and remove this */
- g_setenv ("GST_GL_API", "opengl", FALSE);
-
- gst_init (NULL, NULL);
- QApplication a(argc, argv);
- a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
- QGLRenderer w(argc > 1 ? argv[1] : "");
- w.setWindowTitle("Texture sharing example");
- w.show();
- return a.exec();
-}
-
diff --git a/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp b/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp
deleted file mode 100644
index 1cff8a4f6..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2009 Andrey Nechypurenko <andreynech@gmail.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.
- */
-
-#include "pipeline.h"
-
-
-Pipeline::Pipeline (GstGLDisplay *display,
- GstGLContext * context, const QString & videoLocation, QObject * parent)
- :
-QObject (parent),
-m_videoLocation (videoLocation),
-m_loop (NULL),
-m_bus (NULL),
-m_pipeline (NULL)
-{
- this->display = display;
- this->context = context;
- this->configure ();
-}
-
-Pipeline::~Pipeline ()
-{
-}
-
-void
-Pipeline::configure ()
-{
-
-#ifdef Q_WS_WIN
- m_loop = g_main_loop_new (NULL, FALSE);
-#endif
-
- if (m_videoLocation.isEmpty ()) {
- qDebug ("No video file specified. Using video test source.");
- m_pipeline =
- GST_PIPELINE (gst_parse_launch
- ("videotestsrc ! "
- "video/x-raw, width=640, height=480, "
- "framerate=(fraction)30/1 ! "
- "glupload ! gleffects effect=5 ! fakesink sync=1", NULL));
- } else {
- QByteArray ba = m_videoLocation.toLocal8Bit ();
- qDebug ("Loading video: %s", ba.data ());
- gchar *pipeline = g_strdup_printf ("filesrc name=f ! "
- "decodebin ! gleffects effect=5 ! " "fakesink sync=1");
- m_pipeline = GST_PIPELINE (gst_parse_launch (pipeline, NULL));
- GstElement *f = gst_bin_get_by_name (GST_BIN (m_pipeline), "f");
- g_object_set (G_OBJECT (f), "location", ba.data (), NULL);
- gst_object_unref (GST_OBJECT (f));
- g_free (pipeline);
- }
-
- m_bus = gst_pipeline_get_bus (GST_PIPELINE (m_pipeline));
- gst_bus_add_watch (m_bus, (GstBusFunc) bus_call, this);
- gst_bus_enable_sync_message_emission (m_bus);
- g_signal_connect (m_bus, "sync-message", G_CALLBACK (sync_bus_call), this);
- gst_object_unref (m_bus);
-
- gst_element_set_state (GST_ELEMENT (this->m_pipeline), GST_STATE_PAUSED);
- GstState state = GST_STATE_PAUSED;
- if (gst_element_get_state (GST_ELEMENT (this->m_pipeline),
- &state, NULL, GST_CLOCK_TIME_NONE)
- != GST_STATE_CHANGE_SUCCESS) {
- qDebug ("failed to pause pipeline");
- return;
- }
-}
-
-void
-Pipeline::start ()
-{
- // set a callback to retrieve the gst gl textures
- GstElement *fakesink = gst_bin_get_by_name (GST_BIN (this->m_pipeline),
- "fakesink0");
- g_object_set (G_OBJECT (fakesink), "signal-handoffs", TRUE, NULL);
- g_signal_connect (fakesink, "handoff", G_CALLBACK (on_gst_buffer), this);
- gst_object_unref (fakesink);
-
- GstStateChangeReturn ret =
- gst_element_set_state (GST_ELEMENT (this->m_pipeline), GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE) {
- qDebug ("Failed to start up pipeline!");
-
- /* check if there is an error message with details on the bus */
- GstMessage *msg = gst_bus_poll (this->m_bus, GST_MESSAGE_ERROR, 0);
- if (msg) {
- GError *err = NULL;
- gst_message_parse_error (msg, &err, NULL);
- qDebug ("ERROR: %s", err->message);
- g_error_free (err);
- gst_message_unref (msg);
- }
- return;
- }
-#ifdef Q_WS_WIN
- g_main_loop_run (m_loop);
-#endif
-}
-
-/* fakesink handoff callback */
-void
-Pipeline::on_gst_buffer (GstElement * element,
- GstBuffer * buf, GstPad * pad, Pipeline * p)
-{
- Q_UNUSED (pad)
- Q_UNUSED (element)
-
- /* ref then push buffer to use it in qt */
- gst_buffer_ref (buf);
- p->queue_input_buf.put (buf);
-
- if (p->queue_input_buf.size () > 3)
- p->notifyNewFrame ();
-
- /* pop then unref buffer we have finished to use in qt */
- if (p->queue_output_buf.size () > 3) {
- GstBuffer *buf_old = (p->queue_output_buf.get ());
- if (buf_old)
- gst_buffer_unref (buf_old);
- }
-}
-
-void
-Pipeline::stop ()
-{
-#ifdef Q_WS_WIN
- g_main_loop_quit (m_loop);
-#else
- emit stopRequested ();
-#endif
-}
-
-void
-Pipeline::unconfigure ()
-{
- gst_element_set_state (GST_ELEMENT (this->m_pipeline), GST_STATE_NULL);
-
- GstBuffer *buf;
- while (this->queue_input_buf.size ()) {
- buf = (GstBuffer *) (this->queue_input_buf.get ());
- gst_buffer_unref (buf);
- }
- while (this->queue_output_buf.size ()) {
- buf = (GstBuffer *) (this->queue_output_buf.get ());
- gst_buffer_unref (buf);
- }
-
- gst_object_unref (m_pipeline);
-}
-
-gboolean Pipeline::bus_call (GstBus * bus, GstMessage * msg, Pipeline * p)
-{
- Q_UNUSED (bus)
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- qDebug ("End-of-stream received. Stopping.");
- p->stop ();
- break;
-
- case GST_MESSAGE_ERROR:
- {
- gchar *
- debug = NULL;
- GError *
- err = NULL;
- gst_message_parse_error (msg, &err, &debug);
- qDebug ("Error: %s", err->message);
- g_error_free (err);
- if (debug) {
- qDebug ("Debug deails: %s", debug);
- g_free (debug);
- }
- p->stop ();
- break;
- }
-
- default:
- break;
- }
-
- return TRUE;
-}
-
-gboolean Pipeline::sync_bus_call (GstBus * bus, GstMessage * msg, Pipeline * p)
-{
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_NEED_CONTEXT:
- {
- const gchar *
- context_type;
-
- gst_message_parse_context_type (msg, &context_type);
- g_print ("got need context %s\n", context_type);
-
- if (g_strcmp0 (context_type, GST_GL_DISPLAY_CONTEXT_TYPE) == 0) {
- GstContext *display_context = gst_context_new (GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
- gst_context_set_gl_display (display_context, p->display);
- gst_element_set_context (GST_ELEMENT (msg->src), display_context);
- } else if (g_strcmp0 (context_type, "gst.gl.app_context") == 0) {
- GstContext *app_context = gst_context_new ("gst.gl.app_context", TRUE);
- GstStructure *s = gst_context_writable_structure (app_context);
- gst_structure_set (s, "context", GST_TYPE_GL_CONTEXT, p->context, NULL);
- gst_element_set_context (GST_ELEMENT (msg->src), app_context);
- }
- break;
- }
- default:
- break;
- }
- return FALSE;
-}
diff --git a/tests/examples/gl/qt/qglwtextureshare/pipeline.h b/tests/examples/gl/qt/qglwtextureshare/pipeline.h
deleted file mode 100644
index e517a12d7..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/pipeline.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2009 Andrey Nechypurenko <andreynech@gmail.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 PIPELINE_H
-#define PIPELINE_H
-
-#include <QObject>
-
-#include <gst/gl/gstglcontext.h>
-
-#include "AsyncQueue.h"
-
-
-class Pipeline : public QObject
-{
- Q_OBJECT
-
-public:
- Pipeline(GstGLDisplay *display, GstGLContext *context,
- const QString &videoLocation,
- QObject *parent);
- ~Pipeline();
-
- void configure();
- void start();
- void notifyNewFrame() {emit newFrameReady();}
- void stop();
- void unconfigure();
-
- AsyncQueue<GstBuffer*> queue_input_buf;
- AsyncQueue<GstBuffer*> queue_output_buf;
-
-Q_SIGNALS:
- void newFrameReady();
- void stopRequested();
-
-private:
- GstGLDisplay *display;
- GstGLContext *context;
- const QString m_videoLocation;
- GMainLoop* m_loop;
- GstBus* m_bus;
- GstPipeline* m_pipeline;
- static float m_xrot;
- static float m_yrot;
- static float m_zrot;
-
- static void on_gst_buffer(GstElement * element, GstBuffer * buf, GstPad * pad, Pipeline* p);
- static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p);
- static gboolean sync_bus_call (GstBus *bus, GstMessage *msg, Pipeline* p);
-};
-
-#endif
diff --git a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp b/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp
deleted file mode 100644
index 629cc895f..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2009 Andrey Nechypurenko <andreynech@gmail.com>
- * Copyright (C) 2010 Nuno Santos <nunosantos@imaginando.net>
- *
- * 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.
- */
-
-#include <QGLWidget>
-#include <QApplication>
-#include <QDebug>
-#include <QCloseEvent>
-
-#include <GL/glx.h>
-
-#include <gst/video/video.h>
-#include <gst/gl/gl.h>
-
-#if GST_GL_HAVE_PLATFORM_GLX
-#include <QX11Info>
-#include <gst/gl/x11/gstgldisplay_x11.h>
-#endif
-
-#include "gstthread.h"
-#include "qglrenderer.h"
-#include "pipeline.h"
-
-#if defined(Q_WS_MAC)
-extern void *qt_current_nsopengl_context ();
-#endif
-
-QGLRenderer::QGLRenderer (const QString & videoLocation, QWidget * parent)
- :
-QGLWidget (parent),
-videoLoc (videoLocation),
-gst_thread (NULL),
-closing (false),
-frame (NULL)
-{
- move (20, 10);
- resize (640, 480);
-}
-
-QGLRenderer::~QGLRenderer ()
-{
-}
-
-void
-QGLRenderer::initializeGL ()
-{
- GstGLContext *context;
- GstGLDisplay *display;
-
-#if GST_GL_HAVE_PLATFORM_GLX
- display =
- (GstGLDisplay *) gst_gl_display_x11_new_with_display (QX11Info::
- display ());
-#else
- display = gst_gl_display_new ();
-#endif
-
- /* FIXME: Allow the choice at runtime */
-#if GST_GL_HAVE_PLATFORM_WGL
- context =
- gst_gl_context_new_wrapped (display, (guintptr) wglGetCurrentContext (),
- GST_GL_PLATFORM_WGL, GST_GL_API_OPENGL);
-#elif GST_GL_HAVE_PLATFORM_CGL
- context =
- gst_gl_context_new_wrapped (display,
- (guintptr) qt_current_nsopengl_context (), GST_GL_PLATFORM_CGL,
- GST_GL_API_OPENGL);
-#elif GST_GL_HAVE_PLATFORM_GLX
- context =
- gst_gl_context_new_wrapped (display, (guintptr) glXGetCurrentContext (),
- GST_GL_PLATFORM_GLX, GST_GL_API_OPENGL);
-#endif
- gst_object_unref (display);
-
- // We need to unset Qt context before initializing gst-gl plugin.
- // Otherwise the attempt to share gst-gl context with Qt will fail.
- this->doneCurrent ();
- this->gst_thread =
- new GstThread (display, context, this->videoLoc,
- SLOT (newFrame ()), this);
- this->makeCurrent ();
-
- QObject::connect (this->gst_thread, SIGNAL (finished ()),
- this, SLOT (close ()));
- QObject::connect (this, SIGNAL (closeRequested ()),
- this->gst_thread, SLOT (stop ()), Qt::QueuedConnection);
-
- qglClearColor (QApplication::palette ().color (QPalette::Active,
- QPalette::Window));
- //glShadeModel(GL_FLAT);
- //glEnable(GL_DEPTH_TEST);
- //glEnable(GL_CULL_FACE);
- glEnable (GL_TEXTURE_2D); // Enable Texture Mapping
-
- this->gst_thread->start ();
-}
-
-void
-QGLRenderer::resizeGL (int width, int height)
-{
- // Reset The Current Viewport And Perspective Transformation
- glViewport (0, 0, width, height);
-
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity ();
-
- glMatrixMode (GL_MODELVIEW);
-}
-
-void
-QGLRenderer::newFrame ()
-{
- Pipeline *pipeline = this->gst_thread->getPipeline ();
- if (!pipeline)
- return;
-
- /* frame is initialized as null */
- if (this->frame)
- pipeline->queue_output_buf.put (this->frame);
-
- this->frame = pipeline->queue_input_buf.get ();
-
- /* direct call to paintGL (no queued) */
- this->updateGL ();
-}
-
-static void
-flushGstreamerGL (GstGLContext * context, void *data G_GNUC_UNUSED)
-{
- context->gl_vtable->Flush ();
-}
-
-void
-QGLRenderer::paintGL ()
-{
- static GLfloat xrot = 0;
- static GLfloat yrot = 0;
- static GLfloat zrot = 0;
-
- if (this->frame) {
- guint tex_id;
- GstMemory *mem;
- GstVideoInfo v_info;
- GstVideoFrame v_frame;
- GstVideoMeta *v_meta;
-
- mem = gst_buffer_peek_memory (this->frame, 0);
- v_meta = gst_buffer_get_video_meta (this->frame);
-
- Q_ASSERT (gst_is_gl_memory (mem));
-
- GstGLMemory *gl_memory = (GstGLMemory *) mem;
-
- gst_gl_context_thread_add (gl_memory->mem.context, flushGstreamerGL, NULL);
-
- gst_video_info_set_format (&v_info, v_meta->format, v_meta->width,
- v_meta->height);
-
- gst_video_frame_map (&v_frame, &v_info, this->frame,
- (GstMapFlags) (GST_MAP_READ | GST_MAP_GL));
-
- tex_id = *(guint *) v_frame.data[0];
-
- glEnable (GL_DEPTH_TEST);
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, tex_id);
- if (glGetError () != GL_NO_ERROR) {
- qDebug ("failed to bind texture that comes from gst-gl");
- emit closeRequested ();
- return;
- }
-
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode (GL_MODELVIEW);
- glLoadIdentity ();
-
- glScalef (0.5f, 0.5f, 0.5f);
-
- glRotatef (xrot, 1.0f, 0.0f, 0.0f);
- glRotatef (yrot, 0.0f, 1.0f, 0.0f);
- glRotatef (zrot, 0.0f, 0.0f, 1.0f);
-
- glBegin (GL_QUADS);
- // Front Face
- glTexCoord2f (1.0f, 0.0f);
- glVertex3f (-1.0f, -1.0f, 1.0f);
- glTexCoord2f (0.0f, 0.0f);
- glVertex3f (1.0f, -1.0f, 1.0f);
- glTexCoord2f (0.0f, 1.0f);
- glVertex3f (1.0f, 1.0f, 1.0f);
- glTexCoord2f (1.0f, 1.0f);
- glVertex3f (-1.0f, 1.0f, 1.0f);
- // Back Face
- glTexCoord2f (0.0f, 0.0f);
- glVertex3f (-1.0f, -1.0f, -1.0f);
- glTexCoord2f (0.0f, 1.0f);
- glVertex3f (-1.0f, 1.0f, -1.0f);
- glTexCoord2f (1.0f, 1.0f);
- glVertex3f (1.0f, 1.0f, -1.0f);
- glTexCoord2f (1.0f, 0.0f);
- glVertex3f (1.0f, -1.0f, -1.0f);
- // Top Face
- glTexCoord2f (1.0f, 1.0f);
- glVertex3f (-1.0f, 1.0f, -1.0f);
- glTexCoord2f (1.0f, 0.0f);
- glVertex3f (-1.0f, 1.0f, 1.0f);
- glTexCoord2f (0.0f, 0.0f);
- glVertex3f (1.0f, 1.0f, 1.0f);
- glTexCoord2f (0.0f, 1.0f);
- glVertex3f (1.0f, 1.0f, -1.0f);
- // Bottom Face
- glTexCoord2f (1.0f, 0.0f);
- glVertex3f (-1.0f, -1.0f, -1.0f);
- glTexCoord2f (0.0f, 0.0f);
- glVertex3f (1.0f, -1.0f, -1.0f);
- glTexCoord2f (0.0f, 1.0f);
- glVertex3f (1.0f, -1.0f, 1.0f);
- glTexCoord2f (1.0f, 1.0f);
- glVertex3f (-1.0f, -1.0f, 1.0f);
- // Right face
- glTexCoord2f (0.0f, 0.0f);
- glVertex3f (1.0f, -1.0f, -1.0f);
- glTexCoord2f (0.0f, 1.0f);
- glVertex3f (1.0f, 1.0f, -1.0f);
- glTexCoord2f (1.0f, 1.0f);
- glVertex3f (1.0f, 1.0f, 1.0f);
- glTexCoord2f (1.0f, 0.0f);
- glVertex3f (1.0f, -1.0f, 1.0f);
- // Left Face
- glTexCoord2f (1.0f, 0.0f);
- glVertex3f (-1.0f, -1.0f, -1.0f);
- glTexCoord2f (0.0f, 0.0f);
- glVertex3f (-1.0f, -1.0f, 1.0f);
- glTexCoord2f (0.0f, 1.0f);
- glVertex3f (-1.0f, 1.0f, 1.0f);
- glTexCoord2f (1.0f, 1.0f);
- glVertex3f (-1.0f, 1.0f, -1.0f);
- glEnd ();
-
- xrot += 0.3f;
- yrot += 0.2f;
- zrot += 0.4f;
-
- glLoadIdentity();
- glDisable(GL_DEPTH_TEST);
- glBindTexture (GL_TEXTURE_2D, 0);
-
- gst_video_frame_unmap (&v_frame);
- }
-}
-
-void
-QGLRenderer::closeEvent (QCloseEvent * event)
-{
- if (this->closing == false) {
- this->closing = true;
- emit closeRequested ();
- event->ignore ();
- }
-}
diff --git a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.h b/tests/examples/gl/qt/qglwtextureshare/qglrenderer.h
deleted file mode 100644
index 0bf354ba5..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2009 Andrey Nechypurenko <andreynech@gmail.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 QGLRENDERER_H
-#define QGLRENDERER_H
-
-#include <QGLWidget>
-
-#include <gst/gl/gstglcontext.h>
-
-
-class GstThread;
-
-class QGLRenderer : public QGLWidget
-{
- Q_OBJECT
-
-public:
- QGLRenderer(const QString &videoLocation, QWidget *parent = 0);
- ~QGLRenderer();
-
- void closeEvent(QCloseEvent* event);
-
-Q_SIGNALS:
- void closeRequested();
-
-public Q_SLOTS:
- void newFrame();
-
-protected:
- virtual void initializeGL();
- virtual void resizeGL(int width, int height);
- virtual void paintGL();
-
-private:
- QString videoLoc;
- GstThread *gst_thread;
- bool closing;
- GstBuffer *frame;
-};
-
-#endif // QGLRENDERER_H
diff --git a/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro b/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro
deleted file mode 100644
index 9f60bf5e8..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro
+++ /dev/null
@@ -1,80 +0,0 @@
-TEMPLATE = app
-TARGET = qglwtextureshare
-QT += opengl
-
-# Add console to the CONFIG to see debug messages printed in
-# the console on Windows
-# CONFIG += console
-DESTDIR = ./debug
-DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB
-CONFIG += link_pkgconfig
-PKGCONFIG=gstreamer-1.0 gstreamer-video-1.0 gstreamer-gl-1.0
-
-win32 {
-DEFINES += WIN32
-INCLUDEPATH += \
- C:/gstreamer/include \
- C:/gstreamer/include/libxml2 \
- C:/gstreamer/include/glib-2.0 \
- C:/gstreamer/lib/glib-2.0/include \
- C:/gstreamer/include/gstreamer-1.0
-LIBS += -L"C:/gstreamer/lib" \
- -L"C:/gstreamer/bin" \
- -lgstreamer-1.0 \
- -lgstgl-1.0 \
- -lgstvideo-1.0 \
- -lglib-2.0 \
- -lgmodule-2.0 \
- -lgobject-2.0 \
- -lgthread-2.0 \
- -lgstvideo-1.0 \
- -lopengl32 \
- -lglu32
-}
-unix:!mac {
- DEFINES += UNIX
- LIBS += \
- -lgstvideo-1.0 \
- -lgstgl-1.0 \
- -lGLU \
- -lGL
- QT += x11extras
-}
-mac {
- DEFINES += MACOSX
- INCLUDEPATH += /opt/local/include/ \
- /opt/local/include/gstreamer-1.0/ \
- /opt/local/include/glib-2.0/ \
- /opt/local/lib/glib-2.0/include \
- /opt/local/include/libxml2
- LIBS += -L/opt/local/lib \
- -lgstreamer-1.0 \
- -lgstapp-1.0 \
- -lgstvideo-1.0 \
- -lglib-2.0 \
- -lgobject-2.0 \
- -lcxcore \
- -lcvaux \
- -lcv
- OBJECTIVE_SOURCES += cocoa_utils.mm
- LIBS += -framework AppKit
-}
-DEPENDPATH += .
-
-# Header files
-HEADERS += gstthread.h \
- pipeline.h \
- qglrenderer.h \
- AsyncQueue.h \
-
-# Source files
-SOURCES += gstthread.cpp \
- main.cpp \
- pipeline.cpp \
- qglrenderer.cpp
-
-DEPENDPATH += .
-MOC_DIR += ./GeneratedFiles/debug
-OBJECTS_DIR += debug
-UI_DIR += ./GeneratedFiles
-RCC_DIR += ./GeneratedFiles
diff --git a/tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_gstthread.cpp b/tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_gstthread.cpp
deleted file mode 100644
index 79823067f..000000000
--- a/tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_gstthread.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'gstthread.h'
-**
-** Created by: The Qt Meta Object Compiler version 67 (Qt 5.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../gstthread.h"
-#include <QtCore/qbytearray.h>
-#include <QtCore/qmetatype.h>
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'gstthread.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 67
-#error "This file was generated using the moc from 5.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-QT_BEGIN_MOC_NAMESPACE
-struct qt_meta_stringdata_GstThread_t {
- QByteArrayData data[8];
- char stringdata[69];
-};
-#define QT_MOC_LITERAL(idx, ofs, len) \
- Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
- offsetof(qt_meta_stringdata_GstThread_t, stringdata) + ofs \
- - idx * sizeof(QByteArrayData) \
- )
-static const qt_meta_stringdata_GstThread_t qt_meta_stringdata_GstThread = {
- {
-QT_MOC_LITERAL(0, 0, 9),
-QT_MOC_LITERAL(1, 10, 15),
-QT_MOC_LITERAL(2, 26, 0),
-QT_MOC_LITERAL(3, 27, 5),
-QT_MOC_LITERAL(4, 33, 6),
-QT_MOC_LITERAL(5, 40, 15),
-QT_MOC_LITERAL(6, 56, 6),
-QT_MOC_LITERAL(7, 63, 4)
- },
- "GstThread\0resizeRequested\0\0width\0"
- "height\0exposeRequested\0resize\0stop\0"
-};
-#undef QT_MOC_LITERAL
-
-static const uint qt_meta_data_GstThread[] = {
-
- // content:
- 7, // revision
- 0, // classname
- 0, 0, // classinfo
- 4, 14, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
- 0, 0, // constructors
- 0, // flags
- 1, // signalCount
-
- // signals: name, argc, parameters, tag, flags
- 1, 2, 34, 2, 0x06,
-
- // slots: name, argc, parameters, tag, flags
- 5, 0, 39, 2, 0x0a,
- 6, 2, 40, 2, 0x0a,
- 7, 0, 45, 2, 0x0a,
-
- // signals: parameters
- QMetaType::Void, QMetaType::Int, QMetaType::Int, 3, 4,
-
- // slots: parameters
- QMetaType::Void,
- QMetaType::Void, QMetaType::Int, QMetaType::Int, 3, 4,
- QMetaType::Void,
-
- 0 // eod
-};
-
-void GstThread::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
-{
- if (_c == QMetaObject::InvokeMetaMethod) {
- GstThread *_t = static_cast<GstThread *>(_o);
- switch (_id) {
- case 0: _t->resizeRequested((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
- case 1: _t->exposeRequested(); break;
- case 2: _t->resize((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
- case 3: _t->stop(); break;
- default: ;
- }
- } else if (_c == QMetaObject::IndexOfMethod) {
- int *result = reinterpret_cast<int *>(_a[0]);
- void **func = reinterpret_cast<void **>(_a[1]);
- {
- typedef void (GstThread::*_t)(int , int );
- if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&GstThread::resizeRequested)) {
- *result = 0;
- }
- }
- }
-}
-
-const QMetaObject GstThread::staticMetaObject = {
- { &QThread::staticMetaObject, qt_meta_stringdata_GstThread.data,
- qt_meta_data_GstThread, qt_static_metacall, 0, 0}
-};
-
-
-const QMetaObject *GstThread::metaObject() const
-{
- return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
-}
-
-void *GstThread::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_GstThread.stringdata))
- return static_cast<void*>(const_cast< GstThread*>(this));
- return QThread::qt_metacast(_clname);
-}
-
-int GstThread::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QThread::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- if (_id < 4)
- qt_static_metacall(this, _c, _id, _a);
- _id -= 4;
- } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
- if (_id < 4)
- *reinterpret_cast<int*>(_a[0]) = -1;
- _id -= 4;
- }
- return _id;
-}
-
-// SIGNAL 0
-void GstThread::resizeRequested(int _t1, int _t2)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
- QMetaObject::activate(this, &staticMetaObject, 0, _a);
-}
-QT_END_MOC_NAMESPACE
diff --git a/tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_pipeline.cpp b/tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_pipeline.cpp
deleted file mode 100644
index dff3f77aa..000000000
--- a/tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_pipeline.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'pipeline.h'
-**
-** Created by: The Qt Meta Object Compiler version 67 (Qt 5.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../pipeline.h"
-#include <QtCore/qbytearray.h>
-#include <QtCore/qmetatype.h>
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'pipeline.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 67
-#error "This file was generated using the moc from 5.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-QT_BEGIN_MOC_NAMESPACE
-struct qt_meta_stringdata_Pipeline_t {
- QByteArrayData data[6];
- char stringdata[54];
-};
-#define QT_MOC_LITERAL(idx, ofs, len) \
- Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
- offsetof(qt_meta_stringdata_Pipeline_t, stringdata) + ofs \
- - idx * sizeof(QByteArrayData) \
- )
-static const qt_meta_stringdata_Pipeline_t qt_meta_stringdata_Pipeline = {
- {
-QT_MOC_LITERAL(0, 0, 8),
-QT_MOC_LITERAL(1, 9, 15),
-QT_MOC_LITERAL(2, 25, 0),
-QT_MOC_LITERAL(3, 26, 5),
-QT_MOC_LITERAL(4, 32, 6),
-QT_MOC_LITERAL(5, 39, 13)
- },
- "Pipeline\0resizeRequested\0\0width\0height\0"
- "stopRequested\0"
-};
-#undef QT_MOC_LITERAL
-
-static const uint qt_meta_data_Pipeline[] = {
-
- // content:
- 7, // revision
- 0, // classname
- 0, 0, // classinfo
- 2, 14, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
- 0, 0, // constructors
- 0, // flags
- 2, // signalCount
-
- // signals: name, argc, parameters, tag, flags
- 1, 2, 24, 2, 0x06,
- 5, 0, 29, 2, 0x06,
-
- // signals: parameters
- QMetaType::Void, QMetaType::Int, QMetaType::Int, 3, 4,
- QMetaType::Void,
-
- 0 // eod
-};
-
-void Pipeline::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
-{
- if (_c == QMetaObject::InvokeMetaMethod) {
- Pipeline *_t = static_cast<Pipeline *>(_o);
- switch (_id) {
- case 0: _t->resizeRequested((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
- case 1: _t->stopRequested(); break;
- default: ;
- }
- } else if (_c == QMetaObject::IndexOfMethod) {
- int *result = reinterpret_cast<int *>(_a[0]);
- void **func = reinterpret_cast<void **>(_a[1]);
- {
- typedef void (Pipeline::*_t)(int , int );
- if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Pipeline::resizeRequested)) {
- *result = 0;
- }
- }
- {
- typedef void (Pipeline::*_t)();
- if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&Pipeline::stopRequested)) {
- *result = 1;
- }
- }
- }
-}
-
-const QMetaObject Pipeline::staticMetaObject = {
- { &QObject::staticMetaObject, qt_meta_stringdata_Pipeline.data,
- qt_meta_data_Pipeline, qt_static_metacall, 0, 0}
-};
-
-
-const QMetaObject *Pipeline::metaObject() const
-{
- return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
-}
-
-void *Pipeline::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_Pipeline.stringdata))
- return static_cast<void*>(const_cast< Pipeline*>(this));
- return QObject::qt_metacast(_clname);
-}
-
-int Pipeline::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QObject::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- if (_id < 2)
- qt_static_metacall(this, _c, _id, _a);
- _id -= 2;
- } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
- if (_id < 2)
- *reinterpret_cast<int*>(_a[0]) = -1;
- _id -= 2;
- }
- return _id;
-}
-
-// SIGNAL 0
-void Pipeline::resizeRequested(int _t1, int _t2)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
- QMetaObject::activate(this, &staticMetaObject, 0, _a);
-}
-
-// SIGNAL 1
-void Pipeline::stopRequested()
-{
- QMetaObject::activate(this, &staticMetaObject, 1, 0);
-}
-QT_END_MOC_NAMESPACE
diff --git a/tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_qrenderer.cpp b/tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_qrenderer.cpp
deleted file mode 100644
index 007373ba7..000000000
--- a/tests/examples/gl/qt/videooverlay/GeneratedFiles/debug/moc_qrenderer.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'qrenderer.h'
-**
-** Created by: The Qt Meta Object Compiler version 67 (Qt 5.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../qrenderer.h"
-#include <QtCore/qbytearray.h>
-#include <QtCore/qmetatype.h>
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'qrenderer.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 67
-#error "This file was generated using the moc from 5.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-QT_BEGIN_MOC_NAMESPACE
-struct qt_meta_stringdata_QRenderer_t {
- QByteArrayData data[7];
- char stringdata[72];
-};
-#define QT_MOC_LITERAL(idx, ofs, len) \
- Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
- offsetof(qt_meta_stringdata_QRenderer_t, stringdata) + ofs \
- - idx * sizeof(QByteArrayData) \
- )
-static const qt_meta_stringdata_QRenderer_t qt_meta_stringdata_QRenderer = {
- {
-QT_MOC_LITERAL(0, 0, 9),
-QT_MOC_LITERAL(1, 10, 15),
-QT_MOC_LITERAL(2, 26, 0),
-QT_MOC_LITERAL(3, 27, 14),
-QT_MOC_LITERAL(4, 42, 15),
-QT_MOC_LITERAL(5, 58, 5),
-QT_MOC_LITERAL(6, 64, 6)
- },
- "QRenderer\0exposeRequested\0\0closeRequested\0"
- "resizeRequested\0width\0height\0"
-};
-#undef QT_MOC_LITERAL
-
-static const uint qt_meta_data_QRenderer[] = {
-
- // content:
- 7, // revision
- 0, // classname
- 0, 0, // classinfo
- 3, 14, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
- 0, 0, // constructors
- 0, // flags
- 2, // signalCount
-
- // signals: name, argc, parameters, tag, flags
- 1, 0, 29, 2, 0x06,
- 3, 0, 30, 2, 0x06,
-
- // slots: name, argc, parameters, tag, flags
- 4, 2, 31, 2, 0x0a,
-
- // signals: parameters
- QMetaType::Void,
- QMetaType::Void,
-
- // slots: parameters
- QMetaType::Void, QMetaType::Int, QMetaType::Int, 5, 6,
-
- 0 // eod
-};
-
-void QRenderer::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
-{
- if (_c == QMetaObject::InvokeMetaMethod) {
- QRenderer *_t = static_cast<QRenderer *>(_o);
- switch (_id) {
- case 0: _t->exposeRequested(); break;
- case 1: _t->closeRequested(); break;
- case 2: _t->resizeRequested((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
- default: ;
- }
- } else if (_c == QMetaObject::IndexOfMethod) {
- int *result = reinterpret_cast<int *>(_a[0]);
- void **func = reinterpret_cast<void **>(_a[1]);
- {
- typedef void (QRenderer::*_t)();
- if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&QRenderer::exposeRequested)) {
- *result = 0;
- }
- }
- {
- typedef void (QRenderer::*_t)();
- if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&QRenderer::closeRequested)) {
- *result = 1;
- }
- }
- }
-}
-
-const QMetaObject QRenderer::staticMetaObject = {
- { &QWidget::staticMetaObject, qt_meta_stringdata_QRenderer.data,
- qt_meta_data_QRenderer, qt_static_metacall, 0, 0}
-};
-
-
-const QMetaObject *QRenderer::metaObject() const
-{
- return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
-}
-
-void *QRenderer::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_QRenderer.stringdata))
- return static_cast<void*>(const_cast< QRenderer*>(this));
- return QWidget::qt_metacast(_clname);
-}
-
-int QRenderer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QWidget::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- if (_id < 3)
- qt_static_metacall(this, _c, _id, _a);
- _id -= 3;
- } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
- if (_id < 3)
- *reinterpret_cast<int*>(_a[0]) = -1;
- _id -= 3;
- }
- return _id;
-}
-
-// SIGNAL 0
-void QRenderer::exposeRequested()
-{
- QMetaObject::activate(this, &staticMetaObject, 0, 0);
-}
-
-// SIGNAL 1
-void QRenderer::closeRequested()
-{
- QMetaObject::activate(this, &staticMetaObject, 1, 0);
-}
-QT_END_MOC_NAMESPACE
diff --git a/tests/examples/gl/qt/videooverlay/videooverlay.cpp b/tests/examples/gl/qt/videooverlay/videooverlay.cpp
deleted file mode 100644
index 9a95e906b..000000000
--- a/tests/examples/gl/qt/videooverlay/videooverlay.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Stefan Kost <ensonic@users.sf.net>
- *
- * qt-xoverlay: demonstrate overlay handling using qt
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <glib.h>
-#include <gst/gst.h>
-#include <gst/video/videooverlay.h>
-
-#include <QApplication>
-#include <QTimer>
-#include <QWidget>
-
-int main(int argc, char *argv[])
-{
- gst_init (&argc, &argv);
- QApplication app(argc, argv);
- app.setQuitOnLastWindowClosed(true);
-
- /* prepare the pipeline */
-
- GstElement *pipeline = gst_pipeline_new ("xvoverlay");
- GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
- GstElement *sink = gst_element_factory_make ("glimagesink", NULL);
-
- if (sink == NULL)
- g_error ("Couldn't create glimagesink.");
-
- gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- gst_element_link (src, sink);
-
- /* prepare the ui */
-
- QWidget window;
- window.resize(320, 240);
- window.setWindowTitle("GstVideoOverlay Qt demo");
- window.show();
-
- WId xwinid = window.winId();
- gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), xwinid);
-
- /* run the pipeline */
-
- GstStateChangeReturn sret = gst_element_set_state (pipeline,
- GST_STATE_PLAYING);
- if (sret == GST_STATE_CHANGE_FAILURE) {
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- /* Exit application */
- QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
- }
-
- int ret = app.exec();
-
- window.hide();
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return ret;
-}
diff --git a/tests/examples/gl/qt/videooverlay/videooverlay.pri b/tests/examples/gl/qt/videooverlay/videooverlay.pri
deleted file mode 100644
index 0a53a9024..000000000
--- a/tests/examples/gl/qt/videooverlay/videooverlay.pri
+++ /dev/null
@@ -1,4 +0,0 @@
-#Header files
-
-#Source files
-SOURCES += videooverlay.cpp
diff --git a/tests/examples/gl/qt/videooverlay/videooverlay.pro b/tests/examples/gl/qt/videooverlay/videooverlay.pro
deleted file mode 100644
index 697341445..000000000
--- a/tests/examples/gl/qt/videooverlay/videooverlay.pro
+++ /dev/null
@@ -1,42 +0,0 @@
-TEMPLATE = app
-TARGET = videooverlay
-DESTDIR = ./debug
-CONFIG += debug link_pkgconfig
-DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB
-QT += gui widgets
-PKGCONFIG=gstreamer-1.0 gstreamer-video-1.0
-
-win32 {
-DEFINES += WIN32
-INCLUDEPATH += ./GeneratedFiles \
- ./GeneratedFiles/Debug \
- C:/gstreamer/include \
- C:/gstreamer/include/libxml2 \
- C:/gstreamer/include/glib-2.0 \
- C:/gstreamer/lib/glib-2.0/include \
- C:/gstreamer/include/gstreamer-1.0
-LIBS += -L"C:/gstreamer/bin" \
- -L"C:/gstreamer/lib" \
- -lgstreamer-1.0 \
- -lgstvideo-1.0 \
- -lglib-2.0 \
- -lgmodule-2.0 \
- -lgobject-2.0 \
- -lgthread-2.0
-}
-
-unix {
-DEFINES += UNIX
-INCLUDEPATH += GeneratedFiles \
- GeneratedFiles/Debug
-LIBS += -lGLU -lGL
-}
-
-DEPENDPATH += .
-MOC_DIR += ./GeneratedFiles/debug
-OBJECTS_DIR += debug
-UI_DIR += ./GeneratedFiles
-RCC_DIR += ./GeneratedFiles
-
-#Include file(s)
-include(videooverlay.pri)
diff --git a/tests/examples/gl/qt/videooverlay/videooverlay.sln b/tests/examples/gl/qt/videooverlay/videooverlay.sln
deleted file mode 100644
index f56635778..000000000
--- a/tests/examples/gl/qt/videooverlay/videooverlay.sln
+++ /dev/null
@@ -1,26 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "videooverlay", "videooverlay.vcproj", "{7B8654F9-23A9-4C88-A751-6BBE09ED4CAF}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {7B8654F9-23A9-4C88-A751-6BBE09ED4CAF}.Debug|Win32.ActiveCfg = Debug|Win32
- {7B8654F9-23A9-4C88-A751-6BBE09ED4CAF}.Debug|Win32.Build.0 = Debug|Win32
- {7B8654F9-23A9-4C88-A751-6BBE09ED4CAF}.Release|Win32.ActiveCfg = Release|Win32
- {7B8654F9-23A9-4C88-A751-6BBE09ED4CAF}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(Qt) = preSolution
- Integration = True
- EndGlobalSection
- GlobalSection(Qt) = preSolution
- Integration = True
- EndGlobalSection
-EndGlobal
diff --git a/tests/examples/gl/sdl/.gitignore b/tests/examples/gl/sdl/.gitignore
deleted file mode 100644
index f476096d6..000000000
--- a/tests/examples/gl/sdl/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-sdlshare
-sdlshare2
diff --git a/tests/examples/gl/sdl/Makefile.am b/tests/examples/gl/sdl/Makefile.am
deleted file mode 100644
index dd575097d..000000000
--- a/tests/examples/gl/sdl/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-noinst_PROGRAMS = ##
-
-#works on win32 and X
-if HAVE_SDL
-
-noinst_PROGRAMS += sdlshare sdlshare2
-
-sdlshare_SOURCES = sdlshare.c
-
-sdlshare_CFLAGS= \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_CFLAGS) \
- $(GL_CFLAGS) \
- $(SDL_CFLAGS)
-sdlshare_LDADD= $(GST_LIBS) $(GL_LIBS) $(SDL_LIBS) \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la \
- -lgstvideo-$(GST_API_VERSION)
-
-sdlshare2_SOURCES = sdlshare2.c
-
-sdlshare2_CFLAGS= \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_CFLAGS) \
- $(GL_CFLAGS) \
- $(SDL_CFLAGS)
-sdlshare2_LDADD= $(GST_LIBS) $(GL_LIBS) $(SDL_LIBS) \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la \
- -lgstvideo-$(GST_API_VERSION)
-
-endif
diff --git a/tests/examples/gl/sdl/meson.build b/tests/examples/gl/sdl/meson.build
deleted file mode 100644
index 8285f87f1..000000000
--- a/tests/examples/gl/sdl/meson.build
+++ /dev/null
@@ -1,16 +0,0 @@
-sdl_dep = dependency('sdl', version : '>=1.2.0', required : false)
-if sdl_dep.found() and build_gstgl
- executable('sdlshare',
- 'sdlshare.c',
- install: false,
- dependencies : [gstbase_dep, gstgl_dep, sdl_dep, gl_dep],
- c_args : ['-DGST_USE_UNSTABLE_API', ],
- )
-
- executable('sdlshare2',
- 'sdlshare2.c',
- install: false,
- dependencies : [gstbase_dep, gstgl_dep, sdl_dep, gl_dep],
- c_args : ['-DGST_USE_UNSTABLE_API', ],
-)
-endif
diff --git a/tests/examples/gl/sdl/sdl.sln b/tests/examples/gl/sdl/sdl.sln
deleted file mode 100644
index 0ecdd0057..000000000
--- a/tests/examples/gl/sdl/sdl.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdlshare", "sdlshare.vcproj", "{2C29F5A2-5982-428A-8068-9A5788FD2277}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {2C29F5A2-5982-428A-8068-9A5788FD2277}.Debug|Win32.ActiveCfg = Debug|Win32
- {2C29F5A2-5982-428A-8068-9A5788FD2277}.Debug|Win32.Build.0 = Debug|Win32
- {2C29F5A2-5982-428A-8068-9A5788FD2277}.Release|Win32.ActiveCfg = Release|Win32
- {2C29F5A2-5982-428A-8068-9A5788FD2277}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/tests/examples/gl/sdl/sdlshare.c b/tests/examples/gl/sdl/sdlshare.c
deleted file mode 100644
index 29272f224..000000000
--- a/tests/examples/gl/sdl/sdlshare.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef WIN32
-#include <windows.h>
-#endif
-
-#include <GL/gl.h>
-#include "SDL/SDL.h"
-#include "SDL/SDL_opengl.h"
-
-#ifndef WIN32
-#include <GL/glx.h>
-#include "SDL/SDL_syswm.h"
-#include <gst/gl/x11/gstgldisplay_x11.h>
-#endif
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-
-static GstGLContext *sdl_context;
-static GstGLDisplay *sdl_gl_display;
-
-/* rotation angle for the triangle. */
-float rtri = 0.0f;
-
-/* rotation angle for the quadrilateral. */
-float rquad = 0.0f;
-
-/* A general OpenGL initialization function. Sets all of the initial parameters. */
-static void
-InitGL (int Width, int Height) // We call this right after our OpenGL window is created.
-{
- glViewport (0, 0, Width, Height);
- glClearColor (0.0f, 0.0f, 0.0f, 0.0f); // This Will Clear The Background Color To Black
- glClearDepth (1.0); // Enables Clearing Of The Depth Buffer
- glDepthFunc (GL_LESS); // The Type Of Depth Test To Do
- glEnable (GL_DEPTH_TEST); // Enables Depth Testing
- glShadeModel (GL_SMOOTH); // Enables Smooth Color Shading
-
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity (); // Reset The Projection Matrix
-
- glMatrixMode (GL_MODELVIEW);
-}
-
-/* The main drawing function. */
-static void
-DrawGLScene (GstBuffer * buf)
-{
- GstVideoFrame v_frame;
- GstVideoInfo v_info;
- guint texture;
-
- gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, 320, 240);
-
- if (!gst_video_frame_map (&v_frame, &v_info, buf, GST_MAP_READ | GST_MAP_GL)) {
- g_warning ("Failed to map the video buffer");
- return;
- }
-
- texture = *(guint *) v_frame.data[0];
-
- glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
- glLoadIdentity (); // Reset The View
-
- glTranslatef (-0.4f, 0.0f, 0.0f); // Move Left 1.5 Units And Into The Screen 6.0
-
- glRotatef (rtri, 0.0f, 1.0f, 0.0f); // Rotate The Triangle On The Y axis
- // draw a triangle (in smooth coloring mode)
- glBegin (GL_POLYGON); // start drawing a polygon
- glColor3f (1.0f, 0.0f, 0.0f); // Set The Color To Red
- glVertex3f (0.0f, 0.4f, 0.0f); // Top
- glColor3f (0.0f, 1.0f, 0.0f); // Set The Color To Green
- glVertex3f (0.4f, -0.4f, 0.0f); // Bottom Right
- glColor3f (0.0f, 0.0f, 1.0f); // Set The Color To Blue
- glVertex3f (-0.4f, -0.4f, 0.0f); // Bottom Left
- glEnd (); // we're done with the polygon (smooth color interpolation)
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, texture);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glLoadIdentity (); // make sure we're no longer rotated.
- glTranslatef (0.5f, 0.0f, 0.0f); // Move Right 3 Units, and back into the screen 6.0
-
- glRotatef (rquad, 1.0f, 0.0f, 0.0f); // Rotate The Quad On The X axis
- // draw a square (quadrilateral)
- glColor3f (0.4f, 0.4f, 1.0f); // set color to a blue shade.
- glBegin (GL_QUADS); // start drawing a polygon (4 sided)
- glTexCoord3f (0.0f, 1.0f, 0.0f);
- glVertex3f (-0.4f, 0.4f, 0.0f); // Top Left
- glTexCoord3f (1.0f, 1.0f, 0.0f);
- glVertex3f (0.4f, 0.4f, 0.0f); // Top Right
- glTexCoord3f (1.0f, 0.0f, 0.0f);
- glVertex3f (0.4f, -0.4f, 0.0f); // Bottom Right
- glTexCoord3f (0.0f, 0.0f, 0.0f);
- glVertex3f (-0.4f, -0.4f, 0.0f); // Bottom Left
- glEnd (); // done with the polygon
-
- glBindTexture (GL_TEXTURE_2D, 0);
-
- rtri += 1.0f; // Increase The Rotation Variable For The Triangle
- rquad -= 1.0f; // Decrease The Rotation Variable For The Quad
-
- // swap buffers to display, since we're double buffered.
- SDL_GL_SwapBuffers ();
-
- gst_video_frame_unmap (&v_frame);
-}
-
-static gboolean
-update_sdl_scene (void *fk)
-{
- GstElement *fakesink = (GstElement *) fk;
- GMainLoop *loop =
- (GMainLoop *) g_object_get_data (G_OBJECT (fakesink), "loop");
- GAsyncQueue *queue_input_buf =
- (GAsyncQueue *) g_object_get_data (G_OBJECT (fakesink),
- "queue_input_buf");
- GAsyncQueue *queue_output_buf =
- (GAsyncQueue *) g_object_get_data (G_OBJECT (fakesink),
- "queue_output_buf");
- GstBuffer *buf = (GstBuffer *) g_async_queue_pop (queue_input_buf);
-
- SDL_Event event;
- while (SDL_PollEvent (&event)) {
- if (event.type == SDL_QUIT) {
- g_main_loop_quit (loop);
- }
- if (event.type == SDL_KEYDOWN) {
- if (event.key.keysym.sym == SDLK_ESCAPE) {
- g_main_loop_quit (loop);
- }
- }
- }
-
- DrawGLScene (buf);
-
- /* push buffer so it can be unref later */
- g_async_queue_push (queue_output_buf, buf);
-
- return FALSE;
-}
-
-/* fakesink handoff callback */
-static void
-on_gst_buffer (GstElement * fakesink, GstBuffer * buf, GstPad * pad,
- gpointer data)
-{
- GAsyncQueue *queue_input_buf = NULL;
- GAsyncQueue *queue_output_buf = NULL;
-
- /* ref then push buffer to use it in sdl */
- gst_buffer_ref (buf);
- queue_input_buf =
- (GAsyncQueue *) g_object_get_data (G_OBJECT (fakesink),
- "queue_input_buf");
- g_async_queue_push (queue_input_buf, buf);
- if (g_async_queue_length (queue_input_buf) > 3)
- g_idle_add (update_sdl_scene, (gpointer) fakesink);
-
- /* pop then unref buffer we have finished to use in sdl */
- queue_output_buf =
- (GAsyncQueue *) g_object_get_data (G_OBJECT (fakesink),
- "queue_output_buf");
- if (g_async_queue_length (queue_output_buf) > 3) {
- GstBuffer *buf_old = (GstBuffer *) g_async_queue_pop (queue_output_buf);
- gst_buffer_unref (buf_old);
- }
-}
-
-/* gst bus signal watch callback */
-static void
-end_stream_cb (GstBus * bus, GstMessage * msg, GMainLoop * loop)
-{
- switch (GST_MESSAGE_TYPE (msg)) {
-
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_print
- ("For more information, try to run: GST_DEBUG=gl*:3 ./sdlshare\n");
- break;
-
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, &debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- if (debug) {
- g_print ("Debug deails: %s\n", debug);
- g_free (debug);
- }
-
- break;
- }
-
- default:
- break;
- }
-
- g_main_loop_quit (loop);
-}
-
-static gboolean
-sync_bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_NEED_CONTEXT:
- {
- const gchar *context_type;
-
- gst_message_parse_context_type (msg, &context_type);
- g_print ("got need context %s\n", context_type);
-
- if (g_strcmp0 (context_type, GST_GL_DISPLAY_CONTEXT_TYPE) == 0) {
- GstContext *display_context =
- gst_context_new (GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
- gst_context_set_gl_display (display_context, sdl_gl_display);
- gst_element_set_context (GST_ELEMENT (msg->src), display_context);
- return TRUE;
- } else if (g_strcmp0 (context_type, "gst.gl.app_context") == 0) {
- GstContext *app_context = gst_context_new ("gst.gl.app_context", TRUE);
- GstStructure *s = gst_context_writable_structure (app_context);
- gst_structure_set (s, "context", GST_TYPE_GL_CONTEXT, sdl_context,
- NULL);
- gst_element_set_context (GST_ELEMENT (msg->src), app_context);
- return TRUE;
- }
- break;
- }
- default:
- break;
- }
- return FALSE;
-}
-
-int
-main (int argc, char **argv)
-{
-
-#ifdef WIN32
- HGLRC sdl_gl_context = 0;
- HDC sdl_dc = 0;
-#else
- SDL_SysWMinfo info;
- Display *sdl_display = NULL;
- Window sdl_win = 0;
- GLXContext sdl_gl_context = NULL;
-#endif
-
- GMainLoop *loop = NULL;
- GstPipeline *pipeline = NULL;
- GstBus *bus = NULL;
- GstElement *fakesink = NULL;
- GstState state;
- GAsyncQueue *queue_input_buf = NULL;
- GAsyncQueue *queue_output_buf = NULL;
- const gchar *platform;
-
- /* Initialize SDL for video output */
- if (SDL_Init (SDL_INIT_VIDEO) < 0) {
- fprintf (stderr, "Unable to initialize SDL: %s\n", SDL_GetError ());
- return -1;
- }
-
- /* Create a 640x480 OpenGL screen */
- if (SDL_SetVideoMode (640, 480, 0, SDL_OPENGL) == NULL) {
- fprintf (stderr, "Unable to create OpenGL screen: %s\n", SDL_GetError ());
- SDL_Quit ();
- return -1;
- }
-
- /* Set the title bar in environments that support it */
- SDL_WM_SetCaption ("SDL and gst-plugins-gl", NULL);
-
-
- /* Loop, drawing and checking events */
- InitGL (640, 480);
-
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* retrieve and turn off sdl opengl context */
-#ifdef WIN32
- sdl_gl_context = wglGetCurrentContext ();
- sdl_dc = wglGetCurrentDC ();
- wglMakeCurrent (0, 0);
- platform = "wgl";
- sdl_gl_display = gst_gl_display_new ();
-#else
- SDL_VERSION (&info.version);
- SDL_GetWMInfo (&info);
- /* FIXME: This display is different to the one that SDL uses to create the
- * GL context inside SDL_SetVideoMode() above which fails on Intel hardware
- */
- sdl_display = info.info.x11.gfxdisplay;
- sdl_win = info.info.x11.window;
- sdl_gl_context = glXGetCurrentContext ();
- glXMakeCurrent (sdl_display, None, 0);
- platform = "glx";
- sdl_gl_display =
- (GstGLDisplay *) gst_gl_display_x11_new_with_display (sdl_display);
-#endif
-
- sdl_context =
- gst_gl_context_new_wrapped (sdl_gl_display, (guintptr) sdl_gl_context,
- gst_gl_platform_from_string (platform), GST_GL_API_OPENGL);
-
- pipeline =
- GST_PIPELINE (gst_parse_launch
- ("videotestsrc ! video/x-raw, width=320, height=240, framerate=(fraction)30/1 ! "
- "glupload ! gleffects effect=5 ! fakesink sync=1", NULL));
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch (bus);
- g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb), loop);
- g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb), loop);
- g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), loop);
- gst_bus_enable_sync_message_emission (bus);
- g_signal_connect (bus, "sync-message", G_CALLBACK (sync_bus_call), NULL);
- gst_object_unref (bus);
-
- /* NULL to PAUSED state pipeline to make sure the gst opengl context is created and
- * shared with the sdl one */
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
- state = GST_STATE_PAUSED;
- if (gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL,
- GST_CLOCK_TIME_NONE) != GST_STATE_CHANGE_SUCCESS) {
- g_debug ("failed to pause pipeline\n");
- return -1;
- }
-
- /* turn on back sdl opengl context */
-#ifdef WIN32
- wglMakeCurrent (sdl_dc, sdl_gl_context);
-#else
- glXMakeCurrent (sdl_display, sdl_win, sdl_gl_context);
-#endif
-
- /* append a gst-gl texture to this queue when you do not need it no more */
- fakesink = gst_bin_get_by_name (GST_BIN (pipeline), "fakesink0");
- g_object_set (G_OBJECT (fakesink), "signal-handoffs", TRUE, NULL);
- g_signal_connect (fakesink, "handoff", G_CALLBACK (on_gst_buffer), NULL);
- queue_input_buf = g_async_queue_new ();
- queue_output_buf = g_async_queue_new ();
- g_object_set_data (G_OBJECT (fakesink), "queue_input_buf", queue_input_buf);
- g_object_set_data (G_OBJECT (fakesink), "queue_output_buf", queue_output_buf);
- g_object_set_data (G_OBJECT (fakesink), "loop", loop);
- gst_object_unref (fakesink);
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
- g_main_loop_run (loop);
-
- /* before to deinitialize the gst-gl-opengl context,
- * no shared context (here the sdl one) must be current
- */
-#ifdef WIN32
- wglMakeCurrent (0, 0);
-#else
- glXMakeCurrent (sdl_display, sdl_win, sdl_gl_context);
-#endif
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- /* make sure there is no pending gst gl buffer in the communication queues
- * between sdl and gst-gl
- */
- while (g_async_queue_length (queue_input_buf) > 0) {
- GstBuffer *buf = (GstBuffer *) g_async_queue_pop (queue_input_buf);
- gst_buffer_unref (buf);
- }
-
- while (g_async_queue_length (queue_output_buf) > 0) {
- GstBuffer *buf = (GstBuffer *) g_async_queue_pop (queue_output_buf);
- gst_buffer_unref (buf);
- }
-
- /* turn on back sdl opengl context */
-#ifdef WIN32
- wglMakeCurrent (sdl_dc, sdl_gl_context);
-#else
- glXMakeCurrent (sdl_display, None, 0);
-#endif
-
- SDL_Quit ();
-
- return 0;
-}
diff --git a/tests/examples/gl/sdl/sdlshare2.c b/tests/examples/gl/sdl/sdlshare2.c
deleted file mode 100644
index b9ce10876..000000000
--- a/tests/examples/gl/sdl/sdlshare2.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 Julien Isorce <julien.isorce@gmail.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.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef WIN32
-#include <windows.h>
-#endif
-
-#include <GL/gl.h>
-#include "SDL/SDL.h"
-#include "SDL/SDL_opengl.h"
-
-#ifndef WIN32
-#include <GL/glx.h>
-#include "SDL/SDL_syswm.h"
-#include <gst/gl/x11/gstgldisplay_x11.h>
-#endif
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-
-static GstGLContext *sdl_context;
-static GstGLDisplay *sdl_gl_display;
-
-/* rotation angle for the triangle. */
-float rtri = 0.0f;
-
-/* rotation angle for the quadrilateral. */
-float rquad = 0.0f;
-
-/* A general OpenGL initialization function. Sets all of the initial parameters. */
-static void
-InitGL (int Width, int Height) // We call this right after our OpenGL window is created.
-{
- glViewport (0, 0, Width, Height);
- glClearColor (0.0f, 0.0f, 0.0f, 0.0f); // This Will Clear The Background Color To Black
- glClearDepth (1.0); // Enables Clearing Of The Depth Buffer
- glDepthFunc (GL_LESS); // The Type Of Depth Test To Do
- glEnable (GL_DEPTH_TEST); // Enables Depth Testing
- glShadeModel (GL_SMOOTH); // Enables Smooth Color Shading
-
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity (); // Reset The Projection Matrix
-
- glMatrixMode (GL_MODELVIEW);
-}
-
-/* The main drawing function. */
-static void
-DrawGLScene (GstVideoFrame * v_frame)
-{
- guint texture = 0;
-
-#ifdef WIN32
- if (!wglGetCurrentContext ())
- return;
-#else
- if (!glXGetCurrentContext ())
- return;
-#endif
-
- texture = *(guint *) v_frame->data[0];
-
- glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
- glLoadIdentity (); // Reset The View
-
- glTranslatef (-0.4f, 0.0f, 0.0f); // Move Left 1.5 Units And Into The Screen 6.0
-
- glRotatef (rtri, 0.0f, 1.0f, 0.0f); // Rotate The Triangle On The Y axis
- // draw a triangle (in smooth coloring mode)
- glBegin (GL_POLYGON); // start drawing a polygon
- glColor3f (1.0f, 0.0f, 0.0f); // Set The Color To Red
- glVertex3f (0.0f, 0.4f, 0.0f); // Top
- glColor3f (0.0f, 1.0f, 0.0f); // Set The Color To Green
- glVertex3f (0.4f, -0.4f, 0.0f); // Bottom Right
- glColor3f (0.0f, 0.0f, 1.0f); // Set The Color To Blue
- glVertex3f (-0.4f, -0.4f, 0.0f); // Bottom Left
- glEnd (); // we're done with the polygon (smooth color interpolation)
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, texture);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glLoadIdentity (); // make sure we're no longer rotated.
- glTranslatef (0.5f, 0.0f, 0.0f); // Move Right 3 Units, and back into the screen 6.0
-
- glRotatef (rquad, 1.0f, 0.0f, 0.0f); // Rotate The Quad On The X axis
- // draw a square (quadrilateral)
- glColor3f (0.4f, 0.4f, 1.0f); // set color to a blue shade.
- glBegin (GL_QUADS); // start drawing a polygon (4 sided)
- glTexCoord3f (0.0f, 1.0f, 0.0f);
- glVertex3f (-0.4f, 0.4f, 0.0f); // Top Left
- glTexCoord3f (1.0f, 1.0f, 0.0f);
- glVertex3f (0.4f, 0.4f, 0.0f); // Top Right
- glTexCoord3f (1.0f, 0.0f, 0.0f);
- glVertex3f (0.4f, -0.4f, 0.0f); // Bottom Right
- glTexCoord3f (0.0f, 0.0f, 0.0f);
- glVertex3f (-0.4f, -0.4f, 0.0f); // Bottom Left
- glEnd (); // done with the polygon
-
- glBindTexture (GL_TEXTURE_2D, 0);
-
- rtri += 1.0f; // Increase The Rotation Variable For The Triangle
- rquad -= 1.0f; // Decrease The Rotation Variable For The Quad
-
- // swap buffers to display, since we're double buffered.
- SDL_GL_SwapBuffers ();
-}
-
-static GMutex app_lock;
-static GCond app_cond;
-static gboolean app_rendered = FALSE;
-static gboolean app_quit = FALSE;
-
-static void
-stop_pipeline (GstElement * pipeline)
-{
- g_mutex_lock (&app_lock);
- app_quit = TRUE;
- g_cond_signal (&app_cond);
- g_mutex_unlock (&app_lock);
- gst_element_send_event (pipeline, gst_event_new_eos ());
-}
-
-static gboolean
-update_sdl_scene (gpointer data)
-{
- GstElement *pipeline = (GstElement *) data;
- SDL_Event event;
-
- while (SDL_PollEvent (&event)) {
- if (event.type == SDL_QUIT) {
- stop_pipeline (pipeline);
- return FALSE;
- }
- if (event.type == SDL_KEYDOWN) {
- if (event.key.keysym.sym == SDLK_ESCAPE) {
- stop_pipeline (pipeline);
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-executeCallback (gpointer data)
-{
- g_mutex_lock (&app_lock);
-
- if (!app_quit)
- DrawGLScene (data);
-
- app_rendered = TRUE;
- g_cond_signal (&app_cond);
- g_mutex_unlock (&app_lock);
-
- return FALSE;
-}
-
-static gboolean
-on_client_draw (GstElement * glsink, GstGLContext * context, GstSample * sample,
- gpointer data)
-{
- GstBuffer *buf = gst_sample_get_buffer (sample);
- GstCaps *caps = gst_sample_get_caps (sample);
- GstVideoFrame v_frame;
- GstVideoInfo v_info;
-
- /* FIXME don't do that every frame */
- gst_video_info_from_caps (&v_info, caps);
-
- if (!gst_video_frame_map (&v_frame, &v_info, buf, GST_MAP_READ | GST_MAP_GL)) {
- g_warning ("Failed to map the video buffer");
- return TRUE;
- }
-
- g_mutex_lock (&app_lock);
-
- app_rendered = FALSE;
- g_idle_add_full (G_PRIORITY_HIGH, executeCallback, &v_frame, NULL);
-
- while (!app_rendered && !app_quit)
- g_cond_wait (&app_cond, &app_lock);
-
- g_mutex_unlock (&app_lock);
-
- gst_video_frame_unmap (&v_frame);
-
- return TRUE;
-}
-
-/* gst bus signal watch callback */
-static void
-end_stream_cb (GstBus * bus, GstMessage * msg, GMainLoop * loop)
-{
- switch (GST_MESSAGE_TYPE (msg)) {
-
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- break;
-
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
-
- gst_message_parse_error (msg, &err, &debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- if (debug) {
- g_print ("Debug deails: %s\n", debug);
- g_free (debug);
- }
-
- break;
- }
-
- default:
- break;
- }
-
- g_main_loop_quit (loop);
-}
-
-static gboolean
-sync_bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_NEED_CONTEXT:
- {
- const gchar *context_type;
-
- gst_message_parse_context_type (msg, &context_type);
- g_print ("got need context %s\n", context_type);
-
- if (g_strcmp0 (context_type, GST_GL_DISPLAY_CONTEXT_TYPE) == 0) {
- GstContext *display_context =
- gst_context_new (GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
- gst_context_set_gl_display (display_context, sdl_gl_display);
- gst_element_set_context (GST_ELEMENT (msg->src), display_context);
- return TRUE;
- } else if (g_strcmp0 (context_type, "gst.gl.app_context") == 0) {
- GstContext *app_context = gst_context_new ("gst.gl.app_context", TRUE);
- GstStructure *s = gst_context_writable_structure (app_context);
- gst_structure_set (s, "context", GST_TYPE_GL_CONTEXT, sdl_context,
- NULL);
- gst_element_set_context (GST_ELEMENT (msg->src), app_context);
- return TRUE;
- }
- break;
- }
- default:
- break;
- }
- return FALSE;
-}
-
-int
-main (int argc, char **argv)
-{
-#ifdef WIN32
- HGLRC sdl_gl_context = 0;
- HDC sdl_dc = 0;
-#else
- SDL_SysWMinfo info;
- Display *sdl_display = NULL;
- Window sdl_win = 0;
- GLXContext sdl_gl_context = NULL;
-#endif
-
- GMainLoop *loop = NULL;
- GstPipeline *pipeline = NULL;
- GstBus *bus = NULL;
- GstElement *glimagesink = NULL;
- const gchar *platform;
-
- /* Initialize SDL for video output */
- if (SDL_Init (SDL_INIT_VIDEO) < 0) {
- fprintf (stderr, "Unable to initialize SDL: %s\n", SDL_GetError ());
- return -1;
- }
-
- /* Create a 640x480 OpenGL screen */
- if (SDL_SetVideoMode (640, 480, 0, SDL_OPENGL) == NULL) {
- fprintf (stderr, "Unable to create OpenGL screen: %s\n", SDL_GetError ());
- SDL_Quit ();
- return -1;
- }
-
- /* Set the title bar in environments that support it */
- SDL_WM_SetCaption ("SDL and gst-plugins-gl", NULL);
-
-
- /* Loop, drawing and checking events */
- InitGL (640, 480);
-
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* retrieve and turn off sdl opengl context */
-#ifdef WIN32
- sdl_gl_context = wglGetCurrentContext ();
- sdl_dc = wglGetCurrentDC ();
- wglMakeCurrent (0, 0);
- platform = "wgl";
- sdl_gl_display = gst_gl_display_new ();
-#else
- SDL_VERSION (&info.version);
- SDL_GetWMInfo (&info);
- /* FIXME: This display is different to the one that SDL uses to create the
- * GL context inside SDL_SetVideoMode() above which fails on Intel hardware
- */
- sdl_display = info.info.x11.gfxdisplay;
- sdl_win = info.info.x11.window;
- sdl_gl_context = glXGetCurrentContext ();
- glXMakeCurrent (sdl_display, None, 0);
- platform = "glx";
- sdl_gl_display =
- (GstGLDisplay *) gst_gl_display_x11_new_with_display (sdl_display);
-#endif
-
- sdl_context =
- gst_gl_context_new_wrapped (sdl_gl_display, (guintptr) sdl_gl_context,
- gst_gl_platform_from_string (platform), GST_GL_API_OPENGL);
-
- pipeline =
- GST_PIPELINE (gst_parse_launch
- ("videotestsrc ! video/x-raw, width=320, height=240, framerate=(fraction)30/1 ! "
- "glimagesink name=glimagesink0", NULL));
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch (bus);
- g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb), loop);
- g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb), loop);
- g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), loop);
- gst_bus_enable_sync_message_emission (bus);
- g_signal_connect (bus, "sync-message", G_CALLBACK (sync_bus_call), NULL);
- gst_object_unref (bus);
-
- glimagesink = gst_bin_get_by_name (GST_BIN (pipeline), "glimagesink0");
- g_signal_connect (G_OBJECT (glimagesink), "client-draw",
- G_CALLBACK (on_client_draw), NULL);
- gst_object_unref (glimagesink);
-
- /* NULL to PAUSED state pipeline to make sure the gst opengl context is created and
- * shared with the sdl one */
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
-
- /* turn on back sdl opengl context */
-#ifdef WIN32
- wglMakeCurrent (sdl_dc, sdl_gl_context);
-#else
- glXMakeCurrent (sdl_display, sdl_win, sdl_gl_context);
-#endif
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
- g_timeout_add (100, update_sdl_scene, pipeline);
-
- g_main_loop_run (loop);
-
- /* before to deinitialize the gst-gl-opengl context,
- * no shared context (here the sdl one) must be current
- */
-#ifdef WIN32
- wglMakeCurrent (0, 0);
-#else
- glXMakeCurrent (sdl_display, sdl_win, sdl_gl_context);
-#endif
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- /* turn on back sdl opengl context */
-#ifdef WIN32
- wglMakeCurrent (sdl_dc, sdl_gl_context);
-#else
- glXMakeCurrent (sdl_display, None, 0);
-#endif
-
- SDL_Quit ();
-
- return 0;
-}
diff --git a/tests/examples/meson.build b/tests/examples/meson.build
index 838624807..6c3c4682e 100644
--- a/tests/examples/meson.build
+++ b/tests/examples/meson.build
@@ -5,7 +5,6 @@
#subdir('codecparsers')
subdir('compositor')
#subdir('directfb')
-subdir('gl')
#subdir('gtk')
#subdir('ipcpipeline')
subdir('mpegts')