VirtualBox

Ignore:
Timestamp:
May 10, 2021 5:33:06 PM (4 years ago)
Author:
vboxsync
Message:

Audio/ValKit: A bit of sketching out audio test set handling. bugref:10008

File:
1 edited

Legend:

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

    r88961 r88967  
    2525#include <VBox/vmm/pdmaudioinline.h>
    2626
     27#include <iprt/dir.h>
    2728#include <iprt/rand.h>
     29#include <iprt/uuid.h>
    2830
    2931#define _USE_MATH_DEFINES
     
    206208}
    207209
     210int AudioTestPathCreate(char *pszPath, size_t cbPath, const char *pszTag)
     211{
     212    int rc;
     213
     214    char szTag[RTUUID_STR_LENGTH + 1];
     215    if (pszTag)
     216    {
     217        rc = RTStrCopy(szTag, sizeof(szTag), pszTag);
     218        AssertRCReturn(rc, rc);
     219    }
     220    else /* Create an UUID if no tag is specified. */
     221    {
     222        RTUUID UUID;
     223        rc = RTUuidCreate(&UUID);
     224        AssertRCReturn(rc, rc);
     225        rc = RTUuidToStr(&UUID, szTag, sizeof(szTag));
     226        AssertRCReturn(rc, rc);
     227    }
     228
     229    char szName[128];
     230    rc = RTStrPrintf(szName, sizeof(szName), "%s%s", AUDIOTEST_PATH_PREFIX_STR, szTag);
     231    AssertRCReturn(rc, rc);
     232
     233    rc = RTPathAppend(pszPath, cbPath, szName);
     234    AssertRCReturn(rc, rc);
     235
     236    char szTime[64];
     237    RTTIMESPEC time;
     238    if (!RTTimeSpecToString(RTTimeNow(&time), szTime, sizeof(szTime)))
     239        return VERR_BUFFER_UNDERFLOW;
     240
     241    rc = RTPathAppend(pszPath, cbPath, szTime);
     242    AssertRCReturn(rc, rc);
     243
     244    return RTDirCreateFullPath(pszPath, RTFS_UNIX_IRWXU);
     245}
     246
     247int AudioTestPathCreateTemp(char *pszPath, size_t cbPath, const char *pszTag)
     248{
     249    int rc = RTPathTemp(pszPath, cbPath);
     250    AssertRCReturn(rc, rc);
     251    rc = AudioTestPathCreate(pszPath, cbPath, pszTag);
     252    AssertRCReturn(rc, rc);
     253
     254    return rc;
     255}
     256
     257int AudioTestSetCreate(PAUDIOTESTSET pSet, const char *pszPath, const char *pszTag)
     258{
     259    int rc;
     260
     261    if (pszPath)
     262    {
     263        rc = RTStrCopy(pSet->szPathOutAbs, sizeof(pSet->szPathOutAbs), pszPath);
     264        AssertRCReturn(rc, rc);
     265
     266        rc = AudioTestPathCreate(pSet->szPathOutAbs, sizeof(pSet->szPathOutAbs), pszTag);
     267    }
     268    else
     269        rc = AudioTestPathCreateTemp(pSet->szPathOutAbs, sizeof(pSet->szPathOutAbs), pszTag);
     270    AssertRCReturn(rc, rc);
     271
     272    return rc;
     273}
     274
     275void AudioTestSetDestroy(PAUDIOTESTSET pSet)
     276{
     277    RT_NOREF(pSet);
     278}
     279
     280int AudioTestSetOpen(PAUDIOTESTSET pSet, const char *pszPath, const char *pszTag)
     281{
     282    RT_NOREF(pSet, pszPath, pszTag);
     283
     284    return VERR_NOT_IMPLEMENTED;
     285}
     286
     287void AudioTestSetClose(PAUDIOTESTSET pSet)
     288{
     289    AudioTestSetDestroy(pSet);
     290}
     291
     292int AudioTestSetPack(PAUDIOTESTSET pSet, const char *pszOutDir)
     293{
     294    RT_NOREF(pSet, pszOutDir);
     295    // RTZipTarCmd()
     296
     297    return VERR_NOT_IMPLEMENTED;
     298}
     299
     300int AudioTestSetUnpack(const char *pszFile, const char *pszOutDir)
     301{
     302    RT_NOREF(pszFile, pszOutDir);
     303    // RTZipTarCmd()
     304
     305    return VERR_NOT_IMPLEMENTED;
     306}
     307
     308int AudioTestSetVerify(PAUDIOTESTSET pSet, const char *pszTag)
     309{
     310    RT_NOREF(pSet, pszTag);
     311    //RTIniFileQueryPair()
     312
     313    /** @todo Compare tag with test set. */
     314
     315    return VERR_NOT_IMPLEMENTED;
     316}
     317
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