Skip to content

Instantly share code, notes, and snippets.

@soh335
Created September 6, 2010 00:18
Show Gist options
  • Save soh335/566472 to your computer and use it in GitHub Desktop.
Save soh335/566472 to your computer and use it in GitHub Desktop.
#import <Cocoa/Cocoa.h>
#import <QTKit/QTKit.h>
#import <QTKit/QTCaptureSession.h>
#import <QTKit/QTCaptureDeviceInput.h>
#import <QTKit/QTCaptureView.h>
@interface CaptureTestAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
QTCaptureSession *mCaptureSession;
QTCaptureVideoPreviewOutput *mCaptureVideoPreviewOutput;
QTCaptureDeviceInput *mCaptureVideoDeviceInput;
IBOutlet QTCaptureView *mCaptureView;
}
@property (assign) IBOutlet NSWindow *window;
@end
#import "CaptureTestAppDelegate.h"
@implementation CaptureTestAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
mCaptureSession = [[QTCaptureSession alloc] init];
QTCaptureDevice *videoDevice = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo];
BOOL success = NO;
NSError *error;
success = [videoDevice open:&error];
[videoDevice open:&error];
mCaptureVideoDeviceInput = [[QTCaptureDeviceInput alloc] initWithDevice:videoDevice];
success = [mCaptureSession addInput:mCaptureVideoDeviceInput error:&error];
[mCaptureView setCaptureSession:mCaptureSession];
[mCaptureSession startRunning];
[mCaptureView setDelegate:self];
}
- (CIImage *)view:(QTCaptureView *)view willDisplayImage :(CIImage *)image;
{
return image;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment