Commit graph

141 commits

Author SHA1 Message Date
Nirbheek Chauhan
e9b5e78c9e meson: Add macOS definitions for qmlgl plugin
Tested with Cerbero.
2019-01-29 12:19:37 +05:30
Nirbheek Chauhan
8f9ca07756 meson: Fix building of qmlgl plugin on Android
Needs gnustl for C++ STL support, which is the GNU STL on Android API
19 and older, and is a wrapper for the llvm-libc++ STL on newer APIs.

QtGui C++ templates use GL functions, so GLESv2 is needed at link time
2019-01-29 12:19:37 +05:30
George Kiagiadakis
0a1d048ee3 qmlgl: add README.md with information on building for non-linux platforms with qmake 2019-01-21 11:55:50 +02:00
George Kiagiadakis
f09807fc3d qmlgl: meson: fix theoretical support for building for android
The android code path is slightly different than the EGLFS one,
so I added previously a HAVE_QT_ANDROID define for use with qmake.
Here I also add it in meson, although I expect nobody will ever use
meson to build this, as it's complicated.
2019-01-21 11:55:50 +02:00
George Kiagiadakis
eab642b1c3 qmlgl: qmake: add support for MacOS target 2019-01-21 11:55:50 +02:00
George Kiagiadakis
66d0c41161 qmlgl: qmake: remove cerbero's include dir from the include path
pkg-config should do it's job here, this is unnecessary and implies using cerbero
2019-01-21 11:55:50 +02:00
George Kiagiadakis
e279903857 qmlgl: qualify Qt includes with their module and remove module include dir from the .pro file
it is perfectly legal to use the <module/class> style of includes with Qt
and it avoids the need for having the module's include dir in the include path
2019-01-21 11:55:50 +02:00
George Kiagiadakis
584c5afbe5 qmlgl: qmake: don't link against QtWidgets, it's not used 2019-01-21 11:55:50 +02:00
George Kiagiadakis
d75284cd83 qmlgl: qmake: fix building for android 2019-01-21 11:55:50 +02:00
Nirbheek Chauhan
00f14f34b5 meson: Generate pkg-config file for qmlgl plugin 2019-01-18 21:11:25 +00:00
Nirbheek Chauhan
9ece93dbd8 meson: Search for qmake-qt5 before qmake
The canonical name for the binary is qmake-qt5, and qmake is the
generic name that can also be a qt4 qmake.
2019-01-18 14:41:14 +05:30
Edward Hervey
3d708a5bfa qtgl: Handle OPENGL header guard changes
In 2018 khronos changed the gl header guards. If we don't detect
this properly we would end up with plenty of symbol redifinition
(since we would be importing twice the "same" header).

Instead detect if the "newer" header was already included and if
so define the "old" define to avoid this situation

Fixes #523
2018-12-17 10:51:50 +01:00
Matthew Waters
319171b162 qt: Ensure GL headers are included
Otherwise there may be no valid typedef of GLsync.

...
/usr/include/gstreamer-1.0/gst/gl/gstglfuncs.h:93:24: note: in definition of macro 'GST_GL_EXT_FUNCTION'
   ret (GSTGLAPI *name) args;
                        ^~~~
/usr/include/gstreamer-1.0/gst/gl/glprototypes/sync.h:33:23: error: 'GLsync' has not been declared
                      (GLsync sync))
                       ^~~~~~
...

https://bugzilla.gnome.org/show_bug.cgi?id=796879
2018-08-01 12:11:04 +10:00
Nirbheek Chauhan
8f807477eb meson: Add feature options for all plugins
Checks for GL, Qt5, and C++ are still automagic. FIXMEs have been
added for these so they can be fixed later.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 18:42:54 +05:30
Iñigo Huguet
b03df1abf8 qmlgl: Fix conflicting declaration of type GLsync for non-android
https://bugzilla.gnome.org/show_bug.cgi?id=796821
2018-07-18 13:57:23 +10:00
Matthew Waters
ee046864d8 qt: also check for un-suffixed moc
e.g. Qt windows installer doesn't have suffixes
2018-06-07 14:28:37 +10:00
Matthew Waters
ca67a460ee meson: add build files for the qml plugin
Tested on linux with X11/wayland and semi-tested on Windows.

