qt: Get EGL native display from QPA if platform header is available

https://bugzilla.gnome.org/show_bug.cgi?id=792378
This commit is contained in:
Carlos Rafael Giani 2018-03-04 15:14:08 +01:00 committed by Sebastian Dröge
parent 738eb0d8ed
commit 56a1eb65e2
2 changed files with 11 additions and 0 deletions

View file

@ -892,6 +892,7 @@ AG_GST_CHECK_FEATURE(QT, [Qt elements], qt, [
AS_IF([test -f "$PKG_CONFIG_SYSROOT_DIR/$QPA_INCLUDE_PATH/qpa/qplatformnativeinterface.h"], [
QT_CFLAGS="$QT_CFLAGS -I$PKG_CONFIG_SYSROOT_DIR/$QPA_INCLUDE_PATH"
HAVE_QT_QPA_HEADER="yes"
AC_DEFINE([HAVE_QT_QPA_HEADER], [], [Define if the Qt QPA header is installed])
], [AC_MSG_NOTICE([Cannot find QPA])])
if test "x$GST_GL_HAVE_WINDOW_X11" = "x1" -a "x$GST_GL_HAVE_PLATFORM_GLX" = "x1" || test "x$GST_GL_HAVE_WINDOW_X11" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EGL" = "x1"; then
PKG_CHECK_MODULES(QT_X11, Qt5X11Extras, [

View file

@ -42,6 +42,9 @@
#else
#include <gst/gl/egl/gstegl.h>
#include <gst/gl/egl/gstgldisplay_egl.h>
#ifdef HAVE_QT_QPA_HEADER
#include <qpa/qplatformnativeinterface.h>
#endif
#endif
#endif
@ -110,6 +113,13 @@ gst_qt_get_gl_display ()
}
display = (GstGLDisplay *) gst_gl_display_viv_fb_new (disp_idx);
#elif defined(HAVE_QT_QPA_HEADER)
QPlatformNativeInterface *native =
QGuiApplication::platformNativeInterface();
EGLDisplay egl_display = (EGLDisplay)
native->nativeResourceForWindow("egldisplay", NULL);
if (egl_display != EGL_NO_DISPLAY)
display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (egl_display);
#else
EGLDisplay egl_display = (EGLDisplay) gst_gl_display_egl_get_from_native (GST_GL_DISPLAY_TYPE_ANY, 0);
display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (egl_display);