Changeset 89026 in vbox
- Timestamp:
- May 13, 2021 1:12:44 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144365
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp
r89025 r89026 265 265 * Internal Functions * 266 266 *********************************************************************************************************************************/ 267 DECLHIDDEN(int) coreAudioInputPermissionCheck(void); /* DrvHostAudioCoreAudioAuth.mm */ 268 static int drvHostCoreAudioStreamControlInternal(PCOREAUDIOSTREAM pStreamCA, PDMAUDIOSTREAMCMD enmStreamCmd); 269 270 271 272 273 static void coreAudioPrintASBD(const char *pszDesc, const AudioStreamBasicDescription *pASBD) 267 static int drvHostAudioCaStreamControlInternal(PCOREAUDIOSTREAM pStreamCA, PDMAUDIOSTREAMCMD enmStreamCmd); 268 269 /* DrvHostAudioCoreAudioAuth.mm: */ 270 DECLHIDDEN(int) coreAudioInputPermissionCheck(void); 271 272 273 274 275 static void drvHostAudioCaPrintASBD(const char *pszDesc, const AudioStreamBasicDescription *pASBD) 274 276 { 275 277 LogRel2(("CoreAudio: %s description:\n", pszDesc)); … … 305 307 306 308 307 static void coreAudioPCMPropsToASBD(PCPDMAUDIOPCMPROPS pProps, AudioStreamBasicDescription *pASBD)309 static void drvHostAudioCaPCMPropsToASBD(PCPDMAUDIOPCMPROPS pProps, AudioStreamBasicDescription *pASBD) 308 310 { 309 311 AssertPtrReturnVoid(pProps); … … 328 330 329 331 #if 0 /* unused */ 330 static int coreAudioCFStringToCString(const CFStringRef pCFString, char **ppszString)332 static int drvHostAudioCaCFStringToCString(const CFStringRef pCFString, char **ppszString) 331 333 { 332 334 CFIndex cLen = CFStringGetLength(pCFString) + 1; … … 342 344 } 343 345 344 static AudioDeviceID coreAudioDeviceUIDtoID(const char* pszUID)346 static AudioDeviceID drvHostAudioCaDeviceUIDtoID(const char* pszUID) 345 347 { 346 348 /* Create a CFString out of our CString. */ … … 390 392 * @param pASBDDst Output (destination) stream description to use. 391 393 */ 392 static int coreAudioInitConvCbCtx(PCOREAUDIOCONVCBCTX pConvCbCtx, PCOREAUDIOSTREAM pStream,393 AudioStreamBasicDescription *pASBDSrc, AudioStreamBasicDescription *pASBDDst)394 static int drvHostAudioCaInitConvCbCtx(PCOREAUDIOCONVCBCTX pConvCbCtx, PCOREAUDIOSTREAM pStream, 395 AudioStreamBasicDescription *pASBDSrc, AudioStreamBasicDescription *pASBDDst) 394 396 { 395 397 AssertPtrReturn(pConvCbCtx, VERR_INVALID_POINTER); … … 399 401 400 402 # ifdef DEBUG 401 coreAudioPrintASBD("CbCtx: Src", pASBDSrc);402 coreAudioPrintASBD("CbCtx: Dst", pASBDDst);403 drvHostAudioCaPrintASBD("CbCtx: Src", pASBDSrc); 404 drvHostAudioCaPrintASBD("CbCtx: Dst", pASBDDst); 403 405 # endif 404 406 … … 421 423 * @param pConvCbCtx Conversion callback context to uninitialize. 422 424 */ 423 static void coreAudioUninitConvCbCtx(PCOREAUDIOCONVCBCTX pConvCbCtx)425 static void drvHostAudioCaUninitConvCbCtx(PCOREAUDIOCONVCBCTX pConvCbCtx) 424 426 { 425 427 AssertPtrReturnVoid(pConvCbCtx); … … 435 437 436 438 /* Callback to convert audio input data from one format to another. */ 437 static OSStatus coreAudioConverterCb(AudioConverterRef inAudioConverter, 438 UInt32 *ioNumberDataPackets, 439 AudioBufferList *ioData, 440 AudioStreamPacketDescription **ppASPD, 441 void *pvUser) 439 static OSStatus drvHostAudioCaConverterCb(AudioConverterRef inAudioConverter, UInt32 *ioNumberDataPackets, 440 AudioBufferList *ioData, AudioStreamPacketDescription **ppASPD, void *pvUser) 442 441 { 443 442 RT_NOREF(inAudioConverter); … … 726 725 * @param audioBuffer Audio buffer to store data into. 727 726 */ 728 static int coreAudioOutputQueueProcBuffer(PCOREAUDIOSTREAM pStreamCA, AudioQueueBufferRef audioBuffer)727 static int drvHostAudioCaOutputQueueProcBuffer(PCOREAUDIOSTREAM pStreamCA, AudioQueueBufferRef audioBuffer) 729 728 { 730 729 AssertPtr(pStreamCA); … … 794 793 * @thread queue thread. 795 794 */ 796 static void coreAudioOutputQueueCb(void *pvUser, AudioQueueRef hAudioQueue, AudioQueueBufferRef audioBuffer)795 static void drvHostAudioCaOutputQueueCb(void *pvUser, AudioQueueRef hAudioQueue, AudioQueueBufferRef audioBuffer) 797 796 { 798 797 PCOREAUDIOSTREAM pStreamCA = (PCOREAUDIOSTREAM)pvUser; … … 802 801 AssertRC(rc); 803 802 804 rc = coreAudioOutputQueueProcBuffer(pStreamCA, audioBuffer);803 rc = drvHostAudioCaOutputQueueProcBuffer(pStreamCA, audioBuffer); 805 804 if (RT_SUCCESS(rc)) 806 805 AudioQueueEnqueueBuffer(hAudioQueue, audioBuffer, 0, NULL); … … 818 817 * @param audioBuffer Audio buffer to process input data from. 819 818 */ 820 static int coreAudioInputQueueProcBuffer(PCOREAUDIOSTREAM pStreamCA, AudioQueueBufferRef audioBuffer)819 static int drvHostAudioCaInputQueueProcBuffer(PCOREAUDIOSTREAM pStreamCA, AudioQueueBufferRef audioBuffer) 821 820 { 822 821 PRTCIRCBUF pCircBuf = pStreamCA->pCircBuf; … … 873 872 * @param paPacketDesc Array of packet descriptors. 874 873 */ 875 static void coreAudioInputQueueCb(void *pvUser, AudioQueueRef hAudioQueue, AudioQueueBufferRef audioBuffer,876 const AudioTimeStamp *pAudioTS,877 UInt32 cPacketDesc, const AudioStreamPacketDescription *paPacketDesc)874 static void drvHostAudioCaInputQueueCb(void *pvUser, AudioQueueRef hAudioQueue, AudioQueueBufferRef audioBuffer, 875 const AudioTimeStamp *pAudioTS, 876 UInt32 cPacketDesc, const AudioStreamPacketDescription *paPacketDesc) 878 877 { 879 878 RT_NOREF(pAudioTS, cPacketDesc, paPacketDesc); … … 885 884 AssertRC(rc); 886 885 887 rc = coreAudioInputQueueProcBuffer(pStreamCA, audioBuffer);886 rc = drvHostAudioCaInputQueueProcBuffer(pStreamCA, audioBuffer); 888 887 if (RT_SUCCESS(rc)) 889 888 AudioQueueEnqueueBuffer(hAudioQueue, audioBuffer, 0, NULL); … … 901 900 * stream and handling its callbacks. 902 901 */ 903 static DECLCALLBACK(int) coreAudioQueueThread(RTTHREAD hThreadSelf, void *pvUser)902 static DECLCALLBACK(int) drvHostAudioCaQueueThread(RTTHREAD hThreadSelf, void *pvUser) 904 903 { 905 904 PCOREAUDIOSTREAM pStreamCA = (PCOREAUDIOSTREAM)pvUser; … … 918 917 OSStatus orc; 919 918 if (fIn) 920 orc = AudioQueueNewInput(&pStreamCA->asbdStream, coreAudioInputQueueCb, pStreamCA /* pvData */,919 orc = AudioQueueNewInput(&pStreamCA->asbdStream, drvHostAudioCaInputQueueCb, pStreamCA /* pvData */, 921 920 CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0, &pStreamCA->hAudioQueue); 922 921 else 923 orc = AudioQueueNewOutput(&pStreamCA->asbdStream, coreAudioOutputQueueCb, pStreamCA /* pvData */,922 orc = AudioQueueNewOutput(&pStreamCA->asbdStream, drvHostAudioCaOutputQueueCb, pStreamCA /* pvData */, 924 923 CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0, &pStreamCA->hAudioQueue); 925 924 if (orc == noErr) … … 993 992 * @todo r=bird: Which use of the word 'invalidate' is this? 994 993 */ 995 static int coreAudioStreamInvalidateQueue(PCOREAUDIOSTREAM pStreamCA)994 static int drvHostAudioCaStreamInvalidateQueue(PCOREAUDIOSTREAM pStreamCA) 996 995 { 997 996 int rc = VINF_SUCCESS; … … 1004 1003 if (pStreamCA->Cfg.enmDir == PDMAUDIODIR_IN) 1005 1004 { 1006 int rc2 = coreAudioInputQueueProcBuffer(pStreamCA, pBuf);1005 int rc2 = drvHostAudioCaInputQueueProcBuffer(pStreamCA, pBuf); 1007 1006 if (RT_SUCCESS(rc2)) 1008 1007 AudioQueueEnqueueBuffer(pStreamCA->hAudioQueue, pBuf, 0 /*inNumPacketDescs*/, NULL /*inPacketDescs*/); … … 1011 1010 { 1012 1011 Assert(pStreamCA->Cfg.enmDir == PDMAUDIODIR_OUT); 1013 int rc2 = coreAudioOutputQueueProcBuffer(pStreamCA, pBuf);1012 int rc2 = drvHostAudioCaOutputQueueProcBuffer(pStreamCA, pBuf); 1014 1013 if ( RT_SUCCESS(rc2) 1015 1014 && pBuf->mAudioDataByteSize) … … 1032 1031 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetConfig} 1033 1032 */ 1034 static DECLCALLBACK(int) drvHost CoreAudioHA_GetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg)1033 static DECLCALLBACK(int) drvHostAudioCaHA_GetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg) 1035 1034 { 1036 1035 PDRVHOSTCOREAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio); … … 1061 1060 * @param pDrv Driver instance to use. 1062 1061 */ 1063 static void coreAudioDeviceDataInit(PCOREAUDIODEVICEDATA pDevData, AudioDeviceID deviceID, bool fIsInput, PDRVHOSTCOREAUDIO pDrv) 1062 static void drvHostAudioCaDeviceDataInit(PCOREAUDIODEVICEDATA pDevData, AudioDeviceID deviceID, 1063 bool fIsInput, PDRVHOSTCOREAUDIO pDrv) 1064 1064 { 1065 1065 AssertPtrReturnVoid(pDevData); … … 1096 1096 * @param pDevEnm Where to store the enumerated devices. 1097 1097 */ 1098 static int coreAudioDevicesEnumerate(PDRVHOSTCOREAUDIO pThis, PDMAUDIODIR enmUsage, PPDMAUDIOHOSTENUM pDevEnm)1098 static int drvHostAudioCaDevicesEnumerate(PDRVHOSTCOREAUDIO pThis, PDMAUDIODIR enmUsage, PPDMAUDIOHOSTENUM pDevEnm) 1099 1099 { 1100 1100 AssertPtrReturn(pThis, VERR_INVALID_POINTER); … … 1105 1105 do /* (this is not a loop, just a device for avoid gotos while trying not to shoot oneself in the foot too badly.) */ 1106 1106 { 1107 /* 1108 * First get the device ID of the default device. 1109 */ 1107 1110 AudioDeviceID defaultDeviceID = kAudioDeviceUnknown; 1108 1109 /* Fetch the default audio device currently in use. */1110 1111 AudioObjectPropertyAddress PropAddrDefaultDev = 1111 1112 { … … 1129 1130 } 1130 1131 1132 /* 1133 * Get a list of all audio devices. 1134 */ 1131 1135 AudioObjectPropertyAddress PropAddrDevList = 1132 1136 { … … 1152 1156 UInt16 cDevices = uSize / sizeof(AudioDeviceID); 1153 1157 1158 /* 1159 * Try get details on each device and try add them to the enumeration result. 1160 */ 1154 1161 PCOREAUDIODEVICEDATA pDev = NULL; 1155 1162 for (UInt16 i = 0; i < cDevices; i++) … … 1169 1176 1170 1177 /* Init backend-specific device data. */ 1171 coreAudioDeviceDataInit(pDev, pDevIDs[i], enmUsage == PDMAUDIODIR_IN, pThis);1178 drvHostAudioCaDeviceDataInit(pDev, pDevIDs[i], enmUsage == PDMAUDIODIR_IN, pThis); 1172 1179 1173 1180 /* Check if the device is valid. */ … … 1324 1331 * @param deviceID Device ID to search. 1325 1332 */ 1326 bool coreAudioDevicesHasDevice(PPDMAUDIOHOSTENUM pEnmSrc, AudioDeviceID deviceID)1333 static bool drvHostAudioCaDevicesHasDevice(PPDMAUDIOHOSTENUM pEnmSrc, AudioDeviceID deviceID) 1327 1334 { 1328 1335 PCOREAUDIODEVICEDATA pDevSrc; … … 1345 1352 * @param pEnmDst Where to store the device enumeration list. 1346 1353 */ 1347 int coreAudioDevicesEnumerateAll(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOHOSTENUM pEnmDst)1354 static int drvHostAudioCaDevicesEnumerateAll(PDRVHOSTCOREAUDIO pThis, PPDMAUDIOHOSTENUM pEnmDst) 1348 1355 { 1349 1356 PDMAUDIOHOSTENUM devEnmIn; 1350 int rc = coreAudioDevicesEnumerate(pThis, PDMAUDIODIR_IN, &devEnmIn);1357 int rc = drvHostAudioCaDevicesEnumerate(pThis, PDMAUDIODIR_IN, &devEnmIn); 1351 1358 if (RT_SUCCESS(rc)) 1352 1359 { 1353 1360 PDMAUDIOHOSTENUM devEnmOut; 1354 rc = coreAudioDevicesEnumerate(pThis, PDMAUDIODIR_OUT, &devEnmOut);1361 rc = drvHostAudioCaDevicesEnumerate(pThis, PDMAUDIODIR_OUT, &devEnmOut); 1355 1362 if (RT_SUCCESS(rc)) 1356 1363 { 1364 1365 /** @todo r=bird: This is an awfully complicated and inefficient way of doing 1366 * it. Here you could just merge the two list (walk one, remove duplicates 1367 * from the other one) and skip all that duplication. 1368 * 1369 * Howerver, drvHostAudioCaDevicesEnumerate gets the device list twice, which is 1370 * a complete waste of time. You could easily do all the work in 1371 * drvHostAudioCaDevicesEnumerate by just querying the IDs of both default 1372 * devices we're interested in, saving the merging extra allocations and 1373 * extra allocation. */ 1374 1357 1375 /* 1358 1376 * Build up the final device enumeration, based on the input and output device lists … … 1373 1391 } 1374 1392 1375 coreAudioDeviceDataInit(pDevDst, pDevSrcIn->deviceID, true /* fIsInput */, pThis);1393 drvHostAudioCaDeviceDataInit(pDevDst, pDevSrcIn->deviceID, true /* fIsInput */, pThis); 1376 1394 1377 1395 RTStrCopy(pDevDst->Core.szName, sizeof(pDevDst->Core.szName), pDevSrcIn->Core.szName); … … 1423 1441 RTListForEach(&devEnmOut.LstDevices, pDevSrcOut, COREAUDIODEVICEDATA, Core.ListEntry) 1424 1442 { 1425 if ( coreAudioDevicesHasDevice(pEnmDst, pDevSrcOut->deviceID))1443 if (drvHostAudioCaDevicesHasDevice(pEnmDst, pDevSrcOut->deviceID)) 1426 1444 continue; /* Already in our list, skip. */ 1427 1445 … … 1433 1451 } 1434 1452 1435 coreAudioDeviceDataInit(pDevDst, pDevSrcOut->deviceID, false /* fIsInput */, pThis);1453 drvHostAudioCaDeviceDataInit(pDevDst, pDevSrcOut->deviceID, false /* fIsInput */, pThis); 1436 1454 1437 1455 RTStrCopy(pDevDst->Core.szName, sizeof(pDevDst->Core.szName), pDevSrcOut->Core.szName); … … 1477 1495 * @param pDev Audio device to use for the registered callbacks. 1478 1496 */ 1479 static int coreAudioDeviceRegisterCallbacks(PDRVHOSTCOREAUDIO pThis, PCOREAUDIODEVICEDATA pDev)1497 static int drvHostAudioCaDeviceRegisterCallbacks(PDRVHOSTCOREAUDIO pThis, PCOREAUDIODEVICEDATA pDev) 1480 1498 { 1481 1499 RT_NOREF(pThis); … … 1529 1547 * @param pDev Audio device to use for the registered callbacks. 1530 1548 */ 1531 static int coreAudioDeviceUnregisterCallbacks(PDRVHOSTCOREAUDIO pThis, PCOREAUDIODEVICEDATA pDev)1549 static int drvHostAudioCaDeviceUnregisterCallbacks(PDRVHOSTCOREAUDIO pThis, PCOREAUDIODEVICEDATA pDev) 1532 1550 { 1533 1551 RT_NOREF(pThis); … … 1579 1597 * @param pThis Host audio driver instance. 1580 1598 */ 1581 static int coreAudioEnumerateDevices(PDRVHOSTCOREAUDIO pThis)1599 static int drvHostAudioCaEnumerateDevices(PDRVHOSTCOREAUDIO pThis) 1582 1600 { 1583 1601 LogFlowFuncEnter(); … … 1588 1606 if (pThis->pDefaultDevIn) 1589 1607 { 1590 coreAudioDeviceUnregisterCallbacks(pThis, pThis->pDefaultDevIn);1608 drvHostAudioCaDeviceUnregisterCallbacks(pThis, pThis->pDefaultDevIn); 1591 1609 pThis->pDefaultDevIn = NULL; 1592 1610 } … … 1594 1612 if (pThis->pDefaultDevOut) 1595 1613 { 1596 coreAudioDeviceUnregisterCallbacks(pThis, pThis->pDefaultDevOut);1614 drvHostAudioCaDeviceUnregisterCallbacks(pThis, pThis->pDefaultDevOut); 1597 1615 pThis->pDefaultDevOut = NULL; 1598 1616 } … … 1602 1620 1603 1621 /* Enumerate all devices internally. */ 1604 int rc = coreAudioDevicesEnumerateAll(pThis, &pThis->Devices);1622 int rc = drvHostAudioCaDevicesEnumerateAll(pThis, &pThis->Devices); 1605 1623 if (RT_SUCCESS(rc)) 1606 1624 { … … 1613 1631 LogRel2(("CoreAudio: Default capturing device is '%s'\n", pThis->pDefaultDevIn->Core.szName)); 1614 1632 LogFunc(("pDefaultDevIn=%p, ID=%RU32\n", pThis->pDefaultDevIn, pThis->pDefaultDevIn->deviceID)); 1615 rc = coreAudioDeviceRegisterCallbacks(pThis, pThis->pDefaultDevIn);1633 rc = drvHostAudioCaDeviceRegisterCallbacks(pThis, pThis->pDefaultDevIn); 1616 1634 } 1617 1635 else … … 1626 1644 LogRel2(("CoreAudio: Default playback device is '%s'\n", pThis->pDefaultDevOut->Core.szName)); 1627 1645 LogFunc(("pDefaultDevOut=%p, ID=%RU32\n", pThis->pDefaultDevOut, pThis->pDefaultDevOut->deviceID)); 1628 rc = coreAudioDeviceRegisterCallbacks(pThis, pThis->pDefaultDevOut);1646 rc = drvHostAudioCaDeviceRegisterCallbacks(pThis, pThis->pDefaultDevOut); 1629 1647 } 1630 1648 else … … 1640 1658 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetDevices} 1641 1659 */ 1642 static DECLCALLBACK(int) drvHost CoreAudioHA_GetDevices(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHOSTENUM pDeviceEnum)1660 static DECLCALLBACK(int) drvHostAudioCaHA_GetDevices(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHOSTENUM pDeviceEnum) 1643 1661 { 1644 1662 PDRVHOSTCOREAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio); … … 1653 1671 if (RT_SUCCESS(rc)) 1654 1672 { 1655 rc = coreAudioEnumerateDevices(pThis);1673 rc = drvHostAudioCaEnumerateDevices(pThis); 1656 1674 if (RT_SUCCESS(rc)) 1657 1675 { … … 1676 1694 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetStatus} 1677 1695 */ 1678 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHost CoreAudioHA_GetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)1696 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHostAudioCaHA_GetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir) 1679 1697 { 1680 1698 RT_NOREF(pInterface, enmDir); … … 1686 1704 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCreate} 1687 1705 */ 1688 static DECLCALLBACK(int) drvHost CoreAudioHA_StreamCreate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,1689 1706 static DECLCALLBACK(int) drvHostAudioCaHA_StreamCreate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 1707 PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq) 1690 1708 { 1691 1709 PDRVHOSTCOREAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio); … … 1737 1755 */ 1738 1756 PDMAudioStrmCfgCopy(&pStreamCA->Cfg, pCfgReq); 1739 coreAudioPCMPropsToASBD(&pCfgReq->Props, &pStreamCA->asbdStream);1757 drvHostAudioCaPCMPropsToASBD(&pCfgReq->Props, &pStreamCA->asbdStream); 1740 1758 /** @todo Do some validation? */ 1741 coreAudioPrintASBD( pCfgReq->enmDir == PDMAUDIODIR_IN1742 ? "Capturing queue format"1743 : "Playback queue format", &pStreamCA->asbdStream);1759 drvHostAudioCaPrintASBD( pCfgReq->enmDir == PDMAUDIODIR_IN 1760 ? "Capturing queue format" 1761 : "Playback queue format", &pStreamCA->asbdStream); 1744 1762 1745 1763 rc = RTCircBufCreate(&pStreamCA->pCircBuf, … … 1753 1771 uint32_t idxThread = ASMAtomicIncU32(&s_idxThread); 1754 1772 1755 rc = RTThreadCreateF(&pStreamCA->hThread, coreAudioQueueThread, pStreamCA, 0 /*cbStack*/,1773 rc = RTThreadCreateF(&pStreamCA->hThread, drvHostAudioCaQueueThread, pStreamCA, 0 /*cbStack*/, 1756 1774 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "CaQue%u", idxThread); 1757 1775 if (RT_SUCCESS(rc)) … … 1806 1824 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamDestroy} 1807 1825 */ 1808 static DECLCALLBACK(int) drvHost CoreAudioHA_StreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)1826 static DECLCALLBACK(int) drvHostAudioCaHA_StreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 1809 1827 { 1810 1828 RT_NOREF(pInterface); … … 1826 1844 /** @todo this isn't paranoid enough, the pStreamCA->hAudioQueue is 1827 1845 * owned+released by the queue thread. */ 1828 drvHost CoreAudioStreamControlInternal(pStreamCA, PDMAUDIOSTREAMCMD_DISABLE);1846 drvHostAudioCaStreamControlInternal(pStreamCA, PDMAUDIOSTREAMCMD_DISABLE); 1829 1847 1830 1848 /* … … 1891 1909 1892 1910 1893 static int drvHost CoreAudioStreamControlInternal(PCOREAUDIOSTREAM pStreamCA, PDMAUDIOSTREAMCMD enmStreamCmd)1911 static int drvHostAudioCaStreamControlInternal(PCOREAUDIOSTREAM pStreamCA, PDMAUDIOSTREAMCMD enmStreamCmd) 1894 1912 { 1895 1913 uint32_t enmInitState = ASMAtomicReadU32(&pStreamCA->enmInitState); … … 1911 1929 if (pStreamCA->Cfg.enmDir == PDMAUDIODIR_IN) 1912 1930 { 1913 rc = coreAudioStreamInvalidateQueue(pStreamCA);1931 rc = drvHostAudioCaStreamInvalidateQueue(pStreamCA); 1914 1932 if (RT_SUCCESS(rc)) 1915 1933 { … … 1956 1974 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamControl} 1957 1975 */ 1958 static DECLCALLBACK(int) drvHost CoreAudioHA_StreamControl(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,1959 1976 static DECLCALLBACK(int) drvHostAudioCaHA_StreamControl(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 1977 PDMAUDIOSTREAMCMD enmStreamCmd) 1960 1978 { 1961 1979 RT_NOREF(pInterface); … … 1963 1981 AssertPtrReturn(pStreamCA, VERR_INVALID_POINTER); 1964 1982 1965 return drvHost CoreAudioStreamControlInternal(pStreamCA, enmStreamCmd);1983 return drvHostAudioCaStreamControlInternal(pStreamCA, enmStreamCmd); 1966 1984 } 1967 1985 … … 1970 1988 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetReadable} 1971 1989 */ 1972 static DECLCALLBACK(uint32_t) drvHost CoreAudioHA_StreamGetReadable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)1990 static DECLCALLBACK(uint32_t) drvHostAudioCaHA_StreamGetReadable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 1973 1991 { 1974 1992 RT_NOREF(pInterface); … … 1992 2010 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetWritable} 1993 2011 */ 1994 static DECLCALLBACK(uint32_t) drvHost CoreAudioHA_StreamGetWritable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)2012 static DECLCALLBACK(uint32_t) drvHostAudioCaHA_StreamGetWritable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream) 1995 2013 { 1996 2014 RT_NOREF(pInterface); … … 2016 2034 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetState} 2017 2035 */ 2018 static DECLCALLBACK(PDMHOSTAUDIOSTREAMSTATE) drvHost CoreAudioHA_StreamGetState(PPDMIHOSTAUDIO pInterface,2019 2036 static DECLCALLBACK(PDMHOSTAUDIOSTREAMSTATE) drvHostAudioCaHA_StreamGetState(PPDMIHOSTAUDIO pInterface, 2037 PPDMAUDIOBACKENDSTREAM pStream) 2020 2038 { 2021 2039 RT_NOREF(pInterface); … … 2031 2049 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamPlay} 2032 2050 */ 2033 static DECLCALLBACK(int) drvHost CoreAudioHA_StreamPlay(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,2034 2051 static DECLCALLBACK(int) drvHostAudioCaHA_StreamPlay(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 2052 const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten) 2035 2053 { 2036 2054 PDRVHOSTCOREAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTCOREAUDIO, IHostAudio); … … 2094 2112 && !pStreamCA->fIsRunning) 2095 2113 { 2096 rc = coreAudioStreamInvalidateQueue(pStreamCA);2114 rc = drvHostAudioCaStreamInvalidateQueue(pStreamCA); 2097 2115 if (RT_SUCCESS(rc)) 2098 2116 { … … 2114 2132 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCapture} 2115 2133 */ 2116 static DECLCALLBACK(int) drvHost CoreAudioHA_StreamCapture(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,2117 2134 static DECLCALLBACK(int) drvHostAudioCaHA_StreamCapture(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 2135 void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead) 2118 2136 { 2119 2137 RT_NOREF(pInterface); … … 2165 2183 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 2166 2184 */ 2167 static DECLCALLBACK(void *) drvHost CoreAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)2185 static DECLCALLBACK(void *) drvHostAudioCaQueryInterface(PPDMIBASE pInterface, const char *pszIID) 2168 2186 { 2169 2187 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); … … 2184 2202 * Worker for the power off and destructor callbacks. 2185 2203 */ 2186 static void drvHost CoreAudioRemoveDefaultDeviceListners(PDRVHOSTCOREAUDIO pThis)2204 static void drvHostAudioCaRemoveDefaultDeviceListners(PDRVHOSTCOREAUDIO pThis) 2187 2205 { 2188 2206 /* … … 2224 2242 * @interface_method_impl{PDMDRVREG,pfnPowerOff} 2225 2243 */ 2226 static DECLCALLBACK(void) drvHost CoreAudioPowerOff(PPDMDRVINS pDrvIns)2244 static DECLCALLBACK(void) drvHostAudioCaPowerOff(PPDMDRVINS pDrvIns) 2227 2245 { 2228 2246 PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO); 2229 drvHost CoreAudioRemoveDefaultDeviceListners(pThis);2247 drvHostAudioCaRemoveDefaultDeviceListners(pThis); 2230 2248 } 2231 2249 … … 2234 2252 * @callback_method_impl{FNPDMDRVDESTRUCT} 2235 2253 */ 2236 static DECLCALLBACK(void) drvHost CoreAudioDestruct(PPDMDRVINS pDrvIns)2254 static DECLCALLBACK(void) drvHostAudioCaDestruct(PPDMDRVINS pDrvIns) 2237 2255 { 2238 2256 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns); 2239 2257 PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO); 2240 2258 2241 drvHost CoreAudioRemoveDefaultDeviceListners(pThis);2259 drvHostAudioCaRemoveDefaultDeviceListners(pThis); 2242 2260 2243 2261 int rc2 = RTCritSectDelete(&pThis->CritSect); … … 2252 2270 * Construct a Core Audio driver instance.} 2253 2271 */ 2254 static DECLCALLBACK(int) drvHost CoreAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)2272 static DECLCALLBACK(int) drvHostAudioCaConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 2255 2273 { 2256 2274 RT_NOREF(pCfg, fFlags); … … 2265 2283 PDMAudioHostEnumInit(&pThis->Devices); 2266 2284 /* IBase */ 2267 pDrvIns->IBase.pfnQueryInterface = drvHost CoreAudioQueryInterface;2285 pDrvIns->IBase.pfnQueryInterface = drvHostAudioCaQueryInterface; 2268 2286 /* IHostAudio */ 2269 pThis->IHostAudio.pfnGetConfig = drvHost CoreAudioHA_GetConfig;2270 pThis->IHostAudio.pfnGetDevices = drvHost CoreAudioHA_GetDevices;2271 pThis->IHostAudio.pfnGetStatus = drvHost CoreAudioHA_GetStatus;2287 pThis->IHostAudio.pfnGetConfig = drvHostAudioCaHA_GetConfig; 2288 pThis->IHostAudio.pfnGetDevices = drvHostAudioCaHA_GetDevices; 2289 pThis->IHostAudio.pfnGetStatus = drvHostAudioCaHA_GetStatus; 2272 2290 pThis->IHostAudio.pfnDoOnWorkerThread = NULL; 2273 2291 pThis->IHostAudio.pfnStreamConfigHint = NULL; 2274 pThis->IHostAudio.pfnStreamCreate = drvHost CoreAudioHA_StreamCreate;2292 pThis->IHostAudio.pfnStreamCreate = drvHostAudioCaHA_StreamCreate; 2275 2293 pThis->IHostAudio.pfnStreamInitAsync = NULL; 2276 pThis->IHostAudio.pfnStreamDestroy = drvHost CoreAudioHA_StreamDestroy;2294 pThis->IHostAudio.pfnStreamDestroy = drvHostAudioCaHA_StreamDestroy; 2277 2295 pThis->IHostAudio.pfnStreamNotifyDeviceChanged = NULL; 2278 pThis->IHostAudio.pfnStreamControl = drvHost CoreAudioHA_StreamControl;2279 pThis->IHostAudio.pfnStreamGetReadable = drvHost CoreAudioHA_StreamGetReadable;2280 pThis->IHostAudio.pfnStreamGetWritable = drvHost CoreAudioHA_StreamGetWritable;2296 pThis->IHostAudio.pfnStreamControl = drvHostAudioCaHA_StreamControl; 2297 pThis->IHostAudio.pfnStreamGetReadable = drvHostAudioCaHA_StreamGetReadable; 2298 pThis->IHostAudio.pfnStreamGetWritable = drvHostAudioCaHA_StreamGetWritable; 2281 2299 pThis->IHostAudio.pfnStreamGetPending = NULL; 2282 pThis->IHostAudio.pfnStreamGetState = drvHost CoreAudioHA_StreamGetState;2283 pThis->IHostAudio.pfnStreamPlay = drvHost CoreAudioHA_StreamPlay;2284 pThis->IHostAudio.pfnStreamCapture = drvHost CoreAudioHA_StreamCapture;2300 pThis->IHostAudio.pfnStreamGetState = drvHostAudioCaHA_StreamGetState; 2301 pThis->IHostAudio.pfnStreamPlay = drvHostAudioCaHA_StreamPlay; 2302 pThis->IHostAudio.pfnStreamCapture = drvHostAudioCaHA_StreamCapture; 2285 2303 2286 2304 int rc = RTCritSectInit(&pThis->CritSect); … … 2290 2308 * Enumerate audio devices. 2291 2309 */ 2292 rc = coreAudioEnumerateDevices(pThis);2310 rc = drvHostAudioCaEnumerateDevices(pThis); 2293 2311 AssertRCReturn(rc, rc); 2294 2312 … … 2357 2375 sizeof(DRVHOSTCOREAUDIO), 2358 2376 /* pfnConstruct */ 2359 drvHost CoreAudioConstruct,2377 drvHostAudioCaConstruct, 2360 2378 /* pfnDestruct */ 2361 drvHost CoreAudioDestruct,2379 drvHostAudioCaDestruct, 2362 2380 /* pfnRelocate */ 2363 2381 NULL, … … 2377 2395 NULL, 2378 2396 /* pfnPowerOff */ 2379 drvHost CoreAudioPowerOff,2397 drvHostAudioCaPowerOff, 2380 2398 /* pfnSoftReset */ 2381 2399 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.