關(guān)于AVCaptureDevice

獲取手機(jī)上的設(shè)備
+ (NSArray *)devices;
獲取手機(jī)上某種類型的設(shè)備
+ (NSArray *)devicesWithMediaType:(NSString *)mediaType;
得到某人制定類型的設(shè)備
+ (AVCaptureDevice *)defaultDeviceWithMediaType:(NSString *)mediaType;
得到指定ID類型的設(shè)備
+ (AVCaptureDevice *)deviceWithUniqueID:(NSString *)deviceUniqueID;
獲取媒體的授權(quán)狀態(tài)
+ (AVAuthorizationStatus)authorizationStatusForMediaType:(NSString *)mediaType;
為媒體請求用戶的權(quán)限
+ (void)requestAccessForMediaType:(NSString *)mediaType completionHandler:(void(^)(BOOL granted))handler;
請求調(diào)節(jié)硬件配置的權(quán)限
- (BOOL)lockForConfiguration:(NSError **)outError;
放棄調(diào)節(jié)硬件配置的權(quán)限
- (void)unlockForConfiguration;
是否允許調(diào)節(jié)焦點(diǎn)模式
- (BOOL)isFocusModeSupported:(AVCaptureFocusMode)focusMode;

   AVCaptureFocusModeLocked      關(guān)閉對焦

   AVCaptureFocusModeAutoFocus   自動(dòng)對焦

   AVCaptureFocusModeContinuousAutoFocus  自動(dòng)連續(xù)對焦`

對焦模式

@property(nonatomic) AVCaptureFocusMode focusMode;

是否允許設(shè)置自己感興趣的焦點(diǎn)
@property(nonatomic, readonly, getter=isFocusPointOfInterestSupported) BOOLfocusPointOfInterestSupported;

自己感興趣的對焦點(diǎn)

@property(nonatomic) CGPoint focusPointOfInterest;

是否允許調(diào)節(jié)焦點(diǎn)

@property(nonatomic, readonly, getter=isAdjustingFocus) BOOL adjustingFocus;

自動(dòng)對焦的范圍是否有限制

@property(nonatomic, readonly, getter=isAutoFocusRangeRestrictionSupported)BOOL autoFocusRangeRestrictionSupported;

自動(dòng)對焦的區(qū)域限制

@property(nonatomic) AVCaptureAutoFocusRangeRestrictionautoFocusRangeRestriction;

 AVCaptureAutoFocusRangeRestrictionNone  沒有限制

 AVCaptureAutoFocusRangeRestrictionNear   近處

 AVCaptureAutoFocusRangeRestrictionFar    遠(yuǎn)處

是否支持平滑對焦

@property(nonatomic, readonly, getter=isSmoothAutoFocusSupported) BOOLsmoothAutoFocusSupported NS_AVAILABLE_IOS(7_0);

是否允許平滑對焦

@property(nonatomic, getter=isSmoothAutoFocusEnabled) BOOLsmoothAutoFocusEnabled NS_AVAILABLE_IOS(7_0);

曝光調(diào)節(jié)

是否允許調(diào)節(jié)曝光

@property(nonatomic,readonly, getter=isAdjustingExposure) BOOL adjustingExposure

曝光模式

@property(nonatomic)AVCaptureExposureMode exposureMode

 AVCaptureExposureModeLocked  鎖定曝光

 AVCaptureExposureModeAutoExpose   自動(dòng)曝光

 AVCaptureExposureModeContinuousAutoExposure    自動(dòng)持續(xù)曝光

 AVCaptureExposureModeCustom    自定義曝光

曝光模式是否支持

-(BOOL)isExposureModeSupported:(AVCaptureExposureMode)exposureMode

感興趣的曝光點(diǎn)

@property(nonatomic)CGPoint exposurePointOfInterest

是否支持感興趣的曝光點(diǎn)調(diào)節(jié)

@property(nonatomic,readonly, getter=isExposurePointOfInterestSupported) BOOLexposurePointOfInterestSupported

是否支持白平衡模式

-(BOOL)isWhiteBalanceModeSupported:(AVCaptureWhiteBalanceMode)whiteBalanceMode

 AVCaptureWhiteBalanceModeLocked           鎖定

 AVCaptureWhiteBalanceModeAutoWhiteBalance  自動(dòng)白平衡

 AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance 自動(dòng)持續(xù)白平衡```
 白平衡模式
 `@property(nonatomic)AVCaptureWhiteBalanceMode whiteBalanceMode`

 是否允許調(diào)節(jié)白平衡

