path: root/player/client.h
diff options
authorwm4 <wm4@nowhere>2014-09-06 17:02:47 +0200
committerwm4 <wm4@nowhere>2014-09-06 17:02:47 +0200
commit017b3fa9dbbed1bcd5711599e42513daf5009fd0 (patch)
tree12fcf673bdb3d08038c6d5ad67150238f866d0e4 /player/client.h
parent348dfd93c4178633d3995a955045fafb7e9209d3 (diff)
lua: synchronously wait until scripts are loaded
This makes the player wait until each script is loaded. Do this to give the script a chance to setup all its event handlers. It might also be useful to allow a script to change options that matter for playback. While waiting for a script to be loaded, the player actually accepts input. This is needed because the scripts can execute player commands anyway while they are being "loaded". The player won't react to most commands though: it can't quit or navigate the playlist in this state. For deciding whether a script is finally loaded, we use a cheap hack: if mpv_wait_event() is called, it's considered loaded. Let's hope this is good enough. I think it's better than introducing explicit API for this. Although I'm sure this will turn out as too simplistic some time in the future, the same would probably happen with a more explicit API.
Diffstat (limited to 'player/client.h')
1 files changed, 1 insertions, 0 deletions
diff --git a/player/client.h b/player/client.h
index a8804dbf82..0cb4fff43f 100644
--- a/player/client.h
+++ b/player/client.h
@@ -13,6 +13,7 @@ struct mp_log;
void mp_clients_init(struct MPContext *mpctx);
void mp_clients_destroy(struct MPContext *mpctx);
int mp_clients_num(struct MPContext *mpctx);
+bool mp_clients_all_initialized(struct MPContext *mpctx);
void mp_client_broadcast_event(struct MPContext *mpctx, int event, void *data);
int mp_client_send_event(struct MPContext *mpctx, const char *client_name,