I want to use AVFoundation Fameworkto preview and capture photos. I created AVCaptureSessionand added AVCaptureVideoDataOutput, AVCaptureStillImageOutputto that session. I set the preset to AVCaptureSessionPresetLow.
Now I want to take a photo in full resolution . But within the captureStillImageAsynchronouslyFromConnectionresolution is the same as in my preview delegate.
Here is my code:
AVCaptureSession* cameraSession = [[AVCaptureSession alloc] init];
cameraSession.sessionPreset = AVCaptureSessionPresetLow;
AVCaptureVideoDataOutput* output = [[AVCaptureVideoDataOutput alloc] init];
[cameraSession addOutput:output];
AVCaptureStillImageOutput* cameraStillImage = [[AVCaptureStillImageOutput alloc] init];
[cameraSession addOutput:cameraStillImage];
dispatch_queue_t queue = dispatch_queue_create("MyQueue", NULL);
[output setSampleBufferDelegate:self queue:queue];
dispatch_release(queue);
[cameraSession startRunning];
Photo:
[cameraStillImage captureStillImageAsynchronouslyFromConnection:photoConnection completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error)
{
...
}];
I tried this by changing the preset to a photo just for image capture. But it is very slow (it takes 2-3 seconds to change the preset). I do not want to have such a big delay.
How can i do this? Thank.