devenum: Only scan for devices for the requested filter category.
This matches native behaviour, and greatly reduces the overhead of IFilterMapper2_EnumMatchingFilters(). Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ec16a92b1d
commit
9316d8ae86
|
@ -53,7 +53,6 @@ static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a',
|
|||
static const WCHAR wszFilterData[] = {'F','i','l','t','e','r','D','a','t','a',0};
|
||||
|
||||
static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface);
|
||||
static void register_codecs(void);
|
||||
static HRESULT DEVENUM_CreateAMCategoryKey(const CLSID * clsidCategory);
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -828,31 +827,42 @@ static void register_avicap_devices(void)
|
|||
* DEVENUM_ICreateDevEnum_CreateClassEnumerator
|
||||
*/
|
||||
static HRESULT WINAPI DEVENUM_ICreateDevEnum_CreateClassEnumerator(
|
||||
ICreateDevEnum * iface,
|
||||
REFCLSID clsidDeviceClass,
|
||||
IEnumMoniker **ppEnumMoniker,
|
||||
DWORD dwFlags)
|
||||
ICreateDevEnum *iface, REFCLSID class, IEnumMoniker **out, DWORD flags)
|
||||
{
|
||||
WCHAR guidstr[CHARS_IN_GUID];
|
||||
HRESULT hr;
|
||||
HKEY key;
|
||||
|
||||
TRACE("(%p)->(%s, %p, %x)\n", iface, debugstr_guid(clsidDeviceClass), ppEnumMoniker, dwFlags);
|
||||
TRACE("iface %p, class %s, out %p, flags %#x.\n", iface, debugstr_guid(class), out, flags);
|
||||
|
||||
if (!ppEnumMoniker)
|
||||
if (!out)
|
||||
return E_POINTER;
|
||||
|
||||
*ppEnumMoniker = NULL;
|
||||
*out = NULL;
|
||||
|
||||
register_codecs();
|
||||
if (!RegOpenKeyW(HKEY_CURRENT_USER, wszActiveMovieKey, &key))
|
||||
{
|
||||
StringFromGUID2(class, guidstr, ARRAY_SIZE(guidstr));
|
||||
RegDeleteTreeW(key, guidstr);
|
||||
}
|
||||
|
||||
if (IsEqualGUID(class, &CLSID_LegacyAmFilterCategory))
|
||||
register_legacy_filters();
|
||||
else if (IsEqualGUID(class, &CLSID_AudioRendererCategory))
|
||||
{
|
||||
hr = DirectSoundEnumerateW(®ister_dsound_devices, NULL);
|
||||
if (FAILED(hr)) return hr;
|
||||
register_waveout_devices();
|
||||
register_wavein_devices();
|
||||
register_midiout_devices();
|
||||
}
|
||||
else if (IsEqualGUID(class, &CLSID_AudioInputDeviceCategory))
|
||||
register_wavein_devices();
|
||||
else if (IsEqualGUID(class, &CLSID_VideoCompressorCategory))
|
||||
register_vfw_codecs();
|
||||
else if (IsEqualGUID(class, &CLSID_VideoInputDeviceCategory))
|
||||
register_avicap_devices();
|
||||
|
||||
return create_EnumMoniker(clsidDeviceClass, ppEnumMoniker);
|
||||
return create_EnumMoniker(class, out);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -902,27 +912,3 @@ static HRESULT DEVENUM_CreateAMCategoryKey(const CLSID * clsidCategory)
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void register_codecs(void)
|
||||
{
|
||||
WCHAR class[CHARS_IN_GUID];
|
||||
HKEY basekey;
|
||||
|
||||
/* Since devices can change between session, for example because you just plugged in a webcam
|
||||
* or switched from pulseaudio to alsa, delete all old devices first
|
||||
*/
|
||||
RegOpenKeyW(HKEY_CURRENT_USER, wszActiveMovieKey, &basekey);
|
||||
StringFromGUID2(&CLSID_LegacyAmFilterCategory, class, CHARS_IN_GUID);
|
||||
RegDeleteTreeW(basekey, class);
|
||||
StringFromGUID2(&CLSID_AudioRendererCategory, class, CHARS_IN_GUID);
|
||||
RegDeleteTreeW(basekey, class);
|
||||
StringFromGUID2(&CLSID_AudioInputDeviceCategory, class, CHARS_IN_GUID);
|
||||
RegDeleteTreeW(basekey, class);
|
||||
StringFromGUID2(&CLSID_VideoInputDeviceCategory, class, CHARS_IN_GUID);
|
||||
RegDeleteTreeW(basekey, class);
|
||||
StringFromGUID2(&CLSID_MidiRendererCategory, class, CHARS_IN_GUID);
|
||||
RegDeleteTreeW(basekey, class);
|
||||
StringFromGUID2(&CLSID_VideoCompressorCategory, class, CHARS_IN_GUID);
|
||||
RegDeleteTreeW(basekey, class);
|
||||
RegCloseKey(basekey);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue