VirtualBox

Changeset 88412 in vbox


Ignore:
Timestamp:
Apr 8, 2021 12:00:08 PM (4 years ago)
Author:
vboxsync
Message:

Audio: Made PPDMAUDIOBACKENDSTREAM a typedef instead of a weird #define void-pointer. bugref:9890

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmaudioifs.h

    r88390 r88412  
    994994
    995995
    996 /** @todo r=bird: What is this exactly? */
    997 #define PPDMAUDIOBACKENDSTREAM void *
    998 
    999 
    1000996/** Pointer to a audio connector interface. */
    1001997typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
     
    12031199#define PDMIAUDIOCONNECTOR_IID                  "122511ca-deb3-4630-ad31-ade9f3177df4"
    12041200
     1201
     1202/** Opque pointer host audio specific stream data.
     1203 * @todo r=bird: should extend this to a public part that at least includes a
     1204 *       PPDMAUDIOSTREAM member. */
     1205typedef struct PDMAUDIOBACKENDSTREAM *PPDMAUDIOBACKENDSTREAM;
    12051206
    12061207/** Pointer to a host audio interface. */
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r88390 r88412  
    9898     *
    9999     *  That way the backends do not have access to the audio connector's data. */
    100     void               *pvBackend;
     100    PPDMAUDIOBACKENDSTREAM pBackend;
    101101
    102102    /** For output streams this indicates whether the stream has reached
     
    779779        {
    780780            if (fEnabled)
    781                 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pvBackend, PDMAUDIOSTREAMCMD_ENABLE);
     781                rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_ENABLE);
    782782            break;
    783783        }
     
    785785        case PDMAUDIOSTREAMCMD_DISABLE:
    786786        {
    787             rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pvBackend, PDMAUDIOSTREAMCMD_DISABLE);
     787            rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_DISABLE);
    788788            break;
    789789        }
     
    792792        {
    793793            if (fEnabled) /* Needed, as resume below also is being checked for. */
    794                 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pvBackend, PDMAUDIOSTREAMCMD_PAUSE);
     794                rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_PAUSE);
    795795            break;
    796796        }
     
    799799        {
    800800            if (fEnabled)
    801                 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pvBackend, PDMAUDIOSTREAMCMD_RESUME);
     801                rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_RESUME);
    802802            break;
    803803        }
     
    805805        case PDMAUDIOSTREAMCMD_DRAIN:
    806806        {
    807             rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pvBackend, PDMAUDIOSTREAMCMD_DRAIN);
     807            rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_DRAIN);
    808808            break;
    809809        }
     
    811811        case PDMAUDIOSTREAMCMD_DROP:
    812812        {
    813             rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pvBackend, PDMAUDIOSTREAMCMD_DROP);
     813            rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_DROP);
    814814            break;
    815815        }
     
    849849
    850850        pStreamEx->Core.uMagic    = ~PDMAUDIOSTREAM_MAGIC;
    851         pStreamEx->pvBackend = NULL;
     851        pStreamEx->pBackend      = NULL;
    852852        pStreamEx->uMagic         = DRVAUDIOSTREAM_MAGIC_DEAD;
    853853
     
    10461046        if (   !pThis->Out.fEnabled         /* (see @bugref{9882}) */
    10471047            || pThis->pHostDrvAudio == NULL /* (we used to work this condition differently) */
    1048             || !PDMAudioStrmStatusCanWrite(pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStreamEx->pvBackend)))
     1048            || !PDMAudioStrmStatusCanWrite(pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStreamEx->pBackend)))
    10491049        {
    10501050            Log3Func(("[%s] Backend stream %s, discarding the data\n", pStreamEx->Core.szName,
     
    13571357                if (pThis->pHostDrvAudio->pfnStreamGetPending) /* Optional to implement. */
    13581358                {
    1359                     const uint32_t cxPending = pThis->pHostDrvAudio->pfnStreamGetPending(pThis->pHostDrvAudio, pStreamEx->pvBackend);
     1359                    const uint32_t cxPending = pThis->pHostDrvAudio->pfnStreamGetPending(pThis->pHostDrvAudio, pStreamEx->pBackend);
    13601360                    Log3Func(("[%s] cxPending=%RU32\n", pStreamEx->Core.szName, cxPending));
    13611361
     
    14721472        uint32_t cFramesPlayed = 0;
    14731473        uint32_t cbPlayed      = 0;
    1474         rc = pThis->pHostDrvAudio->pfnStreamPlay(pThis->pHostDrvAudio, pStreamEx->pvBackend, abChunk, cbRead, &cbPlayed);
     1474        rc = pThis->pHostDrvAudio->pfnStreamPlay(pThis->pHostDrvAudio, pStreamEx->pBackend, abChunk, cbRead, &cbPlayed);
    14751475        if (RT_SUCCESS(rc))
    14761476        {
     
    15491549           some heuristics based on number of writable bytes now compared to when
    15501550           prebuffering ended the first time around. */
    1551         uint32_t cbBuffered = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pvBackend);
     1551        uint32_t cbBuffered = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pBackend);
    15521552        if (cbBuffered < pStreamEx->Out.cbBackendMaxWritable)
    15531553            cbBuffered = pStreamEx->Out.cbBackendMaxWritable - cbBuffered;
     
    15801580    {
    15811581        /* not-prebuffering, likely after a while at least */
    1582         cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pvBackend);
     1582        cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pBackend);
    15831583    }
    15841584    else
     
    16181618
    16191619        /* Hack alert! This is for the underrun detection.  */
    1620         cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pvBackend);
     1620        cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pBackend);
    16211621        if (cbWritable > pStreamEx->Out.cbBackendMaxWritable)
    16221622            pStreamEx->Out.cbBackendMaxWritable = cbWritable;
     
    16481648        pStreamEx->nsLastPlayedCaptured = RTTimeNanoTS();
    16491649        pStreamEx->Out.Stats.cbBackendWritableAfter = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio,
    1650                                                                                                  pStreamEx->pvBackend);
     1650                                                                                                 pStreamEx->pBackend);
    16511651    }
    16521652    else
     
    17271727     */
    17281728    AssertPtr(pThis->pHostDrvAudio->pfnStreamGetReadable);
    1729     uint32_t cbReadable = pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->pvBackend);
     1729    uint32_t cbReadable = pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->pBackend);
    17301730    if (!cbReadable)
    17311731        Log2Func(("[%s] No readable data available\n", pStreamEx->Core.szName));
     
    17471747        uint8_t  abChunk[_4K];
    17481748        uint32_t cbCaptured;
    1749         rc = pThis->pHostDrvAudio->pfnStreamCapture(pThis->pHostDrvAudio, pStreamEx->pvBackend,
     1749        rc = pThis->pHostDrvAudio->pfnStreamCapture(pThis->pHostDrvAudio, pStreamEx->pBackend,
    17501750                                                    abChunk, RT_MIN(cbReadable, (uint32_t)sizeof(abChunk)), &cbCaptured);
    17511751        if (RT_FAILURE(rc))
     
    18291829     */
    18301830    /* Note: Raw means *audio frames*, not bytes! */
    1831     uint32_t cfReadable = pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->pvBackend);
     1831    uint32_t cfReadable = pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->pBackend);
    18321832    if (!cfReadable)
    18331833        Log2Func(("[%s] No readable data available\n", pStreamEx->Core.szName));
     
    18551855
    18561856        uint32_t cfCaptured;
    1857         rc = pThis->pHostDrvAudio->pfnStreamCapture(pThis->pHostDrvAudio, pStreamEx->pvBackend,
     1857        rc = pThis->pHostDrvAudio->pfnStreamCapture(pThis->pHostDrvAudio, pStreamEx->pBackend,
    18581858                                                    paFrames, cfWritable, &cfCaptured);
    18591859        if (RT_FAILURE(rc))
     
    24092409    AssertPtr(pThis->pHostDrvAudio);
    24102410    if (pThis->pHostDrvAudio)
    2411         rc = pThis->pHostDrvAudio->pfnStreamCreate(pThis->pHostDrvAudio, pStreamEx->pvBackend, pCfgReq, pCfgAcq);
     2411        rc = pThis->pHostDrvAudio->pfnStreamCreate(pThis->pHostDrvAudio, pStreamEx->pBackend, pCfgReq, pCfgAcq);
    24122412    else
    24132413        rc = VERR_PDM_NO_ATTACHED_DRIVER;
     
    27982798            pStreamEx->Core.cbBackend = (uint32_t)cbHstStrm;
    27992799            if (cbHstStrm)
    2800                 pStreamEx->pvBackend = pStreamEx + 1;
     2800                pStreamEx->pBackend   = (PPDMAUDIOBACKENDSTREAM)(pStreamEx + 1);
    28012801            pStreamEx->fNoMixBufs     = RT_BOOL(fFlags & PDMAUDIOSTREAM_CREATE_F_NO_MIXBUF);
    28022802            pStreamEx->uMagic         = DRVAUDIOSTREAM_MAGIC;
     
    30383038    {
    30393039        if (pStreamEx->fNoMixBufs)
    3040             cbReadable = pThis->pHostDrvAudio ? pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStream) : 0;
     3040            cbReadable = pThis->pHostDrvAudio
     3041                       ? pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->pBackend) : 0;
    30413042        else
    30423043        {
     
    30573058            PDMAUDIOSTREAMSTS fStatus = PDMAUDIOSTREAMSTS_FLAGS_NONE;
    30583059            if (pThis->pHostDrvAudio->pfnStreamGetStatus)
    3059                 fStatus = pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStreamEx->pvBackend);
     3060                fStatus = pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStreamEx->pBackend);
    30603061            if (   !PDMAudioStrmStatusCanRead(fStatus)
    30613062                || fDisabled)
     
    31123113    {
    31133114        if (pStreamEx->fNoMixBufs)
    3114             cbWritable = pThis->pHostDrvAudio ? pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStream) : 0;
     3115            cbWritable = pThis->pHostDrvAudio
     3116                       ? pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pBackend) : 0;
    31153117        else
    31163118            cbWritable = AudioMixBufFreeBytes(&pStreamEx->Host.MixBuf);
     
    32043206    if (pStreamEx->Core.fStatus & PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED)
    32053207    {
    3206         AssertPtr(pStreamEx->pvBackend);
     3208        AssertPtr(pStreamEx->pBackend);
    32073209
    32083210        /* Check if the pointer to  the host audio driver is still valid.
    32093211         * It can be NULL if we were called in drvAudioDestruct, for example. */
    32103212        if (pThis->pHostDrvAudio)
    3211             rc = pThis->pHostDrvAudio->pfnStreamDestroy(pThis->pHostDrvAudio, pStreamEx->pvBackend);
     3213            rc = pThis->pHostDrvAudio->pfnStreamDestroy(pThis->pHostDrvAudio, pStreamEx->pBackend);
    32123214
    32133215        pStreamEx->Core.fStatus &= ~PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED;
  • trunk/src/VBox/Devices/Audio/DrvHostAudioDSound.cpp

    r88390 r88412  
    20652065}
    20662066
    2067 static int dsoundDestroyStreamOut(PDRVHOSTDSOUND pThis, PPDMAUDIOBACKENDSTREAM pStream)
    2068 {
    2069     PDSOUNDSTREAM pStreamDS = (PDSOUNDSTREAM)pStream;
    2070 
     2067static int dsoundDestroyStreamOut(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
     2068{
    20712069    LogFlowFuncEnter();
    20722070
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