写虚拟网络摄像头? [英] Writing a virtual webcam?
问题描述
我需要创建一个虚拟网络摄像头,作为网络摄像头,但作为输入一组图像,它播放。我看过像ManyCam和Fake Webcam这样的解决方案,但他们似乎有一个限制或其他(分辨率,最大文件大小,fps等)我正在Windows XP SP3。
I need to create a virtual webcam that poses as a webcam, but takes as input a set of images that it plays. I have seen solutions like ManyCam, and Fake Webcam, but they all seem to one limitation or the other (resolution, max file size, fps etc.) I am working on Windows XP SP3.
我知道我必须为这个任务写一个WIA接口,但是作为一个Python程序员,我从来没有为设备编写驱动程序或接口。编写此接口的主要任务是什么?
I understand that I have to write a WIA interface for this task, but being a Python programmer, I have never written drivers or interfaces to devices. What are the main tasks in writing this interface ? What would the flow look like ?
推荐答案
您需要编写DirectShow过滤器,它是一个COM服务器,实现 IPin
,< a href =http://msdn.microsoft.com/en-us/library/dd319784%28v=vs.85%29.aspx> IAMStreamConfig
与 IKsPropertySet
接口。对于 IPin
部分,最好先继承 CSourceStream
类,因为您需要获取Windows SDK,安装SDK将会有一个DirectShow Base在 samples\multimedia\directshow
文件夹中的类源,你会发现 CSourceStream
(在许多其他) 。 DllRegisterServer
COM服务器的功能应该使用过滤器映射器在 CLSID_VideoInputDeviceCategory
类别中注册您的过滤器。
You need to write DirectShow filter which is a COM server that implements an IPin
, IAMStreamConfig
and IKsPropertySet
interfaces. For the IPin
part you'd better to start by inheriting the CSourceStream
class, for that you need to get the Windows SDK, having the SDK installed there would be a DirectShow Base Classes sources in samples\multimedia\directshow
folder, there you'll find the CSourceStream
(among many others). DllRegisterServer
function of the COM server should register your filter within CLSID_VideoInputDeviceCategory
category using filter mapper.
构建COM服务器后,您可以使用 regsvr32
工具注册它,并且您的虚拟网络摄像头应显示在网络摄像头列表中。
After building the COM-server, you register it with regsvr32
tool, and your virtual webcam should appear in the web cam lists.
同时检查 samples\multimedia\directshow\filters\ball
示例,可以改进并用作您的任务的起点。
Also check the samples\multimedia\directshow\filters\ball
sample that can be improved and used as a starting point for your task.
这篇关于写虚拟网络摄像头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!