diff options
author | wm4 <wm4@nowhere> | 2014-11-09 09:58:44 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-09 09:58:44 +0100 |
commit | b021d038c2217903e511ca3673d5f2f1b996c4d4 (patch) | |
tree | adc8258d5f8d18f11aa85f72fb6bc34ff62fb33f /audio/out/internal.h | |
parent | 7ee4e533693ee02e660ae0efb2e0e94db8c8c5af (diff) | |
download | mpv-b021d038c2217903e511ca3673d5f2f1b996c4d4.tar.bz2 mpv-b021d038c2217903e511ca3673d5f2f1b996c4d4.tar.xz |
audio/out: make ao_request_reload() idempotent
This is what you would expect. Before this commit, each
ao_request_reload() call would just queue a reload command, and then
recreate the AO for the number of times the function was called.
Instead of sending a command, introduce some sort of event retrieval
mechanism. At least for the reload case, use atomics, because we're too
lazy to setup an extra mutex.
Diffstat (limited to 'audio/out/internal.h')
-rw-r--r-- | audio/out/internal.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/audio/out/internal.h b/audio/out/internal.h index 8ba789f603..fbea763306 100644 --- a/audio/out/internal.h +++ b/audio/out/internal.h @@ -22,6 +22,7 @@ #include <stdbool.h> #include <pthread.h> +#include "osdep/atomics.h" #include "audio/out/ao.h" /* global data used by ao.c and ao drivers */ @@ -55,6 +56,8 @@ struct ao { // Used during init: if init fails, redirect to this ao char *redirect; + atomic_bool request_reload; + int buffer; double def_buffer; void *api_priv; @@ -186,8 +189,6 @@ bool ao_chmap_sel_adjust(struct ao *ao, const struct mp_chmap_sel *s, bool ao_chmap_sel_get_def(struct ao *ao, const struct mp_chmap_sel *s, struct mp_chmap *map, int num); -void ao_request_reload(struct ao *ao); - // Add a deep copy of e to the list. // Call from ao_driver->list_devs callback only. void ao_device_list_add(struct ao_device_list *list, struct ao *ao, |