15 ottobre 2009

Hidden Gems of Snow Leopard: IOSurface (with video in)

Video input

I've modified the command line tool to accept some more params, in order to use as frame source a video input. The code, thanks to the QTCapture framework, is pretty straightforward, and it's interesting to note that very little was needed to get it working. Clearly, although with little documentation, IOSurface integrates perfectly in the existing technologies!


Previous posts:

10 ottobre 2009

Hidden Gems of Snow Leopard: IOSurface (again)

The QCPlugin

To extend the previous sample, I've now added a Quartz Composer plugin that spawns the CLI application: it's also possible to choose at compilation time (through a #define) if the image has to be provided to QC as a GL texture or a pixel buffer.
A sample composition has been included in the code.

Notes
  • The embedded CLI application is set as a dependency for the other 2 targets in the project, and should be compiled automatically: however, in certain cases it appears that Xcode "forgets" to apply the build flags, and tries to compile in 64 bits (that fails, as Quicktime doesn't exist in that universe). To solve this issue, compile the IOSurfaceCLI target separately.
  • A bug seems to affect Quartz Composer whenever a movie is started and stopped multiple times: the projection matrix, for some reason, isn't reset, and the frame appears much bigger than it should. A bug report has been posted to Apple.


Other posts on the same argument: