mirror of
https://github.com/opencv/opencv.git
synced 2025-08-01 10:26:53 +08:00
AVFoundation: backported runtime authorization check from master
This commit is contained in:
parent
aaad238c6e
commit
f10fce9ab4
@ -316,6 +316,8 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) {
|
||||
NSAutoreleasePool *localpool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
|
||||
if (@available(macOS 10.14, *))
|
||||
{
|
||||
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
|
||||
if (status == AVAuthorizationStatusDenied)
|
||||
{
|
||||
@ -353,6 +355,7 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) {
|
||||
[localpool drain];
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// get capture device
|
||||
|
Loading…
Reference in New Issue
Block a user