| /* |
| * Copyright 2012 ZXing authors |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #include <QuartzCore/QuartzCore.h> |
| #import "ZXCaptureDelegate.h" |
| |
| @protocol ZXReader; |
| @class ZXDecodeHints; |
| |
| #if !TARGET_IPHONE_SIMULATOR |
| #if TARGET_OS_EMBEDDED |
| #include <AVFoundation/AVFoundation.h> |
| #define ZX(x) x |
| #define ZXAV(x) x |
| #define ZXAVC(x) ,x |
| #define ZXQT(x) |
| #define ZXCaptureSession AVCaptureSession |
| #define ZXCaptureVideoPreviewLayer AVCaptureVideoPreviewLayer |
| #define ZXCaptureDevice AVCaptureDevice |
| #define ZXCaptureDeviceInput AVCaptureDeviceInput |
| #define ZXCaptureVideoOutput AVCaptureVideoDataOutput |
| #else |
| #import <QTKit/QTKit.h> |
| #define ZX(x) x |
| #define ZXAV(x) |
| #define ZXAVC(x) |
| #define ZXQT(x) x |
| #define ZXCaptureSession QTCaptureSession |
| #define ZXCaptureVideoPreviewLayer QTCaptureLayer |
| #define ZXCaptureDevice QTCaptureDevice |
| #define ZXCaptureDeviceInput QTCaptureDeviceInput |
| #define ZXCaptureVideoOutput QTCaptureDecompressedVideoOutput |
| #endif |
| |
| @interface ZXCapture |
| : NSObject |
| ZX(<CAAction ZXAVC(AVCaptureVideoDataOutputSampleBufferDelegate)>) { |
| ZX( |
| ZXCaptureSession *session; |
| ZXCaptureVideoPreviewLayer *layer; |
| ZXCaptureDevice *capture_device; |
| ZXCaptureDeviceInput *input; |
| ZXCaptureVideoOutput *output; |
| ) |
| |
| int order_in_skip; |
| int order_out_skip; |
| BOOL running; |
| BOOL on_screen; |
| CALayer *luminance; |
| CALayer *binary; |
| size_t width; |
| size_t height; |
| size_t reported_width; |
| size_t reported_height; |
| NSString *captureToFilename; |
| BOOL hard_stop; |
| int camera; |
| BOOL torch; |
| BOOL mirror; |
| int capture_device_index; |
| CGAffineTransform transform; |
| BOOL cameraIsReady; |
| } |
| |
| @property (nonatomic, weak) id<ZXCaptureDelegate> delegate; |
| @property (nonatomic, copy) NSString *captureToFilename; |
| @property (nonatomic) CGAffineTransform transform; |
| @property (nonatomic, readonly) ZXCaptureVideoOutput *output; |
| @property (nonatomic, readonly) CALayer *layer; |
| @property (nonatomic, retain) ZXCaptureDevice *captureDevice; |
| @property (nonatomic, assign) BOOL mirror; |
| @property (nonatomic, readonly) BOOL running; |
| @property (nonatomic, retain) id<ZXReader> reader; |
| @property (nonatomic, retain) ZXDecodeHints *hints; |
| @property (nonatomic, assign) CGFloat rotation; |
| |
| - (id)init; |
| - (CALayer *)luminance; |
| - (void)setLuminance:(BOOL)on_off; |
| - (CALayer *)binary; |
| - (void)setBinary:(BOOL)on_off; |
| - (void)start; |
| |
| // Nest Labs addition: |
| - (void)stopAndFreezeOutput:(BOOL)freezeOutput; |
| |
| - (void)stop; |
| - (void)hard_stop; |
| - (void)order_skip; |
| |
| @property (nonatomic, readonly) BOOL hasFront; |
| @property (nonatomic, readonly) BOOL hasBack; |
| @property (nonatomic, readonly) BOOL hasTorch; |
| |
| @property (nonatomic, readonly) int front; |
| @property (nonatomic, readonly) int back; |
| |
| @property (nonatomic) int camera; |
| @property (nonatomic) BOOL torch; |
| |
| @end |
| |
| #else |
| |
| @interface ZXCapture : NSObject { |
| // Nest Labs addition: |
| // Prevents compilation errors on simulator |
| BOOL running; |
| } |
| |
| @property (nonatomic,weak) id<ZXCaptureDelegate> delegate; |
| @property (nonatomic,copy) NSString *captureToFilename; |
| @property (nonatomic) CGAffineTransform transform; |
| @property (nonatomic, readonly) void *output; |
| @property (weak, nonatomic, readonly) CALayer *layer; |
| @property (nonatomic, strong) id<ZXReader> reader; |
| @property (nonatomic, strong) ZXDecodeHints *hints; |
| @property (nonatomic, assign) CGFloat rotation; |
| |
| - (id)init; |
| - (CALayer *)luminance; |
| - (void)setLuminance:(BOOL)on_off; |
| - (CALayer *)binary; |
| - (void)setBinary:(BOOL)on_off; |
| - (void)start; |
| - (void)stop; |
| |
| // Nest Labs addition: |
| - (void)stopAndFreezeOutput:(BOOL)freezeOutput; |
| |
| - (void)hard_stop; |
| - (void)order_skip; |
| |
| @property (nonatomic,readonly) BOOL hasFront; |
| @property (nonatomic,readonly) BOOL hasBack; |
| @property (nonatomic,readonly) BOOL hasTorch; |
| |
| @property (nonatomic,readonly) int front; |
| @property (nonatomic,readonly) int back; |
| |
| @property (nonatomic) int camera; |
| @property (nonatomic) BOOL torch; |
| |
| @property (nonatomic, assign) BOOL mirror; |
| |
| // Nest Labs addition: |
| // Prevents compilation errors on simulator |
| @property (nonatomic, readonly) BOOL running; |
| |
| @end |
| |
| #endif |