diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-13 01:10:00 -0800 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-17 04:30:53 -0800 |
commit | e647f202ed82b553639a79832bc9909121bde372 (patch) | |
tree | 57fd4bdc9defa31801783e6037e33f508057adb8 /audio/out/ao_wasapi_changenotify.c | |
parent | f29f16663ab5687c8cd84234cb5f26aaa66abb97 (diff) | |
download | mpv-e647f202ed82b553639a79832bc9909121bde372.tar.bz2 mpv-e647f202ed82b553639a79832bc9909121bde372.tar.xz |
ao/wasapi: add convenience functions for change notifiy
Diffstat (limited to 'audio/out/ao_wasapi_changenotify.c')
-rwxr-xr-x | audio/out/ao_wasapi_changenotify.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/audio/out/ao_wasapi_changenotify.c b/audio/out/ao_wasapi_changenotify.c index d5db1a9e89..7ff6b16d0d 100755 --- a/audio/out/ao_wasapi_changenotify.c +++ b/audio/out/ao_wasapi_changenotify.c @@ -42,6 +42,55 @@ static int GUID_compare(const GUID *l, const GUID *r) return 0; } +static int PKEY_compare(const PROPERTYKEY *l, const PROPERTYKEY *r) +{ + if (GUID_compare(&l->fmtid, &r->fmtid)) return 1; + if (l->pid != r->pid) return 1; + return 0; +} + +static char *GUID_to_str_buf(char *buf, size_t buf_size, const GUID *guid) +{ + snprintf(buf, buf_size, + "{%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x}", + guid->Data1, guid->Data2, guid->Data3, + guid->Data4[0], guid->Data4[1], + guid->Data4[2], guid->Data4[3], + guid->Data4[4], guid->Data4[5], + guid->Data4[6], guid->Data4[7]); + return buf; +} + +static char *PKEY_to_str_buf(char *buf, size_t buf_size, const PROPERTYKEY *pkey) +{ + buf = GUID_to_str_buf(buf, buf_size, &pkey->fmtid); + size_t guid_len = strnlen(buf, buf_size); + snprintf(buf + guid_len, buf_size - guid_len, ",%"PRIu32, (uint32_t)pkey->pid ); + return buf; +} + +#define PKEY_to_str(pkey) PKEY_to_str_buf((char[42]){0}, 42, (pkey)) + +static char* ERole_to_str(ERole role) +{ + switch(role){ + case eConsole: return "console"; + case eMultimedia: return "multimedia"; + case eCommunications: return "communications"; + default: return "<Unknown>"; + } +} + +static char* EDataFlow_to_str(EDataFlow flow) +{ + switch(flow){ + case eRender: return "render"; + case eCapture: return "capture"; + case eAll: return "all"; + default: return "<Unknown>"; + } +} + static HRESULT STDMETHODCALLTYPE sIMMNotificationClient_QueryInterface( IMMNotificationClient* This, REFIID riid, void **ppvObject) { |