且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为OS X构建虚拟相机

更新时间:2023-11-04 20:40:04

在某种程度上,这取决于您希望与之交互的应用程序.如果它是老式的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.