Merge pull request #14278 from mshabunin:fix-osx-camera-auth-rt

* AVFoundation: Use runtime check for camera authorization
pull/13930/head^2
Maksim Shabunin 6 years ago committed by Alexander Alekhin
parent 64168fc20a
commit 5cb0eded64
  1. 3
      modules/videoio/src/cap_avfoundation_mac.mm

@ -325,6 +325,8 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) {
NSAutoreleasePool *localpool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *localpool = [[NSAutoreleasePool alloc] init];
#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 #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]; AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if (status == AVAuthorizationStatusDenied) if (status == AVAuthorizationStatusDenied)
{ {
@ -344,6 +346,7 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) {
[localpool drain]; [localpool drain];
return 0; return 0;
} }
}
#endif #endif
// get capture device // get capture device

Loading…
Cancel
Save