diff --git a/DOCS/client-api-changes.rst b/DOCS/client-api-changes.rst index 2a97fd29e1..f2cc5993eb 100644 --- a/DOCS/client-api-changes.rst +++ b/DOCS/client-api-changes.rst @@ -32,7 +32,12 @@ API changes :: + --- mpv 0.12.0 --- + 1.20 - deprecate "GL_MP_D3D_interfaces"/"glMPGetD3DInterface", and introduce + "GL_MP_MPGetNativeDisplay"/"glMPGetNativeDisplay" (this is a + backwards-compatible rename) --- mpv 0.11.0 --- + --- mpv 0.10.0 --- 1.19 - add "GL_MP_D3D_interfaces" pseudo extension to make it possible to use DXVA2 in OpenGL fullscreen mode in some situations - mpv_request_log_messages() now accepts "terminal-default" as parameter diff --git a/libmpv/client.h b/libmpv/client.h index 54ac421209..af583d9571 100644 --- a/libmpv/client.h +++ b/libmpv/client.h @@ -198,7 +198,7 @@ extern "C" { * relational operators (<, >, <=, >=). */ #define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL) -#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 19) +#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 20) /** * Return the MPV_CLIENT_API_VERSION the mpv source has been compiled with. diff --git a/libmpv/opengl_cb.h b/libmpv/opengl_cb.h index 2e031cd109..bd694b61d4 100644 --- a/libmpv/opengl_cb.h +++ b/libmpv/opengl_cb.h @@ -108,8 +108,26 @@ extern "C" { * context must have been uninitialized. If this doesn't happen, undefined * behavior will result. * - * Special D3D interop considerations - * ---------------------------------- + * Special windowing system interop considerations + * ------------------------------------------------ + * + * In some cases, libmpv needs to have access to the windowing system's handles. + * This can be a pointer to a X11 "Display" for example. Usually this is needed + * only for hardware decoding. + * + * You can communicate these handles to libmpv by adding a pseudo-OpenGL + * extension "GL_MP_MPGetNativeDisplay" to the additional extension string when + * calling mpv_opengl_cb_init_gl(). The get_proc_address callback should resolve + * a function named "glMPGetNativeDisplay", which has the signature: + * + * void* GLAPIENTRY glMPGetNativeDisplay(const char* name) + * + * See below what names are defined. Usually, libmpv will use the native handle + * up until mpv_opengl_cb_uninit_gl() is called. If the name is not anything + * you know/expected, return NULL from the function. + * + * Windowing system interop on MS win32 + * ------------------------------------ * * If OpenGL switches to fullscreen, most players give it access GPU access, * which means DXVA2 hardware decoding in mpv won't work. This can be worked @@ -117,14 +135,14 @@ extern "C" { * create a decoder. The device can be either the real device used for display, * or a "blank" device created before switching to fullscreen. * - * You can do this by adding "GL_MP_D3D_interfaces" to the additional extension - * string when calling mpv_opengl_cb_init_gl(). The get_proc_address callback - * should resolve a function named "glMPGetD3DInterface", which has the - * signature: "void* __stdcall glMPGetD3DInterface(const char* name)". If - * name is "IDirect3DDevice9", it should return a IDirect3DDevice9 pointer - * (or NULL if not available). libmpv will release this interface when it is - * done with it (usually when mpv_opengl_cb_uninit_gl() is called). New - * interface names can be added in the future. + * You can provide glMPGetNativeDisplay as described in the previous section. + * If it is called with name set to "IDirect3DDevice9", it should return a + * IDirect3DDevice9 pointer (or NULL if not available). libmpv will release + * this interface when it is done with it. + * + * In previous libmpv releases, this used "GL_MP_D3D_interfaces" and + * "glMPGetD3DInterface". This is deprecated; use glMPGetNativeDisplay instead + * (the semantics are 100% compatible). */ /** diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c index 6720e13f2a..2b6d3949ef 100644 --- a/video/out/opengl/common.c +++ b/video/out/opengl/common.c @@ -290,10 +290,18 @@ static const struct gl_functions gl_functions[] = { }, // These don't exist - they are for the sake of mpv internals, and libmpv // interaction (see libmpv/opengl_cb.h). + { + .extension = "GL_MP_MPGetNativeDisplay", + .functions = (const struct gl_function[]) { + DEF_FN(MPGetNativeDisplay), + {0} + }, + }, + // Same, but using the old name. { .extension = "GL_MP_D3D_interfaces", .functions = (const struct gl_function[]) { - DEF_FN(MPGetD3DInterface), + DEF_FN_NAME(MPGetNativeDisplay, "glMPGetD3DInterface"), {0} }, }, diff --git a/video/out/opengl/common.h b/video/out/opengl/common.h index 083e2ca023..0e3566d689 100644 --- a/video/out/opengl/common.h +++ b/video/out/opengl/common.h @@ -271,7 +271,7 @@ struct GL { void (GLAPIENTRY *DebugMessageCallback)(MP_GLDEBUGPROC callback, const void *userParam); - void *(GLAPIENTRY *MPGetD3DInterface)(const char *name); + void *(GLAPIENTRY *MPGetNativeDisplay)(const char *name); }; #endif /* MPLAYER_GL_COMMON_H */ diff --git a/video/out/opengl/hwdec_dxva2.c b/video/out/opengl/hwdec_dxva2.c index f6b3ac0e74..aba442b653 100644 --- a/video/out/opengl/hwdec_dxva2.c +++ b/video/out/opengl/hwdec_dxva2.c @@ -23,13 +23,13 @@ static void destroy(struct gl_hwdec *hw) static int create(struct gl_hwdec *hw) { GL *gl = hw->gl; - if (hw->hwctx || !gl->MPGetD3DInterface) + if (hw->hwctx || !gl->MPGetNativeDisplay) return -1; struct priv *p = talloc_zero(hw, struct priv); hw->priv = p; - p->ctx.d3d9_device = gl->MPGetD3DInterface("IDirect3DDevice9"); + p->ctx.d3d9_device = gl->MPGetNativeDisplay("IDirect3DDevice9"); if (!p->ctx.d3d9_device) return -1;