MCPcopy Create free account
hub / github.com/AgoraIO/API-Examples / EnumDevices

Method EnumDevices

windows/APIExample/APIExample/DirectShow/DShowHelper.cpp:285–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285bool CDShowHelper::EnumDevices(const GUID &type, IBaseFilter** outFilter, const wchar_t *name, const wchar_t *path)
286{
287 //std::lock_guard<recursive_mutex* lock(enumMutex);
288 ICreateDevEnum* deviceEnum = nullptr;
289 IEnumMoniker* enumMoniker = nullptr;
290 IMoniker* deviceInfo = nullptr;
291 IBaseFilter* filter = nullptr;
292 HRESULT hr;
293 DWORD count = 0;
294
295 hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
296 CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void**)&deviceEnum);
297 if (FAILED(hr)) {
298 OutputDebugString(L"EnumDevices: Could not create "
299 L"ICreateDeviceEnum");
300 return false;
301 }
302
303 hr = deviceEnum->CreateClassEnumerator(type, &enumMoniker, 0);
304 if (FAILED(hr)) {
305 OutputDebugString(L"EnumDevices: CreateClassEnumerator failed");
306 return false;
307 }
308
309 if (hr == S_OK) {
310 while (enumMoniker->Next(1, &deviceInfo, &count) == S_OK) {
311 if (!EnumDevice(type, deviceInfo, outFilter, name, path))
312 //*outFilter = filter;
313 return true;
314 }
315 }
316 return true;
317}
318
319bool CDShowHelper::GetDeviceFilter(const IID &type, const wchar_t *name, const wchar_t *path,
320 IBaseFilter **out)

Callers

nothing calls this directly

Calls 1

NextMethod · 0.80

Tested by

no test coverage detected