Graphics Reference
In-Depth Information
FIGURE 7-7
Window of Photo Capture Sample Project
Listing 7-10 shows the code needed to create a
QTCaptureSession
object.
LISTING 7-10
Initializing the Capture Session
- (
void
)initCaptureSession;
{
if
(captureSession ==
nil
)
{
NSError
*error =
nil
;
captureSession = [[QTCaptureSession
alloc
]
init
];
// This finds a device, such as an iSight camera
QTCaptureDevice *videoDevice =
[QTCaptureDevice
defaultInputDeviceWithMediaType:
QTMediaTypeVideo];
if
(videoDevice ==
nil
)
{
// Try a different device, such as miniDV camcorder
videoDevice = [QTCaptureDevice
defaultInputDeviceWithMediaType:
QTMediaTypeMuxed];
}
// No need to continue if we can't find a device
if
(videoDevice ==
nil
)
return
;