Windows crashes on item destruction however this is better than nothing.

Fix up some win32 build issues on the way with mismatched {} and
G_STMT_{START,END}
2018-04-15 23:49:57 +10:00
Carlos Rafael Giani
56a1eb65e2 qt: Get EGL native display from QPA if platform header is available
https://bugzilla.gnome.org/show_bug.cgi?id=792378
2018-03-22 09:58:52 +02:00
Matthew Waters
ff7d14a384 qt: don't use libEGL functions when we don't link to libEGL
Use the provided wrapper available from libgstgl.

https://bugzilla.gnome.org/show_bug.cgi?id=793547
2018-02-21 11:35:33 +11:00
Matthew Waters
93cf3ef912 qt: don't #include platform specific gstglcontext_*.h headers
They aren't public headers
2018-02-07 20:15:35 +11:00
Tim-Philipp Müller
fab34b7d0e gl: update plugins to use GstGL from -base 2017-12-19 12:02:31 +00:00
Matthew Waters
92c89e2a31 gl/caopengllayer: use public GstGLContext instead of Cocoa-specific one
Allows keeping the GstGLCAOpenGLLayer public but not the winsys-specific
context/display/window.
2017-11-27 15:20:28 +11:00
Jan Schmidt
4359684dd2 Revert "gl: Use GstGLDisplayEGL directly instead of creating a GstGLDisplayVIVFb subclass"
This reverts commit 47fd4d391e.

This patch is incorrect. It doesn't actually compile, and causes a crash
because the viv-fb window implementation needs a native EGL handle
to pass to fbCreateWindow, but the GstGLDisplayEGL handleis actually
an EGLDisplay now (and gets cast to the wrong type)
2017-11-24 01:48:27 +11:00
Tim-Philipp Müller
e16ad13ed6 qt: update qmake .pro file
Update for renaming of plugin file, and add some
missing source files.
2017-10-13 12:25:22 +01:00
Cassandra Rommel
43827a05f9 gl: Use GstGLDisplayEGL directly instead of creating a GstGLDisplayVIVFb subclass
This simplifies the code a lot without any functional changes apart from
not closing the display connection. Closing the display connection is
not safe to do as it is shared between all other code in the same
process and no reference counting or anything happens at the platform
layer.
2017-10-03 10:14:51 +02:00
Jochen Henneberg
a0d526a2a8 qmlglsink: Expose itemInitialized as property
Instead of just signalling when ready exposing the state
as a property allows us to bind at any time if player is
loaded async.
2017-09-14 15:12:12 +10:00
Tim-Philipp Müller
be7ebefd27 qt: fix build with qmake
Move the package defines for GST_PLUGIN_DEFINE from the
command line into the source file to avoid quoting issues
(-DPACKAGE_NAME="foo" means the quotes won't actually make
it to the compiler and then it no longer gets a string constant).
2017-09-07 09:39:13 +01:00
Nicolas Dufresne
346474c25d Request minimum buffer even if need_pool is FALSE
When tee is used, it will not request a pool, but still it wants to
know how many buffers are required.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-09-06 14:19:37 -04:00
Edward Hervey
115fb15a40 qt: Only include qtgui-config.h on qt >= 5.9.0
The file does not exist in previous versions
2017-09-01 15:57:25 +02:00
Matthew Waters
20d51d876f qt: the defines for QT_OPENGL_ES_2 have moved
Update the includes to account for that
2017-08-31 14:40:44 +10:00
Jochen Henneberg
0e47176b40 qt: ensure GL_DRAW_FRAMEBUFFER 2017-08-31 12:41:52 +10:00
Julien Isorce
96a2092b45 qt: fix broken build due to commit 2fd84a6c for gstgl
https://bugzilla.gnome.org/show_bug.cgi?id=784779
2017-08-22 13:44:20 +01:00
Carlos Rafael Giani
d9a294ac9f qmlglsink: Add itemInitialized signal to QML item
This is useful for autoplay for example. With autoplay, it is necessary to
wait until the scene graph is fully set up. This signal is emitted once the
QML item node is ready. So, inside a connected slot, the pipeline's state
can be set to PLAYING to automatically start playback as soon as the QML
script is loaded.

