为OS X构建虚拟相机 [英] Building a virtual camera for OS X

查看:100
本文介绍了为OS X构建虚拟相机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在像Skype这样的程序中获得合成的视频流.音频部分很简单.有一个名为 Soundflower 的项目,它是一个适配器.它在一侧提供了一个虚拟的音频目标设备,在另一侧提供了一个视频源.我正在寻找OSX的相同解决方案.除了我只需要部分如何将其呈现为虚拟相机.不要误会,我不需要即用型"工具,我需要如何开发它的方式.因此,现成的工具仅对源代码有用.

I need to get a synthetic generated video stream in a program like skype. The audio part is easy. There is a project called Soundflower which is an adapter. It presents a virtual audio destination device on the one side and a video source on the other side. I am searching for the same solution for OSX. Except I only need the part how to present it as a virtual camera. Do not misunderstood, I do not need a "ready to use" tool, I need the way how to develop it. So a ready to use tool is only helpful with the source code.

在我来自Windows的世界中,我已经使用DirectShow编写了这样的虚拟摄像机.现在,我正在OSX世界中寻找类似的解决方案.

In the Windows world, where I came from, I already programmed such a Virtual Camera using DirectShow. Now I am searching for a similar solution in the OSX world.

推荐答案

在某种程度上,这取决于您希望与之交互的应用程序.如果它是老式的QuickTime应用程序(32位,10.8或更早版本),则需要编写一个QuickTime vdig(视频数字化仪)组件.这基本上是一个插件,提供了可以由任何QT兼容应用程序动态枚举和调用的特定接口.但是,这一切现在都已弃用(从10.9开始)!

This depends to some extent on the application with which you wish to interface. If it is an old-school QuickTime app (32-bit, 10.8 or earlier), you would need to write a QuickTime vdig (video digitiser) component. This is basically a plugin that provides a certain interface that can be dynamically enumerated and invoked by any QT-compatible app. However, this is all now deprecated (as of 10.9)!

现代方法是使用Core Media I/O Framework.不幸的是,它没有像大多数其他框架那样完整地记录在案,因为只有一小部分开发人员(需要创建硬件接口)使用了它.

The modern approach is to use the Core Media I/O Framework. Unfortunately, it isn't as thoroughly documented as most of the other frameworks, as it is used by only a fraction of the developer base (who need to create hardware interfaces).

有一个可用的SDK项目,其中包含CoreMedia框架以及一些示例代码:

There's an SDK project available, which contains the CoreMedia framework plus some example code:

专门看一下IOVideoSampleDevice.

您可能不需要kext(内核扩展名),因为您无需与真实的硬件连接.因此,希望您能够实现所需的CMIO接口并注册设备类型.

You probably won't need a kext (kernel extension) as you won't be interfacing with real hardware. So hopefully you will just be able to get by with implementing the required CMIO interfaces and registering your device type.

有一本很棒的书,涵盖了OS X和iOS的驱动程序开发:

There's a great book available which covers driver development for OS X and iOS:

(免责声明:作者是我的大学和朋友.)

(Disclaimer: the authors are colleges and friends of mine.)

QuickTime曾经与DirectShow等效.现在,CoreMedia和朋友已经用更现代,更灵活的API取代了它.

QuickTime used to be the DirectShow equivalent. Now, CoreMedia and friends have superseded it, with a far more modern and flexible API.

这篇关于为OS X构建虚拟相机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