|
@@ -1,5 +1,9 @@
|
|
|
+#include <QtGlobal>
|
|
|
#include <QSurfaceFormat>
|
|
|
|
|
|
+#include <mpv/client.h>
|
|
|
+#include <mpv/qthelper.hpp>
|
|
|
+
|
|
|
#include "OpenGLDetect.h"
|
|
|
|
|
|
#if defined(Q_OS_MAC)
|
|
@@ -17,6 +21,38 @@ void detectOpenGL()
|
|
|
QSurfaceFormat::setDefaultFormat(format);
|
|
|
}
|
|
|
|
|
|
+#elif defined(Q_OS_LINUX)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+static QString probeHwdecInterop()
|
|
|
+{
|
|
|
+ auto mpv = mpv::qt::Handle::FromRawHandle(mpv_create());
|
|
|
+ if (!mpv)
|
|
|
+ return "";
|
|
|
+ mpv::qt::set_option_variant(mpv, "hwdec-preload", "auto");
|
|
|
+
|
|
|
+
|
|
|
+ mpv::qt::set_option_variant(mpv, "force-window", true);
|
|
|
+
|
|
|
+
|
|
|
+ mpv::qt::set_option_variant(mpv, "geometry", "1x1+0+0");
|
|
|
+ mpv::qt::set_option_variant(mpv, "border", false);
|
|
|
+ if (mpv_initialize(mpv) < 0)
|
|
|
+ return "";
|
|
|
+ return mpv::qt::get_property_variant(mpv, "hwdec-interop").toString();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+void detectOpenGL()
|
|
|
+{
|
|
|
+
|
|
|
+ if (probeHwdecInterop() == "vaapi-egl")
|
|
|
+ qputenv("QT_XCB_GL_INTEGRATION", "xcb_egl");
|
|
|
+}
|
|
|
+
|
|
|
#else
|
|
|
|
|
|
|