https://bugzilla.gnome.org/show_bug.cgi?id=786246
2017-08-14 14:51:43 +03:00
Jan Schmidt
ac068bd2b9 qt: Use a proxy object for access to the QML widget
QML can destroy the video widget at any time, leaving
us with a dangling pointer. Use a lock and a proxy
object to cope with that, and block in the widget
destructor if there are ongoing calls into the widget.
2017-07-12 15:51:11 +10:00
Jan Schmidt
c4eabb1a87 qt: Remove misleading reference to GTK in qtitem.cc 2017-06-22 01:01:40 +10:00
Haihua Hu
cbcd0a12b6 glframebuffer: check frame buffer status need use specific fbo target
https://bugzilla.gnome.org/show_bug.cgi?id=783065
2017-05-25 12:34:04 +03:00
Carlos Rafael Giani
fdb2784491 qmlglsink: Add dummy texture that is shown as placeholder for NULL buffers
https://bugzilla.gnome.org/show_bug.cgi?id=782917
2017-05-21 16:52:23 +02:00
Simon Himmelbauer
b33563294f qt: Use GST_GL_HAVE_PLATFORM_CGL instead of GST_GL_HAVE_PLATFORM_COCOA
The latter is not used/available anymore since years. Also fix a typo
in the include path for the Cocoa GL display header.
2017-05-18 15:24:13 +03:00
Haihua Hu
5178fcdfda qml: Add EGL platform support for x11 backend
Add support for EGL platform when x11 is available. This can work
e.g. on imx6 platform.

https://bugzilla.gnome.org/show_bug.cgi?id=782718
2017-05-17 10:33:48 +03:00
Nicolas Dufresne
e44d936487 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Nicolas Dufresne
6ebafb7daf qmlgl: Make the plugin name match the pugin file name 2017-05-09 09:47:10 -04:00
Matthew Waters
f647a79aa8 gl/format: use our own GL format enum's instead of gstvideo's
They can describe in more detail (such as component sizes) the requested format.
2017-03-13 21:10:58 +11:00
Sebastian Dröge
219f485c2c qml: Add support for Vivante EGL FS windowing system
https://bugzilla.gnome.org/show_bug.cgi?id=778825
2017-02-27 10:42:05 +02:00
Sebastian Dröge
d3f6497f50 qt: The code requires at least C++11
... and clang requires this to be specified on the commandline while gcc
nowadays defaults to C++11 or even newer.
2017-01-25 19:21:03 +02:00
Matthew Waters
cd9db288b2 gl/utils: also take care of the local GL context in query functions
Simplifies a deduplicates a lot of code in elements retrieving/setting
the local OpenGL context.
2017-01-13 11:20:51 +11:00
Haihua Hu
f54fcb0349 qmlglsrc: use glBlitFramebuffer to copy texture for GLES3.0
If support glBlitFrameBuffer, use it for texture copy instead
of glCopyTexImage2D

https://bugzilla.gnome.org/show_bug.cgi?id=777078
2017-01-10 21:34:30 +11:00
Tim-Philipp Müller
01a462a4c9 qt: improve element and property descriptions a bit 2016-12-17 13:42:34 +00:00
Sergey Borovkov
d1f4c207a8 qml: Fix egl being deinitialized on display cleanup
Use the with_egl_display() variant in order to not destroy the
EGLDisplay on destruction.

https://bugzilla.gnome.org/show_bug.cgi?id=775793
2016-12-09 21:44:05 +11:00
Matthew Waters
01b6c38ec9 qml/item: also unref the display on destruction
Leaking objects (and a thread!) is never a good idea.

