From fb855b86593ad2a9db71cce3aa652ace93af38b5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 9 Dec 2014 17:47:02 +0100 Subject: client API: expose OpenGL renderer This adds API to libmpv that lets host applications use the mpv opengl renderer. This is a more flexible (and possibly more portable) option to foreign window embedding (via --wid). This assumes that methods like context sharing and multithreaded OpenGL rendering are infeasible, and that a way is needed to integrate it with an application that uses a single thread to render everything. Add an example that does this with QtQuick/qml. The example is relatively lazy, but still shows how relatively simple the integration is. The FBO indirection could probably be avoided, but would require more work (and would probably lead to worse QtQuick integration, because it would have to ignore transformations like rotation). Because this makes mpv directly use the host application's OpenGL context, there is no platform specific code involved in mpv, except for hw decoding interop. main.qml is derived from some Qt example. The following things are still missing: - a way to do better video timing - expose GL renderer options, allow changing them at runtime - support for color equalizer controls - support for screenshots --- player/video.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'player/video.c') diff --git a/player/video.c b/player/video.c index f0829a2c8d..a14b647872 100644 --- a/player/video.c +++ b/player/video.c @@ -275,6 +275,9 @@ int reinit_video_chain(struct MPContext *mpctx) goto err_out; } mpctx->mouse_cursor_visible = true; + + vo_control(mpctx->video_out, VOCTRL_SET_LIBMPV_OPENGL_CB_CONTEXT, + mpctx->gl_cb_ctx); } update_window_title(mpctx, true); -- cgit v1.2.3