summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_wasapi.h
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2015-03-28 17:12:48 -0700
committerKevin Mitchell <kevmitch@gmail.com>2015-04-04 16:31:14 -0700
commit642f84f9227607f0c64bf35ec5896cb80804f64f (patch)
tree6c21e7b59235686b5284ec2ad47858eb6b6ce5bf /audio/out/ao_wasapi.h
parentfe60cff03bbdc0790f96365d6cf3ab8116785bb0 (diff)
downloadmpv-642f84f9227607f0c64bf35ec5896cb80804f64f.tar.bz2
mpv-642f84f9227607f0c64bf35ec5896cb80804f64f.tar.xz
ao/wasapi: use atomic state variable instead of different events
Unfortunately, because we have proxy objects (pAudioVolumeProxy, pEndpointVolumeProxy, pSessionControlProxy) it looks like we still have to use MsgWaitForMultipleObjects and watch for and dispatch pending messages: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680112%28v=vs.85%29.aspx
Diffstat (limited to 'audio/out/ao_wasapi.h')
-rwxr-xr-xaudio/out/ao_wasapi.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h
index eb06e46566..24b9b862ed 100755
--- a/audio/out/ao_wasapi.h
+++ b/audio/out/ao_wasapi.h
@@ -43,11 +43,18 @@ void wasapi_change_uninit(struct ao* ao);
#define SAFE_RELEASE(unk, release) \
do { if ((unk) != NULL) { release; (unk) = NULL; } } while(0)
+enum wasapi_thread_state {
+ WASAPI_THREAD_FEED = 0,
+ WASAPI_THREAD_RESUME,
+ WASAPI_THREAD_RESET,
+ WASAPI_THREAD_SHUTDOWN
+};
+
typedef struct wasapi_state {
struct mp_log *log;
/* Init phase */
HRESULT init_ret;
- HANDLE init_done;
+ HANDLE hInitDone;
int share_mode;
/* volume control */
@@ -66,11 +73,9 @@ typedef struct wasapi_state {
IMMDeviceEnumerator *pEnumerator;
/* thread handles */
- HANDLE threadLoop; /* the thread itself */
- HANDLE hUninit; /* thread shutdown */
- HANDLE hFeed; /* wasapi event */
- HANDLE hResume; /* signal audio thread to resume the stream */
- HANDLE hReset; /* signal audio thread to reset the stream */
+ HANDLE hAudioThread; /* the thread itself */
+ HANDLE hWake; /* thread wakeup event */
+ atomic_int thread_state; /* enum wasapi_thread_state */
/* for setting the audio thread priority */
HANDLE hTask; /* AV thread */