mirror of
https://github.com/mpv-player/mpv
synced 2024-12-19 21:31:52 +00:00
8716c2e88f
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.
23 lines
995 B
C
23 lines
995 B
C
#ifndef MP_DISPATCH_H_
|
|
#define MP_DISPATCH_H_
|
|
|
|
typedef void (*mp_dispatch_fn)(void *data);
|
|
struct mp_dispatch_queue;
|
|
|
|
struct mp_dispatch_queue *mp_dispatch_create(void *talloc_parent);
|
|
void mp_dispatch_set_wakeup_fn(struct mp_dispatch_queue *queue,
|
|
void (*wakeup_fn)(void *wakeup_ctx),
|
|
void *wakeup_ctx);
|
|
void mp_dispatch_enqueue(struct mp_dispatch_queue *queue,
|
|
mp_dispatch_fn fn, void *fn_data);
|
|
void mp_dispatch_enqueue_autofree(struct mp_dispatch_queue *queue,
|
|
mp_dispatch_fn fn, void *fn_data);
|
|
void mp_dispatch_run(struct mp_dispatch_queue *queue,
|
|
mp_dispatch_fn fn, void *fn_data);
|
|
void mp_dispatch_queue_process(struct mp_dispatch_queue *queue, double timeout);
|
|
void mp_dispatch_interrupt(struct mp_dispatch_queue *queue);
|
|
void mp_dispatch_lock(struct mp_dispatch_queue *queue);
|
|
void mp_dispatch_unlock(struct mp_dispatch_queue *queue);
|
|
|
|
#endif
|