VirtualBox

Changeset 89110 in vbox for trunk/src


Ignore:
Timestamp:
May 17, 2021 4:04:56 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144451
Message:

DrvHostAudioCoreAudioAuth.mm: Just try make it build (though not work) with ancient SDKs. bugref:9890 bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudioAuth.mm

    r88235 r89110  
    2626#include <iprt/semaphore.h>
    2727
    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
    3032#import <Foundation/NSException.h>
    3133
     
    4951 * AVAuthorizationStatus and do everything dynmically during runtime, sigh...
    5052 */
    51 typedef enum AVAuthorizationStatus: NSInteger
     53typedef enum AVAuthorizationStatus
     54# if RT_CPLUSPLUS_PREREQ(201100)
     55    : NSInteger
     56# endif
    5257{
    5358    AVAuthorizationStatusNotDetermined = 0,
    5459    AVAuthorizationStatusRestricted    = 1,
    5560    AVAuthorizationStatusDenied        = 2,
    56     AVAuthorizationStatusAuthorized    = 3,
     61    AVAuthorizationStatusAuthorized    = 3
    5762} AVAuthorizationStatus;
    5863
    5964#endif
    6065
     66
     67#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 /** @todo need some better fix/whatever for AudioTest */
    6168
    6269/**
     
    7279    {
    7380        /* 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            {
    7687                LogRel(("CoreAudio: Access denied!\n"));
    7788                rc = VERR_ACCESS_DENIED;
     
    8091        }];
    8192
    82         rc = RTSemEventWait(hEvt, 10 * RT_MS_1SEC);
     93        rc = RTSemEventWait(hEvt, RT_MS_10SEC);
    8394        RTSemEventDestroy(hEvt);
    8495    }
     
    8697    return rc;
    8798}
     99
     100#endif
    88101
    89102/**
     
    102115         * (introduced with Mojave 10.14) we have to resort to resolving the APIs dynamically.
    103116         */
     117#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 /** @todo need some better fix/whatever for AudioTest */
    104118        LogRel(("CoreAudio: macOS 10.14+ detected, checking audio input permissions\n"));
    105119
    106120        if ([AVCaptureDevice respondsToSelector:@selector(authorizationStatusForMediaType:)])
    107121        {
    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];
    109125            if (enmAuthSts == AVAuthorizationStatusNotDetermined)
    110126                rc = coreAudioInputPermissionRequest();
     
    116132            }
    117133        }
     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
    118137    }
    119138
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette