VirtualBox

Changeset 73612 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Aug 10, 2018 10:16:36 AM (6 years ago)
Author:
vboxsync
Message:

Audio/Main: Added support for superseding extra-data values with driver-specific ones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r73611 r73612  
    34303430
    34313431/**
    3432  * Retrieves an uint32_t value from audio's extra data branch and returns a default value
    3433  * if not found or an invalid value is found.
     3432 * Retrieves an uint32_t value from the audio driver's extra data branch
     3433 * (VBoxInternal2/Audio/<DriverName>/<Value>), or, if not found, use global branch
     3434 * (VBoxInternal2/Audio/<Value>).
     3435 *
     3436 * The driver branch always supersedes the global branch.
     3437 * If both branches are not found (empty), return the given default value.
    34343438 *
    34353439 * @return VBox status code.
     
    34433447                                         const char *pszDriverName, const char *pszValue, uint32_t uDefault)
    34443448{
    3445     Utf8StrFmt strPath("VBoxInternal2/Audio/%s/%s", pszDriverName, pszValue);
    3446 
    34473449    Utf8Str strTmp;
    3448     GetExtraDataBoth(pVirtualBox, pMachine, strPath.c_str(), &strTmp);
    3449 
    3450     if (strTmp.isNotEmpty())
     3450
     3451    Utf8StrFmt strPathDrv("VBoxInternal2/Audio/%s/%s", pszDriverName, pszValue);
     3452    GetExtraDataBoth(pVirtualBox, pMachine, strPathDrv.c_str(), &strTmp);
     3453    if (strTmp.isEmpty())
     3454    {
     3455        Utf8StrFmt strPathGlobal("VBoxInternal2/Audio/%s", pszValue);
     3456        GetExtraDataBoth(pVirtualBox, pMachine, strPathGlobal.c_str(), &strTmp);
     3457        if (strTmp.isNotEmpty())
     3458            return strTmp.toUInt32();
     3459    }
     3460    else /* Return driver-specific value. */
    34513461        return strTmp.toUInt32();
    34523462
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