mirror of https://github.com/mpv-player/mpv
ao_wasapi: use correct UINT type for device enumeration
Notably, the address of the enumerator->count member is passed to IMMDeviceCollection::GetCount(), which expects a UINT variable, not an int. How did this ever work?
This commit is contained in:
parent
ff7884e635
commit
ce0b26c60f
|
@ -749,7 +749,7 @@ struct enumerator {
|
|||
struct mp_log *log;
|
||||
IMMDeviceEnumerator *pEnumerator;
|
||||
IMMDeviceCollection *pDevices;
|
||||
int count;
|
||||
UINT count;
|
||||
};
|
||||
|
||||
static void destroy_enumerator(struct enumerator *e)
|
||||
|
@ -784,7 +784,7 @@ exit_label:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct device_desc *device_desc_for_num(struct enumerator *e, int i)
|
||||
static struct device_desc *device_desc_for_num(struct enumerator *e, UINT i)
|
||||
{
|
||||
IMMDevice *pDevice = NULL;
|
||||
HRESULT hr = IMMDeviceCollection_Item(e->pDevices, i, &pDevice);
|
||||
|
@ -818,7 +818,7 @@ void wasapi_list_devs(struct ao *ao, struct ao_device_list *list)
|
|||
if (!enumerator)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < enumerator->count; i++) {
|
||||
for (UINT i = 0; i < enumerator->count; i++) {
|
||||
struct device_desc *d = device_desc_for_num(enumerator, i);
|
||||
if (!d)
|
||||
goto exit_label;
|
||||
|
@ -888,7 +888,7 @@ LPWSTR find_deviceID(struct ao *ao)
|
|||
// try selecting by number
|
||||
bstr rest;
|
||||
long long devno = bstrtoll(device, &rest, 10);
|
||||
if (!rest.len && 0 <= devno && devno < enumerator->count) {
|
||||
if (!rest.len && 0 <= devno && devno < (long long)enumerator->count) {
|
||||
MP_VERBOSE(ao, "Selecting device by number: #%lld\n", devno);
|
||||
d = device_desc_for_num(enumerator, devno);
|
||||
deviceID = select_device(ao->log, d);
|
||||
|
@ -897,7 +897,7 @@ LPWSTR find_deviceID(struct ao *ao)
|
|||
|
||||
// select by id or name
|
||||
bstr_eatstart0(&device, "{0.0.0.00000000}.");
|
||||
for (int i = 0; i < enumerator->count; i++) {
|
||||
for (UINT i = 0; i < enumerator->count; i++) {
|
||||
d = device_desc_for_num(enumerator, i);
|
||||
if (!d)
|
||||
goto exit_label;
|
||||
|
|
Loading…
Reference in New Issue