summaryrefslogtreecommitdiffstats
path: root/player/client.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-02-20 13:30:18 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-02-28 00:55:06 -0800
commitb03712143012f08591de59d09675fdd3a0eaeed8 (patch)
tree34bdfe31802573c1452dcbe023610acad3f1b5a9 /player/client.h
parente76fda8594a7fa19888260c86d95396c5e799cad (diff)
downloadmpv-b03712143012f08591de59d09675fdd3a0eaeed8.tar.bz2
mpv-b03712143012f08591de59d09675fdd3a0eaeed8.tar.xz
client API: deprecate opengl-cb API and introduce a replacement API
The purpose of the new API is to make it useable with other APIs than OpenGL, especially D3D11 and vulkan. In theory it's now possible to support other vo_gpu backends, as well as backends that don't use the vo_gpu code at all. This also aims to get rid of the dumb mpv_get_sub_api() function. The life cycle of the new mpv_render_context is a bit different from mpv_opengl_cb_context, and you explicitly create/destroy the new context, instead of calling init/uninit on an object returned by mpv_get_sub_api(). In other to make the render API generic, it's annoyingly EGL style, and requires you to pass in API-specific objects to generic functions. This is to avoid explicit objects like the internal ra API has, because that sounds more complicated and annoying for an API that's supposed to never change. The opengl_cb API will continue to exist for a bit longer, but internally there are already a few tradeoffs, like reduced thread-safety. Mostly untested. Seems to work fine with mpc-qt.
Diffstat (limited to 'player/client.h')
-rw-r--r--player/client.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/player/client.h b/player/client.h
index 042934cde3..58e84418a2 100644
--- a/player/client.h
+++ b/player/client.h
@@ -12,6 +12,7 @@ struct MPContext;
struct mpv_handle;
struct mp_client_api;
struct mp_log;
+struct mpv_global;
// Includes space for \0
#define MAX_CLIENT_NAME 64
@@ -33,6 +34,7 @@ void mp_client_property_change(struct MPContext *mpctx, const char *name);
struct mpv_handle *mp_new_client(struct mp_client_api *clients, const char *name);
struct mp_log *mp_client_get_log(struct mpv_handle *ctx);
+struct mpv_global *mp_client_get_global(struct mpv_handle *ctx);
struct MPContext *mp_client_get_core(struct mpv_handle *ctx);
struct MPContext *mp_client_api_get_core(struct mp_client_api *api);
void *mp_get_sub_api2(mpv_handle *ctx, mpv_sub_api sub_api, bool lock);
@@ -40,19 +42,22 @@ void *mp_get_sub_api2(mpv_handle *ctx, mpv_sub_api sub_api, bool lock);
// m_option.c
void *node_get_alloc(struct mpv_node *node);
-// vo_opengl_cb.c
-struct mpv_opengl_cb_context;
-struct mpv_global;
+// for vo_libmpv.c
struct osd_state;
-struct mpv_opengl_cb_context *mp_opengl_create(struct mpv_global *g,
- struct mp_client_api *client_api);
+struct mpv_render_context;
+bool mp_set_main_render_context(struct mp_client_api *client_api,
+ struct mpv_render_context *ctx, bool active);
+struct mpv_render_context *
+mp_client_api_acquire_render_context(struct mp_client_api *ca);
void kill_video(struct mp_client_api *client_api);
bool mp_streamcb_lookup(struct mpv_global *g, const char *protocol,
void **out_user_data, mpv_stream_cb_open_ro_fn *out_fn);
-typedef int (*mpv_opengl_cb_control_fn)(void *cb_ctx, int *events, uint32_t request, void *data);
-
+// Legacy.
+typedef int (*mpv_opengl_cb_control_fn)(void *cb_ctx, int *events,
+ uint32_t request, void *data);
+struct mpv_opengl_cb_context;
void mp_client_set_control_callback(struct mpv_opengl_cb_context *ctx,
mpv_opengl_cb_control_fn callback,
void *callback_ctx);