2012/3/20

AvFundaction Capture Note




  1. AVCaptureInput:AVCaptrueDeviceInput
  2. 立AVCaptureOutput:AVCaptureStillImageOutputAVCaptureMovieFileOutput
  3. 建立session:AVCaptrueSessuon
  4. 連inputoutput與session
  5. AVCaptureVideoPreviewLayer與session
  6. 將AVCaptureVideoPreviewLayer的view的layer
  7. 透過[session startRunning],將預覽畫面顯示到previewLayer上



  1. connection是input、output與session之間的橋梁,先取得介於output與session之間的connection,並設定錄影水平方向
  2. 執行AVCaptureOutput的startRecordingToOutputFileURL:recordingDelegate:
  3. AVCaptureOutput 的isRecording會變成YES
三、影結束
  1. AVCaptureOutputinstance的AVCaptureOutput


其他附註
取得所有裝置
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];

過濾出所要的裝置
    
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
for (AVCaptureDevice *device in devices) {
    if ([device position] == position) {
    return device;
    }
}
return nil;






取得裝置清單
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
- (AVCaptureDevice *) cameraWithPosition:(AVCaptureDevicePosition) position
{
    NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
    for (AVCaptureDevice *device in devices) {
        if ([device position] == position) {
            return device;
        }
    }
    return nil;
}






Torch mode

Torch mode is where a camera uses the flash continuously at a low power to illuminate a video capture. There are three torch modes:
You use hasTorch to determine whether a device has a flash. You use the isTorchModeSupported: method to determine whether a device supports a given flash mode, then set the mode using the torchMode property.
For devices with a torch, the torch only turns on if the device is associated with a running capture session.


取得音源裝置
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio];


沒有留言: