0

I am programming a video capture application using QTKit. It is set up so that users must select a webcam from the list obtained with [QTCaptureDevice inputDevicesWithMediaType: QTMediaTypeVideo]. I want the user to be able to choose a camera, and have the corresponding microphone automatically selected, but I don't see a way to accomplish this within QTKit.

My application needs to run on OSX 10.6 to 10.8, so I can't use AVFoundation, which arrived in 10.7. QuickTime is deprecated at this point.

So the question is: On Mac OS 10.6 to 10.8, how can I automatically match a webcam camera with it's embedded microphone.

Thanks

SteveS
  • 514
  • 3
  • 16

1 Answers1

0

The documented way of doing this is found in the QTCaptureDevice Class Reference, using method attributeForKey with a key of QTCaptureDeviceLinkeDevicesAttribute, which may be called like so.

QTCaptureDevice* device = [QTCaptureDevice deviceWithUniqueID:deviceUniqueID];
QTCaptureDevice* sibling = Nil;
NSArray* linkedDevices = [device attributeForKey: QTCaptureDeviceLinkeDevicesAttribute
NSUInteger linkedCount = [linkedDevices count];

for (NSUInteger i = 0; i < linkedCount; i++)
{
    sibling = [linkedDevicesobjectAtIndex: i];
    .
    .
    .
}

However, I have not seen this work, the returned array is always Nil. Additionally This Apple Mailing List Archive suggests that it may only work for Apple iSight devices :(.

Finally, An additional sample may be found here: Apple QTRecorder Sample

SteveS
  • 514
  • 3
  • 16