Commit ea53d9fe authored by Carlos Rafael Giani's avatar Carlos Rafael Giani Committed by Tim-Philipp Müller

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

https://bugzilla.gnome.org/show_bug.cgi?id=792378
parent 6ab0442f
......@@ -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, [
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment