虚拟网络摄像头驱动程序
我想开发一个虚拟网络摄像头驱动程序,从用户模式我将图像传递给它,它将显示为网络摄像头输出。
我不想使用 DirectX 过滤器和 CSourceStream 等。因为它们不适用于某些不使用 DirectX 捕获网络摄像头图像的程序。
我必须编写一个内核模式设备驱动程序。
有什么想法吗?我尝试了 DDK 示例中的 testcap,但它不会处理用户模式下的图像,也不会获得任何输入,只是在网络摄像头中显示 7 种颜色...
任何帮助将不胜感激。 谢谢
谢谢大家!
我尝试了这里的代码: http://tmhare.mvps.org/downloads.htm(找到捕获源过滤器)
它有效当我在 Yahoo、MSN 中编译它时,它崩溃了 AIM、Internet Explorer Flash 网络摄像头、Firefox Flash 网络摄像头和 Skype...我在 QueryInterface 中调用了 8 次后崩溃了,我通过大量跟踪发现了它技巧..
现在我知道,它在第 8 次调用时崩溃 HRESULT CVCamStream::QueryInterface(REFIID riid, void **ppv)
到达最后一个 if 时的第 8 次调用,我的意思是: 返回 CSourceStream::QueryInterface(riid, ppv);
它位于 Filters.cpp 第 17 行
你为什么认为我会崩溃?
谢谢大家指导我找到正确的解决方案,即 DirectShow,而不是驱动程序
I want to develop a virtual webcam driver which from User mode I'll pass image to it and it will display as webcam output.
I don't want to use DirectX filter and CSourceStream etc. Because they don't work on some programs which doesn't use DirectX for capturing webcam image.
I have to write a kernel mode device driver so.
Any ideas? I tried testcap from DDK samples, but it doesn't process image from user mode and doesn't get any input, just it displays 7 colors in webcam...
Any help would be greatly appreciated.
Thanks
Thank you all!
I tried code from here:
http://tmhare.mvps.org/downloads.htm (find Capture Source Filter)
It worked well when I compiled it in Yahoo, MSN, but it crashed AIM, Internet Explorer Flash Webcam, Firefox Flash webcam and Skype... I got crash in QueryInterface after 8 time call to that, I found it with tracing it with a lot of tricks..
Now I know, it crashes on 8th call to
HRESULT CVCamStream::QueryInterface(REFIID riid, void **ppv)
8th call when it reaches to last if, I mean:
return CSourceStream::QueryInterface(riid, ppv);
It's in 17th line of Filters.cpp
Why do you think I'm getting crash??
Thank you all for guiding me to find correct solution which is DirectShow, not driver
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Microsoft 有多个 API 可以提供对图像数据的访问。
DirectShow 特定:
要在 Windows 下创建图像采集设备,您必须提供实现流类接口(或更新的 Avstream)的设备(驱动程序),或者必须编写必须将其添加到 VideoInputCategory 枚举器的用户模式 COM 对象。
Avstream 示例提供了真实图像采集设备的一切。只有实际设备的下层确实丢失了。
如果您可以设计设备,则应该将其创建为兼容 DCAM 或 UVC。对于两者,都有 Windows 提供的内置驱动程序。
如何编写软件源设备:
您必须创建一个提供至少一个输出引脚的 DirectShow 过滤器,并将其注册到 VideoInputCategory 下。某些应用程序可能需要捕获应用程序提供多个接口,但这些接口取决于应用程序本身。用于尝试过滤器的简单应用程序是 Plattform SDK 中提供的 GraphEdit 和 AMCap。
一些代码:
_InstanceID 是为此“虚拟设备”条目创建的 GUID。
There are several APIs from Microsoft which provide access to image data.
DirectShow specific :
To create image acquisition devices under windows, you have to provide either a device (driver) which implements the streamclasses interfaces (or newer Avstream) or you have to write a usermode COM object which has to be added to the VideoInputCategory enumerator.
The Avstream sample provides everything for a real image acquisition device. Only the lower layer for the actual device really is missing.
If you can design a device, you should either create it DCAM or UVC compatible. For both there are built-in drivers supplied by windows.
How to write a software source device :
You have to create a DirectShow filter which provides at least one output pin and register this under the VideoInputCategory. There may be several interfaces certain applications require from a capture application, but these depend on the application itself. Simple applications to try out filters are GraphEdit and AMCap which are supplied in the Plattform SDK.
Some code :
_InstanceID is a GUID created for this 'virtual device' entry.
您无法决定其他程序如何调用您的驱动程序。大多数程序都会使用DirectShow。有些会使用win3.x技术的VFW。许多新程序,包括 Windows XP 的扫描仪和相机向导,可能会通过 WIA 接口呼叫您。如果您不想实现所有这些,则需要至少提供 DirectShow 接口 通过WDM并让vfwwdm32.dll给你一个VFW接口,或者编写你自己的VFW驱动程序。
You can not decide how other program would call your driver. Most of programs will use DirectShow. Some would use the win3.x technology VFW. Many new programs, including Windows XP's scanner and camera wizard, may call you via the WIA interface. If you do not want to implement all that, you need to at least provide the DirectShow interface via WDM and let vfwwdm32.dll gives you a VFW interface, or write your own VFW driver.