Commit 70f8d807 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #4003 from uwinsoftware:2.4

parents daa21a43 58dd70e8
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
@property (nonatomic, readonly) BOOL captureSessionLoaded; @property (nonatomic, readonly) BOOL captureSessionLoaded;
@property (nonatomic, assign) int defaultFPS; @property (nonatomic, assign) int defaultFPS;
@property (nonatomic, readonly) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer;
@property (nonatomic, assign) AVCaptureDevicePosition defaultAVCaptureDevicePosition; @property (nonatomic, assign) AVCaptureDevicePosition defaultAVCaptureDevicePosition;
@property (nonatomic, assign) AVCaptureVideoOrientation defaultAVCaptureVideoOrientation; @property (nonatomic, assign) AVCaptureVideoOrientation defaultAVCaptureVideoOrientation;
@property (nonatomic, assign) BOOL useAVCaptureVideoPreviewLayer; @property (nonatomic, assign) BOOL useAVCaptureVideoPreviewLayer;
...@@ -142,6 +143,7 @@ ...@@ -142,6 +143,7 @@
- (void)layoutPreviewLayer; - (void)layoutPreviewLayer;
- (void)saveVideo; - (void)saveVideo;
- (NSURL *)videoFileURL; - (NSURL *)videoFileURL;
- (NSString *)videoFileString;
@end @end
......
...@@ -41,7 +41,9 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; ...@@ -41,7 +41,9 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
@interface CvVideoCamera () @interface CvVideoCamera () {
int recordingCountDown;
}
- (void)createVideoDataOutput; - (void)createVideoDataOutput;
- (void)createVideoFileOutput; - (void)createVideoFileOutput;
...@@ -98,6 +100,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; ...@@ -98,6 +100,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
- (void)start; - (void)start;
{ {
recordingCountDown = 10;
[super start]; [super start];
if (self.recordVideo == YES) { if (self.recordVideo == YES) {
...@@ -537,7 +540,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; ...@@ -537,7 +540,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
}); });
if (self.recordVideo == YES) { recordingCountDown--;
if (self.recordVideo == YES && recordingCountDown < 0) {
lastSampleTime = CMSampleBufferGetPresentationTimeStamp(sampleBuffer); lastSampleTime = CMSampleBufferGetPresentationTimeStamp(sampleBuffer);
// CMTimeShow(lastSampleTime); // CMTimeShow(lastSampleTime);
if (self.recordAssetWriter.status != AVAssetWriterStatusWriting) { if (self.recordAssetWriter.status != AVAssetWriterStatusWriting) {
...@@ -557,6 +561,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; ...@@ -557,6 +561,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
withPresentationTime:lastSampleTime] ) { withPresentationTime:lastSampleTime] ) {
NSLog(@"Video Writing Error"); NSLog(@"Video Writing Error");
} }
if (pixelBuffer != nullptr)
CVPixelBufferRelease(pixelBuffer);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment