VirtualBox

Changeset 61727 in vbox


Ignore:
Timestamp:
Jun 15, 2016 5:22:08 PM (9 years ago)
Author:
vboxsync
Message:

Audio/DrvHostCoreAudio.cpp: Implemented rudimentary device enumeration.

File:
1 edited

Legend:

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

    r61706 r61727  
    274274typedef struct COREAUDIOSTREAMCBCTX
    275275{
     276    /** Pointer to driver instance. */
     277    PDRVHOSTCOREAUDIO       pThis;
    276278    /** The stream's direction. */
    277279    PDMAUDIODIR             enmDir;
     
    351353
    352354
    353 static int coreAudioInitIn(PPDMAUDIOSTREAM pStream, uint32_t *pcSamples);
    354 static int coreAudioReinitIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream);
    355 static int coreAudioInitOut(PPDMAUDIOSTREAM pStream, uint32_t *pcSamples);
    356 static int coreAudioReinitOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream);
     355static int coreAudioInitIn(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream, uint32_t *pcSamples);
     356static int coreAudioReinitIn(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream);
     357static int coreAudioInitOut(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream, uint32_t *pcSamples);
     358static int coreAudioReinitOut(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream);
     359static int coreAudioControlStreamIn(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd);
     360static int coreAudioControlStreamOut(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd);
     361static int coreAudioDestroyStreamIn(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream);
     362static int coreAudioDestroyStreamOut(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream);
     363
    357364static OSStatus coreAudioPlaybackAudioDevicePropertyChanged(AudioObjectID propertyID, UInt32 nAddresses, const AudioObjectPropertyAddress properties[], void *pvUser);
    358365static OSStatus coreAudioPlaybackCb(void *pvUser, AudioUnitRenderActionFlags *pActionFlags, const AudioTimeStamp *pAudioTS, UInt32 uBusID, UInt32 cFrames, AudioBufferList* pBufData);
    359366
    360 static int coreAudioControlStreamIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd);
    361 static int coreAudioControlStreamOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd);
    362 static int coreAudioDestroyStreamIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream);
    363 static int coreAudioDestroyStreamOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream);
     367/**
     368 * Does a (Re-)enumeration of the host's playback + capturing devices.
     369 *
     370 * @return  IPRT status code.
     371 * @param   pThis               Host audio driver instance.
     372 * @param   pCfg                Where to store the enumeration results.
     373 * @param   fEnum               Enumeration flags.
     374 */
     375static int coreAudioDevicesEnumerate(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOBACKENDCFG pCfg, bool fIn, uint32_t fEnum)
     376{
     377    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
     378    /* pCfg is optional. */
     379
     380    int rc = VINF_SUCCESS;
     381
     382    do
     383    {
     384        AudioObjectPropertyAddress propAdrDevList = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal,
     385                                                      kAudioObjectPropertyElementMaster };
     386        UInt32 uSize = 0;
     387        OSStatus err = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propAdrDevList, 0, NULL, &uSize);
     388        if (err != kAudioHardwareNoError)
     389            break;
     390
     391        AudioDeviceID *pDevIDs = (AudioDeviceID *)alloca(uSize);
     392        if (pDevIDs == NULL)
     393            break;
     394
     395        err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propAdrDevList, 0, NULL, &uSize, pDevIDs);
     396        if (err != kAudioHardwareNoError)
     397            break;
     398
     399        UInt32 cDevices = uSize / sizeof (AudioDeviceID);
     400        for (UInt32 i = 0; i < cDevices; i++)
     401        {
     402            AudioDeviceID curDevID = pDevIDs[i];
     403
     404            /* Check if the device is valid. */
     405            AudioObjectPropertyAddress propAddrCfg = { kAudioDevicePropertyStreamConfiguration,
     406                                                       fIn ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
     407                                                       kAudioObjectPropertyElementMaster };
     408
     409            err = AudioObjectGetPropertyDataSize(curDevID, &propAddrCfg, 0, NULL, &uSize);
     410            if (err != noErr)
     411                continue;
     412
     413            AudioBufferList *pBufList = (AudioBufferList *)RTMemAlloc(uSize);
     414            if (!pBufList)
     415                continue;
     416
     417            bool fIsValid = false;
     418
     419            err = AudioObjectGetPropertyData(curDevID, &propAddrCfg, 0, NULL, &uSize, pBufList);
     420            if (err == noErr)
     421            {
     422                for (UInt32 a = 0; a < pBufList->mNumberBuffers; a++)
     423                {
     424                    fIsValid = pBufList->mBuffers[a].mNumberChannels > 0;
     425                    if (fIsValid)
     426                        break;
     427                }
     428            }
     429
     430            if (pBufList)
     431            {
     432                RTMemFree(pBufList);
     433                pBufList = NULL;
     434            }
     435
     436            if (!fIsValid)
     437                continue;
     438
     439            /* Resolve the device's name. */
     440            AudioObjectPropertyAddress propAddrName = { kAudioObjectPropertyName,
     441                                                        fIn ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
     442                                                        kAudioObjectPropertyElementMaster };
     443            uSize = sizeof(CFStringRef);
     444            CFStringRef pcfstrName = NULL;
     445
     446            err = AudioObjectGetPropertyData(curDevID, &propAddrName, 0, NULL, &uSize, &pcfstrName);
     447            if (err != kAudioHardwareNoError)
     448                continue;
     449
     450            CFIndex uMax = CFStringGetMaximumSizeForEncoding(CFStringGetLength(pcfstrName), kCFStringEncodingUTF8) + 1;
     451            if (uMax)
     452            {
     453                char *pszName = (char *)RTStrAlloc(uMax);
     454                if (   pszName
     455                    && CFStringGetCString(pcfstrName, pszName, uMax, kCFStringEncodingUTF8))
     456                {
     457                    LogRel2(("CoreAudio: Found %s device '%s'\n", fIn ? "recording" : "playback", pszName));
     458
     459                    if (pCfg)
     460                    {
     461                        if (fIn)
     462                            pCfg->cSources++;
     463                        else
     464                            pCfg->cSinks++;
     465                    }
     466                }
     467
     468                if (pszName)
     469                {
     470                    RTStrFree(pszName);
     471                    pszName = NULL;
     472                }
     473            }
     474
     475            CFRelease(pcfstrName);
     476        }
     477
     478    } while (0);
     479
     480    LogFlowFuncLeaveRC(rc);
     481    return rc;
     482}
     483
     484/**
     485 * Updates this host driver's internal status, according to the global, overall input/output
     486 * state and all connected (native) audio streams.
     487 *
     488 * @param   pThis               Host audio driver instance.
     489 * @param   pCfg                Where to store the backend configuration. Optional.
     490 * @param   fEnum               Enumeration flags.
     491 */
     492int coreAudioUpdateStatusInternalEx(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOBACKENDCFG pCfg, uint32_t fEnum)
     493{
     494    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
     495    /* pCfg is optional. */
     496
     497    PDMAUDIOBACKENDCFG Cfg;
     498    RT_ZERO(Cfg);
     499
     500    Cfg.cbStreamOut    = sizeof(COREAUDIOSTREAMOUT);
     501    Cfg.cbStreamIn     = sizeof(COREAUDIOSTREAMIN);
     502    Cfg.cMaxStreamsIn  = UINT32_MAX;
     503    Cfg.cMaxStreamsOut = UINT32_MAX;
     504
     505    int rc = coreAudioDevicesEnumerate(pThis, &Cfg, false /* fIn */, 0 /* fEnum */);
     506    AssertRC(rc);
     507    rc = coreAudioDevicesEnumerate(pThis, &Cfg, true /* fIn */, 0 /* fEnum */);
     508    AssertRC(rc);
     509
     510    if (pCfg)
     511        memcpy(pCfg, &Cfg, sizeof(PDMAUDIOBACKENDCFG));
     512
     513    LogFlowFuncLeaveRC(rc);
     514    return rc;
     515}
    364516
    365517static DECLCALLBACK(OSStatus) drvHostCoreAudioDeviceStateChanged(AudioObjectID propertyID,
     
    368520                                                                 void *pvUser)
    369521{
     522    LogFlowFunc(("propertyID=%u nAddresses=%u pvUser=%p\n", propertyID, nAddresses, pvUser));
     523
    370524    PCOREAUDIOSTREAMCBCTX pCbCtx = (PCOREAUDIOSTREAMCBCTX)pvUser;
    371 
    372     LogFlowFunc(("propertyID=%u nAddresses=%u pvUser=%p\n", propertyID, nAddresses, pvUser));
     525    AssertPtr(pCbCtx);
    373526
    374527    UInt32 uAlive = 1;
     
    425578        }
    426579    }
     580
     581    int rc2 = coreAudioDevicesEnumerate(pCbCtx->pThis, NULL /* pCfg */, false /* fIn */, 0 /* fEnum */);
     582    AssertRC(rc2);
     583    rc2 = coreAudioDevicesEnumerate(pCbCtx->pThis, NULL /* pCfg */, true /* fIn */, 0 /* fEnum */);
     584    AssertRC(rc2);
    427585
    428586    return noErr;
     
    439597    LogFlowFunc(("propertyID=%u nAddresses=%u pvUser=%p\n", propertyID, nAddresses, pvUser));
    440598
     599    PCOREAUDIOSTREAMCBCTX pCbCtx = (PCOREAUDIOSTREAMCBCTX)pvUser;
     600    AssertPtr(pCbCtx);
     601
    441602    for (UInt32 idxAddress = 0; idxAddress < nAddresses; idxAddress++)
    442603    {
     
    447608            case kAudioHardwarePropertyDefaultInputDevice:
    448609            {
    449                 PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pvUser;
     610                PCOREAUDIOSTREAMIN pStreamIn = pCbCtx->pIn;
    450611
    451612                /* This listener is called on every change of the hardware
     
    472633            case kAudioHardwarePropertyDefaultOutputDevice:
    473634            {
    474                 PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pvUser;
     635                PCOREAUDIOSTREAMOUT pStreamOut = pCbCtx->pOut;
    475636
    476637                /* This listener is called on every change of the hardware
     
    503664    }
    504665
     666    int rc2 = coreAudioDevicesEnumerate(pCbCtx->pThis, NULL /* pCfg */, false /* fIn */, 0 /* fEnum */);
     667    AssertRC(rc2);
     668    rc2 = coreAudioDevicesEnumerate(pCbCtx->pThis, NULL /* pCfg */, true /* fIn */, 0 /* fEnum */);
     669    AssertRC(rc2);
     670
    505671    /** @todo Implement callback notification here to let the audio connector / device emulation
    506672     *        know that something has changed. */
     
    509675}
    510676
    511 static int coreAudioReinitIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)
    512 {
    513     PPDMDRVINS pDrvIns      = PDMIBASE_2_PDMDRV(pInterface);
    514     PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
    515 
     677static int coreAudioReinitIn(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream)
     678{
    516679    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pStream;
    517680
    518     int rc = coreAudioDestroyStreamIn(pInterface, &pStreamIn->Stream);
     681    int rc = coreAudioDestroyStreamIn(pThis, &pStreamIn->Stream);
    519682    if (RT_SUCCESS(rc))
    520683    {
    521         rc = coreAudioInitIn(&pStreamIn->Stream, NULL /* pcSamples */);
     684        rc = coreAudioInitIn(pThis, &pStreamIn->Stream, NULL /* pcSamples */);
    522685        if (RT_SUCCESS(rc))
    523             rc = coreAudioControlStreamIn(pInterface, &pStreamIn->Stream, PDMAUDIOSTREAMCMD_ENABLE);
     686            rc = coreAudioControlStreamIn(pThis, &pStreamIn->Stream, PDMAUDIOSTREAMCMD_ENABLE);
    524687    }
    525688
     
    530693}
    531694
    532 static int coreAudioReinitOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)
    533 {
    534     PPDMDRVINS pDrvIns      = PDMIBASE_2_PDMDRV(pInterface);
    535     PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
    536 
     695static int coreAudioReinitOut(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream)
     696{
    537697    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pStream;
    538698
    539     int rc = coreAudioDestroyStreamOut(pInterface, &pStreamOut->Stream);
     699    int rc = coreAudioDestroyStreamOut(pThis, &pStreamOut->Stream);
    540700    if (RT_SUCCESS(rc))
    541701    {
    542         rc = coreAudioInitOut(&pStreamOut->Stream, NULL /* pcSamples */);
     702        rc = coreAudioInitOut(pThis, &pStreamOut->Stream, NULL /* pcSamples */);
    543703        if (RT_SUCCESS(rc))
    544             rc = coreAudioControlStreamOut(pInterface, &pStreamOut->Stream, PDMAUDIOSTREAMCMD_ENABLE);
     704            rc = coreAudioControlStreamOut(pThis, &pStreamOut->Stream, PDMAUDIOSTREAMCMD_ENABLE);
    545705    }
    546706
     
    813973
    814974/** @todo Eventually split up this function, as this already is huge! */
    815 static int coreAudioInitIn(PPDMAUDIOSTREAM pStream, uint32_t *pcSamples)
     975static int coreAudioInitIn(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream, uint32_t *pcSamples)
    816976{
    817977    OSStatus err = noErr;
     
    11701330    {
    11711331        /* Set callback context. */
     1332        pStreamIn->cbCtx.pThis  = pThis;
    11721333        pStreamIn->cbCtx.enmDir = PDMAUDIODIR_IN;
    11731334        pStreamIn->cbCtx.pIn    = pStreamIn;
     
    11941355
    11951356/** @todo Eventually split up this function, as this already is huge! */
    1196 static int coreAudioInitOut(PPDMAUDIOSTREAM pStream, uint32_t *pcSamples)
     1357static int coreAudioInitOut(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream, uint32_t *pcSamples)
    11971358{
    11981359    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pStream;
     
    14561617    {
    14571618        /* Set callback context. */
     1619        pStreamOut->cbCtx.pThis  = pThis;
    14581620        pStreamOut->cbCtx.enmDir = PDMAUDIODIR_OUT;
    14591621        pStreamOut->cbCtx.pOut   = pStreamOut;
     
    14781640    return rc;
    14791641}
    1480 
    14811642
    14821643/* Callback for getting notified when some of the properties of an audio device has changed. */
     
    15841745    /* Check if the audio device should be reinitialized. If so do it. */
    15851746    if (ASMAtomicReadU32(&pStreamIn->status) == CA_STATUS_REINIT)
    1586         coreAudioReinitIn(pInterface, &pStreamIn->Stream);
     1747        coreAudioReinitIn(pThis, &pStreamIn->Stream);
    15871748
    15881749    if (ASMAtomicReadU32(&pStreamIn->status) != CA_STATUS_INIT)
     
    16691830    if (ASMAtomicReadU32(&pStreamOut->status) == CA_STATUS_REINIT)
    16701831    {
    1671         rc = coreAudioReinitOut(pInterface, &pStreamOut->Stream);
     1832        rc = coreAudioReinitOut(pThis, &pStreamOut->Stream);
    16721833        if (RT_FAILURE(rc))
    16731834            return rc;
     
    17421903}
    17431904
    1744 static DECLCALLBACK(int) coreAudioControlStreamOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream,
    1745                                                    PDMAUDIOSTREAMCMD enmStreamCmd)
     1905static DECLCALLBACK(int) coreAudioControlStreamOut(PDRVHOSTCOREAUDIO pThis,
     1906                                                   PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd)
    17461907{
    17471908    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pStream;
     
    18181979}
    18191980
    1820 static int coreAudioControlStreamIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream,
    1821                                     PDMAUDIOSTREAMCMD enmStreamCmd)
     1981static int coreAudioControlStreamIn(PDRVHOSTCOREAUDIO pThis,
     1982                                    PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd)
    18221983{
    18231984    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pStream;
     
    18952056}
    18962057
    1897 static int coreAudioDestroyStreamIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)
    1898 {
    1899     PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN) pStream;
    1900 
    1901     PPDMDRVINS pDrvIns       = PDMIBASE_2_PDMDRV(pInterface);
    1902     PDRVHOSTCOREAUDIO  pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
     2058static int coreAudioDestroyStreamIn(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream)
     2059{
     2060    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pStream;
    19032061
    19042062    LogFlowFuncEnter();
     
    19132071    OSStatus err = noErr;
    19142072
    1915     int rc = coreAudioControlStreamIn(pInterface, &pStreamIn->Stream, PDMAUDIOSTREAMCMD_DISABLE);
     2073    int rc = coreAudioControlStreamIn(pThis, &pStreamIn->Stream, PDMAUDIOSTREAMCMD_DISABLE);
    19162074    if (RT_SUCCESS(rc))
    19172075    {
     
    20112169}
    20122170
    2013 static int coreAudioDestroyStreamOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)
    2014 {
    2015     PPDMDRVINS pDrvIns      = PDMIBASE_2_PDMDRV(pInterface);
    2016     PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
    2017 
     2171static int coreAudioDestroyStreamOut(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOSTREAM pStream)
     2172{
    20182173    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pStream;
    20192174
     
    20272182    }
    20282183
    2029     int rc = coreAudioControlStreamOut(pInterface, &pStreamOut->Stream, PDMAUDIOSTREAMCMD_DISABLE);
     2184    int rc = coreAudioControlStreamOut(pThis, &pStreamOut->Stream, PDMAUDIOSTREAMCMD_DISABLE);
    20302185    if (RT_SUCCESS(rc))
    20312186    {
     
    21122267}
    21132268
    2114 static int coreAudioCreateStreamIn(PPDMIHOSTAUDIO pInterface,
     2269static int coreAudioCreateStreamIn(PDRVHOSTCOREAUDIO pThis,
    21152270                                   PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfg, uint32_t *pcSamples)
    21162271{
     
    21482303        }
    21492304#endif
    2150         rc = coreAudioInitIn(&pStreamIn->Stream, pcSamples);
     2305        rc = coreAudioInitIn(pThis, &pStreamIn->Stream, pcSamples);
    21512306    }
    21522307
     
    21892344}
    21902345
    2191 static int coreAudioCreateStreamOut(PPDMIHOSTAUDIO pInterface,
     2346static int coreAudioCreateStreamOut(PDRVHOSTCOREAUDIO pThis,
    21922347                                    PPDMAUDIOSTREAM pStream, PPDMAUDIOSTREAMCFG pCfg,
    21932348                                    uint32_t *pcSamples)
     
    22242379        }
    22252380#endif
    2226         rc = coreAudioInitOut(pStream, pcSamples);
     2381        rc = coreAudioInitOut(pThis, pStream, pcSamples);
    22272382    }
    22282383
     
    22682423static DECLCALLBACK(int) drvHostCoreAudioGetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pCfg)
    22692424{
    2270     NOREF(pInterface);
    2271     AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
    2272 
    2273     LogFlowFuncEnter();
    2274 
    2275     pCfg->cbStreamIn      = sizeof(COREAUDIOSTREAMIN);
    2276     pCfg->cbStreamOut     = sizeof(COREAUDIOSTREAMOUT);
    2277     pCfg->cMaxStreamsIn   = UINT32_MAX;
    2278     pCfg->cMaxStreamsOut  = UINT32_MAX;
    2279 
    2280     /** @todo Implement a proper device detection. */
    2281     pCfg->cSources        = 1;
    2282     pCfg->cSinks          = 1;
    2283 
    2284     return VINF_SUCCESS;
     2425    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
     2426    AssertPtrReturn(pCfg,       VERR_INVALID_POINTER);
     2427
     2428    PPDMDRVINS        pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     2429    PDRVHOSTCOREAUDIO pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
     2430
     2431    return coreAudioUpdateStatusInternalEx(pThis, pCfg, 0 /* fEnum */);
    22852432}
    22862433
     
    22992446    AssertPtrReturn(pCfg,       VERR_INVALID_POINTER);
    23002447
     2448    PPDMDRVINS        pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     2449    PDRVHOSTCOREAUDIO pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
     2450
    23012451    int rc;
    23022452    if (pCfg->enmDir == PDMAUDIODIR_IN)
    2303         rc = coreAudioCreateStreamIn(pInterface,  pStream, pCfg, pcSamples);
     2453        rc = coreAudioCreateStreamIn(pThis,  pStream, pCfg, pcSamples);
    23042454    else
    2305         rc = coreAudioCreateStreamOut(pInterface, pStream, pCfg, pcSamples);
     2455        rc = coreAudioCreateStreamOut(pThis, pStream, pCfg, pcSamples);
    23062456
    23072457    LogFlowFunc(("%s: rc=%Rrc\n", pStream->szName, rc));
     
    23142464    AssertPtrReturn(pStream,    VERR_INVALID_POINTER);
    23152465
     2466    PPDMDRVINS        pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     2467    PDRVHOSTCOREAUDIO pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
     2468
    23162469    int rc;
    23172470    if (pStream->enmDir == PDMAUDIODIR_IN)
    2318         rc = coreAudioDestroyStreamIn(pInterface,  pStream);
     2471        rc = coreAudioDestroyStreamIn(pThis,  pStream);
    23192472    else
    2320         rc = coreAudioDestroyStreamOut(pInterface, pStream);
     2473        rc = coreAudioDestroyStreamOut(pThis, pStream);
    23212474
    23222475    return rc;
     
    23312484    Assert(pStream->enmCtx == PDMAUDIOSTREAMCTX_HOST);
    23322485
     2486    PPDMDRVINS        pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     2487    PDRVHOSTCOREAUDIO pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
     2488
    23332489    int rc;
    23342490    if (pStream->enmDir == PDMAUDIODIR_IN)
    2335         rc = coreAudioControlStreamIn(pInterface,  pStream, enmStreamCmd);
     2491        rc = coreAudioControlStreamIn(pThis,  pStream, enmStreamCmd);
    23362492    else
    2337         rc = coreAudioControlStreamOut(pInterface, pStream, enmStreamCmd);
     2493        rc = coreAudioControlStreamOut(pThis, pStream, enmStreamCmd);
    23382494
    23392495    return rc;
Note: See TracChangeset for help on using the changeset viewer.

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