diff options
author | Lukas Grimm | 2020-11-28 20:46:27 +0100 |
---|---|---|
committer | Lukas Grimm | 2020-11-28 20:46:27 +0100 |
commit | 179c86775dbd11c11289929380a4c8c40be46d44 (patch) | |
tree | f704a5d9c7f8cc7f85828387a18ec21424da6f59 | |
parent | 29fef8623fecca797c52c8d7d8cdba4fe8509ab3 (diff) | |
download | aur-179c86775dbd11c11289929380a4c8c40be46d44.tar.gz |
implementet mpv patch
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 7 | ||||
-rw-r--r-- | mpv.patch | 164 |
3 files changed, 172 insertions, 3 deletions
@@ -1,7 +1,7 @@ pkgbase = plex-media-player pkgdesc = Next generation Plex Desktop Client pkgver = 2.58.0 - pkgrel = 3 + pkgrel = 4 url = https://github.com/plexinc/plex-media-player arch = i686 arch = x86_64 @@ -27,6 +27,7 @@ pkgbase = plex-media-player source = web-client-tv-183-045db5be50e175-4.29.6-045db5b.tar.xz.sha1::https://artifacts.plex.tv/web-client-pmp/183-045db5be50e175/web-client-tv-4.29.6-045db5b.tar.xz.sha1 source = qt.patch source = plex.patch + source = mpv.patch sha512sums = 702826ed5dc5ad4f1a9a877834dce0734eeb5b0f3eb007a6e6dff2fc1b7fc1ebbd1ad7a42be6ebec392e5313abb2867121b3dfcf00acc008dbae628564594866 sha512sums = 6c3fa0d2fa26da3c8ed47de5385f0f2fb1af0409f4a58aef5bc2c2cf75741dcbddd4b496ca5b9a55c4ce35e09ed076d411c3e9c330de1d99761aa0ebc3fae6bc sha512sums = 0c09ebf57cd39e8e4dae449e3882725686214e0bed07e3dac25eae579ebdc3a136e51bb2272aaca6a5b8e317b1ccbe94231eb214ddf11cbfb14307a0e7f3e3e0 @@ -35,6 +36,7 @@ pkgbase = plex-media-player sha512sums = 442c2e5a31eed30167009bdaf263c66bea482d4ad03e168c9d9eb5e9f4e40f771dee9bc6913d6be46f7d86feb961603f172bb6497fac28c4f5d36a1f05d0ec66 sha512sums = SKIP sha512sums = SKIP + sha512sums = SKIP pkgname = plex-media-player @@ -12,7 +12,7 @@ _fullname="$pkgname-$_fullver" _web_buildid=183-045db5be50e175 _web_desktop_ver=4.29.2-e50e175 _web_tv_ver=4.29.6-045db5b -pkgrel=3 +pkgrel=4 pkgdesc='Next generation Plex Desktop Client' arch=('i686' 'x86_64' 'armv7h' 'aarch64') license=('GPL') @@ -26,7 +26,8 @@ source=("$_fullname.tar.gz::https://github.com/plexinc/plex-media-player/archive "web-client-tv-${_web_buildid}-${_web_tv_ver}.tar.xz::https://artifacts.plex.tv/web-client-pmp/${_web_buildid}/web-client-tv-${_web_tv_ver}.tar.xz" "web-client-tv-${_web_buildid}-${_web_tv_ver}.tar.xz.sha1::https://artifacts.plex.tv/web-client-pmp/${_web_buildid}/web-client-tv-${_web_tv_ver}.tar.xz.sha1" 'qt.patch' - 'plex.patch') + 'plex.patch' + 'mpv.patch') noextract=("web-client-desktop-${_web_buildid}-${_web_desktop_ver}.tar.xz" "web-client-tv-${_web_buildid}-${_web_tv_ver}.tar.xz") sha512sums=('702826ed5dc5ad4f1a9a877834dce0734eeb5b0f3eb007a6e6dff2fc1b7fc1ebbd1ad7a42be6ebec392e5313abb2867121b3dfcf00acc008dbae628564594866' @@ -36,6 +37,7 @@ sha512sums=('702826ed5dc5ad4f1a9a877834dce0734eeb5b0f3eb007a6e6dff2fc1b7fc1ebbd1 'd60cc01f6b9abf579b3fa2e5b5c9b19e71a986578b0ca46173572324fb54573c97f09ac0ef1654a0b04d68eee20ab3d81ab19a85a761ba638b2b543548ff94ac' '442c2e5a31eed30167009bdaf263c66bea482d4ad03e168c9d9eb5e9f4e40f771dee9bc6913d6be46f7d86feb961603f172bb6497fac28c4f5d36a1f05d0ec66' 'SKIP' + 'SKIP' 'SKIP') prepare() { @@ -43,6 +45,7 @@ prepare() { patch --forward --strip=1 --input="${srcdir}/qt.patch" patch --forward --strip=1 --input="${srcdir}/plex.patch" + patch --forward --strip=1 --input="${srcdir}/mpv.patch" # All this git version junk fails, just remove it we already have the version sed -i 's|include(GetGitRevisionDescription)|| diff --git a/mpv.patch b/mpv.patch new file mode 100644 index 000000000000..946242374401 --- /dev/null +++ b/mpv.patch @@ -0,0 +1,164 @@ +--- a/src/player/PlayerComponent.cpp ++++ b/src/player/PlayerComponent.cpp +@@ -259,7 +259,7 @@ void PlayerComponent::setQtQuickWindow(QQuickWindow* window) + /////////////////////////////////////////////////////////////////////////////////////////////////// + void PlayerComponent::setWindow(QQuickWindow* window) + { +- QString vo = "opengl-cb"; ++ QString vo = "libmpv"; + + #ifdef TARGET_RPI + window->setFlags(Qt::FramelessWindowHint); +@@ -276,7 +276,7 @@ void PlayerComponent::setWindow(QQuickWindow* window) + + mpv::qt::set_property(m_mpv, "vo", vo); + +- if (vo == "opengl-cb") ++ if (vo == "libmpv") + setQtQuickWindow(window); + } + +diff --git a/src/player/PlayerQuickItem.cpp b/src/player/PlayerQuickItem.cpp +index 6f5a46bb..1a7aa6c4 100644 +--- a/src/player/PlayerQuickItem.cpp ++++ b/src/player/PlayerQuickItem.cpp +@@ -11,6 +11,8 @@ + #include <QtQuick/QQuickWindow> + #include <QOpenGLFunctions> + ++#include <mpv/render_gl.h> ++ + #include "QsLog.h" + #include "utils/Utils.h" + +@@ -93,7 +95,6 @@ class RequestRepaintJob : public QRunnable + PlayerRenderer::PlayerRenderer(mpv::qt::Handle mpv, QQuickWindow* window) + : m_mpv(mpv), m_mpvGL(nullptr), m_window(window), m_size(), m_hAvrtHandle(nullptr), m_videoRectangle(-1, -1, -1, -1), m_fbo(0) + { +- m_mpvGL = (mpv_opengl_cb_context *)mpv_get_sub_api(m_mpv, MPV_SUB_API_OPENGL_CB); + } + + /////////////////////////////////////////////////////////////////////////////////////////////////// +@@ -104,11 +105,27 @@ bool PlayerRenderer::init() + DwmEnableMMCSS(TRUE); + #endif + +- mpv_opengl_cb_set_update_callback(m_mpvGL, on_update, (void *)this); + + // Signals presence of MPGetNativeDisplay(). + const char *extensions = "GL_MP_MPGetNativeDisplay"; +- return mpv_opengl_cb_init_gl(m_mpvGL, extensions, get_proc_address, nullptr) >= 0; ++ ++ mpv_opengl_init_params opengl_params = { ++ .get_proc_address = get_proc_address, ++ .get_proc_address_ctx = NULL, ++ .extra_exts = extensions, ++ }; ++ mpv_render_param params[] = { ++ {MPV_RENDER_PARAM_API_TYPE, (void*)MPV_RENDER_API_TYPE_OPENGL}, ++ {MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &opengl_params}, ++ {MPV_RENDER_PARAM_INVALID}, ++ }; ++ int err = mpv_render_context_create(&m_mpvGL, m_mpv, params); ++ ++ if (err >= 0) { ++ mpv_render_context_set_update_callback(m_mpvGL, on_update, (void *)this); ++ return true; ++ } ++ return false; + } + + /////////////////////////////////////////////////////////////////////////////////////////////////// +@@ -116,7 +133,8 @@ PlayerRenderer::~PlayerRenderer() + { + // Keep in mind that the m_mpv handle must be held until this is done. + if (m_mpvGL) +- mpv_opengl_cb_uninit_gl(m_mpvGL); ++ mpv_render_context_free(m_mpvGL); ++ m_mpvGL = nullptr; + delete m_fbo; + } + +@@ -158,9 +176,18 @@ void PlayerRenderer::render() + } + } + +- // The negative height signals to mpv that the video should be flipped +- // (according to the flipped OpenGL coordinate system). +- mpv_opengl_cb_draw(m_mpvGL, fbo, fboSize.width(), (flip ? -1 : 1) * fboSize.height()); ++ mpv_opengl_fbo mpv_fbo = { ++ .fbo = fbo, ++ .w = fboSize.width(), ++ .h = fboSize.height(), ++ }; ++ int mpv_flip = flip ? -1 : 0; ++ mpv_render_param params[] = { ++ {MPV_RENDER_PARAM_OPENGL_FBO, &mpv_fbo}, ++ {MPV_RENDER_PARAM_FLIP_Y, &mpv_flip}, ++ {MPV_RENDER_PARAM_INVALID} ++ }; ++ mpv_render_context_render(m_mpvGL, params); + + m_window->resetOpenGLState(); + +@@ -177,7 +204,8 @@ void PlayerRenderer::render() + /////////////////////////////////////////////////////////////////////////////////////////////////// + void PlayerRenderer::swap() + { +- mpv_opengl_cb_report_flip(m_mpvGL, 0); ++ if (m_mpvGL) ++ mpv_render_context_report_swap(m_mpvGL); + } + + /////////////////////////////////////////////////////////////////////////////////////////////////// +@@ -224,7 +252,7 @@ PlayerQuickItem::PlayerQuickItem(QQuickItem* parent) + PlayerQuickItem::~PlayerQuickItem() + { + if (m_mpvGL) +- mpv_opengl_cb_set_update_callback(m_mpvGL, nullptr, nullptr); ++ mpv_render_context_set_update_callback(m_mpvGL, nullptr, nullptr); + } + + /////////////////////////////////////////////////////////////////////////////////////////////////// +@@ -298,10 +326,6 @@ void PlayerQuickItem::initMpv(PlayerComponent* player) + { + m_mpv = player->getMpvHandle(); + +- m_mpvGL = (mpv_opengl_cb_context *)mpv_get_sub_api(m_mpv, MPV_SUB_API_OPENGL_CB); +- if (!m_mpvGL) +- throw FatalException(tr("OpenGL not enabled in libmpv.")); +- + connect(player, &PlayerComponent::windowVisible, this, &QQuickItem::setVisible); + window()->update(); + } +diff --git a/src/player/PlayerQuickItem.h b/src/player/PlayerQuickItem.h +index b706b892..644a62e0 100644 +--- a/src/player/PlayerQuickItem.h ++++ b/src/player/PlayerQuickItem.h +@@ -6,7 +6,7 @@ + #include <QOpenGLFramebufferObject> + + #include <mpv/client.h> +-#include <mpv/opengl_cb.h> ++#include <mpv/render.h> + + #ifdef Q_OS_WIN32 + #include <windows.h> +@@ -34,7 +34,7 @@ public slots: + private: + static void on_update(void *ctx); + mpv::qt::Handle m_mpv; +- mpv_opengl_cb_context* m_mpvGL; ++ mpv_render_context* m_mpvGL; + QQuickWindow* m_window; + QSize m_size; + HANDLE m_hAvrtHandle; +@@ -64,7 +64,7 @@ private slots: + + private: + mpv::qt::Handle m_mpv; +- mpv_opengl_cb_context* m_mpvGL; ++ mpv_render_context* m_mpvGL; + PlayerRenderer* m_renderer; + QString m_debugInfo; + }; |