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

Method EnumDevice

windows/APIExample/APIExample/DirectShow/DShowHelper.cpp:245–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245bool CDShowHelper::EnumDevice(const GUID &type, IMoniker *deviceInfo,
246 IBaseFilter** outfilter, const wchar_t *name, const wchar_t *path)
247{
248 IPropertyBag* propertyData = nullptr;
249 IBaseFilter* filter = nullptr;
250 HRESULT hr;
251
252 hr = deviceInfo->BindToStorage(0, 0, IID_IPropertyBag,
253 (void**)&propertyData);
254 if (FAILED(hr))
255 return true;
256
257 VARIANT deviceName, devicePath;
258 deviceName.vt = VT_BSTR;
259 devicePath.vt = VT_BSTR;
260 devicePath.bstrVal = NULL;
261
262 hr = propertyData->Read(L"FriendlyName", &deviceName, NULL);
263 if (FAILED(hr))
264 return true;
265
266
267 propertyData->Read(L"DevicePath", &devicePath, NULL);
268
269 hr = deviceInfo->BindToObject(NULL, 0, IID_IBaseFilter,
270 (void**)&filter);
271 if (SUCCEEDED(hr)) {
272 if (deviceName.bstrVal && name && wcscmp(name, deviceName.bstrVal) != 0)
273 return true;
274
275// if (!devicePath.bstrVal || wcscmp(path, devicePath.bstrVal) != 0)
276// return true;
277
278 *outfilter = filter;
279 return false;
280 }
281
282 return true;
283}
284
285bool CDShowHelper::EnumDevices(const GUID &type, IBaseFilter** outFilter, const wchar_t *name, const wchar_t *path)
286{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected