diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-13 01:09:47 -0800 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-17 04:31:20 -0800 |
commit | 6c512892d4691e004c453af5f0c7f3837d87b7fb (patch) | |
tree | 25c4ddea3550a3ca9b4156ea0513f58476011af1 /audio/out/ao_wasapi.h | |
parent | e647f202ed82b553639a79832bc9909121bde372 (diff) | |
download | mpv-6c512892d4691e004c453af5f0c7f3837d87b7fb.tar.bz2 mpv-6c512892d4691e004c453af5f0c7f3837d87b7fb.tar.xz |
ao/wasapi: request reset on appropriate events
on changes to PKEY_AudioEngine_DeviceFormat, device status, and default device.
call ao_reload directly in the change_notify "methods".
this requires keeping a device enumerator around for the duration of
execution, rather than just for initially querying devices
Diffstat (limited to 'audio/out/ao_wasapi.h')
-rwxr-xr-x | audio/out/ao_wasapi.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h index 43c81a89d2..7e7cc6cd06 100755 --- a/audio/out/ao_wasapi.h +++ b/audio/out/ao_wasapi.h @@ -31,12 +31,18 @@ #include "osdep/atomics.h" typedef struct change_notify { - IMMNotificationClient client; + IMMNotificationClient client; /* this must be first in the structure! */ LPWSTR monitored; /* Monitored device */ + struct ao *ao; } change_notify; -HRESULT wasapi_change_init(struct change_notify *change, IMMDevice *monitor); -void wasapi_change_free(struct change_notify *change); +HRESULT wasapi_change_init(struct ao* ao); +void wasapi_change_uninit(struct ao* ao); + +#define EXIT_ON_ERROR(hres) \ + do { if (FAILED(hres)) { goto exit_label; } } while(0) +#define SAFE_RELEASE(unk, release) \ + do { if ((unk) != NULL) { release; (unk) = NULL; } } while(0) typedef struct wasapi_state { struct mp_log *log; @@ -70,6 +76,8 @@ typedef struct wasapi_state { ISimpleAudioVolume *pAudioVolume; IAudioEndpointVolume *pEndpointVolume; IAudioSessionControl *pSessionControl; + IMMDeviceEnumerator *pEnumerator; + HANDLE hFeed; /* wasapi event */ HANDLE hForceFeed; /* forces writing a buffer (e.g. before audio_resume) */ HANDLE hFeedDone; /* set only after a hForceFeed */ @@ -108,6 +116,8 @@ typedef struct wasapi_state { HANDLE (WINAPI *pAvSetMmThreadCharacteristicsW)(LPCWSTR, LPDWORD); WINBOOL (WINAPI *pAvRevertMmThreadCharacteristics)(HANDLE); } VistaBlob; + + change_notify change; } wasapi_state; #endif |