https://bugzilla.gnome.org/show_bug.cgi?id=775746
2016-12-07 23:02:02 +11:00
Haihua Hu
4450152a9e qmlglsrc: some enhancements for qmlglsrc
1. Need set use-default-fbo to qquickwindow during set property
   to support change render target on the fly.
2. Calculate qmlglsrc refresh frame rate in qtglwindow

https://bugzilla.gnome.org/show_bug.cgi?id=774035
2016-11-08 02:05:20 +11:00
Matthew Waters
389e386d50 gl: GST_GL_TYPE -> GST_TYPE_GL
Some deprecated symbols are kept for backwards compatibility
2016-11-03 16:16:12 +11:00
Sergey Borovkov
642e12ed9f qt: Fix failing build on RPI
https://bugzilla.gnome.org/show_bug.cgi?id=773026
2016-10-18 11:25:03 +11:00
Haihua Hu
ac06d0d829 qmlglsink: check qt_context_ first in GstQSGTexture::bind()
When start qmlglsink app, it will set NULL buffer to GstQSGTexture
in which case that qt_context_ will be a random value and cause
gst_gl_context_activate() fail.

https://bugzilla.gnome.org/show_bug.cgi?id=770925
2016-09-07 00:15:02 +10:00
Jan Schmidt
a50b7c24da qt: Use wglShareLists() workaround unconditionally.
Sometimes wglCreateContextAttribsARB() exists, but
isn't functional (some Intel drivers), so it's
easiest to do the workaround unconditionally.
2016-08-16 00:53:38 +10:00
Jan Schmidt
f52491d978 qt: Move debug statement to after the category init
Don't output debug to an uninitialised debug category.
2016-08-16 00:43:39 +10:00
Haihua Hu
669600617c qt: implement qmlglsrc for qml view grab
[Matthew Waters]: gst-indent sources

https://bugzilla.gnome.org/show_bug.cgi?id=768160
2016-08-03 22:11:11 +10:00
Tim-Philipp Müller
474ece7683 qt: fix build some more when QPA is not available
Compiler would complain about include directory that didn't
exist because QPA_INCLUDE_PATH gets subst-ed regardless
(and if it didn't we'd have just an empty -I argument).

https://bugzilla.gnome.org/show_bug.cgi?id=767553
2016-07-01 19:29:49 +01:00
Haihua Hu
04fd6dc6c4 qmlglsink: Fix build error when don't have QPA installed.
Check header file existance and wrap the header file include
in the necessary #ifdef to avoid build error.

https://bugzilla.gnome.org/show_bug.cgi?id=767553
2016-06-27 22:44:56 +10:00
Matthew Waters
3be4b85a43 qmlglsink: add win32 support
The current state of c++ ABI's on Window's and Gst's/Qt's conflicting
mingw builds means that we cannot use mingw for building the qt plugin.

Instead, a qmake .pro file is provided that is expected to be used with the
msvc binaries provided by Qt like so:

(with the PATH environment variable containing the path to the qt biniaries
and PKG_CONFIG_PATH containing the path to GStreamer modules)
cd /path/to/sources/gst-plugins-bad/ext/qt
qmake -tp vc

Then open the resulting VS project and build the library.  Then

cp debug/libgstqtsink.dll /path/to/prefix/lib/gstreamer-1.0/libgstqtsink.cll

https://bugzilla.gnome.org/show_bug.cgi?id=761260
2016-06-22 14:26:05 +10:00
Sergey Borovkov
c9dd45393e qml: Enable qmlglsink for eglfs
https://bugzilla.gnome.org/show_bug.cgi?id=763044
2016-06-16 01:49:16 +10:00
Matthew Waters
486d3c3b59 qmlglsink: propagate GL context creation failure upwards
Otherwise an application cannot know if the qmlglsink will be displaying frames
incorrectly/at all.
2016-06-16 01:49:16 +10:00
Matthew Waters
f17e58f888 qmlglsink: also allow wayland-egl as a platform name 2016-06-16 01:49:16 +10:00
Haihua Hu
a07a9b0bc3 qmlglsink: Add Wayland support
Don't use gstgldisplay to get wayland display. Should use QPA on wayland
to get wayland display for QT.

