Q: How can I disable the audio or video stream when capturing from a muxed device?A: Muxed devices such as DV and HDV Cameras are represented in QTKit Capture by the media type QTMediaTypeMuxed. To only capture a single stream from the device (for example video only), disable the audio connections on the device input for the capture device by using the QTCaptureConnection method setEnabled: and passing in NO. Listing 1: Disable Audio Connections From A Muxed Device Input.
QTCaptureDevice *theDefaultMuxedDevice;
QTCaptureDeviceInput *theDeviceInput;
BOOL success;
NSError *error;
...
// get the default muxed device
theDefaultMuxedDevice = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeMuxed];
// open the device
success = [theDefaultMuxedDevice open:&error];
if (YES == success) {
// get the associated device input
theDeviceInput = [QTCaptureDeviceInput deviceInputWithDevice:theDefaultMuxedDevice];
// get the list of owned connections
NSArray *ownedConnections = [theDeviceInput connections];
// disable all the audio connections
for (QTCaptureConnection *connection in ownedConnections) {
if ( [[connection mediaType] isEqualToString:QTMediaTypeSound] ) {
[connection setEnabled:NO];
}
}
} else {
// do something with the error code
}
...
If you only want to capture audio, disable the QTMediaTypeVideo connections. References:Introduction to QTKit Capture Programming Guide Back to Top  Document Revision History| Date | Notes |
|---|
| 2008-05-19 | First Version |
Posted: 2008-05-19
|