VirtualBox

Changeset 89026 in vbox


Ignore:
Timestamp:
May 13, 2021 1:12:44 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144365
Message:

DrvHostAudioCoreAudio: More cleanups; use drvHostAudioCa as function prefix. bugref:9890D

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp

    r89025 r89026  
    265265*   Internal Functions                                                                                                           *
    266266*********************************************************************************************************************************/
    267 DECLHIDDEN(int) coreAudioInputPermissionCheck(void); /* DrvHostAudioCoreAudioAuth.mm */
    268 static int drvHostCoreAudioStreamControlInternal(PCOREAUDIOSTREAM pStreamCA, PDMAUDIOSTREAMCMD enmStreamCmd);
    269 
    270 
    271 
    272 
    273 static void coreAudioPrintASBD(const char *pszDesc, const AudioStreamBasicDescription *pASBD)
     267static int drvHostAudioCaStreamControlInternal(PCOREAUDIOSTREAM pStreamCA, PDMAUDIOSTREAMCMD enmStreamCmd);
     268
     269/* DrvHostAudioCoreAudioAuth.mm: */
     270DECLHIDDEN(int) coreAudioInputPermissionCheck(void);
     271
     272
     273
     274
     275static void drvHostAudioCaPrintASBD(const char *pszDesc, const AudioStreamBasicDescription *pASBD)
    274276{
    275277    LogRel2(("CoreAudio: %s description:\n", pszDesc));
     
    305307
    306308
    307 static void coreAudioPCMPropsToASBD(PCPDMAUDIOPCMPROPS pProps, AudioStreamBasicDescription *pASBD)
     309static void drvHostAudioCaPCMPropsToASBD(PCPDMAUDIOPCMPROPS pProps, AudioStreamBasicDescription *pASBD)
    308310{
    309311    AssertPtrReturnVoid(pProps);
     
    328330
    329331#if 0 /* unused */
    330 static int coreAudioCFStringToCString(const CFStringRef pCFString, char **ppszString)
     332static int drvHostAudioCaCFStringToCString(const CFStringRef pCFString, char **ppszString)
    331333{
    332334    CFIndex cLen = CFStringGetLength(pCFString) + 1;
     
    342344}
    343345
    344 static AudioDeviceID coreAudioDeviceUIDtoID(const char* pszUID)
     346static AudioDeviceID drvHostAudioCaDeviceUIDtoID(const char* pszUID)
    345347{
    346348    /* Create a CFString out of our CString. */
     
    390392 * @param   pASBDDst            Output (destination) stream description to use.
    391393 */
    392 static int coreAudioInitConvCbCtx(PCOREAUDIOCONVCBCTX pConvCbCtx, PCOREAUDIOSTREAM pStream,
    393                                   AudioStreamBasicDescription *pASBDSrc, AudioStreamBasicDescription *pASBDDst)
     394static int drvHostAudioCaInitConvCbCtx(PCOREAUDIOCONVCBCTX pConvCbCtx, PCOREAUDIOSTREAM pStream,
     395                                       AudioStreamBasicDescription *pASBDSrc, AudioStreamBasicDescription *pASBDDst)
    394396{
    395397    AssertPtrReturn(pConvCbCtx, VERR_INVALID_POINTER);
     
    399401
    400402# ifdef DEBUG
    401     coreAudioPrintASBD("CbCtx: Src", pASBDSrc);
    402     coreAudioPrintASBD("CbCtx: Dst", pASBDDst);
     403    drvHostAudioCaPrintASBD("CbCtx: Src", pASBDSrc);
     404    drvHostAudioCaPrintASBD("CbCtx: Dst", pASBDDst);
    403405# endif
    404406
     
    421423 * @param   pConvCbCtx          Conversion callback context to uninitialize.
    422424 */
    423 static void coreAudioUninitConvCbCtx(PCOREAUDIOCONVCBCTX pConvCbCtx)
     425static void drvHostAudioCaUninitConvCbCtx(PCOREAUDIOCONVCBCTX pConvCbCtx)
    424426{
    425427    AssertPtrReturnVoid(pConvCbCtx);
     
    435437
    436438/* Callback to convert audio input data from one format to another. */
    437 static OSStatus coreAudioConverterCb(AudioConverterRef              inAudioConverter,
    438                                      UInt32                        *ioNumberDataPackets,
    439                                      AudioBufferList               *ioData,
    440                                      AudioStreamPacketDescription **ppASPD,
    441                                      void                          *pvUser)
     439static OSStatus drvHostAudioCaConverterCb(AudioConverterRef inAudioConverter, UInt32 *ioNumberDataPackets,
     440                                          AudioBufferList *ioData, AudioStreamPacketDescription **ppASPD, void *pvUser)
    442441{
    443442    RT_NOREF(inAudioConverter);
     
    726725 * @param   audioBuffer         Audio buffer to store data into.
    727726 */
    728 static int coreAudioOutputQueueProcBuffer(PCOREAUDIOSTREAM pStreamCA, AudioQueueBufferRef audioBuffer)
     727static int drvHostAudioCaOutputQueueProcBuffer(PCOREAUDIOSTREAM pStreamCA, AudioQueueBufferRef audioBuffer)
    729728{
    730729    AssertPtr(pStreamCA);
     
    794793 * @thread  queue thread.
    795794 */
    796 static void coreAudioOutputQueueCb(void *pvUser, AudioQueueRef hAudioQueue, AudioQueueBufferRef audioBuffer)
     795static void drvHostAudioCaOutputQueueCb(void *pvUser, AudioQueueRef hAudioQueue, AudioQueueBufferRef audioBuffer)
    797796{
    798797    PCOREAUDIOSTREAM pStreamCA = (PCOREAUDIOSTREAM)pvUser;
     
    802801    AssertRC(rc);
    803802
    804     rc = coreAudioOutputQueueProcBuffer(pStreamCA, audioBuffer);
     803    rc = drvHostAudioCaOutputQueueProcBuffer(pStreamCA, audioBuffer);
    805804    if (RT_SUCCESS(rc))
    806805        AudioQueueEnqueueBuffer(hAudioQueue, audioBuffer, 0, NULL);
     
    818817 * @param   audioBuffer         Audio buffer to process input data from.
    819818 */
    820 static int coreAudioInputQueueProcBuffer(PCOREAUDIOSTREAM pStreamCA, AudioQueueBufferRef audioBuffer)
     819static int drvHostAudioCaInputQueueProcBuffer(PCOREAUDIOSTREAM pStreamCA, AudioQueueBufferRef audioBuffer)
    821820{
    822821    PRTCIRCBUF pCircBuf = pStreamCA->pCircBuf;
     
    873872 * @param   paPacketDesc        Array of packet descriptors.
    874873 */
    875 static void coreAudioInputQueueCb(void *pvUser, AudioQueueRef hAudioQueue, AudioQueueBufferRef audioBuffer,
    876                                   const AudioTimeStamp *pAudioTS,
    877                                   UInt32 cPacketDesc, const AudioStreamPacketDescription *paPacketDesc)
     874static void drvHostAudioCaInputQueueCb(void *pvUser, AudioQueueRef hAudioQueue, AudioQueueBufferRef audioBuffer,
     875                                       const AudioTimeStamp *pAudioTS,
     876                                       UInt32 cPacketDesc, const AudioStreamPacketDescription *paPacketDesc)
    878877{
    879878    RT_NOREF(pAudioTS, cPacketDesc, paPacketDesc);
     
    885884    AssertRC(rc);
    886885
    887     rc = coreAudioInputQueueProcBuffer(pStreamCA, audioBuffer);
     886    rc = drvHostAudioCaInputQueueProcBuffer(pStreamCA, audioBuffer);
    888887    if (RT_SUCCESS(rc))
    889888        AudioQueueEnqueueBuffer(hAudioQueue, audioBuffer, 0, NULL);
     
    901900 * stream and handling its callbacks.
    902901 */
    903 static DECLCALLBACK(int) coreAudioQueueThread(RTTHREAD hThreadSelf, void *pvUser)
     902static DECLCALLBACK(int) drvHostAudioCaQueueThread(RTTHREAD hThreadSelf, void *pvUser)
    904903{
    905904    PCOREAUDIOSTREAM           pStreamCA = (PCOREAUDIOSTREAM)pvUser;
     
    918917    OSStatus orc;
    919918    if (fIn)
    920         orc = AudioQueueNewInput(&pStreamCA->asbdStream, coreAudioInputQueueCb, pStreamCA /* pvData */,
     919        orc = AudioQueueNewInput(&pStreamCA->asbdStream, drvHostAudioCaInputQueueCb, pStreamCA /* pvData */,
    921920                                 CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0, &pStreamCA->hAudioQueue);
    922921    else
    923         orc = AudioQueueNewOutput(&pStreamCA->asbdStream, coreAudioOutputQueueCb, pStreamCA /* pvData */,
     922        orc = AudioQueueNewOutput(&pStreamCA->asbdStream, drvHostAudioCaOutputQueueCb, pStreamCA /* pvData */,
    924923                                  CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0, &pStreamCA->hAudioQueue);
    925924    if (orc == noErr)
     
    993992 * @todo r=bird: Which use of the word 'invalidate' is this?
    994993 */
    995 static int coreAudioStreamInvalidateQueue(PCOREAUDIOSTREAM pStreamCA)
     994static int drvHostAudioCaStreamInvalidateQueue(PCOREAUDIOSTREAM pStreamCA)
    996995{
    997996    int rc = VINF_SUCCESS;
     
    10041003        if (pStreamCA->Cfg.enmDir == PDMAUDIODIR_IN)
    10051004        {
    1006             int rc2 = coreAudioInputQueueProcBuffer(pStreamCA, pBuf);
     1005            int rc2 = drvHostAudioCaInputQueueProcBuffer(pStreamCA, pBuf);
    10071006            if (RT_SUCCESS(rc2))
    10081007                AudioQueueEnqueueBuffer(pStreamCA->hAudioQueue, pBuf, 0 /*inNumPacketDescs*/, NULL /*inPacketDescs*/);
     
    10111010        {
    10121011            Assert(pStreamCA->Cfg.enmDir == PDMAUDIODIR_OUT);
    1013             int rc2 = coreAudioOutputQueueProcBuffer(pStreamCA, pBuf);
     1012            int rc2 = drvHostAudioCaOutputQueueProcBuffer(pStreamCA, pBuf);
    10141013            if (   RT_SUCCESS(rc2)
    10151014                && pBuf->mAudioDataByteSize)
     
    10321031 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetConfig}
    10331032 */
    1034 static DECLCALLBACK(int) drvHostCoreAudioHA_GetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg)
     1033static DECLCALLBACK(int) drvHostAudioCaHA_GetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg)
    10351034{
    10361035    PDRVHOSTCOREAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio);
     
    10611060 * @param   pDrv                Driver instance to use.
    10621061 */
    1063 static void coreAudioDeviceDataInit(PCOREAUDIODEVICEDATA pDevData, AudioDeviceID deviceID, bool fIsInput, PDRVHOSTCOREAUDIO pDrv)
     1062static void drvHostAudioCaDeviceDataInit(PCOREAUDIODEVICEDATA pDevData, AudioDeviceID deviceID,
     1063                                         bool fIsInput, PDRVHOSTCOREAUDIO pDrv)
    10641064{
    10651065    AssertPtrReturnVoid(pDevData);
     
    10961096 * @param   pDevEnm             Where to store the enumerated devices.
    10971097 */
    1098 static int coreAudioDevicesEnumerate(PDRVHOSTCOREAUDIO pThis, PDMAUDIODIR enmUsage, PPDMAUDIOHOSTENUM pDevEnm)
     1098static int drvHostAudioCaDevicesEnumerate(PDRVHOSTCOREAUDIO pThis, PDMAUDIODIR enmUsage, PPDMAUDIOHOSTENUM pDevEnm)
    10991099{
    11001100    AssertPtrReturn(pThis,   VERR_INVALID_POINTER);
     
    11051105    do /* (this is not a loop, just a device for avoid gotos while trying not to shoot oneself in the foot too badly.) */
    11061106    {
     1107        /*
     1108         * First get the device ID of the default device.
     1109         */
    11071110        AudioDeviceID defaultDeviceID = kAudioDeviceUnknown;
    1108 
    1109         /* Fetch the default audio device currently in use. */
    11101111        AudioObjectPropertyAddress PropAddrDefaultDev =
    11111112        {
     
    11291130        }
    11301131
     1132        /*
     1133         * Get a list of all audio devices.
     1134         */
    11311135        AudioObjectPropertyAddress PropAddrDevList =
    11321136        {
     
    11521156        UInt16 cDevices = uSize / sizeof(AudioDeviceID);
    11531157
     1158        /*
     1159         * Try get details on each device and try add them to the enumeration result.
     1160         */
    11541161        PCOREAUDIODEVICEDATA pDev = NULL;
    11551162        for (UInt16 i = 0; i < cDevices; i++)
     
    11691176
    11701177            /* Init backend-specific device data. */
    1171             coreAudioDeviceDataInit(pDev, pDevIDs[i], enmUsage == PDMAUDIODIR_IN, pThis);
     1178            drvHostAudioCaDeviceDataInit(pDev, pDevIDs[i], enmUsage == PDMAUDIODIR_IN, pThis);
    11721179
    11731180            /* Check if the device is valid. */
     
    13241331 * @param   deviceID              Device ID to search.
    13251332 */
    1326 bool coreAudioDevicesHasDevice(PPDMAUDIOHOSTENUM pEnmSrc, AudioDeviceID deviceID)
     1333static bool drvHostAudioCaDevicesHasDevice(PPDMAUDIOHOSTENUM pEnmSrc, AudioDeviceID deviceID)
    13271334{
    13281335    PCOREAUDIODEVICEDATA pDevSrc;
     
    13451352 * @param   pEnmDst             Where to store the device enumeration list.
    13461353 */
    1347 int coreAudioDevicesEnumerateAll(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOHOSTENUM pEnmDst)
     1354static int drvHostAudioCaDevicesEnumerateAll(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOHOSTENUM pEnmDst)
    13481355{
    13491356    PDMAUDIOHOSTENUM devEnmIn;
    1350     int rc = coreAudioDevicesEnumerate(pThis, PDMAUDIODIR_IN, &devEnmIn);
     1357    int rc = drvHostAudioCaDevicesEnumerate(pThis, PDMAUDIODIR_IN, &devEnmIn);
    13511358    if (RT_SUCCESS(rc))
    13521359    {
    13531360        PDMAUDIOHOSTENUM devEnmOut;
    1354         rc = coreAudioDevicesEnumerate(pThis, PDMAUDIODIR_OUT, &devEnmOut);
     1361        rc = drvHostAudioCaDevicesEnumerate(pThis, PDMAUDIODIR_OUT, &devEnmOut);
    13551362        if (RT_SUCCESS(rc))
    13561363        {
     1364
     1365/** @todo r=bird: This is an awfully complicated and inefficient way of doing
     1366 * it.   Here you could just merge the two list (walk one, remove duplicates
     1367 * from the other one) and skip all that duplication.
     1368 *
     1369 * Howerver, drvHostAudioCaDevicesEnumerate gets the device list twice, which is
     1370 * a complete waste of time.  You could easily do all the work in
     1371 * drvHostAudioCaDevicesEnumerate by just querying the IDs of both default
     1372 * devices we're interested in, saving the merging extra allocations and
     1373 * extra allocation.  */
     1374
    13571375            /*
    13581376             * Build up the final device enumeration, based on the input and output device lists
     
    13731391                }
    13741392
    1375                 coreAudioDeviceDataInit(pDevDst, pDevSrcIn->deviceID, true /* fIsInput */, pThis);
     1393                drvHostAudioCaDeviceDataInit(pDevDst, pDevSrcIn->deviceID, true /* fIsInput */, pThis);
    13761394
    13771395                RTStrCopy(pDevDst->Core.szName, sizeof(pDevDst->Core.szName), pDevSrcIn->Core.szName);
     
    14231441                RTListForEach(&devEnmOut.LstDevices, pDevSrcOut, COREAUDIODEVICEDATA, Core.ListEntry)
    14241442                {
    1425                     if (coreAudioDevicesHasDevice(pEnmDst, pDevSrcOut->deviceID))
     1443                    if (drvHostAudioCaDevicesHasDevice(pEnmDst, pDevSrcOut->deviceID))
    14261444                        continue; /* Already in our list, skip. */
    14271445
     
    14331451                    }
    14341452
    1435                     coreAudioDeviceDataInit(pDevDst, pDevSrcOut->deviceID, false /* fIsInput */, pThis);
     1453                    drvHostAudioCaDeviceDataInit(pDevDst, pDevSrcOut->deviceID, false /* fIsInput */, pThis);
    14361454
    14371455                    RTStrCopy(pDevDst->Core.szName, sizeof(pDevDst->Core.szName), pDevSrcOut->Core.szName);
     
    14771495 * @param  pDev                 Audio device to use for the registered callbacks.
    14781496 */
    1479 static int coreAudioDeviceRegisterCallbacks(PDRVHOSTCOREAUDIO pThis, PCOREAUDIODEVICEDATA pDev)
     1497static int drvHostAudioCaDeviceRegisterCallbacks(PDRVHOSTCOREAUDIO pThis, PCOREAUDIODEVICEDATA pDev)
    14801498{
    14811499    RT_NOREF(pThis);
     
    15291547 * @param  pDev                 Audio device to use for the registered callbacks.
    15301548 */
    1531 static int coreAudioDeviceUnregisterCallbacks(PDRVHOSTCOREAUDIO pThis, PCOREAUDIODEVICEDATA pDev)
     1549static int drvHostAudioCaDeviceUnregisterCallbacks(PDRVHOSTCOREAUDIO pThis, PCOREAUDIODEVICEDATA pDev)
    15321550{
    15331551    RT_NOREF(pThis);
     
    15791597 * @param   pThis               Host audio driver instance.
    15801598 */
    1581 static int coreAudioEnumerateDevices(PDRVHOSTCOREAUDIO pThis)
     1599static int drvHostAudioCaEnumerateDevices(PDRVHOSTCOREAUDIO pThis)
    15821600{
    15831601    LogFlowFuncEnter();
     
    15881606    if (pThis->pDefaultDevIn)
    15891607    {
    1590         coreAudioDeviceUnregisterCallbacks(pThis, pThis->pDefaultDevIn);
     1608        drvHostAudioCaDeviceUnregisterCallbacks(pThis, pThis->pDefaultDevIn);
    15911609        pThis->pDefaultDevIn = NULL;
    15921610    }
     
    15941612    if (pThis->pDefaultDevOut)
    15951613    {
    1596         coreAudioDeviceUnregisterCallbacks(pThis, pThis->pDefaultDevOut);
     1614        drvHostAudioCaDeviceUnregisterCallbacks(pThis, pThis->pDefaultDevOut);
    15971615        pThis->pDefaultDevOut = NULL;
    15981616    }
     
    16021620
    16031621    /* Enumerate all devices internally. */
    1604     int rc = coreAudioDevicesEnumerateAll(pThis, &pThis->Devices);
     1622    int rc = drvHostAudioCaDevicesEnumerateAll(pThis, &pThis->Devices);
    16051623    if (RT_SUCCESS(rc))
    16061624    {
     
    16131631            LogRel2(("CoreAudio: Default capturing device is '%s'\n", pThis->pDefaultDevIn->Core.szName));
    16141632            LogFunc(("pDefaultDevIn=%p, ID=%RU32\n", pThis->pDefaultDevIn, pThis->pDefaultDevIn->deviceID));
    1615             rc = coreAudioDeviceRegisterCallbacks(pThis, pThis->pDefaultDevIn);
     1633            rc = drvHostAudioCaDeviceRegisterCallbacks(pThis, pThis->pDefaultDevIn);
    16161634        }
    16171635        else
     
    16261644            LogRel2(("CoreAudio: Default playback device is '%s'\n", pThis->pDefaultDevOut->Core.szName));
    16271645            LogFunc(("pDefaultDevOut=%p, ID=%RU32\n", pThis->pDefaultDevOut, pThis->pDefaultDevOut->deviceID));
    1628             rc = coreAudioDeviceRegisterCallbacks(pThis, pThis->pDefaultDevOut);
     1646            rc = drvHostAudioCaDeviceRegisterCallbacks(pThis, pThis->pDefaultDevOut);
    16291647        }
    16301648        else
     
    16401658 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetDevices}
    16411659 */
    1642 static DECLCALLBACK(int) drvHostCoreAudioHA_GetDevices(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHOSTENUM pDeviceEnum)
     1660static DECLCALLBACK(int) drvHostAudioCaHA_GetDevices(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHOSTENUM pDeviceEnum)
    16431661{
    16441662    PDRVHOSTCOREAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio);
     
    16531671    if (RT_SUCCESS(rc))
    16541672    {
    1655         rc = coreAudioEnumerateDevices(pThis);
     1673        rc = drvHostAudioCaEnumerateDevices(pThis);
    16561674        if (RT_SUCCESS(rc))
    16571675        {
     
    16761694 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetStatus}
    16771695 */
    1678 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHostCoreAudioHA_GetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
     1696static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHostAudioCaHA_GetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
    16791697{
    16801698    RT_NOREF(pInterface, enmDir);
     
    16861704 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCreate}
    16871705 */
    1688 static DECLCALLBACK(int) drvHostCoreAudioHA_StreamCreate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,
    1689                                                          PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq)
     1706static DECLCALLBACK(int) drvHostAudioCaHA_StreamCreate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,
     1707                                                       PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq)
    16901708{
    16911709    PDRVHOSTCOREAUDIO pThis     = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio);
     
    17371755             */
    17381756            PDMAudioStrmCfgCopy(&pStreamCA->Cfg, pCfgReq);
    1739             coreAudioPCMPropsToASBD(&pCfgReq->Props, &pStreamCA->asbdStream);
     1757            drvHostAudioCaPCMPropsToASBD(&pCfgReq->Props, &pStreamCA->asbdStream);
    17401758            /** @todo Do some validation? */
    1741             coreAudioPrintASBD(  pCfgReq->enmDir == PDMAUDIODIR_IN
    1742                                ? "Capturing queue format"
    1743                                : "Playback queue format", &pStreamCA->asbdStream);
     1759            drvHostAudioCaPrintASBD(  pCfgReq->enmDir == PDMAUDIODIR_IN
     1760                                    ? "Capturing queue format"
     1761                                    : "Playback queue format", &pStreamCA->asbdStream);
    17441762
    17451763            rc = RTCircBufCreate(&pStreamCA->pCircBuf,
     
    17531771                uint32_t idxThread = ASMAtomicIncU32(&s_idxThread);
    17541772
    1755                 rc = RTThreadCreateF(&pStreamCA->hThread, coreAudioQueueThread, pStreamCA, 0 /*cbStack*/,
     1773                rc = RTThreadCreateF(&pStreamCA->hThread, drvHostAudioCaQueueThread, pStreamCA, 0 /*cbStack*/,
    17561774                                     RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "CaQue%u", idxThread);
    17571775                if (RT_SUCCESS(rc))
     
    18061824 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamDestroy}
    18071825 */
    1808 static DECLCALLBACK(int) drvHostCoreAudioHA_StreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
     1826static DECLCALLBACK(int) drvHostAudioCaHA_StreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
    18091827{
    18101828    RT_NOREF(pInterface);
     
    18261844        /** @todo this isn't paranoid enough, the pStreamCA->hAudioQueue is
    18271845         *        owned+released by the queue thread. */
    1828         drvHostCoreAudioStreamControlInternal(pStreamCA, PDMAUDIOSTREAMCMD_DISABLE);
     1846        drvHostAudioCaStreamControlInternal(pStreamCA, PDMAUDIOSTREAMCMD_DISABLE);
    18291847
    18301848        /*
     
    18911909
    18921910
    1893 static int drvHostCoreAudioStreamControlInternal(PCOREAUDIOSTREAM pStreamCA, PDMAUDIOSTREAMCMD enmStreamCmd)
     1911static int drvHostAudioCaStreamControlInternal(PCOREAUDIOSTREAM pStreamCA, PDMAUDIOSTREAMCMD enmStreamCmd)
    18941912{
    18951913    uint32_t enmInitState = ASMAtomicReadU32(&pStreamCA->enmInitState);
     
    19111929            if (pStreamCA->Cfg.enmDir == PDMAUDIODIR_IN)
    19121930            {
    1913                 rc = coreAudioStreamInvalidateQueue(pStreamCA);
     1931                rc = drvHostAudioCaStreamInvalidateQueue(pStreamCA);
    19141932                if (RT_SUCCESS(rc))
    19151933                {
     
    19561974 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamControl}
    19571975 */
    1958 static DECLCALLBACK(int) drvHostCoreAudioHA_StreamControl(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,
    1959                                                           PDMAUDIOSTREAMCMD enmStreamCmd)
     1976static DECLCALLBACK(int) drvHostAudioCaHA_StreamControl(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,
     1977                                                        PDMAUDIOSTREAMCMD enmStreamCmd)
    19601978{
    19611979    RT_NOREF(pInterface);
     
    19631981    AssertPtrReturn(pStreamCA, VERR_INVALID_POINTER);
    19641982
    1965     return drvHostCoreAudioStreamControlInternal(pStreamCA, enmStreamCmd);
     1983    return drvHostAudioCaStreamControlInternal(pStreamCA, enmStreamCmd);
    19661984}
    19671985
     
    19701988 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetReadable}
    19711989 */
    1972 static DECLCALLBACK(uint32_t) drvHostCoreAudioHA_StreamGetReadable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
     1990static DECLCALLBACK(uint32_t) drvHostAudioCaHA_StreamGetReadable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
    19731991{
    19741992    RT_NOREF(pInterface);
     
    19922010 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetWritable}
    19932011 */
    1994 static DECLCALLBACK(uint32_t) drvHostCoreAudioHA_StreamGetWritable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
     2012static DECLCALLBACK(uint32_t) drvHostAudioCaHA_StreamGetWritable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
    19952013{
    19962014    RT_NOREF(pInterface);
     
    20162034 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetState}
    20172035 */
    2018 static DECLCALLBACK(PDMHOSTAUDIOSTREAMSTATE) drvHostCoreAudioHA_StreamGetState(PPDMIHOSTAUDIO pInterface,
    2019                                                                                PPDMAUDIOBACKENDSTREAM pStream)
     2036static DECLCALLBACK(PDMHOSTAUDIOSTREAMSTATE) drvHostAudioCaHA_StreamGetState(PPDMIHOSTAUDIO pInterface,
     2037                                                                             PPDMAUDIOBACKENDSTREAM pStream)
    20202038{
    20212039    RT_NOREF(pInterface);
     
    20312049 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamPlay}
    20322050 */
    2033 static DECLCALLBACK(int) drvHostCoreAudioHA_StreamPlay(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,
    2034                                                        const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten)
     2051static DECLCALLBACK(int) drvHostAudioCaHA_StreamPlay(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,
     2052                                                     const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten)
    20352053{
    20362054    PDRVHOSTCOREAUDIO pThis     = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio);
     
    20942112        && !pStreamCA->fIsRunning)
    20952113    {
    2096         rc = coreAudioStreamInvalidateQueue(pStreamCA);
     2114        rc = drvHostAudioCaStreamInvalidateQueue(pStreamCA);
    20972115        if (RT_SUCCESS(rc))
    20982116        {
     
    21142132 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCapture}
    21152133 */
    2116 static DECLCALLBACK(int) drvHostCoreAudioHA_StreamCapture(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,
    2117                                                           void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead)
     2134static DECLCALLBACK(int) drvHostAudioCaHA_StreamCapture(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,
     2135                                                        void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead)
    21182136{
    21192137    RT_NOREF(pInterface);
     
    21652183 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    21662184 */
    2167 static DECLCALLBACK(void *) drvHostCoreAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     2185static DECLCALLBACK(void *) drvHostAudioCaQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    21682186{
    21692187    PPDMDRVINS        pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     
    21842202 * Worker for the power off and destructor callbacks.
    21852203 */
    2186 static void drvHostCoreAudioRemoveDefaultDeviceListners(PDRVHOSTCOREAUDIO pThis)
     2204static void drvHostAudioCaRemoveDefaultDeviceListners(PDRVHOSTCOREAUDIO pThis)
    21872205{
    21882206    /*
     
    22242242 * @interface_method_impl{PDMDRVREG,pfnPowerOff}
    22252243 */
    2226 static DECLCALLBACK(void) drvHostCoreAudioPowerOff(PPDMDRVINS pDrvIns)
     2244static DECLCALLBACK(void) drvHostAudioCaPowerOff(PPDMDRVINS pDrvIns)
    22272245{
    22282246    PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
    2229     drvHostCoreAudioRemoveDefaultDeviceListners(pThis);
     2247    drvHostAudioCaRemoveDefaultDeviceListners(pThis);
    22302248}
    22312249
     
    22342252 * @callback_method_impl{FNPDMDRVDESTRUCT}
    22352253 */
    2236 static DECLCALLBACK(void) drvHostCoreAudioDestruct(PPDMDRVINS pDrvIns)
     2254static DECLCALLBACK(void) drvHostAudioCaDestruct(PPDMDRVINS pDrvIns)
    22372255{
    22382256    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
    22392257    PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
    22402258
    2241     drvHostCoreAudioRemoveDefaultDeviceListners(pThis);
     2259    drvHostAudioCaRemoveDefaultDeviceListners(pThis);
    22422260
    22432261    int rc2 = RTCritSectDelete(&pThis->CritSect);
     
    22522270 *      Construct a Core Audio driver instance.}
    22532271 */
    2254 static DECLCALLBACK(int) drvHostCoreAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
     2272static DECLCALLBACK(int) drvHostAudioCaConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
    22552273{
    22562274    RT_NOREF(pCfg, fFlags);
     
    22652283    PDMAudioHostEnumInit(&pThis->Devices);
    22662284    /* IBase */
    2267     pDrvIns->IBase.pfnQueryInterface = drvHostCoreAudioQueryInterface;
     2285    pDrvIns->IBase.pfnQueryInterface = drvHostAudioCaQueryInterface;
    22682286    /* IHostAudio */
    2269     pThis->IHostAudio.pfnGetConfig                  = drvHostCoreAudioHA_GetConfig;
    2270     pThis->IHostAudio.pfnGetDevices                 = drvHostCoreAudioHA_GetDevices;
    2271     pThis->IHostAudio.pfnGetStatus                  = drvHostCoreAudioHA_GetStatus;
     2287    pThis->IHostAudio.pfnGetConfig                  = drvHostAudioCaHA_GetConfig;
     2288    pThis->IHostAudio.pfnGetDevices                 = drvHostAudioCaHA_GetDevices;
     2289    pThis->IHostAudio.pfnGetStatus                  = drvHostAudioCaHA_GetStatus;
    22722290    pThis->IHostAudio.pfnDoOnWorkerThread           = NULL;
    22732291    pThis->IHostAudio.pfnStreamConfigHint           = NULL;
    2274     pThis->IHostAudio.pfnStreamCreate               = drvHostCoreAudioHA_StreamCreate;
     2292    pThis->IHostAudio.pfnStreamCreate               = drvHostAudioCaHA_StreamCreate;
    22752293    pThis->IHostAudio.pfnStreamInitAsync            = NULL;
    2276     pThis->IHostAudio.pfnStreamDestroy              = drvHostCoreAudioHA_StreamDestroy;
     2294    pThis->IHostAudio.pfnStreamDestroy              = drvHostAudioCaHA_StreamDestroy;
    22772295    pThis->IHostAudio.pfnStreamNotifyDeviceChanged  = NULL;
    2278     pThis->IHostAudio.pfnStreamControl              = drvHostCoreAudioHA_StreamControl;
    2279     pThis->IHostAudio.pfnStreamGetReadable          = drvHostCoreAudioHA_StreamGetReadable;
    2280     pThis->IHostAudio.pfnStreamGetWritable          = drvHostCoreAudioHA_StreamGetWritable;
     2296    pThis->IHostAudio.pfnStreamControl              = drvHostAudioCaHA_StreamControl;
     2297    pThis->IHostAudio.pfnStreamGetReadable          = drvHostAudioCaHA_StreamGetReadable;
     2298    pThis->IHostAudio.pfnStreamGetWritable          = drvHostAudioCaHA_StreamGetWritable;
    22812299    pThis->IHostAudio.pfnStreamGetPending           = NULL;
    2282     pThis->IHostAudio.pfnStreamGetState             = drvHostCoreAudioHA_StreamGetState;
    2283     pThis->IHostAudio.pfnStreamPlay                 = drvHostCoreAudioHA_StreamPlay;
    2284     pThis->IHostAudio.pfnStreamCapture              = drvHostCoreAudioHA_StreamCapture;
     2300    pThis->IHostAudio.pfnStreamGetState             = drvHostAudioCaHA_StreamGetState;
     2301    pThis->IHostAudio.pfnStreamPlay                 = drvHostAudioCaHA_StreamPlay;
     2302    pThis->IHostAudio.pfnStreamCapture              = drvHostAudioCaHA_StreamCapture;
    22852303
    22862304    int rc = RTCritSectInit(&pThis->CritSect);
     
    22902308     * Enumerate audio devices.
    22912309     */
    2292     rc = coreAudioEnumerateDevices(pThis);
     2310    rc = drvHostAudioCaEnumerateDevices(pThis);
    22932311    AssertRCReturn(rc, rc);
    22942312
     
    23572375    sizeof(DRVHOSTCOREAUDIO),
    23582376    /* pfnConstruct */
    2359     drvHostCoreAudioConstruct,
     2377    drvHostAudioCaConstruct,
    23602378    /* pfnDestruct */
    2361     drvHostCoreAudioDestruct,
     2379    drvHostAudioCaDestruct,
    23622380    /* pfnRelocate */
    23632381    NULL,
     
    23772395    NULL,
    23782396    /* pfnPowerOff */
    2379     drvHostCoreAudioPowerOff,
     2397    drvHostAudioCaPowerOff,
    23802398    /* pfnSoftReset */
    23812399    NULL,
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