Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "cinder/Cinder.h"
00024 #include "cinder/Surface.h"
00025 #include "cinder/Capture.h"
00026 #import <AVFoundation/AVFoundation.h>
00027 #include <vector>
00028
00029 namespace cinder {
00030
00031 class CaptureImplAvFoundationDevice : public Capture::Device {
00032 public:
00033 CaptureImplAvFoundationDevice( AVCaptureDevice *device );
00034 ~CaptureImplAvFoundationDevice();
00035
00036 bool checkAvailable() const;
00037 bool isConnected() const;
00038 Capture::DeviceIdentifier getUniqueId() const { return mUniqueId; }
00039 bool isFrontFacing() const { return mFrontFacing; }
00040 void* getNative() const { return mNativeDevice; }
00041 private:
00042 Capture::DeviceIdentifier mUniqueId;
00043 AVCaptureDevice *mNativeDevice;
00044 bool mFrontFacing;
00045 };
00046
00047 }
00048
00049 @interface CaptureImplAvFoundation : NSObject <AVCaptureVideoDataOutputSampleBufferDelegate> {
00050 AVCaptureSession *mSession;
00051 CVPixelBufferRef mWorkingPixelBuffer;
00052 cinder::Surface8u mCurrentFrame;
00053 NSString *mDeviceUniqueId;
00054
00055 cinder::Capture::DeviceRef mDevice;
00056 bool mHasNewFrame;
00057 bool mIsCapturing;
00058 int32_t mWidth, mHeight;
00059 int32_t mSurfaceChannelOrderCode;
00060 int32_t mExposedFrameBytesPerRow;
00061 int32_t mExposedFrameHeight;
00062 int32_t mExposedFrameWidth;
00063 }
00064
00065 + (const std::vector<cinder::Capture::DeviceRef>&)getDevices:(BOOL)forceRefresh;
00066
00067 - (id)initWithDevice:(const cinder::Capture::DeviceRef)device width:(int)width height:(int)height;
00068 - (bool)prepareStartCapture;
00069 - (void)startCapture;
00070 - (void)stopCapture;
00071 - (bool)isCapturing;
00072 - (cinder::Surface8u)getCurrentFrame;
00073 - (bool)checkNewFrame;
00074 - (const cinder::Capture::DeviceRef)getDevice;
00075 - (int32_t)getWidth;
00076 - (int32_t)getHeight;
00077 - (int32_t)getCurrentFrameBytesPerRow;
00078 - (int32_t)getCurrentFrameWidth;
00079 - (int32_t)getCurrentFrameHeight;
00080
00081 @end