1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // VideoCaptureDeviceQTKit implements all QTKit related code for 6 // communicating with a QTKit capture device. 7 8 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_QTKIT_H_ 9 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_QTKIT_H_ 10 11 #import <Foundation/Foundation.h> 12 13 #include <vector> 14 15 namespace media { 16 class VideoCaptureDeviceMac; 17 } 18 19 @class QTCaptureDeviceInput; 20 @class QTCaptureSession; 21 22 @interface VideoCaptureDeviceQTKit : NSObject { 23 @private 24 // Settings. 25 int frameRate_; 26 int frameWidth_; 27 int frameHeight_; 28 29 NSLock *lock_; 30 media::VideoCaptureDeviceMac *frameReceiver_; 31 32 // QTKit variables. 33 QTCaptureSession *captureSession_; 34 QTCaptureDeviceInput *captureDeviceInput_; 35 36 // Buffer for adjusting frames which do not fit receiver 37 // assumptions. scoped_array<> might make more sense, if the size 38 // can be proven invariant. 39 std::vector<UInt8> adjustedFrame_; 40 } 41 42 // Returns a dictionary of capture devices with friendly name and unique id. 43 + (NSDictionary *)deviceNames; 44 45 // Initializes the instance and registers the frame receiver. 46 - (id)initWithFrameReceiver:(media::VideoCaptureDeviceMac *)frameReceiver; 47 48 // Set the frame receiver. 49 - (void)setFrameReceiver:(media::VideoCaptureDeviceMac *)frameReceiver; 50 51 // Sets which capture device to use. Returns YES on sucess, NO otherwise. 52 - (BOOL)setCaptureDevice:(NSString *)deviceId; 53 54 // Configures the capture properties. 55 - (BOOL)setCaptureHeight:(int)height width:(int)width frameRate:(int)frameRate; 56 57 // Start video capturing. Returns YES on sucess, NO otherwise. 58 - (BOOL)startCapture; 59 60 // Stops video capturing. 61 - (void)stopCapture; 62 63 @end 64 65 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_QTKIT_H_ 66