directshow获取电脑摄像头流程图:
DsDevice[] ds = DsDevice.GetDevicesOfCat(FilterCategory.VideoCompressorCategory);获取视频codec filter
DsDevice[] ds = DsDevice.GetDevicesOfCat(FilterCategory.AudioCompressorCategory);获取音频codec filter
DsDevice[] ds = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);获取视频输入codec filter
DsDevice[] ds = DsDevice.GetDevicesOfCat(FilterCategory.AudioInputDevice);获取音频输入codec filter
for (int i = 0; i < ds.Length; i++)
{
Guid id = typeof(IBaseFilter).GUID;
object o;
ds[i].Mon.BindToObject(null, null, ref id, out o);
ibf = o as IBaseFilter;
break;
}
如果筛选指定名字的filter,加个判断即可:if (ds[i].Name ==filtername)