Commit f10fce9a authored by Maksim Shabunin's avatar Maksim Shabunin

AVFoundation: backported runtime authorization check from master

parent aaad238c
...@@ -316,6 +316,8 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) { ...@@ -316,6 +316,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)
{ {
...@@ -353,6 +355,7 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) { ...@@ -353,6 +355,7 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) {
[localpool drain]; [localpool drain];
return 0; return 0;
} }
}
#endif #endif
// get capture device // get capture device
......
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