https://bugzilla.gnome.org/show_bug.cgi?id=767553
2016-06-16 01:49:16 +10:00
Vineeth TM
acb1b44ee0 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2016-03-24 14:56:51 +02:00
Sergey Borovkov
c2f17d4834 qml: Fix leak of the OpenGL contexts
[Matthew Waters]: add NULL checks before unreffing

https://bugzilla.gnome.org/show_bug.cgi?id=762999
2016-03-03 13:13:26 +11:00
Matthew Waters
6c6a9cf509 qt: use a static_cast instead of dynamic one
The dynamic_cast is a little but of overkill as the app will still crash if it
fails in the later g_assert.

Allows compilation with -fno-rtti

https://bugzilla.gnome.org/show_bug.cgi?id=762526
2016-02-24 21:20:18 +11:00
Sergey Borovkov
472b396528 qmlglsink: Schedule onSceneGrpahInitialized to execute on render thread
onSceneGraphInitialized() is called from non render thread currently when
scene graph is already initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=761003
2016-02-22 20:26:41 +11:00
Matthew Waters
0d851a66af qt: specify that we currently only take 2D textures
Fixes black screen video playback on android without a caps filter.
2016-01-27 16:13:28 +11:00
Sergey Borovkov
1d41990b26 qml: Mark material dirty when texture buffer is updated
Qt might not redraw the scene otherwise.

https://bugzilla.gnome.org/show_bug.cgi?id=758286
2016-01-15 14:11:52 +11:00
Nicolas Dufresne
0e6a8838dc qtsink: Add configured GL cflags to the build
We don't directly link to GL in the element, though we use GL headers.
For this reason we need to include the proper GL headers path. This
prevent this element from using a different GL header then libgstgl.
2015-12-15 19:28:22 -05:00
Matthew Waters
28d088fa2d glmemory: base classify and add the pbo memory on top
The base class is useful for having multiple backing memory types other
than the default.  e.g. IOSurface, EGLImage, dmabuf?

The PBO transfer logic is now inside GstGLMemoryPBO which uses GstGLBuffer
to manage the PBO memory.

This also moves the format utility functions into their own file.
2015-12-14 16:35:32 +11:00
Roman Nowicki
1dc889c6d0 qml: reuse existing GstQSGTexture
Fixes a memory leak leaking the texture objects.

https://bugzilla.gnome.org/show_bug.cgi?id=758286
2015-11-20 11:18:43 +11:00
Matthew Waters
aca25b521f qml: activate the wrapped context when binding
Mitigates the following critical

gst_gl_context_thread_add: assertion 'context->priv->active_thread == g_thread_self ()' failed
2015-11-20 11:09:45 +11:00
Roman Nowicki
21ca4ac9d3 qml: proper initialization if scene is already initialized
The scene graph can be initialized when the we receive window handle change
notification and so we will not receive a scenegraph initialization
notification.  Initialize ourself in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=758337
2015-11-20 09:41:56 +11:00
Matthew Waters
b2718cbd81 gl: be consistent in gobject boilerpate
GST_GL_IS_* vs GST_IS_GL_*

git grep -l 'GST_GL_IS_' | xargs sed -i 's/GST_GL_IS_/GST_IS_GL_/g'
2015-10-19 15:15:30 +11:00
Matthew Waters
c6d03bc7d4 qt: add support for building on osx/ios
Including:
- Necessary configure checks
- Necessary compile time platform checks
- Necessary runtime qt iOS/OSX platform detection

https://bugzilla.gnome.org/show_bug.cgi?id=755100
2015-10-02 22:29:45 +10:00
Luis de Bethencourt
c95bb94fc2 qtsink: explicitely fallthrough switch statement
In case ret is False, fallthrough to default case.