` @property(nonatomic,readonly, getter=isAdjustingWhiteBalance) BOOL adjustingWhiteBalance`

 //

 `@property(nonatomic)CGFloat videoZoomFactor`

 //
` -(void)rampToVideoZoomFactor:(CGFloat)factor
 withRate:(float)rate`
 //
 `-(void)cancelVideoZoomRamp`
 //
` @property(nonatomic,readonly, getter=isRampingVideoZoom) BOOL rampingVideoZoom`
   ##閃光燈設(shè)置

設(shè)備是否有閃光燈
 `@property(nonatomic,readonly) BOOL hasFlash`
   //閃光燈模式
` @property(nonatomic)AVCaptureFlashMode flashMode`

 ```objc
 AVCaptureFlashModeOff     關(guān)
 AVCaptureFlashModeOn     開
 AVCaptureFlashModeAuto   自動(dòng)```
  是否支持設(shè)定的閃光燈模式
` -(BOOL)isFlashModeSupported:(AVCaptureFlashMode)flashMode`
當(dāng)前閃光燈是否處于活動(dòng)狀態(tài)
` @property(nonatomic,readonly, getter=isFlashActive) BOOL flashActive`
   當(dāng)前閃光燈是否處于可用狀態(tài)
` @property(nonatomic,readonly, getter=isFlashAvailable) BOOL flashAvailable`
  ##手電筒設(shè)置

   當(dāng)前設(shè)備是否有手電筒

` @property(nonatomic,readonly) BOOL hasTorch`

   手電筒是否可用
 `@property(nonatomic,readonly, getter=isTorchAvailable) BOOL torchAvailable`

   手電筒是否處于活動(dòng)狀態(tài)

` @property(nonatomic,readonly, getter=isTorchActive) BOOL torchActive`

 

   手電筒亮度調(diào)節(jié)

` @property(nonatomic,readonly) float torchLevel`

 

   手電筒模式

` -(BOOL)isTorchModeSupported:(AVCaptureTorchMode)torchMode`

 

  ```objc
   AVCaptureTorchModeOff    關(guān)

   AVCaptureTorchModeOn     開

   AVCaptureTorchModeAuto   自動(dòng)```

 

   調(diào)節(jié)手電筒的亮度

 ` -(BOOL)setTorchModeOnWithLevel:(float)torchLevel
 error:(NSError**)outError`

 
  
##低亮度設(shè)置
  是否支持低亮度下提高亮度

` @property(nonatomic,readonly, getter=isLowLightBoostSupported) BOOL lowLightBoostSupported`

 

   是否允許低亮度調(diào)節(jié)

` @property(nonatomic,readonly, getter=isLowLightBoostEnabled) BOOL lowLightBoostEnabled`

 

   自動(dòng)允許低亮狀態(tài)下提高亮度

` @property(nonatomic)BOOL automaticallyEnablesLowLightBoostWhenAvailable`
##屏幕比率設(shè)置
   最小屏幕的持續(xù)時(shí)間

` @property(nonatomic)CMTime activeVideoMinFrameDuration`

 

   最大屏幕的持續(xù)時(shí)間

 `@property(nonatomic)CMTime activeVideoMaxFrameDuration`

 

 
