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];
#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)
{
@ -344,6 +346,7 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) {
[localpool drain];
return 0;
}
}
#endif
// get capture device

Loading…
Cancel
Save