Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
Add restartVideoCapture method
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-smule committed Oct 12, 2017
1 parent fa22525 commit c78b6ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/PBJVision.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ static CGFloat const PBJVideoBitRate1280x750 = 5000000 * 8; // 40bmps
- (void)pauseVideoCapture;
- (void)resumeVideoCapture;
- (void)endVideoCapture;
- (void)restartVideoCapture;
- (void)cancelVideoCapture;
- (void)setPreviewFrameRate:(int)frameRate;

Expand Down
19 changes: 18 additions & 1 deletion Source/PBJVision.m
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ @interface PBJVision () <
@property (nonatomic, retain) __attribute__((NSObject)) CMFormatDescriptionRef outputVideoFormatDescription;
@property (nonatomic, retain) __attribute__((NSObject)) CMFormatDescriptionRef outputAudioFormatDescription;

@property (nonatomic) BOOL isRestartingVideoCapture;

@end


Expand Down Expand Up @@ -2029,6 +2031,17 @@ - (void)endVideoCapture
}];
}

- (void)restartVideoCapture
{
if (self.isRestartingVideoCapture)
{
return;
}

self.isRestartingVideoCapture = YES;
[self endVideoCapture];
}

- (void)cancelVideoCapture
{
DLog(@"cancel video capture");
Expand Down Expand Up @@ -2673,7 +2686,11 @@ - (void)mediaWriterDidFinishRecording:(PBJMediaWriter *)mediaWriter
}
}];


if (self.isRestartingVideoCapture)
{
self.isRestartingVideoCapture = NO;
[self startVideoCapture];
}

}];
}
Expand Down

0 comments on commit c78b6ac

Please sign in to comment.