##監(jiān)測區(qū)域的改變

   是否允許監(jiān)視區(qū)域的改變,便于重新聚焦 調(diào)節(jié)白平衡,調(diào)節(jié)曝光等

 `@property(nonatomic,getter=isSubjectAreaChangeMonitoringEnabled) BOOLsubjectAreaChangeMonitoringEnabled`

 
##檢查設(shè)備的特性

 

   當(dāng)前設(shè)備是否連接

` @property(nonatomic,readonly, getter=isConnected) BOOL connected`

 

當(dāng)前設(shè)備的位置

` @property(nonatomic,readonly) AVCaptureDevicePosition position`

 

 ```objc
 AVCaptureDevicePositionUnspecified  未制定

 AVCaptureDevicePositionBack        后

 AVCaptureDevicePositionFront      前```

 

   判斷當(dāng)前設(shè)備是否有給定的媒體類型

 `-(BOOL)hasMediaType:(NSString *)mediaType`

 

   modelID  所有設(shè)備相同model的不同ID

 `@property(nonatomic,readonly) NSString *modelID`

   設(shè)備的本地名字

 `@property(nonatomic,readonly) NSString *localizedName`

 

   uniqueID

 `@property(nonatomic,readonly) NSString *uniqueID`

 

   是否允許捕捉期間預(yù)先設(shè)置參數(shù)

` -(BOOL)supportsAVCaptureSessionPreset:(NSString *)preset`

 

   鏡頭的光圈 (只讀)

` @property(nonatomic,readonly) float lensAperture`

 
 ##鏡頭的位置
 鏡頭的位置(只讀)

 `@property(nonatomic,readonly) float lensPosition`

 

 調(diào)節(jié)鏡頭的位置

` -(void)setFocusModeLockedWithLensPosition:(float)lensPosition
 completionHandler:(void(^)(CMTime syncTime))handler`

圖像曝光

   曝光時(shí)長(只讀)
` @property(nonatomic,readonly) CMTime exposureDuration`

 

   調(diào)解自定義曝光模式和時(shí)長

 `-(void)setExposureModeCustomWithDuration:(CMTime)duration
 ISO:(float)ISO completionHandler:(void(^)(CMTime syncTime))handler`

 

   曝光的偏移量

` @property(nonatomic,readonly) float exposureTargetOffset`

 

   曝光目標(biāo)的傾斜

` @property(nonatomic,readonly) float exposureTargetBias`

 最大的傾斜
 `@property(nonatomic,readonly) float maxExposureTargetBias`

 最小的傾斜
` @property(nonatomic,readonly) float maxExposureTargetBias`

 調(diào)節(jié)曝光傾斜
 `-(void)setExposureTargetBias:(float)bias
 completionHandler:(void(^)(CMTime syncTime))handler`
##白平衡

  白平衡色度調(diào)節(jié)

`-(AVCaptureWhiteBalanceChromaticityValues)chromaticityValuesForDeviceWhiteBalanceGains:(AVCaptureWhiteBalanceGains)whiteBalanceGains`

 

   獲取白平衡增益
` @property(nonatomic,readonly) AVCaptureWhiteBalanceGains deviceWhiteBalanceGains`
   最大的白平衡增益
 `@property(nonatomic,readonly) float maxWhiteBalanceGain`
   設(shè)備的白平衡色彩度
 `-(AVCaptureWhiteBalanceGains)deviceWhiteBalanceGainsForChromaticityValues:(AVCaptureWhiteBalanceChromaticityValues)chromaticityValues`


   溫度和色彩度的白平衡調(diào)節(jié)
`-(AVCaptureWhiteBalanceGains)deviceWhiteBalanceGainsForTemperatureAndTintValues:(AVCaptureWhiteBalanceTemperatureAndTintValues)tempAndTintValues`

 //
` @property(nonatomic,readonly) AVCaptureWhiteBalanceGains grayWorldDeviceWhiteBalanceGains`

 //
