Changeset 89994 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Jul 2, 2021 9:41:02 AM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r89990 r89994 75 75 *********************************************************************************************************************************/ 76 76 /** 77 * Structure for an internal object handle. 78 */ 79 typedef struct AUDIOTESTOBJHANDLE 80 { 77 * Enumeration for an audio test object type. 78 */ 79 typedef enum AUDIOTESTOBJTYPE 80 { 81 /** Unknown / invalid, do not use. */ 82 AUDIOTESTOBJTYPE_UNKNOWN = 0, 83 /** The test object is a file. */ 84 AUDIOTESTOBJTYPE_FILE, 85 /** The usual 32-bit hack. */ 86 AUDIOTESTOBJTYPE_32BIT_HACK = 0x7fffffff 87 } AUDIOTESTOBJTYPE; 88 89 /** 90 * Structure for keeping an audio test object file. 91 */ 92 typedef struct AUDIOTESTOBJFILE 93 { 94 /** File handle. */ 95 RTFILE hFile; 96 /** Total size (in bytes). */ 97 size_t cbSize; 98 } AUDIOTESTOBJFILE; 99 /** Pointer to an audio test object file. */ 100 typedef AUDIOTESTOBJFILE *PAUDIOTESTOBJFILE; 101 102 /** 103 * Enumeration for an audio test object meta data type. 104 */ 105 typedef enum AUDIOTESTOBJMETADATATYPE 106 { 107 /** Unknown / invalid, do not use. */ 108 AUDIOTESTOBJMETADATATYPE_INVALID = 0, 109 /** Meta data is an UTF-8 string. */ 110 AUDIOTESTOBJMETADATATYPE_STRING, 111 /** The usual 32-bit hack. */ 112 AUDIOTESTOBJMETADATATYPE_32BIT_HACK = 0x7fffffff 113 } AUDIOTESTOBJMETADATATYPE; 114 115 /** 116 * Structure for keeping a meta data block. 117 */ 118 typedef struct AUDIOTESTOBJMETA 119 { 120 /** List node. */ 121 RTLISTNODE Node; 122 /** Meta data type. */ 123 AUDIOTESTOBJMETADATATYPE enmType; 124 /** Meta data block. */ 125 void *pvMeta; 126 /** Size (in bytes) of \a pvMeta. */ 127 size_t cbMeta; 128 } AUDIOTESTOBJMETA; 129 /** Pointer to an audio test object file. */ 130 typedef AUDIOTESTOBJMETA *PAUDIOTESTOBJMETA; 131 132 /** 133 * Structure for keeping a single audio test object. 134 * 135 * A test object is data which is needed in order to perform and verify one or 136 * more audio test case(s). 137 */ 138 typedef struct AUDIOTESTOBJINT 139 { 140 /** List node. */ 141 RTLISTNODE Node; 81 142 /** Pointer to test set this handle is bound to. */ 82 PAUDIOTESTSET pSet;143 PAUDIOTESTSET pSet; 83 144 /** As we only support .INI-style files for now, this only has the object's section name in it. */ 84 145 /** @todo Make this more generic (union, ++). */ 85 char szSec[AUDIOTEST_MAX_SEC_LEN]; 86 } AUDIOTESTOBJHANDLE; 87 /** Pointer to an audio test object handle. */ 88 typedef AUDIOTESTOBJHANDLE* PAUDIOTESTOBJHANDLE; 146 char szSec[AUDIOTEST_MAX_SEC_LEN]; 147 /** The UUID of the object. 148 * Used to identify an object within a test set. */ 149 RTUUID Uuid; 150 /** Number of references to this test object. */ 151 uint32_t cRefs; 152 /** Name of the test object. 153 * Must not contain a path and has to be able to serialize to disk. */ 154 char szName[64]; 155 /** The object type. */ 156 AUDIOTESTOBJTYPE enmType; 157 /** Meta data list. */ 158 RTLISTANCHOR lstMeta; 159 /** Union for holding the object type-specific data. */ 160 union 161 { 162 AUDIOTESTOBJFILE File; 163 }; 164 } AUDIOTESTOBJINT; 165 /** Pointer to an audio test object. */ 166 typedef AUDIOTESTOBJINT *PAUDIOTESTOBJINT; 89 167 90 168 /** … … 131 209 * Internal Functions * 132 210 *********************************************************************************************************************************/ 133 static int audioTest SetObjCloseInternal(PAUDIOTESTOBJpObj);134 static void audioTest SetObjFinalize(PAUDIOTESTOBJpObj);211 static int audioTestObjCloseInternal(PAUDIOTESTOBJINT pObj); 212 static void audioTestObjFinalize(PAUDIOTESTOBJINT pObj); 135 213 136 214 … … 703 781 * @param cbVal Size (in bytes) of \a pszVal. 704 782 */ 705 static int audioTestObjGetStr(PAUDIOTESTOBJ HANDLEphObj, const char *pszKey, char *pszVal, size_t cbVal)783 static int audioTestObjGetStr(PAUDIOTESTOBJINT phObj, const char *pszKey, char *pszVal, size_t cbVal) 706 784 { 707 785 /** @todo For now we only support .INI-style files. */ … … 718 796 * @param pbVal Where to return the value on success. 719 797 */ 720 static int audioTestObjGetBool(PAUDIOTESTOBJ HANDLEphObj, const char *pszKey, bool *pbVal)798 static int audioTestObjGetBool(PAUDIOTESTOBJINT phObj, const char *pszKey, bool *pbVal) 721 799 { 722 800 char szVal[_1K]; … … 736 814 * @param puVal Where to return the value on success. 737 815 */ 738 static int audioTestObjGetUInt8(PAUDIOTESTOBJ HANDLEphObj, const char *pszKey, uint8_t *puVal)816 static int audioTestObjGetUInt8(PAUDIOTESTOBJINT phObj, const char *pszKey, uint8_t *puVal) 739 817 { 740 818 char szVal[_1K]; … … 754 832 * @param puVal Where to return the value on success. 755 833 */ 756 static int audioTestObjGetUInt32(PAUDIOTESTOBJ HANDLEphObj, const char *pszKey, uint32_t *puVal)834 static int audioTestObjGetUInt32(PAUDIOTESTOBJINT phObj, const char *pszKey, uint32_t *puVal) 757 835 { 758 836 char szVal[_1K]; … … 894 972 return rc; 895 973 896 PAUDIOTESTOBJ pObj, pObjNext;897 RTListForEachSafe(&pSet->lstObj, pObj, pObjNext, AUDIOTESTOBJ , Node)898 { 899 rc = audioTest SetObjCloseInternal(pObj);974 PAUDIOTESTOBJINT pObj, pObjNext; 975 RTListForEachSafe(&pSet->lstObj, pObj, pObjNext, AUDIOTESTOBJINT, Node) 976 { 977 rc = audioTestObjCloseInternal(pObj); 900 978 if (RT_SUCCESS(rc)) 901 979 { … … 1033 1111 AssertRCReturn(rc, rc); 1034 1112 1035 PAUDIOTESTOBJ pObj;1036 RTListForEach(&pSet->lstObj, pObj, AUDIOTESTOBJ , Node)1113 PAUDIOTESTOBJINT pObj; 1114 RTListForEach(&pSet->lstObj, pObj, AUDIOTESTOBJINT, Node) 1037 1115 { 1038 1116 rc = audioTestManifestWrite(pSet, "\n"); … … 1103 1181 char szFilePath[RTPATH_MAX]; 1104 1182 1105 PAUDIOTESTOBJ pObj;1106 RTListForEach(&pSet->lstObj, pObj, AUDIOTESTOBJ , Node)1107 { 1108 int rc2 = audioTest SetObjCloseInternal(pObj);1183 PAUDIOTESTOBJINT pObj; 1184 RTListForEach(&pSet->lstObj, pObj, AUDIOTESTOBJINT, Node) 1185 { 1186 int rc2 = audioTestObjCloseInternal(pObj); 1109 1187 if (RT_SUCCESS(rc2)) 1110 1188 { … … 1139 1217 * @param pSet Test set to create and register new object for. 1140 1218 * @param pszName Name of new object to create. 1141 * @param p pObjWhere to return the pointer to the newly created object on success.1142 */ 1143 int AudioTestSetObjCreateAndRegister(PAUDIOTESTSET pSet, const char *pszName, PAUDIOTESTOBJ *ppObj)1219 * @param pObj Where to return the pointer to the newly created object on success. 1220 */ 1221 int AudioTestSetObjCreateAndRegister(PAUDIOTESTSET pSet, const char *pszName, PAUDIOTESTOBJ pObj) 1144 1222 { 1145 1223 AssertReturn(pSet->cTestsRunning == 1, VERR_WRONG_ORDER); /* No test nesting allowed. */ … … 1147 1225 AssertPtrReturn(pszName, VERR_INVALID_POINTER); 1148 1226 1149 PAUDIOTESTOBJ pObj = (PAUDIOTESTOBJ)RTMemAlloc(sizeof(AUDIOTESTOBJ));1150 AssertPtrReturn(p Obj, VERR_NO_MEMORY);1151 1152 RTListInit(&p Obj->lstMeta);1153 1154 if (RTStrPrintf2(p Obj->szName, sizeof(pObj->szName), "%04RU32-%s", pSet->cObj, pszName) <= 0)1227 PAUDIOTESTOBJINT pThis = (PAUDIOTESTOBJINT)RTMemAlloc(sizeof(AUDIOTESTOBJINT)); 1228 AssertPtrReturn(pThis, VERR_NO_MEMORY); 1229 1230 RTListInit(&pThis->lstMeta); 1231 1232 if (RTStrPrintf2(pThis->szName, sizeof(pThis->szName), "%04RU32-%s", pSet->cObj, pszName) <= 0) 1155 1233 AssertFailedReturn(VERR_BUFFER_OVERFLOW); 1156 1234 … … 1158 1236 1159 1237 char szObjPathAbs[RTPATH_MAX]; 1160 int rc = audioTestSetGetObjPath(pSet, szObjPathAbs, sizeof(szObjPathAbs), p Obj->szName);1238 int rc = audioTestSetGetObjPath(pSet, szObjPathAbs, sizeof(szObjPathAbs), pThis->szName); 1161 1239 if (RT_SUCCESS(rc)) 1162 1240 { 1163 rc = RTFileOpen(&p Obj->File.hFile, szObjPathAbs, RTFILE_O_CREATE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE);1241 rc = RTFileOpen(&pThis->File.hFile, szObjPathAbs, RTFILE_O_CREATE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE); 1164 1242 if (RT_SUCCESS(rc)) 1165 1243 { 1166 p Obj->enmType = AUDIOTESTOBJTYPE_FILE;1167 p Obj->cRefs = 1; /* Currently only 1:1 mapping. */1168 1169 RTListAppend(&pSet->lstObj, &p Obj->Node);1244 pThis->enmType = AUDIOTESTOBJTYPE_FILE; 1245 pThis->cRefs = 1; /* Currently only 1:1 mapping. */ 1246 1247 RTListAppend(&pSet->lstObj, &pThis->Node); 1170 1248 pSet->cObj++; 1171 1249 1172 1250 /* Generate + set an UUID for the object and assign it to the current test. */ 1173 rc = RTUuidCreate(&p Obj->Uuid);1251 rc = RTUuidCreate(&pThis->Uuid); 1174 1252 AssertRCReturn(rc, rc); 1175 1253 char szUuid[AUDIOTEST_MAX_OBJ_LEN]; 1176 rc = RTUuidToStr(&p Obj->Uuid, szUuid, sizeof(szUuid));1254 rc = RTUuidToStr(&pThis->Uuid, szUuid, sizeof(szUuid)); 1177 1255 AssertRCReturn(rc, rc); 1178 1256 … … 1183 1261 pSet->pTestCur->cObj++; 1184 1262 1185 *p pObj = pObj;1263 *pObj = pThis; 1186 1264 } 1187 1265 } 1188 1266 1189 1267 if (RT_FAILURE(rc)) 1190 RTMemFree(p Obj);1268 RTMemFree(pThis); 1191 1269 1192 1270 return rc; … … 1197 1275 * 1198 1276 * @returns VBox status code. 1199 * @param pObjAudio test object to write to.1277 * @param Obj Audio test object to write to. 1200 1278 * @param pvBuf Pointer to data to write. 1201 1279 * @param cbBuf Size (in bytes) of \a pvBuf to write. 1202 1280 */ 1203 int AudioTestSetObjWrite(PAUDIOTESTOBJ pObj, const void *pvBuf, size_t cbBuf) 1204 { 1281 int AudioTestObjWrite(AUDIOTESTOBJ Obj, const void *pvBuf, size_t cbBuf) 1282 { 1283 AUDIOTESTOBJINT *pThis = Obj; 1284 1205 1285 /** @todo Generalize this function more once we have more object types. */ 1206 AssertReturn(p Obj->enmType == AUDIOTESTOBJTYPE_FILE, VERR_INVALID_PARAMETER);1207 1208 return RTFileWrite(p Obj->File.hFile, pvBuf, cbBuf, NULL);1286 AssertReturn(pThis->enmType == AUDIOTESTOBJTYPE_FILE, VERR_INVALID_PARAMETER); 1287 1288 return RTFileWrite(pThis->File.hFile, pvBuf, cbBuf, NULL); 1209 1289 } 1210 1290 … … 1213 1293 * 1214 1294 * @returns VBox status code. 1215 * @param pObjTest object to add meta data for.1295 * @param Obj Test object to add meta data for. 1216 1296 * @param pszFormat Format string to add. 1217 1297 * @param va Variable arguments list to use for the format string. 1218 1298 */ 1219 static int audioTest SetObjAddMetadataStrV(PAUDIOTESTOBJpObj, const char *pszFormat, va_list va)1299 static int audioTestObjAddMetadataStrV(PAUDIOTESTOBJINT pObj, const char *pszFormat, va_list va) 1220 1300 { 1221 1301 PAUDIOTESTOBJMETA pMeta = (PAUDIOTESTOBJMETA)RTMemAlloc(sizeof(AUDIOTESTOBJMETA)); … … 1237 1317 * 1238 1318 * @returns VBox status code. 1239 * @param pObjTest object to add meta data for.1319 * @param Obj Test object to add meta data for. 1240 1320 * @param pszFormat Format string to add. 1241 1321 * @param ... Variable arguments for the format string. 1242 1322 */ 1243 int AudioTestSetObjAddMetadataStr(PAUDIOTESTOBJ pObj, const char *pszFormat, ...) 1244 { 1323 int AudioTestObjAddMetadataStr(AUDIOTESTOBJ Obj, const char *pszFormat, ...) 1324 { 1325 AUDIOTESTOBJINT *pThis = Obj; 1326 1245 1327 va_list va; 1246 1328 1247 1329 va_start(va, pszFormat); 1248 int rc = audioTest SetObjAddMetadataStrV(pObj, pszFormat, va);1330 int rc = audioTestObjAddMetadataStrV(pThis, pszFormat, va); 1249 1331 va_end(va); 1250 1332 … … 1256 1338 * 1257 1339 * @returns VBox status code. 1258 * @param pObj Audio test object to close. 1259 */ 1260 int AudioTestSetObjClose(PAUDIOTESTOBJ pObj) 1261 { 1262 if (!pObj) 1340 * @param Obj Audio test object to close. 1341 */ 1342 int AudioTestObjClose(AUDIOTESTOBJ Obj) 1343 { 1344 AUDIOTESTOBJINT *pThis = Obj; 1345 1346 if (!pThis) 1263 1347 return VINF_SUCCESS; 1264 1348 1265 audioTest SetObjFinalize(pObj);1266 1267 return audioTest SetObjCloseInternal(pObj);1349 audioTestObjFinalize(pThis); 1350 1351 return audioTestObjCloseInternal(pThis); 1268 1352 } 1269 1353 … … 1275 1359 * @param pszDesc Test description. 1276 1360 * @param pParms Test parameters to use. 1277 * @param ppEntry Where to return the new test handle.1361 * @param ppEntry Where to return the new test 1278 1362 */ 1279 1363 int AudioTestSetTestBegin(PAUDIOTESTSET pSet, const char *pszDesc, PAUDIOTESTPARMS pParms, PAUDIOTESTENTRY *ppEntry) … … 1539 1623 * @param phSec Where to store the object handle on success. 1540 1624 */ 1541 static int audioTestSetGetSection(PAUDIOTESTSET pSet, const char *pszSec, PAUDIOTESTOBJ HANDLEphSec)1625 static int audioTestSetGetSection(PAUDIOTESTSET pSet, const char *pszSec, PAUDIOTESTOBJINT phSec) 1542 1626 { 1543 1627 int rc = RTStrCopy(phSec->szSec, sizeof(phSec->szSec), pszSec); … … 1561 1645 * @param phTst Where to store the object handle on success. 1562 1646 */ 1563 static int audioTestSetGetTest(PAUDIOTESTSET pSet, uint32_t idxTst, PAUDIOTESTOBJ HANDLEphTst)1647 static int audioTestSetGetTest(PAUDIOTESTSET pSet, uint32_t idxTst, PAUDIOTESTOBJINT phTst) 1564 1648 { 1565 1649 char szSec[AUDIOTEST_MAX_SEC_LEN]; … … 1571 1655 1572 1656 /** 1573 * Retrieves a n object handle of a specificobject.1574 * 1575 * @returns VBox status code. 1576 * @param phParent Object handle (parent) theobject contains.1657 * Retrieves a child object of a specific parent object. 1658 * 1659 * @returns VBox status code. 1660 * @param phParent Parent object the child object contains. 1577 1661 * @param idxObj Index of object to retrieve the object handle for. 1578 1662 * @param phObj Where to store the object handle on success. 1579 1663 */ 1580 static int audioTest SetGetObj(PAUDIOTESTOBJHANDLE phParent, uint32_t idxObj, PAUDIOTESTOBJHANDLEphObj)1664 static int audioTestObjGetChild(PAUDIOTESTOBJINT phParent, uint32_t idxObj, PAUDIOTESTOBJINT phObj) 1581 1665 { 1582 1666 char szObj[AUDIOTEST_MAX_SEC_LEN]; … … 1613 1697 */ 1614 1698 static int audioTestVerifyValue(PAUDIOTESTVERIFYJOB pVerify, 1615 PAUDIOTESTOBJ HANDLE phObjA, PAUDIOTESTOBJHANDLEphObjB, const char *pszKey, const char *pszVal, const char *pszErrFmt, ...)1699 PAUDIOTESTOBJINT phObjA, PAUDIOTESTOBJINT phObjB, const char *pszKey, const char *pszVal, const char *pszErrFmt, ...) 1616 1700 { 1617 1701 va_list va; … … 1656 1740 * @param ppObj Where to return the pointer of the allocated and registered audio test object. 1657 1741 */ 1658 static int audioTest SetObjOpen(PAUDIOTESTOBJHANDLE phObj, PAUDIOTESTOBJ*ppObj)1659 { 1660 PAUDIOTESTOBJ pObj = (PAUDIOTESTOBJ)RTMemAlloc(sizeof(AUDIOTESTOBJ));1742 static int audioTestObjOpen(PAUDIOTESTOBJINT phObj, PAUDIOTESTOBJINT *ppObj) 1743 { 1744 PAUDIOTESTOBJINT pObj = (PAUDIOTESTOBJINT)RTMemAlloc(sizeof(AUDIOTESTOBJINT)); 1661 1745 AssertPtrReturn(pObj, VERR_NO_MEMORY); 1662 1746 … … 1697 1781 * 1698 1782 * @returns VBox status code. 1699 * @param pObjObject to close.1700 */ 1701 static int audioTest SetObjCloseInternal(PAUDIOTESTOBJpObj)1783 * @param Obj Object to close. 1784 */ 1785 static int audioTestObjCloseInternal(PAUDIOTESTOBJINT pObj) 1702 1786 { 1703 1787 int rc; … … 1721 1805 * Finalizes an audio test set object. 1722 1806 * 1723 * @param pObjTest object to finalize.1724 */ 1725 static void audioTest SetObjFinalize(PAUDIOTESTOBJpObj)1807 * @param Obj Test object to finalize. 1808 */ 1809 static void audioTestObjFinalize(PAUDIOTESTOBJINT pObj) 1726 1810 { 1727 1811 /** @todo Generalize this function more once we have more object types. */ … … 1739 1823 * @param pProps Where to store the PCM properties on success. 1740 1824 */ 1741 static int audioTest SetObjGetTonePcmProps(PAUDIOTESTOBJHANDLEphObj, PPDMAUDIOPCMPROPS pProps)1825 static int audioTestObjGetTonePcmProps(PAUDIOTESTOBJINT phObj, PPDMAUDIOPCMPROPS pProps) 1742 1826 { 1743 1827 int rc; … … 1827 1911 * @param phTestB Test handle B of test to verify PCM data for. 1828 1912 */ 1829 static int audioTestVerifyTestToneData(PAUDIOTESTVERIFYJOB pVerJob, PAUDIOTESTOBJ HANDLE phTestA, PAUDIOTESTOBJHANDLEphTestB)1913 static int audioTestVerifyTestToneData(PAUDIOTESTVERIFYJOB pVerJob, PAUDIOTESTOBJINT phTestA, PAUDIOTESTOBJINT phTestB) 1830 1914 { 1831 1915 int rc; … … 1833 1917 /** @todo For now ASSUME that we only have one object per test. */ 1834 1918 1835 AUDIOTESTOBJ HANDLEhObjA;1836 1837 rc = audioTest SetGetObj(phTestA, 0 /* idxObj */, &hObjA);1919 AUDIOTESTOBJINT hObjA; 1920 1921 rc = audioTestObjGetChild(phTestA, 0 /* idxObj */, &hObjA); 1838 1922 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Unable to get object A"); 1839 1923 1840 PAUDIOTESTOBJ pObjA;1841 rc = audioTest SetObjOpen(&hObjA, &pObjA);1924 PAUDIOTESTOBJINT pObjA; 1925 rc = audioTestObjOpen(&hObjA, &pObjA); 1842 1926 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Unable to open object A"); 1843 1927 1844 AUDIOTESTOBJ HANDLEhObjB;1845 rc = audioTest SetGetObj(phTestB, 0 /* idxObj */, &hObjB);1928 AUDIOTESTOBJINT hObjB; 1929 rc = audioTestObjGetChild(phTestB, 0 /* idxObj */, &hObjB); 1846 1930 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Unable to get object B"); 1847 1931 1848 PAUDIOTESTOBJ pObjB;1849 rc = audioTest SetObjOpen(&hObjB, &pObjB);1932 PAUDIOTESTOBJINT pObjB; 1933 rc = audioTestObjOpen(&hObjB, &pObjB); 1850 1934 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Unable to open object B"); 1851 1935 AssertReturn(pObjA->enmType == AUDIOTESTOBJTYPE_FILE, VERR_NOT_SUPPORTED); … … 1902 1986 } 1903 1987 1904 rc = audioTest SetObjCloseInternal(pObjA);1905 AssertRCReturn(rc, rc); 1906 rc = audioTest SetObjCloseInternal(pObjB);1988 rc = audioTestObjCloseInternal(pObjA); 1989 AssertRCReturn(rc, rc); 1990 rc = audioTestObjCloseInternal(pObjB); 1907 1991 AssertRCReturn(rc, rc); 1908 1992 … … 1920 2004 * @param phTestB Test handle of test tone B to verify tone A with.* 1921 2005 */ 1922 static int audioTestVerifyTestTone(PAUDIOTESTVERIFYJOB pVerify, PAUDIOTESTOBJ HANDLE phTestA, PAUDIOTESTOBJHANDLEphTestB)2006 static int audioTestVerifyTestTone(PAUDIOTESTVERIFYJOB pVerify, PAUDIOTESTOBJINT phTestA, PAUDIOTESTOBJINT phTestB) 1923 2007 { 1924 2008 int rc; … … 1951 2035 CHECK_RC_MAYBE_RET(rc, pVerify); 1952 2036 1953 rc = audioTest SetObjGetTonePcmProps(phTestA, &pVerify->PCMProps);2037 rc = audioTestObjGetTonePcmProps(phTestA, &pVerify->PCMProps); 1954 2038 CHECK_RC_MAYBE_RET(rc, pVerify); 1955 2039 … … 2000 2084 * Compare obvious values first. 2001 2085 */ 2002 AUDIOTESTOBJ HANDLEhHdrA;2086 AUDIOTESTOBJINT hHdrA; 2003 2087 rc = audioTestSetGetSection(pVerJob->pSetA, AUDIOTEST_SEC_HDR_STR, &hHdrA); 2004 2088 CHECK_RC_MAYBE_RET(rc, pVerJob); 2005 2089 2006 AUDIOTESTOBJ HANDLEhHdrB;2090 AUDIOTESTOBJINT hHdrB; 2007 2091 rc = audioTestSetGetSection(pVerJob->pSetB, AUDIOTEST_SEC_HDR_STR, &hHdrB); 2008 2092 CHECK_RC_MAYBE_RET(rc, pVerJob); … … 2030 2114 VerJob.idxTest = i; 2031 2115 2032 AUDIOTESTOBJ HANDLEhTestA;2116 AUDIOTESTOBJINT hTestA; 2033 2117 rc = audioTestSetGetTest(VerJob.pSetA, i, &hTestA); 2034 2118 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Test A not found"); 2035 2119 2036 AUDIOTESTOBJ HANDLEhTestB;2120 AUDIOTESTOBJINT hTestB; 2037 2121 rc = audioTestSetGetTest(VerJob.pSetB, i, &hTestB); 2038 2122 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Test B not found"); -
trunk/src/VBox/Devices/Audio/AudioTest.h
r89984 r89994 152 152 typedef AUDIOTESTPARMS *PAUDIOTESTPARMS; 153 153 154 /** 155 * Enumeration for an audio test object type. 156 */ 157 typedef enum AUDIOTESTOBJTYPE 158 { 159 /** Unknown / invalid, do not use. */ 160 AUDIOTESTOBJTYPE_UNKNOWN = 0, 161 /** The test object is a file. */ 162 AUDIOTESTOBJTYPE_FILE, 163 /** The usual 32-bit hack. */ 164 AUDIOTESTOBJTYPE_32BIT_HACK = 0x7fffffff 165 } AUDIOTESTOBJTYPE; 166 167 /** 168 * Structure for keeping an audio test object file. 169 */ 170 typedef struct AUDIOTESTOBJFILE 171 { 172 /** File handle. */ 173 RTFILE hFile; 174 /** Total size (in bytes). */ 175 size_t cbSize; 176 } AUDIOTESTOBJFILE; 177 /** Pointer to an audio test object file. */ 178 typedef AUDIOTESTOBJFILE *PAUDIOTESTOBJFILE; 179 180 /** 181 * Enumeration for an audio test object meta data type. 182 */ 183 typedef enum AUDIOTESTOBJMETADATATYPE 184 { 185 /** Unknown / invalid, do not use. */ 186 AUDIOTESTOBJMETADATATYPE_INVALID = 0, 187 /** Meta data is an UTF-8 string. */ 188 AUDIOTESTOBJMETADATATYPE_STRING, 189 /** The usual 32-bit hack. */ 190 AUDIOTESTOBJMETADATATYPE_32BIT_HACK = 0x7fffffff 191 } AUDIOTESTOBJMETADATATYPE; 192 193 /** 194 * Structure for keeping a meta data block. 195 */ 196 typedef struct AUDIOTESTOBJMETA 197 { 198 /** List node. */ 199 RTLISTNODE Node; 200 /** Meta data type. */ 201 AUDIOTESTOBJMETADATATYPE enmType; 202 /** Meta data block. */ 203 void *pvMeta; 204 /** Size (in bytes) of \a pvMeta. */ 205 size_t cbMeta; 206 } AUDIOTESTOBJMETA; 207 /** Pointer to an audio test object file. */ 208 typedef AUDIOTESTOBJMETA *PAUDIOTESTOBJMETA; 209 210 /** 211 * Structure for keeping a single audio test object. 212 * 213 * A test object is data which is needed in order to perform and verify one or 214 * more audio test case(s). 215 */ 216 typedef struct AUDIOTESTOBJ 217 { 218 /** List node. */ 219 RTLISTNODE Node; 220 /** The UUID of the object. 221 * Used to identify an object within a test set. */ 222 RTUUID Uuid; 223 /** Number of references to this test object. */ 224 uint32_t cRefs; 225 /** Name of the test object. 226 * Must not contain a path and has to be able to serialize to disk. */ 227 char szName[64]; 228 /** The object type. */ 229 AUDIOTESTOBJTYPE enmType; 230 /** Meta data list. */ 231 RTLISTANCHOR lstMeta; 232 /** Union for holding the object type-specific data. */ 233 union 234 { 235 AUDIOTESTOBJFILE File; 236 }; 237 } AUDIOTESTOBJ; 238 /** Pointer to an audio test object. */ 239 typedef AUDIOTESTOBJ *PAUDIOTESTOBJ; 154 /** Test object handle. */ 155 typedef R3R0PTRTYPE(struct AUDIOTESTOBJINT RT_FAR *) AUDIOTESTOBJ; 156 /** Pointer to test object handle. */ 157 typedef AUDIOTESTOBJ RT_FAR *PAUDIOTESTOBJ; 158 /** Nil test object handle. */ 159 #define NIL_AUDIOTESTOBJ ((AUDIOTESTOBJ)~(RTHCINTPTR)0) 240 160 241 161 struct AUDIOTESTSET; … … 351 271 int AudioTestPathCreate(char *pszPath, size_t cbPath, const char *pszUUID); 352 272 353 int AudioTestSetObjCreateAndRegister(PAUDIOTESTSET pSet, const char *pszName, PAUDIOTESTOBJ *ppObj); 354 int AudioTestSetObjWrite(PAUDIOTESTOBJ pObj, const void *pvBuf, size_t cbBuf); 355 int AudioTestSetObjAddMetadataStr(PAUDIOTESTOBJ pObj, const char *pszFormat, ...); 356 int AudioTestSetObjClose(PAUDIOTESTOBJ pObj); 273 int AudioTestSetObjCreateAndRegister(PAUDIOTESTSET pSet, const char *pszName, PAUDIOTESTOBJ pObj); 274 275 int AudioTestObjWrite(AUDIOTESTOBJ Obj, const void *pvBuf, size_t cbBuf); 276 int AudioTestObjAddMetadataStr(AUDIOTESTOBJ Obj, const char *pszFormat, ...); 277 int AudioTestObjClose(AUDIOTESTOBJ Obj); 357 278 358 279 int AudioTestSetTestBegin(PAUDIOTESTSET pSet, const char *pszDesc, PAUDIOTESTPARMS pParms, PAUDIOTESTENTRY *ppEntry); -
trunk/src/VBox/Devices/Audio/DrvHostAudioValidationKit.cpp
r89992 r89994 95 95 PAUDIOTESTENTRY pEntry; 96 96 /** Current test object to process. */ 97 PAUDIOTESTOBJ pObj;97 AUDIOTESTOBJ Obj; 98 98 /** Stream configuration to use for this test. */ 99 99 PDMAUDIOSTREAMCFG StreamCfg; … … 170 170 RTListNodeRemove(&pTst->Node); 171 171 172 AudioTest SetObjClose(pTst->pObj);173 pTst-> pObj = NULL;172 AudioTestObjClose(pTst->Obj); 173 pTst->Obj = NULL; 174 174 175 175 if (pTst->pEntry) /* Set set entry assign? Mark as done. */ … … 777 777 &Parms, &pTst->pEntry); 778 778 if (RT_SUCCESS(rc)) 779 rc = AudioTestSetObjCreateAndRegister(&pThis->Set, "host-tone-rec.pcm", &pTst-> pObj);779 rc = AudioTestSetObjCreateAndRegister(&pThis->Set, "host-tone-rec.pcm", &pTst->Obj); 780 780 781 781 if (RT_SUCCESS(rc)) … … 794 794 || (fIsSilence && fHandleSilence)) 795 795 { 796 rc = AudioTest SetObjWrite(pTst->pObj, pvBuf, cbBuf);796 rc = AudioTestObjWrite(pTst->Obj, pvBuf, cbBuf); 797 797 pTst->t.TestTone.u.Play.cbRead += cbBuf; 798 798 … … 894 894 &Parms, &pTst->pEntry); 895 895 if (RT_SUCCESS(rc)) 896 rc = AudioTestSetObjCreateAndRegister(&pThis->Set, "host-tone-play.pcm", &pTst-> pObj);896 rc = AudioTestSetObjCreateAndRegister(&pThis->Set, "host-tone-play.pcm", &pTst->Obj); 897 897 898 898 if (RT_SUCCESS(rc)) … … 915 915 && cbRead) 916 916 { 917 rc = AudioTest SetObjWrite(pTst->pObj, pvBuf, cbRead);917 rc = AudioTestObjWrite(pTst->Obj, pvBuf, cbRead); 918 918 if (RT_SUCCESS(rc)) 919 919 {
Note:
See TracChangeset
for help on using the changeset viewer.