1
0
Fork 0
This commit is contained in:
namedkitten 2020-04-11 16:01:18 +01:00
parent eca87bfcfd
commit b794a741aa
2 changed files with 8 additions and 9 deletions

View file

@ -36,12 +36,6 @@ on_mpv_redraw(void* ctx)
reinterpret_cast<MPVBackend*>(ctx), "update", Qt::QueuedConnection); reinterpret_cast<MPVBackend*>(ctx), "update", Qt::QueuedConnection);
} }
} // namespace
class MpvRenderer : public QQuickFramebufferObject::Renderer
{
MPVBackend* obj;
static void* static void*
get_proc_address_mpv(void* ctx, const char* name) get_proc_address_mpv(void* ctx, const char* name)
{ {
@ -51,11 +45,15 @@ get_proc_address_mpv(void* ctx, const char* name)
std::cerr << "No GLCTX :(" << std::endl; std::cerr << "No GLCTX :(" << std::endl;
return nullptr; return nullptr;
} }
return reinterpret_cast<void*>(glctx->getProcAddress(QByteArray(name))); return reinterpret_cast<void*>(glctx->getProcAddress(QByteArray(name)));
} }
} // namespace
class MpvRenderer : public QQuickFramebufferObject::Renderer
{
MPVBackend* obj;
public: public:
MpvRenderer(MPVBackend* new_obj) MpvRenderer(MPVBackend* new_obj)
: obj{ new_obj } : obj{ new_obj }
@ -70,7 +68,6 @@ public:
{ {
// init mpv_gl: // init mpv_gl:
if (!obj->mpv_gl) { if (!obj->mpv_gl) {
QOpenGLContext* glctx = QOpenGLContext::currentContext();
mpv_opengl_init_params gl_init_params{ get_proc_address_mpv, mpv_opengl_init_params gl_init_params{ get_proc_address_mpv,
nullptr, nullptr,
nullptr }; nullptr };

View file

@ -15,6 +15,8 @@
#include "src/enums.hpp" #include "src/enums.hpp"
#include "src/utils.hpp" #include "src/utils.hpp"
class MpvRenderer;
class MPVBackend class MPVBackend
: public QQuickFramebufferObject : public QQuickFramebufferObject
, public BackendInterface , public BackendInterface