summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/client.c11
-rw-r--r--player/client.h3
-rw-r--r--sub/osd.c4
3 files changed, 16 insertions, 2 deletions
diff --git a/player/client.c b/player/client.c
index 97e43a15ce..6e454db34b 100644
--- a/player/client.c
+++ b/player/client.c
@@ -779,6 +779,17 @@ void mp_client_broadcast_event(struct MPContext *mpctx, int event, void *data)
pthread_mutex_unlock(&clients->lock);
}
+// Like mp_client_broadcast_event(), but can be called from any thread.
+// Avoid using this.
+void mp_client_broadcast_event_external(struct mp_client_api *api, int event,
+ void *data)
+{
+ struct MPContext *mpctx = api->mpctx;
+
+ mp_client_broadcast_event(mpctx, event, data);
+ mp_wakeup_core(mpctx);
+}
+
// If client_name == NULL, then broadcast and free the event.
int mp_client_send_event(struct MPContext *mpctx, const char *client_name,
uint64_t reply_userdata, int event, void *data)
diff --git a/player/client.h b/player/client.h
index 3408ff17f0..affefe8d71 100644
--- a/player/client.h
+++ b/player/client.h
@@ -39,6 +39,9 @@ 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_client_broadcast_event_external(struct mp_client_api *api, int event,
+ void *data);
+
// m_option.c
void *node_get_alloc(struct mpv_node *node);
diff --git a/sub/osd.c b/sub/osd.c
index c480e19cb2..f7935e3772 100644
--- a/sub/osd.c
+++ b/sub/osd.c
@@ -242,8 +242,8 @@ static void check_obj_resize(struct osd_state *osd, struct mp_osd_res res,
{
if (!osd_res_equals(res, obj->vo_res)) {
obj->vo_res = res;
- mp_client_broadcast_event(mp_client_api_get_core(osd->global->client_api),
- MP_EVENT_WIN_RESIZE, NULL);
+ mp_client_broadcast_event_external(osd->global->client_api,
+ MP_EVENT_WIN_RESIZE, NULL);
}
}