summaryrefslogtreecommitdiffstats
path: root/player/core.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-16 14:25:50 +0200
committerwm4 <wm4@nowhere>2016-09-16 14:49:23 +0200
commit8716c2e88f9694cf8368132e50a0e778dc055dd1 (patch)
treefde808300704d664eef1c19a8115de9bcc00cec3 /player/core.h
parent15baf2789cd5c5e0413616df22f235478f40e65e (diff)
downloadmpv-8716c2e88f9694cf8368132e50a0e778dc055dd1.tar.bz2
mpv-8716c2e88f9694cf8368132e50a0e778dc055dd1.tar.xz
player: use better way to wait for input and dispatching commands
Instead of using input_ctx for waiting, use the dispatch queue directly. One big change is that the dispatch queue will just process commands that come in (e.g. from client API) without returning. This should reduce unnecessary playloop excutions (which is good since the playloop got a bit fat from rechecking a lot of conditions every iteration). Since this doesn't force a new playloop iteration on every access, this has to be enforced manually in some cases. Normal input (via terminal or VO window) still wakes up the playloop every time, though that's not too important. It makes testing this harder, though. If there are missing wakeup calls, it will be noticed only when using the client API in some form. At this point we could probably use a normal lock instead of the dispatch queue stuff.
Diffstat (limited to 'player/core.h')
-rw-r--r--player/core.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/player/core.h b/player/core.h
index c39f316276..0f1c8c7e17 100644
--- a/player/core.h
+++ b/player/core.h
@@ -21,6 +21,8 @@
#include <stdbool.h>
#include <pthread.h>
+#include "osdep/atomic.h"
+
#include "libmpv/client.h"
#include "common/common.h"
@@ -233,6 +235,7 @@ typedef struct MPContext {
struct mp_client_api *clients;
struct mp_dispatch_queue *dispatch;
struct mp_cancel *playback_abort;
+ bool in_dispatch;
struct mp_log *statusline;
struct osd_state *osd;
@@ -510,7 +513,7 @@ void get_current_osd_sym(struct MPContext *mpctx, char *buf, size_t buf_size);
void set_osd_bar_chapters(struct MPContext *mpctx, int type);
// playloop.c
-void mp_wait_events(struct MPContext *mpctx, double sleeptime);
+void mp_wait_events(struct MPContext *mpctx);
void mp_set_timeout(struct MPContext *mpctx, double sleeptime);
void mp_wakeup_core(struct MPContext *mpctx);
void mp_wakeup_core_cb(void *ctx);