VirtualBox

忽略:
時間撮記:
2018-12-5 上午09:34:58 (6 年 以前)
作者:
vboxsync
訊息:

Forward ported r127158 (Audio/HDA: Implemented support for Windows 10 Build 1809 default surround speaker setup) + build fixes (r127159, r127160, r127162, r127165, r127167).

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/Audio/HDAStreamChannel.cpp

    r71736 r75962  
    6666
    6767/**
    68  * Extracts HDA audio stream data and stores it into the given stream channel data block.
    69  *
    70  * @returns IPRT status code.
    71  * @param   pChan               Channel data to extract audio stream data into.
    72  * @param   pvBuf               Buffer of audio data to extract.
    73  * @param   cbBuf               Size (in bytes) of audio data to extract.
    74  */
    75 int hdaR3StreamChannelExtract(PPDMAUDIOSTREAMCHANNEL pChan, const void *pvBuf, size_t cbBuf)
    76 {
    77     AssertPtrReturn(pChan, VERR_INVALID_POINTER);
    78     AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
    79     AssertReturn(cbBuf,    VERR_INVALID_PARAMETER);
    80 
    81     AssertRelease(pChan->cbOff <= cbBuf);
    82 
    83     const uint8_t *pu8Buf = (const uint8_t *)pvBuf;
    84 
    85     size_t         cbSrc = cbBuf - pChan->cbOff;
    86     const uint8_t *pvSrc = &pu8Buf[pChan->cbOff];
    87 
    88     size_t         cbDst;
    89     uint8_t       *pvDst;
    90     RTCircBufAcquireWriteBlock(pChan->Data.pCircBuf, cbBuf, (void **)&pvDst, &cbDst);
    91 
    92     cbSrc = RT_MIN(cbSrc, cbDst);
    93 
    94     while (cbSrc)
    95     {
    96         AssertBreak(cbDst >= cbSrc);
    97 
    98         /* Enough data for at least one next frame? */
    99         if (cbSrc < pChan->cbFrame)
    100             break;
    101 
    102         memcpy(pvDst, pvSrc, pChan->cbFrame);
    103 
    104         /* Advance to next channel frame in stream. */
    105         pvSrc        += pChan->cbStep;
    106         Assert(cbSrc >= pChan->cbStep);
    107         cbSrc        -= pChan->cbStep;
    108 
    109         /* Advance destination by one frame. */
    110         pvDst        += pChan->cbFrame;
    111         Assert(cbDst >= pChan->cbFrame);
    112         cbDst        -= pChan->cbFrame;
    113 
    114         /* Adjust offset. */
    115         pChan->cbOff += pChan->cbFrame;
    116     }
    117 
    118     RTCircBufReleaseWriteBlock(pChan->Data.pCircBuf, cbDst);
    119 
    120     return VINF_SUCCESS;
    121 }
    122 
    123 /**
    124  * Advances the current read / write pointer by a certain amount.
    125  *
    126  * @returns IPRT status code.
    127  * @param   pChan               Channel data to advance read / write pointer for.
    128  * @param   cbAdv               Amount (in bytes) to advance read / write pointer.
    129  *
    130  * @remark  Currently not used / implemented.
    131  */
    132 int hdaR3StreamChannelAdvance(PPDMAUDIOSTREAMCHANNEL pChan, size_t cbAdv)
    133 {
    134     AssertPtrReturn(pChan, VERR_INVALID_POINTER);
    135 
    136     if (!cbAdv)
    137         return VINF_SUCCESS;
    138 
    139     return VINF_SUCCESS;
    140 }
    141 
    142 /**
    14368 * Acquires (reads) audio channel data.
    14469 * Must be released when done with hdaR3StreamChannelReleaseData().
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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