Merge pull request #7044 from wolever:master

pull/6862/merge
Alexander Alekhin 9 years ago
commit 44bda8fbb7
  1. 3
      modules/videoio/src/cap_ios_abstract_camera.mm
  2. 11
      modules/videoio/src/cap_ios_video_camera.mm

@ -193,6 +193,7 @@
// Release any retained subviews of the main view. // Release any retained subviews of the main view.
// e.g. self.myOutlet = nil; // e.g. self.myOutlet = nil;
if (self.captureSession) {
for (AVCaptureInput *input in self.captureSession.inputs) { for (AVCaptureInput *input in self.captureSession.inputs) {
[self.captureSession removeInput:input]; [self.captureSession removeInput:input];
} }
@ -203,6 +204,8 @@
[self.captureSession stopRunning]; [self.captureSession stopRunning];
self.captureSession = nil; self.captureSession = nil;
}
self.captureVideoPreviewLayer = nil; self.captureVideoPreviewLayer = nil;
self.videoCaptureConnection = nil; self.videoCaptureConnection = nil;
captureSessionLoaded = NO; captureSessionLoaded = NO;

@ -122,10 +122,6 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
- (void)stop; - (void)stop;
{ {
if (self.running == NO) {
return;
}
[super stop]; [super stop];
self.videoDataOutput = nil; self.videoDataOutput = nil;
@ -134,22 +130,25 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
} }
if (self.recordVideo == YES) { if (self.recordVideo == YES) {
if (self.recordAssetWriter) {
if (self.recordAssetWriter.status == AVAssetWriterStatusWriting) { if (self.recordAssetWriter.status == AVAssetWriterStatusWriting) {
[self.recordAssetWriter finishWriting]; [self.recordAssetWriter finishWriting];
NSLog(@"[Camera] recording stopped"); NSLog(@"[Camera] recording stopped");
} else { } else {
NSLog(@"[Camera] Recording Error: asset writer status is not writing"); NSLog(@"[Camera] Recording Error: asset writer status is not writing");
} }
self.recordAssetWriter = nil; self.recordAssetWriter = nil;
}
self.recordAssetWriterInput = nil; self.recordAssetWriterInput = nil;
self.recordPixelBufferAdaptor = nil; self.recordPixelBufferAdaptor = nil;
} }
if (self.customPreviewLayer) {
[self.customPreviewLayer removeFromSuperlayer]; [self.customPreviewLayer removeFromSuperlayer];
self.customPreviewLayer = nil; self.customPreviewLayer = nil;
} }
}
// TODO fix // TODO fix
- (void)adjustLayoutToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; - (void)adjustLayoutToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;

Loading…
Cancel
Save