diff options
Diffstat (limited to 'audio/out/ao.c')
-rw-r--r-- | audio/out/ao.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c index baf6db1e45..b92a78ff26 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -397,6 +397,22 @@ bool ao_eof_reached(struct ao *ao) return ao->api->get_eof ? ao->api->get_eof(ao) : true; } +// Query the AO_EVENT_*s as requested by the events parameter, and return them. +int ao_query_and_reset_events(struct ao *ao, int events) +{ + int actual_events = 0; + if (atomic_load(&ao->request_reload)) // don't need to reset it + actual_events |= AO_EVENT_RELOAD; + return actual_events & events; +} + +// Request that the player core destroys and recreates the AO. +void ao_request_reload(struct ao *ao) +{ + atomic_store(&ao->request_reload, true); + mp_input_wakeup(ao->input_ctx); +} + bool ao_chmap_sel_adjust(struct ao *ao, const struct mp_chmap_sel *s, struct mp_chmap *map) { @@ -409,13 +425,6 @@ bool ao_chmap_sel_get_def(struct ao *ao, const struct mp_chmap_sel *s, return mp_chmap_sel_get_def(s, map, num); } -// Request that the player core destroys and recreates the AO. -void ao_request_reload(struct ao *ao) -{ - const char *cmd[] = {"ao_reload", NULL}; - mp_input_run_cmd(ao->input_ctx, cmd); -} - // --- The following functions just return immutable information. void ao_get_format(struct ao *ao, struct mp_audio *format) |