Created
September 6, 2010 00:18
-
-
Save soh335/566472 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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