`-(void)setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:(AVCaptureWhiteBalanceGains)whiteBalanceGains
completionHandler:(void(^)(CMTime syncTime))handler` 

 // `-(AVCaptureWhiteBalanceTemperatureAndTintValues)temperatureAndTintValuesForDeviceWhiteBalanceGains:(AVCaptureWhiteBalanceGains)whiteBalanceGains`

 

##ISO
   曝光的ISO值
 `@property(nonatomic,readonly) float ISO`
##HDR
 

  是否允許自動(dòng)調(diào)節(jié)HDR
`@property(nonatomic)BOOL automaticallyAdjustsVideoHDREnabled`
 是否允許HDR調(diào)節(jié)
` @property(nonatomic,getter=isVideoHDREnabled) BOOL videoHDREnabled`
 
 ##常量

```objc
 AVCaptureDevicePositionUnspecified = 0, 未規(guī)定
 AVCaptureDevicePositionBack  = 1,   后
 AVCaptureDevicePositionFront = 2   前

 AVCaptureFlashModeOff    = 0, 閃光燈關(guān)
 AVCaptureFlashModeOn     = 1, 閃光燈開
 AVCaptureFlashModeAuto   = 2  自動(dòng)

 AVCaptureTorchModeOff    = 0, 手電筒關(guān)
 AVCaptureTorchModeOn     = 1, 手電筒開
 AVCaptureTorchModeAuto   = 2  手電筒自動(dòng)

 const float AVCaptureMaxAvailableTorchLevel  手電筒最大亮度

 AVCaptureFocusModeLocked               = 0, 不對焦
 AVCaptureFocusModeAutoFocus            = 1,  自動(dòng)對焦
 AVCaptureFocusModeContinuousAutoFocus   = 2,  持續(xù)對焦

 AVCaptureExposureModeLocked                   = 0, 不曝光
 AVCaptureExposureModeAutoExpose               = 1, 自動(dòng)曝光
 AVCaptureExposureModeContinuousAutoExposure    = 2, 持續(xù)曝光
 AVCaptureExposureModeCustom                   = 3, 自定義曝光

 AVCaptureWhiteBalanceModeLocked            = 0,  關(guān)閉拍平衡模式
 AVCaptureWhiteBalanceModeAutoWhiteBalance   = 1, 自動(dòng)白平衡
 AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance = 2, 持續(xù)拍平衡

 AVAuthorizationStatusNotDetermined = 0, 授權(quán)狀態(tài)不確定
 AVAuthorizationStatusRestricted,   受限制的授權(quán)狀態(tài)
 AVAuthorizationStatusDenied,       無權(quán)訪問
 AVAuthorizationStatusAuthorized    授權(quán)

 AVCaptureAutoFocusRangeRestrictionNone = 0, 自動(dòng)對焦區(qū)域無限制
 AVCaptureAutoFocusRangeRestrictionNear = 1, 近
 AVCaptureAutoFocusRangeRestrictionFar  = 2, 遠(yuǎn)

 const AVCaptureWhiteBalanceGainsAVCaptureWhiteBalanceGainsCurrent; 當(dāng)前白平衡增益
 const float AVCaptureLensPositionCurrent  當(dāng)前鏡頭位置
 const float AVCaptureISOCurrent 當(dāng)前ISO
 const float AVCaptureExposureTargetBiasCurrent 當(dāng)前曝光傾斜
 const CMTime AVCaptureExposureDurationCurrent; 當(dāng)前曝光時(shí)間
 
 通知Notifications
 AVCaptureDeviceWasConnectedNotification  已連接通知
 AVCaptureDeviceWasDisconnectedNotification 未連接通知
 AVCaptureDeviceSubjectAreaDidChangeNotification 區(qū)域改變通知```
[原文連接](http://blog.csdn.net/qq_34353990/article/details/51547400)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容