VirtualBox

Ignore:
Timestamp:
Mar 8, 2021 6:01:15 PM (4 years ago)
Author:
vboxsync
Message:

Audio: Preparing to move some of the DrvAudio.h stuff into PDM. bugref:9890

File:
1 edited

Legend:

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

    r88022 r88023  
    621621 * @param   enmFmt              Audio format to retrieve value for.
    622622 */
    623 bool DrvAudioHlpAudFmtIsSigned(PDMAUDIOFMT enmFmt)
     623bool PDMAudioFormatIsSigned(PDMAUDIOFMT enmFmt)
    624624{
    625625    switch (enmFmt)
     
    650650 * @param   enmFmt              Audio format to retrieve value for.
    651651 */
    652 uint8_t DrvAudioHlpAudFmtToBits(PDMAUDIOFMT enmFmt)
     652uint8_t PDMAudioFormatGetBits(PDMAUDIOFMT enmFmt)
    653653{
    654654    switch (enmFmt)
     
    742742 * @param   pCfg                Stream configuration to initialize.
    743743 */
    744 void DrvAudioHlpStreamCfgInit(PPDMAUDIOSTREAMCFG pCfg)
     744void PDMAudioStrmCfgInit(PPDMAUDIOSTREAMCFG pCfg)
    745745{
    746746    AssertPtrReturnVoid(pCfg);
     
    758758 * @param   pProps      PCM properties to use.
    759759 */
    760 int DrvAudioHlpStreamCfgInitFromPcmProps(PPDMAUDIOSTREAMCFG pCfg, PCPDMAUDIOPCMPROPS pProps)
     760int PDMAudioStrmCfgInitWithProps(PPDMAUDIOSTREAMCFG pCfg, PCPDMAUDIOPCMPROPS pProps)
    761761{
    762762    AssertPtrReturn(pProps, VERR_INVALID_POINTER);
    763763    AssertPtrReturn(pCfg,   VERR_INVALID_POINTER);
    764764
    765     DrvAudioHlpStreamCfgInit(pCfg);
     765    PDMAudioStrmCfgInit(pCfg);
    766766
    767767    memcpy(&pCfg->Props, pProps, sizeof(PDMAUDIOPCMPROPS));
     
    798798 * @param   pProps  PCM properties to match with.
    799799 */
    800 bool DrvAudioHlpStreamCfgMatchesPcmProps(PCPDMAUDIOSTREAMCFG pCfg, PCPDMAUDIOPCMPROPS pProps)
     800bool PDMAudioStrmCfgMatchesProps(PCPDMAUDIOSTREAMCFG pCfg, PCPDMAUDIOPCMPROPS pProps)
    801801{
    802802    AssertPtrReturn(pCfg, false);
     
    809809 * @param   pCfg                Audio stream configuration to free.
    810810 */
    811 void DrvAudioHlpStreamCfgFree(PPDMAUDIOSTREAMCFG pCfg)
     811void PDMAudioStrmCfgFree(PPDMAUDIOSTREAMCFG pCfg)
    812812{
    813813    if (pCfg)
     
    825825 * @param   pSrcCfg             Source stream configuration to copy to destination.
    826826 */
    827 int DrvAudioHlpStreamCfgCopy(PPDMAUDIOSTREAMCFG pDstCfg, PCPDMAUDIOSTREAMCFG pSrcCfg)
     827int PDMAudioStrmCfgCopy(PPDMAUDIOSTREAMCFG pDstCfg, PCPDMAUDIOSTREAMCFG pSrcCfg)
    828828{
    829829    AssertPtrReturn(pDstCfg, VERR_INVALID_POINTER);
     
    845845/**
    846846 * Duplicates an audio stream configuration.
    847  * Must be free'd with DrvAudioHlpStreamCfgFree().
     847 * Must be free'd with PDMAudioStrmCfgFree().
    848848 *
    849849 * @return  Duplicates audio stream configuration on success, or NULL on failure.
    850850 * @param   pCfg                    Audio stream configuration to duplicate.
    851851 */
    852 PPDMAUDIOSTREAMCFG DrvAudioHlpStreamCfgDup(PCPDMAUDIOSTREAMCFG pCfg)
     852PPDMAUDIOSTREAMCFG PDMAudioStrmCfgDup(PCPDMAUDIOSTREAMCFG pCfg)
    853853{
    854854    AssertPtrReturn(pCfg, NULL);
     
    866866        return NULL;
    867867
    868     int rc2 = DrvAudioHlpStreamCfgCopy(pDst, pCfg);
     868    int rc2 = PDMAudioStrmCfgCopy(pDst, pCfg);
    869869    if (RT_FAILURE(rc2))
    870870    {
    871         DrvAudioHlpStreamCfgFree(pDst);
     871        PDMAudioStrmCfgFree(pDst);
    872872        pDst = NULL;
    873873    }
     
    882882 * @param   pCfg                Stream configuration to log.
    883883 */
    884 void DrvAudioHlpStreamCfgPrint(PCPDMAUDIOSTREAMCFG pCfg)
    885 {
    886     if (!pCfg)
    887         return;
    888 
    889     LogFunc(("szName=%s, enmDir=%RU32 (uHz=%RU32, cBits=%RU8%s, cChannels=%RU8)\n",
    890              pCfg->szName, pCfg->enmDir,
    891              pCfg->Props.uHz, pCfg->Props.cbSample * 8, pCfg->Props.fSigned ? "S" : "U", pCfg->Props.cChannels));
     884void PDMAudioStrmCfgLog(PCPDMAUDIOSTREAMCFG pCfg)
     885{
     886    if (pCfg)
     887        LogFunc(("szName=%s enmDir=%RU32 uHz=%RU32 cBits=%RU8%s cChannels=%RU8\n", pCfg->szName, pCfg->enmDir,
     888                 pCfg->Props.uHz, pCfg->Props.cbSample * 8, pCfg->Props.fSigned ? "S" : "U", pCfg->Props.cChannels));
    892889}
    893890
     
    999996uint32_t PDMAudioPropsGetBitrate(PCPDMAUDIOPCMPROPS pProps)
    1000997{
    1001     return DrvAudioHlpCalcBitrate(pProps->cbSample * 8, pProps->uHz, pProps->cChannels);
     998    return pProps->cbSample * pProps->cChannels * pProps->uHz * 8;
    1002999}
    10031000
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