Closed SuRGeoNix closed 2 years ago
Please open a discussion instead of issue:
I found out that is possible with the newest Media Foundation API with MFEnumDeviceSources. So, probably not really required to add DirectShow. Sample:
var attrs = MediaFactory.MFCreateAttributes(1);
attrs.Set(CaptureDeviceAttributeKeys.SourceType, CaptureDeviceAttributeKeys.SourceTypeVidcap);
var res = MediaFactory.MFEnumDeviceSources(attrs, out IntPtr vidCapsPtr, out int capsCount);
IntPtr* ptrs = (IntPtr*)vidCapsPtr;
for (int i=0; i<capsCount; i++)
{
var capDevice = new IMFActivate(*ptrs);
System.Diagnostics.Debug.WriteLine(capDevice.Get(CaptureDeviceAttributeKeys.FriendlyName));
capDevice.Release();
ptrs++;
}
https://github.com/amerkoleci/Vortice.Windows/commit/b8ec1490d366bfb66c17cac680c1f4b1c115d13b added improvements in this scenario. I've added also example that enumerates Audio/Video capture devices:
Nice one. Much cleaner now!
Just wondering if you have this in your plans. I think it would fits for Vortice purpose.
I mainly interesting for this to enumerate audio/video capture devices.
Update: It seems I can use IMMDeviceEnumerator for at least audio capture devices