- Timestamp:
- May 17, 2021 4:04:56 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144451
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudioAuth.mm
r88235 r89110 26 26 #include <iprt/semaphore.h> 27 27 28 #import <AVFoundation/AVFoundation.h> 29 #import <AVFoundation/AVMediaFormat.h> 28 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 29 # import <AVFoundation/AVFoundation.h> 30 # import <AVFoundation/AVMediaFormat.h> 31 #endif 30 32 #import <Foundation/NSException.h> 31 33 … … 49 51 * AVAuthorizationStatus and do everything dynmically during runtime, sigh... 50 52 */ 51 typedef enum AVAuthorizationStatus: NSInteger 53 typedef enum AVAuthorizationStatus 54 # if RT_CPLUSPLUS_PREREQ(201100) 55 : NSInteger 56 # endif 52 57 { 53 58 AVAuthorizationStatusNotDetermined = 0, 54 59 AVAuthorizationStatusRestricted = 1, 55 60 AVAuthorizationStatusDenied = 2, 56 AVAuthorizationStatusAuthorized = 3 ,61 AVAuthorizationStatusAuthorized = 3 57 62 } AVAuthorizationStatus; 58 63 59 64 #endif 60 65 66 67 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 /** @todo need some better fix/whatever for AudioTest */ 61 68 62 69 /** … … 72 79 { 73 80 /* Perform auth request. */ 74 [AVCaptureDevice performSelector: @selector(requestAccessForMediaType: completionHandler:) withObject: (id)AVMediaTypeAudio withObject: (id)^(BOOL granted) { 75 if (!granted) { 81 [AVCaptureDevice performSelector: @selector(requestAccessForMediaType: completionHandler:) 82 withObject: (id)AVMediaTypeAudio 83 withObject: (id)^(BOOL granted) 84 { 85 if (!granted) 86 { 76 87 LogRel(("CoreAudio: Access denied!\n")); 77 88 rc = VERR_ACCESS_DENIED; … … 80 91 }]; 81 92 82 rc = RTSemEventWait(hEvt, 10 * RT_MS_1SEC);93 rc = RTSemEventWait(hEvt, RT_MS_10SEC); 83 94 RTSemEventDestroy(hEvt); 84 95 } … … 86 97 return rc; 87 98 } 99 100 #endif 88 101 89 102 /** … … 102 115 * (introduced with Mojave 10.14) we have to resort to resolving the APIs dynamically. 103 116 */ 117 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 /** @todo need some better fix/whatever for AudioTest */ 104 118 LogRel(("CoreAudio: macOS 10.14+ detected, checking audio input permissions\n")); 105 119 106 120 if ([AVCaptureDevice respondsToSelector:@selector(authorizationStatusForMediaType:)]) 107 121 { 108 AVAuthorizationStatus enmAuthSts = (AVAuthorizationStatus)(NSInteger)[AVCaptureDevice performSelector: @selector(authorizationStatusForMediaType:) withObject: (id)AVMediaTypeAudio]; 122 AVAuthorizationStatus enmAuthSts 123 = (AVAuthorizationStatus)(NSInteger)[AVCaptureDevice performSelector: @selector(authorizationStatusForMediaType:) 124 withObject: (id)AVMediaTypeAudio]; 109 125 if (enmAuthSts == AVAuthorizationStatusNotDetermined) 110 126 rc = coreAudioInputPermissionRequest(); … … 116 132 } 117 133 } 134 #else 135 LogRel(("CoreAudio: WARNING! macOS 10.14+ detected. Audio input probably wont work as this app was compiled using a too old SDK.\n")); 136 #endif 118 137 } 119 138
Note:
See TracChangeset
for help on using the changeset viewer.