How To Get A List Of Available Video Capture Devices

谁说胖子不能爱 提交于 2019-12-08 08:04:11

问题


I am creating a project using DirectShow.Net that shows a preview of a webcam view within a windows form using Visual C#.

I would like to start with gaining a collection of available video devices so I can choose between either the built in webcam or the USB webcam.

I have seen several examples of this being done in C++, e.g. on the msdn "http://msdn.microsoft.com/en-us/library/windows/desktop/dd377566(v=vs.85).aspx".

However as I do not know any C++ I do not know how to convert this code into C#.


回答1:


DirectShow.NET sample \Samples\Capture\DxLogo\Capture.cs shows how to do it:

// Get the collection of video devices
capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);

The keyword you need is FilterCategory.VideoInputDevice.

See also:

  • Is directshow.net video input device filter enumeration broken (in newer environments)?
  • AForge - Working with video card with multiple cameras


来源:https://stackoverflow.com/questions/19258886/how-to-get-a-list-of-available-video-capture-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!