CID #1320705
2015-09-29 13:37:08 +01:00
Luis de Bethencourt
704f97defd qml: remove overwritten value
Value in tex is overwritten before being used. Removing it.

CID 1320715

https://bugzilla.gnome.org/show_bug.cgi?id=754253
2015-09-28 18:17:22 +10:00
Matthew Waters
d47398de3b qt: add support for building/running on android
Including:
- Necessary configure checks
- Necessary compile time platform checks
- Necessary runtime qt android platform detection
- Escaping GLsync definition with Qt's GLES2 implementation

https://bugzilla.gnome.org/show_bug.cgi?id=754466
2015-09-28 16:47:00 +10:00
Matthew Waters
5f8a587ddc qt: don't use CPPFLAGS for tools that cannot use them
For example moc will bail out when given arguments it does not
know about.  The moc specific MOC_CPPFLAGS can still be used
to pass flags to moc.

https://bugzilla.gnome.org/show_bug.cgi?id=754466
2015-09-28 16:47:00 +10:00
Matthew Waters
e29df60665 qt: rename library to include gst prefix
libqtsink -> libgstqtsink

https://bugzilla.gnome.org/show_bug.cgi?id=754466
2015-09-28 16:47:00 +10:00
Matthew Waters
f1cb602476 gtk, qt: more specifically define the compile time requirements
Otherwise we could include headers/configurations that will
never been installed.

https://bugzilla.gnome.org/show_bug.cgi?id=754732
2015-09-10 13:11:06 +10:00
Matthew Waters
579b734346 qt: use our function table instead of directly calling gl functions
Otherwise when building with --as-needed we would need to link to
a GL or GLES library.

https://bugzilla.gnome.org/show_bug.cgi?id=754732
2015-09-10 00:33:40 +10:00
Nirbheek Chauhan
e99c591dc9 qmlsink: Ensure that at least one windowing system is available
Otherwise, we'll just crash at runtime because the gl context is NULL

https://bugzilla.gnome.org/show_bug.cgi?id=754108
2015-08-31 23:16:07 +01:00
Tim-Philipp Müller
9846984c63 gtk, qt, gl: fix typo in debug and error messages 2015-08-31 18:06:31 +01:00
Matthew Waters
b8bb4cc50f qml: implement the required multiple GL context synchonisation
From GStreamer's GL context into the QML context
2015-08-08 17:30:42 +02:00
Edward Hervey
523edaf6bd qt: Don't dist files that might not exist
We only require moc building at build time.
2015-07-22 15:14:28 +02:00
Edward Hervey
2df392541e qt: Tidy up makefile a bit more
Separate generated files, from disted files
2015-07-22 08:06:19 +02:00
Matthew Waters
e56df237ee glcontext: fix get_current_gl_api on x11/nvidia drivers
They require to get_proc_address some functions through the
platform specific {glX,egl}GetProcAddress rather than the default
GL library symbol lookup.
2015-07-18 18:18:22 +10:00
Edward Hervey
d1ad64fca7 configure/qt: Fix build without Qt5X11Extras 2015-07-10 14:01:59 +02:00
Matthew Waters
b1bbdceeb2 new qt5 qml GL video sink
Very much in the same spirit as the Gtk GL sink

Two things are provided
1. A QQuickItem subclass that renders out RGBA filled GstGLMemory
   buffers that is instantiated from qml.
2. A sink element that will push buffers into (1)

To use
1. Declare the GstGLVideoItem in qml with an appropriate
   objectName property set.
2. Get the aforementioned GstGLVideoItem from qml using something like

QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

QObject *rootObject = engine.rootObjects().first();
QQuickItem *videoItem = rootObject->findChild<QQuickItem *> ("videoItem");

3. Set the videoItem on the sink

https://bugzilla.gnome.org/show_bug.cgi?id=752185
2015-07-10 15:25:26 +10:00