
I took a few hours Sunday to take my earlier QTKit capture experiment 2 and get a live camera-switch working. In particular, I want to have multiple cameras capturing at once, something QTKit can do and QuickTime can’t.
I realized that the typical simple Cocoa arrangement of a single window and a controller object wasn’t appropriate for what would need to be a multi-window app. To get multiple windows up and running quickly, I opted for a Cocoa document-based application, figuring each “document” will be a simple delegate to a QTCaptureSession object, and then removing everything relating to saving and loading the document from disk (since that’s not really the point here). I imagine the clean way to do this would be to manage my own windows with NSWindowControllers, but this got me up and running quickly.
To wit, I didn’t think the preview of the default device would work when I copied it over from the old code, since I didn’t think I’d written anything to actually find the default video device and wire it up to the QTCaptureView. But as it turns out, in my blind copying, I’d copied awakeFromNib, in which I was doing all this work, and it’s called every time you create a new window in a document-based Cocoa application. So, bonus: I got the basics up and running more or less for free.
However, wildly slapping code around has its limits, and my attempts to find other devices and get their QTCaptureOutputs’ connections wired up to the preview haven’t worked. I’m going to remove all that code and take a more deliberate approach, pairing each window’s session object only with the selected device.
Hopefully the next time I blog on this, I’ll have three windows from three different cams.
Oh, and then handle audio.





1 Comment
1. [Time code];&hellip replies at 4th December 2007 um 5:30 pm :
[...] that came together a lot faster than I thought it [...]
Leave a comment
You must be logged in to post a comment.