2014-02-10 20:01:35 +00:00
|
|
|
#ifndef MP_CLIENT_H_
|
|
|
|
#define MP_CLIENT_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2014-10-19 03:46:16 +00:00
|
|
|
#include <stdbool.h>
|
2014-02-10 20:01:35 +00:00
|
|
|
|
|
|
|
#include "libmpv/client.h"
|
2016-08-07 16:10:05 +00:00
|
|
|
#include "libmpv/stream_cb.h"
|
cocoa-cb: initial implementation via opengl-cb API
this is meant to replace the old and not properly working vo_gpu/opengl
cocoa backend in the future. the problems are various shortcomings of
Apple's opengl implementation and buggy behaviour in certain
circumstances that couldn't be properly worked around. there are also
certain regressions on newer macOS versions from 10.11 onwards.
- awful opengl performance with a none layer backed context
- huge amount of dropped frames with an early context flush
- flickering of system elements like the dock or volume indicator
- double buffering not properly working with a none layer backed context
- bad performance in fullscreen because of system optimisations
all the problems were caused by using a normal opengl context, that
seems somewhat abandoned by apple, and are fixed by using a layer backed
opengl context instead. problems that couldn't be fixed could be
properly worked around.
this has all features our old backend has sans the wid embedding,
the possibility to disable the automatic GPU switching and taking
screenshots of the window content. the first was deemed unnecessary by
me for now, since i just use the libmpv API that others can use anyway.
second is technically not possible atm because we have to pre-allocate
our opengl context at a time the config isn't read yet, so we can't get
the needed property. third one is a bit tricky because of deadlocking
and it needed to be in sync, hopefully i can work around that in the
future.
this also has at least one additional feature or eye-candy. a properly
working fullscreen animation with the native fs. also since this is a
direct port of the old backend of the parts that could be used, though
with adaptions and improvements, this looks a lot cleaner and easier to
understand.
some credit goes to @pigoz for the initial swift build support which
i could improve upon.
Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739,
#2392, #2217
2018-02-12 11:28:19 +00:00
|
|
|
#include "misc/bstr.h"
|
2014-02-10 20:01:35 +00:00
|
|
|
|
|
|
|
struct MPContext;
|
|
|
|
struct mpv_handle;
|
|
|
|
struct mp_client_api;
|
|
|
|
struct mp_log;
|
|
|
|
|
2014-11-23 12:40:52 +00:00
|
|
|
// Includes space for \0
|
|
|
|
#define MAX_CLIENT_NAME 64
|
|
|
|
|
2014-02-10 20:01:35 +00:00
|
|
|
void mp_clients_init(struct MPContext *mpctx);
|
2016-09-21 13:55:34 +00:00
|
|
|
void mp_client_enter_shutdown(struct MPContext *mpctx);
|
2014-02-10 20:01:35 +00:00
|
|
|
void mp_clients_destroy(struct MPContext *mpctx);
|
|
|
|
int mp_clients_num(struct MPContext *mpctx);
|
2014-09-06 15:02:47 +00:00
|
|
|
bool mp_clients_all_initialized(struct MPContext *mpctx);
|
2014-02-10 20:01:35 +00:00
|
|
|
|
2014-10-24 19:52:16 +00:00
|
|
|
bool mp_client_exists(struct MPContext *mpctx, const char *client_name);
|
2014-02-10 20:01:35 +00:00
|
|
|
void mp_client_broadcast_event(struct MPContext *mpctx, int event, void *data);
|
|
|
|
int mp_client_send_event(struct MPContext *mpctx, const char *client_name,
|
|
|
|
int event, void *data);
|
2014-11-23 14:08:49 +00:00
|
|
|
int mp_client_send_event_dup(struct MPContext *mpctx, const char *client_name,
|
|
|
|
int event, void *data);
|
2014-08-28 15:35:50 +00:00
|
|
|
bool mp_client_event_is_registered(struct MPContext *mpctx, int event);
|
2014-08-01 23:39:28 +00:00
|
|
|
void mp_client_property_change(struct MPContext *mpctx, const char *name);
|
2014-02-10 20:01:35 +00:00
|
|
|
|
|
|
|
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);
|
2014-05-12 23:14:07 +00:00
|
|
|
struct MPContext *mp_client_get_core(struct mpv_handle *ctx);
|
2016-01-15 21:49:10 +00:00
|
|
|
struct MPContext *mp_client_api_get_core(struct mp_client_api *api);
|
cocoa-cb: initial implementation via opengl-cb API
this is meant to replace the old and not properly working vo_gpu/opengl
cocoa backend in the future. the problems are various shortcomings of
Apple's opengl implementation and buggy behaviour in certain
circumstances that couldn't be properly worked around. there are also
certain regressions on newer macOS versions from 10.11 onwards.
- awful opengl performance with a none layer backed context
- huge amount of dropped frames with an early context flush
- flickering of system elements like the dock or volume indicator
- double buffering not properly working with a none layer backed context
- bad performance in fullscreen because of system optimisations
all the problems were caused by using a normal opengl context, that
seems somewhat abandoned by apple, and are fixed by using a layer backed
opengl context instead. problems that couldn't be fixed could be
properly worked around.
this has all features our old backend has sans the wid embedding,
the possibility to disable the automatic GPU switching and taking
screenshots of the window content. the first was deemed unnecessary by
me for now, since i just use the libmpv API that others can use anyway.
second is technically not possible atm because we have to pre-allocate
our opengl context at a time the config isn't read yet, so we can't get
the needed property. third one is a bit tricky because of deadlocking
and it needed to be in sync, hopefully i can work around that in the
future.
this also has at least one additional feature or eye-candy. a properly
working fullscreen animation with the native fs. also since this is a
direct port of the old backend of the parts that could be used, though
with adaptions and improvements, this looks a lot cleaner and easier to
understand.
some credit goes to @pigoz for the initial swift build support which
i could improve upon.
Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739,
#2392, #2217
2018-02-12 11:28:19 +00:00
|
|
|
void *mp_get_sub_api2(mpv_handle *ctx, mpv_sub_api sub_api, bool lock);
|
2014-02-10 20:01:35 +00:00
|
|
|
|
2014-10-19 03:46:16 +00:00
|
|
|
// m_option.c
|
|
|
|
void *node_get_alloc(struct mpv_node *node);
|
|
|
|
|
2014-12-09 16:47:02 +00:00
|
|
|
// vo_opengl_cb.c
|
|
|
|
struct mpv_opengl_cb_context;
|
|
|
|
struct mpv_global;
|
|
|
|
struct osd_state;
|
|
|
|
struct mpv_opengl_cb_context *mp_opengl_create(struct mpv_global *g,
|
2014-12-31 19:31:19 +00:00
|
|
|
struct mp_client_api *client_api);
|
|
|
|
void kill_video(struct mp_client_api *client_api);
|
2014-12-09 16:47:02 +00:00
|
|
|
|
2016-08-07 16:10:05 +00:00
|
|
|
bool mp_streamcb_lookup(struct mpv_global *g, const char *protocol,
|
|
|
|
void **out_user_data, mpv_stream_cb_open_ro_fn *out_fn);
|
|
|
|
|
cocoa-cb: initial implementation via opengl-cb API
this is meant to replace the old and not properly working vo_gpu/opengl
cocoa backend in the future. the problems are various shortcomings of
Apple's opengl implementation and buggy behaviour in certain
circumstances that couldn't be properly worked around. there are also
certain regressions on newer macOS versions from 10.11 onwards.
- awful opengl performance with a none layer backed context
- huge amount of dropped frames with an early context flush
- flickering of system elements like the dock or volume indicator
- double buffering not properly working with a none layer backed context
- bad performance in fullscreen because of system optimisations
all the problems were caused by using a normal opengl context, that
seems somewhat abandoned by apple, and are fixed by using a layer backed
opengl context instead. problems that couldn't be fixed could be
properly worked around.
this has all features our old backend has sans the wid embedding,
the possibility to disable the automatic GPU switching and taking
screenshots of the window content. the first was deemed unnecessary by
me for now, since i just use the libmpv API that others can use anyway.
second is technically not possible atm because we have to pre-allocate
our opengl context at a time the config isn't read yet, so we can't get
the needed property. third one is a bit tricky because of deadlocking
and it needed to be in sync, hopefully i can work around that in the
future.
this also has at least one additional feature or eye-candy. a properly
working fullscreen animation with the native fs. also since this is a
direct port of the old backend of the parts that could be used, though
with adaptions and improvements, this looks a lot cleaner and easier to
understand.
some credit goes to @pigoz for the initial swift build support which
i could improve upon.
Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739,
#2392, #2217
2018-02-12 11:28:19 +00:00
|
|
|
typedef int (*mpv_opengl_cb_control_fn)(void *cb_ctx, int *events, uint32_t request, void *data);
|
|
|
|
|
|
|
|
void mp_client_set_control_callback(struct mpv_opengl_cb_context *ctx,
|
|
|
|
mpv_opengl_cb_control_fn callback,
|
|
|
|
void *callback_ctx);
|
|
|
|
void mp_client_set_icc_profile(struct mpv_opengl_cb_context *ctx, bstr icc_data);
|
|
|
|
void mp_client_set_ambient_lux(struct mpv_opengl_cb_context *ctx, int lux);
|
|
|
|
|
2014-02-10 20:01:35 +00:00
|
|
|
#endif
|