Blame | Last modification | View Log | RSS feed
//
// CameraQuickTime.cpp
// cameraCapture
//
// Created by Jakob Wilm on 04/04/13.
// Copyright (c) 2013 Jakob Wilm. All rights reserved.
//
#include "CameraQuickTime.h"
#import <Foundation/Foundation.h>
#import <QTKit/QTKit.h>
static vector<CameraInfo> GetCameraList(){};
CameraQuickTime::CameraQuickTime(){
QTCaptureDevice *video = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo];
NSError *error = nil;
BOOL success = true;
success = [video open:&error];
// QTCaptureDeviceInput is the object that will use the
// device as input, i.e. handle the photo-taking
QTCaptureDeviceInput *input = [[QTCaptureDeviceInput alloc] initWithDevice:video];
// Session handles the input and output of both objects
QTCaptureSession *session = [[QTCaptureSession alloc] init];
// Add our input object as input for this particular session
// (the code is pretty self-explanatory)
success = [session addInput:input error:&error];
// // Create an object for outputing the video
// // The input will tell the session object that it has taken
// // some data, which will in turn send this to the output
// // object, which has a delegate that you defined
// output = [[QTCaptureDecompressedVideoOutput alloc] init];
//
// // This is the delegate. Note the
// // captureOutput:didOutputVideoFrame...-method of this
// // object. That is the method which will be called when
// // a photo has been taken.
// [output setDelegate:self];
// Add the output-object for the session
success = [session addOutput:output error:&error];
if ( ! success || error )
{
NSLog(@"Did succeed in connecting output to session: %d", success);
NSLog(@"Error: %@", [error localizedDescription]);
return nil;
}
// Because the input stream is video we will be getting
// many frames after each other, we take the first one
// we get and store it, and don't accept any more after
// we already have one
currentImage = nil;
[session startRunning];
}
Generated by GNU Enscript 1.6.6.