Changeset 54230 in vbox
- Timestamp:
- Feb 17, 2015 1:13:02 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/RemoteDesktop/VRDE.h
r53442 r54230 633 633 634 634 /** Hints what has been intercepted by the application. */ 635 #define VRDE_CLIENT_INTERCEPT_AUDIO (0x1)636 #define VRDE_CLIENT_INTERCEPT_USB (0x2)637 #define VRDE_CLIENT_INTERCEPT_CLIPBOARD (0x4)638 #define VRDE_CLIENT_INTERCEPT_AUDIO_INPUT (0x8)635 #define VRDE_CLIENT_INTERCEPT_AUDIO RT_BIT(0) 636 #define VRDE_CLIENT_INTERCEPT_USB RT_BIT(1) 637 #define VRDE_CLIENT_INTERCEPT_CLIPBOARD RT_BIT(2) 638 #define VRDE_CLIENT_INTERCEPT_AUDIO_INPUT RT_BIT(3) 639 639 640 640 -
trunk/include/VBox/vmm/pdmaudioifs.h
r53831 r54230 4 4 5 5 /* 6 * Copyright (C) 2006-201 4Oracle Corporation6 * Copyright (C) 2006-2015 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 64 64 65 65 /** 66 * Function pointer for device emulation callback.67 */68 typedef void (*PDMAUDIOCALLBACK_FN) (void *pvContext, uint32_t cbData);69 70 /**71 * Structure holding all necessary callback data to communicate72 * with the sound device emulation, e.g. for reading or writing73 * audio data.74 */75 typedef struct PDMAUDIOCALLBACK76 {77 /** Callback function to use in the device emulation. */78 PDMAUDIOCALLBACK_FN fn;79 /** Opaque pointer to context data given on callback80 * creation. Set by the device emulation. */81 void *pvContext;82 } PDMAUDIOCALLBACK, *PPDMAUDIOCALLBACK;83 84 /**85 66 * Audio configuration of a certain backend. 86 67 */ … … 142 123 #endif 143 124 144 typedef enum 125 typedef enum PDMAUDIODIR 126 { 127 PDMAUDIODIR_UNKNOWN = 0, 128 PDMAUDIODIR_IN = 1, 129 PDMAUDIODIR_OUT = 2, 130 PDMAUDIODIR_BOTH = 3 131 } PDMAUDIODIR; 132 133 typedef enum PDMAUDIOMIXERCTL 145 134 { 146 135 PDMAUDIOMIXERCTL_UNKNOWN = 0, … … 152 141 } PDMAUDIOMIXERCTL; 153 142 154 typedef enum 143 typedef enum PDMAUDIORECSOURCE 155 144 { 156 145 PDMAUDIORECSOURCE_UNKNOWN = 0, … … 372 361 /** Pointer to associated host input stream. */ 373 362 PPDMAUDIOHSTSTRMIN pHstStrmIn; 374 /**375 * Callback set by the device emulation on creation.376 * This function is used to mix the guest input samples into the target377 * host input recording buffer. */378 PDMAUDIOCALLBACK Callback;379 363 } PDMAUDIOGSTSTRMIN, *PPDMAUDIOGSTSTRMIN; 380 364 … … 397 381 /** Pointer to the associated host output stream. */ 398 382 PPDMAUDIOHSTSTRMOUT pHstStrmOut; 399 /**400 * Callback set by the device emulation on creation.401 * This function is used to tell the device emulation that we're ready to402 * process new samples.403 */404 PDMAUDIOCALLBACK Callback;405 383 } PDMAUDIOGSTSTRMOUT, *PPDMAUDIOGSTSTRMOUT; 406 384 … … 414 392 typedef struct PDMIAUDIOCONNECTOR 415 393 { 416 DECLR3CALLBACKMEMBER(int, pfnQuery Data, (PPDMIAUDIOCONNECTOR pInterface, uint32_t *pcbAvailIn, uint32_t *pcbFreeOut, uint32_t *pcSamplesLive));394 DECLR3CALLBACKMEMBER(int, pfnQueryStatus, (PPDMIAUDIOCONNECTOR pInterface, uint32_t *pcbAvailIn, uint32_t *pcbFreeOut, uint32_t *pcSamplesLive)); 417 395 418 396 /** … … 476 454 * @param uVolRight Right audio stream volume. 477 455 */ 478 DECLR3CALLBACKMEMBER(int, pfn IsSetOutVolume, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut,479 456 DECLR3CALLBACKMEMBER(int, pfnSetVolumeOut, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut, 457 bool fMute, uint8_t uVolLeft, uint8_t uVolRight)); 480 458 481 459 /** … … 534 512 * @param pszName Name of the audio channel. 535 513 * @param enmRecSource Specifies the type of recording source to be opened. 536 * @param fnCallback Callback function to be assigned to this input stream.537 * @param pvCallback Pointer to parameters assigned to the callback function.538 514 * @param pCfg Pointer to PDMAUDIOSTREAMCFG to use. 539 515 * @param ppGstStrmIn Pointer where to return the guest guest input stream on success. 540 516 */ 541 517 DECLR3CALLBACKMEMBER(int, pfnOpenIn, (PPDMIAUDIOCONNECTOR pInterface, const char *pszName, 542 PDMAUDIORECSOURCE enmRecSource, 543 PDMAUDIOCALLBACK_FN fnCallback, void *pvCallback, 544 PPDMAUDIOSTREAMCFG pCfg, 518 PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg, 545 519 PPDMAUDIOGSTSTRMIN *ppGstStrmIn)); 546 520 … … 551 525 * @param pInterface Pointer to the interface structure containing the called function pointer. 552 526 * @param pszName Name of the audio channel. 553 * @param fnCallback Callback function to be assigned to this input stream.554 * @param pvCallback Pointer to parameters assigned to the callback function.555 527 * @param pCfg Pointer to PDMAUDIOSTREAMCFG to use. 556 528 * @param ppGstStrmOut Pointer where to return the guest guest input stream on success. 557 529 */ 558 530 DECLR3CALLBACKMEMBER(int, pfnOpenOut, (PPDMIAUDIOCONNECTOR pInterface, const char *pszName, 559 PDMAUDIOCALLBACK_FN fnCallback, void *pvCallback, 560 PPDMAUDIOSTREAMCFG pCfg, 561 PPDMAUDIOGSTSTRMOUT *ppGstStrmOut)); 562 563 DECLR3CALLBACKMEMBER(int, pfnPlayOut, (PPDMIAUDIOCONNECTOR pInterface)); 531 PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMOUT *ppGstStrmOut)); 532 533 DECLR3CALLBACKMEMBER(int, pfnPlayOut, (PPDMIAUDIOCONNECTOR pInterface, uint32_t *pcSamplesPlayed)); 564 534 565 535 /** … … 585 555 /** PDMIAUDIOCONNECTOR interface ID. */ 586 556 #define PDMIAUDIOCONNECTOR_IID "a41ca770-ed07-4f57-a0a6-41377d9d484f" 557 558 /** Defines all needed interface callbacks for an audio backend. */ 559 #define PDMAUDIO_IHOSTAUDIOR3_CALLBACKS(_aDrvName) \ 560 pThis->IHostAudioR3.pfnCaptureIn = _aDrvName##CaptureIn; \ 561 pThis->IHostAudioR3.pfnControlIn = _aDrvName##ControlIn; \ 562 pThis->IHostAudioR3.pfnControlOut = _aDrvName##ControlOut; \ 563 pThis->IHostAudioR3.pfnFiniIn = _aDrvName##FiniIn; \ 564 pThis->IHostAudioR3.pfnFiniOut = _aDrvName##FiniOut; \ 565 pThis->IHostAudioR3.pfnGetConf = _aDrvName##GetConf; \ 566 pThis->IHostAudioR3.pfnInit = _aDrvName##Init; \ 567 pThis->IHostAudioR3.pfnInitIn = _aDrvName##InitIn; \ 568 pThis->IHostAudioR3.pfnInitOut = _aDrvName##InitOut; \ 569 pThis->IHostAudioR3.pfnIsEnabled = _aDrvName##IsEnabled; \ 570 pThis->IHostAudioR3.pfnPlayOut = _aDrvName##PlayOut; 587 571 588 572 /** Pointer to a host audio interface. */ … … 661 645 DECLR3CALLBACKMEMBER(int, pfnFiniOut, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut)); 662 646 663 /** 664 * Plays an audio stream. 647 DECLR3CALLBACKMEMBER(bool, pfnIsEnabled, (PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)); 648 649 /** 650 * Plays a host audio stream. 665 651 * 666 652 * @returns VBox status code. -
trunk/src/VBox/Devices/Audio/AudioMixBuffer.cpp
r54140 r54230 1 /* $Id$ */ 2 /** @file 3 * VBox audio: TODO 4 */ 5 6 /* 7 * Copyright (C) 2014-2015 Oracle Corporation 8 * 9 * This file is part of VirtualBox Open Source Edition (OSE), as 10 * available from http://www.virtualbox.org. This file is free software; 11 * you can redistribute it and/or modify it under the terms of the GNU 12 * General Public License (GPL) as published by the Free Software 13 * Foundation, in version 2 as it comes in the "COPYING" file of the 14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 */ 1 17 2 18 #include <iprt/asm-math.h> … … 22 38 # include <VBox/log.h> 23 39 #else 24 #define AUDMIXBUF_LOG(x)40 # define AUDMIXBUF_LOG(x) 25 41 #endif 26 42 … … 1148 1164 uint32_t cWritten; 1149 1165 1150 #if def DEBUG1166 #if 0 1151 1167 RTFILE fh; 1152 1168 rc = RTFileOpen(&fh, "c:\\temp\\test_writeat.pcm", … … 1266 1282 } 1267 1283 1268 #if def DEBUG_andy1284 #if 0 1269 1285 RTFILE fh; 1270 1286 RTFileOpen(&fh, "c:\\temp\\test_writeex.pcm", -
trunk/src/VBox/Devices/Audio/AudioMixBuffer.h
r53830 r54230 5 5 6 6 /* 7 * Copyright (C) 2014 Oracle Corporation7 * Copyright (C) 2014-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 23 23 24 24 /** Constructs 32 bit value for given frequency, number of channels, bits per sample and signed bit. 25 * Note: This currently matches 1:1 the VRDE encoding .*/25 * Note: This currently matches 1:1 the VRDE encoding -- this might change in the future, so better don't rely on this fact! */ 26 26 #define AUDMIXBUF_AUDIO_FMT_MAKE(freq, c, bps, s) ((((s) & 0x1) << 28) + (((bps) & 0xFF) << 20) + (((c) & 0xF) << 16) + ((freq) & 0xFFFF)) 27 27 -
trunk/src/VBox/Devices/Audio/AudioMixer.h
r53442 r54230 7 7 8 8 /* 9 * Copyright (C) 2014 Oracle Corporation9 * Copyright (C) 2014-2015 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r53831 r54230 5 5 6 6 /* 7 * Copyright (C) 2006-201 4Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 576 576 577 577 rc = pDrv->pConnector->pfnOpenIn(pDrv->pConnector, 578 pszDesc, PDMAUDIORECSOURCE_LINE_IN, 579 NULL, pDrv /* pvContext */, 580 &streamCfg, 581 &pDrv->LineIn.pStrmIn); 578 pszDesc, PDMAUDIORECSOURCE_LINE_IN, &streamCfg, &pDrv->LineIn.pStrmIn); 582 579 LogFlowFunc(("LUN#%RU8: Opened line input with rc=%Rrc\n", uLUN, rc)); 583 580 if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */ … … 606 603 } 607 604 608 rc = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszDesc, 609 NULL, pDrv /* pvContext */, 610 &streamCfg, 611 &pDrv->Out.pStrmOut); 605 rc = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszDesc, &streamCfg, &pDrv->Out.pStrmOut); 612 606 LogFlowFunc(("LUN#%RU8: Opened output with rc=%Rrc\n", uLUN, rc)); 613 607 … … 629 623 630 624 rc = pDrv->pConnector->pfnOpenIn(pDrv->pConnector, 631 pszDesc, PDMAUDIORECSOURCE_MIC, 632 NULL, pDrv /* pvContext */, 633 &streamCfg, 634 &pDrv->MicIn.pStrmIn); 625 pszDesc, PDMAUDIORECSOURCE_MIC, &streamCfg, &pDrv->MicIn.pStrmIn); 635 626 LogFlowFunc(("LUN#%RU8: Opened mic input with rc=%Rrc\n", uLUN, rc)); 636 627 if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */ … … 820 811 pDrv->pConnector->pfnEnableIn(pDrv->pConnector, pDrv->MicIn.pStrmIn, fEnable); 821 812 #else 822 813 AUD_set_active_in(pThis->voice_mc, active[MC_INDEX]); 823 814 #endif /* VBOX_WITH_PDM_AUDIO_DRIVER */ 824 815 } … … 845 836 if (index == AC97_Master_Volume_Mute) 846 837 { 847 # 838 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 848 839 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 849 pDrv->pConnector->pfn IsSetOutVolume(pDrv->pConnector, pDrv->Out.pStrmOut, RT_BOOL(mute), lvol, rvol);850 # 840 pDrv->pConnector->pfnSetVolumeOut(pDrv->pConnector, pDrv->Out.pStrmOut, RT_BOOL(mute), lvol, rvol); 841 #else 851 842 AUD_set_volume_out(pThis->voice_po, mute, lvol, rvol); 852 # 843 #endif /* VBOX_WITH_PDM_AUDIO_DRIVER */ 853 844 } 854 845 else 855 846 { 856 # 847 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 857 848 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 858 {859 /** @todo In SetVolume no passing audmixerctl_in as its not used in DrvAudio.cpp. */860 849 pDrv->pConnector->pfnSetVolume(pDrv->pConnector, RT_BOOL(mute), lvol, rvol); 861 } 862 # else 850 #else 863 851 AUD_set_volume(mt, &mute, &lvol, &rvol); 864 # 852 #endif /* VBOX_WITH_PDM_AUDIO_DRIVER */ 865 853 } 866 854 #else /* !SOFT_VOLUME */ 867 # 855 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 868 856 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 869 857 pDrv->pConnector->pfnSetVolume(pDrv->pConnector, RT_BOOL(mute), lvol, rvol); 870 # 858 #else 871 859 AUD_set_volume(mt, &mute, &lvol, &rvol); 872 # 860 #endif /* VBOX_WITH_PDM_AUDIO_DRIVER */ 873 861 #endif /* SOFT_VOLUME */ 874 862 … … 1042 1030 } 1043 1031 1032 /** 1033 * Writes data from the device to the host backends. 1034 * 1035 * @return IPRT status code. 1036 * @return int 1037 * @param pThis 1038 * @param pReg 1039 * @param cbMax 1040 * @param pcbWritten 1041 */ 1044 1042 static int ichac97WriteAudio(PAC97STATE pThis, PAC97BMREG pReg, uint32_t cbMax, uint32_t *pcbWritten) 1045 1043 { 1044 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 1045 AssertPtrReturn(pReg, VERR_INVALID_POINTER); 1046 AssertReturn(cbMax, VERR_INVALID_PARAMETER); 1047 AssertPtrReturn(pcbWritten, VERR_INVALID_POINTER); 1048 1046 1049 PPDMDEVINS pDevIns = ICHAC97STATE_2_DEVINS(pThis); 1047 1050 1048 1051 uint32_t addr = pReg->bd.addr; 1049 1052 uint32_t cbWrittenTotal = 0; 1050 uint32_t cbToRead ;1053 uint32_t cbToRead = 0; 1051 1054 1052 1055 uint32_t cbToWrite = RT_MIN((uint32_t)(pReg->picb << 1), cbMax); 1053 1056 if (!cbToWrite) 1054 return VERR_NO_DATA; 1057 { 1058 *pcbWritten = 0; 1059 return VINF_EOF; 1060 } 1055 1061 1056 1062 int rc = VINF_SUCCESS; 1057 1063 1058 LogFlowFunc(("pReg=%p, cbMax=%RU32 \n", pReg, cbMax));1064 LogFlowFunc(("pReg=%p, cbMax=%RU32, cbToWrite=%RU32\n", pReg, cbMax, cbToWrite)); 1059 1065 1060 1066 while (cbToWrite) … … 1089 1095 if (!cbWrittenMin) 1090 1096 { 1091 rc = V ERR_NO_DATA;1097 rc = VINF_EOF; 1092 1098 break; 1093 1099 } … … 1114 1120 pThis->last_samp = *(uint32_t *)&pThis->pvReadWriteBuf[cbToRead - 4]; 1115 1121 } 1116 } 1117 1118 if (RT_SUCCESS(rc)) 1119 { 1120 if (pcbWritten) 1121 *pcbWritten = cbWrittenTotal; 1122 1123 *pcbWritten = cbWrittenTotal; 1122 1124 } 1123 1125 … … 1177 1179 } 1178 1180 1179 static int ichac97ReadAudio(PAC97STATE pThis, PAC97BMREG pReg, uint32_t cbMax, uint32_t *pcbWritten) 1180 { 1181 static int ichac97ReadAudio(PAC97STATE pThis, PAC97BMREG pReg, uint32_t cbMax, uint32_t *pcbRead) 1182 { 1183 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 1184 AssertPtrReturn(pReg, VERR_INVALID_POINTER); 1181 1185 AssertReturn(cbMax, VERR_INVALID_PARAMETER); 1186 AssertPtrReturn(pcbRead, VERR_INVALID_POINTER); 1182 1187 1183 1188 PPDMDEVINS pDevIns = ICHAC97STATE_2_DEVINS(pThis); 1184 1189 1185 int rc = VINF_SUCCESS;1190 int rc; 1186 1191 1187 1192 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 1188 1193 /* Select audio sink to process. */ 1189 PAUDMIXSINK pSink = (pReg - pThis->bm_regs) == MC_INDEX 1190 ? pThis->pSinkMicIn : pThis->pSinkLineIn; 1194 PAUDMIXSINK pSink = (pReg - pThis->bm_regs) == MC_INDEX ? pThis->pSinkMicIn : pThis->pSinkLineIn; 1191 1195 AssertPtr(pSink); 1192 1196 … … 1197 1201 1198 1202 if (!cbToRead) 1199 return VERR_NO_DATA; 1203 { 1204 *pcbRead = 0; 1205 return VINF_EOF; 1206 } 1200 1207 1201 1208 uint8_t *pvMixBuf = (uint8_t *)RTMemAlloc(cbMixBuf); … … 1218 1225 { 1219 1226 Assert(cbRead); 1220 if (pcbWritten) 1221 *pcbWritten = cbRead; 1227 *pcbRead = cbRead; 1222 1228 } 1223 1229 1224 1230 return rc; 1225 1231 #else 1232 rc = VINF_SUCCESS; 1233 1226 1234 uint32_t addr = pReg->bd.addr; 1227 1235 uint32_t temp = pReg->picb << 1; … … 1233 1241 temp = audio_MIN(temp, (uint32_t)cbMax); 1234 1242 if (!temp) 1235 return VERR_NO_DATA; 1243 { 1244 *pcbRead = 0; 1245 return VINF_EOF; 1246 } 1236 1247 1237 1248 uint8_t tmpbuf[4096]; … … 1255 1266 1256 1267 if (RT_SUCCESS(rc)) 1257 { 1258 if (pcbWritten) 1259 *pcbWritten = nread; 1260 } 1268 *pcbRead = nread; 1261 1269 1262 1270 return rc; … … 1268 1276 { 1269 1277 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 1270 AssertPtr (pThis);1278 AssertPtrReturnVoid(pThis); 1271 1279 1272 1280 STAM_PROFILE_START(&pThis->StatTimer, a); … … 1278 1286 1279 1287 PAC97DRIVER pDrv; 1280 uint32_t cbIn, cbOut; 1288 1289 LogFlowFuncEnter(); 1281 1290 1282 1291 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 1283 1292 { 1284 if (!pDrv->pConnector->pfnIsOutputOK(pDrv->pConnector, pDrv->Out.pStrmOut)) 1285 continue; 1286 1287 rc = pDrv->pConnector->pfnQueryData(pDrv->pConnector, /** @todo Rename QueryStatus */ 1288 &cbIn, &cbOut, &pDrv->cSamplesLive); 1293 uint32_t cbIn, cbOut; 1294 rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector, 1295 &cbIn, &cbOut, &pDrv->cSamplesLive); 1289 1296 if (RT_SUCCESS(rc)) 1290 1297 { 1291 if (cbIn || cbOut) 1292 LogFlowFunc(("\tLUN#%RU8: cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut)); 1298 LogFlowFunc(("\tLUN#%RU8: [1] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut)); 1299 1300 if (pDrv->cSamplesLive) 1301 { 1302 uint32_t cSamplesPlayed; 1303 int rc2 = pDrv->pConnector->pfnPlayOut(pDrv->pConnector, &cSamplesPlayed); 1304 if (RT_SUCCESS(rc2)) 1305 { 1306 LogFlowFunc(("LUN#%RU8: cSamplesLive=%RU32, cSamplesPlayed=%RU32\n", 1307 pDrv->uLUN, pDrv->cSamplesLive, cSamplesPlayed)); 1308 Assert(pDrv->cSamplesLive >= cSamplesPlayed); 1309 pDrv->cSamplesLive -= cSamplesPlayed; 1310 } 1311 1312 rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector, 1313 &cbIn, &cbOut, &pDrv->cSamplesLive); 1314 if (RT_SUCCESS(rc)) 1315 LogFlowFunc(("\tLUN#%RU8: [2] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut)); 1316 } 1293 1317 1294 1318 cbInMax = RT_MAX(cbInMax, cbIn); … … 1298 1322 pDrv->cSamplesLive = 0; 1299 1323 } 1324 1325 LogFlowFunc(("cbInMax=%RU32, cbOutMin=%RU32\n", cbInMax, cbOutMin)); 1326 1327 if (cbOutMin == UINT32_MAX) 1328 cbOutMin = 0; 1300 1329 1301 1330 /* … … 1306 1335 Assert(cbOutMin != UINT32_MAX); 1307 1336 ichac97TransferAudio(pThis, PO_INDEX, cbOutMin); /** @todo Add rc! */ 1308 }1309 else1310 {1311 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)1312 {1313 if (pDrv->cSamplesLive)1314 pDrv->pConnector->pfnPlayOut(pDrv->pConnector);1315 }1316 1337 } 1317 1338 … … 1324 1345 TMTimerSet(pThis->pTimer, TMTimerGet(pThis->pTimer) + pThis->uTicks); 1325 1346 1347 LogFlowFuncLeave(); 1348 1326 1349 STAM_PROFILE_STOP(&pThis->StatTimer, a); 1327 1350 } … … 1364 1387 if (!pReg->picb) /* Got a new buffer descriptor, that is, the position is 0? */ 1365 1388 { 1366 LogFlowFunc(("Fresh buffer descriptor % dis empty, addr=%#x, len=%#x, skipping\n",1389 LogFlowFunc(("Fresh buffer descriptor %RU8 is empty, addr=%#x, len=%#x, skipping\n", 1367 1390 pReg->civ, pReg->bd.addr, pReg->bd.ctl_len)); 1368 1391 if (pReg->civ == pReg->lvi) … … 1371 1394 pThis->bup_flag = 0; 1372 1395 1373 rc = VINF_ SUCCESS;1396 rc = VINF_EOF; 1374 1397 break; 1375 1398 } … … 1383 1406 } 1384 1407 1385 uint32_t cb Written;1408 uint32_t cbTransferred; 1386 1409 switch (index) 1387 1410 { 1388 1411 case PO_INDEX: 1389 {1390 rc = ichac97WriteAudio(pThis, pReg, cbElapsed, &cbWritten);1391 if (RT_SUCCESS(rc))1392 1412 { 1393 cbWrittenTotal += cbWritten; 1394 cbElapsed -= cbWritten; 1395 Assert((cbWritten & 1) == 0); /* Else the following shift won't work */ 1396 pReg->picb -= (cbWritten >> 1); 1413 rc = ichac97WriteAudio(pThis, pReg, cbElapsed, &cbTransferred); 1414 if (RT_SUCCESS(rc) 1415 && cbTransferred) 1416 { 1417 cbWrittenTotal += cbTransferred; 1418 Assert(cbElapsed >= cbTransferred); 1419 cbElapsed -= cbTransferred; 1420 Assert((cbTransferred & 1) == 0); /* Else the following shift won't work */ 1421 pReg->picb -= (cbTransferred >> 1); 1422 } 1423 break; 1397 1424 } 1398 break;1399 }1400 1425 1401 1426 case PI_INDEX: 1402 1427 case MC_INDEX: 1403 {1404 rc = ichac97ReadAudio(pThis, pReg, cbElapsed, &cbWritten);1405 if (RT_SUCCESS(rc))1406 1428 { 1407 cbElapsed -= cbWritten; 1408 Assert((cbWritten & 1) == 0); /* Else the following shift won't work */ 1409 pReg->picb -= (cbWritten >> 1); 1429 rc = ichac97ReadAudio(pThis, pReg, cbElapsed, &cbTransferred); 1430 if (RT_SUCCESS(rc) 1431 && cbTransferred) 1432 { 1433 Assert(cbElapsed >= cbTransferred); 1434 cbElapsed -= cbTransferred; 1435 Assert((cbTransferred & 1) == 0); /* Else the following shift won't work */ 1436 pReg->picb -= (cbTransferred >> 1); 1437 } 1438 break; 1410 1439 } 1411 break;1412 }1413 1440 1414 1441 default: … … 1418 1445 } 1419 1446 1420 LogFlowFunc(("pReg->picb=% RU16, cbWrittenTotal=%RU32\n", pReg->picb, cbWrittenTotal));1447 LogFlowFunc(("pReg->picb=%#x, cbWrittenTotal=%RU32\n", pReg->picb, cbWrittenTotal)); 1421 1448 1422 1449 if (!pReg->picb) … … 1431 1458 if (pReg->civ == pReg->lvi) 1432 1459 { 1433 LogFlowFunc(("Underrun civ (% d) == lvi (%d)\n", pReg->civ, pReg->lvi));1460 LogFlowFunc(("Underrun civ (%RU8) == lvi (%RU8)\n", pReg->civ, pReg->lvi)); 1434 1461 new_sr |= SR_LVBCI | SR_DCH | SR_CELV; 1435 1462 pThis->bup_flag = (pReg->bd.ctl_len & BD_BUP) ? BUP_LAST : 0; 1436 1463 1437 rc = V ERR_NO_DATA;1464 rc = VINF_EOF; 1438 1465 } 1439 1466 else … … 1447 1474 } 1448 1475 1449 if (RT_FAILURE(rc)) 1450 { 1451 if (rc == VERR_NO_DATA) 1452 rc = VINF_SUCCESS; 1453 1476 if ( RT_FAILURE(rc) 1477 || rc == VINF_EOF) /* All data processed? */ 1478 { 1454 1479 break; 1455 1480 } … … 2171 2196 } 2172 2197 2198 LogFlowFuncLeave(); 2173 2199 return VINF_SUCCESS; 2174 2200 } … … 2319 2345 RTListInit(&pThis->lstDrv); 2320 2346 2321 uint8_t uLUN = 0;2322 do2347 uint8_t uLUN; 2348 for (uLUN = 0; uLUN < UINT8_MAX; uLUN) 2323 2349 { 2324 2350 LogFunc(("Trying to attach driver for LUN #%RU8 ...\n", uLUN)); 2325 rc = ichac97Attach(pDevIns, uLUN ++, PDM_TACH_FLAGS_NOT_HOT_PLUG);2351 rc = ichac97Attach(pDevIns, uLUN, PDM_TACH_FLAGS_NOT_HOT_PLUG); 2326 2352 if (RT_FAILURE(rc)) 2327 2353 { … … 2331 2357 } 2332 2358 2333 } while (0); 2359 uLUN++; 2360 } 2334 2361 2335 2362 LogFunc(("cLUNs=%RU8, rc=%Rrc\n", uLUN, rc)); … … 2472 2499 { 2473 2500 pThis->cbReadWriteBuf = _4K; /** @todo Make this configurable. */ 2474 pThis->pvReadWriteBuf = (uint8_t *)RTMemAlloc (pThis->cbReadWriteBuf);2501 pThis->pvReadWriteBuf = (uint8_t *)RTMemAllocZ(pThis->cbReadWriteBuf); 2475 2502 if (!pThis->pvReadWriteBuf) 2476 2503 rc = VERR_NO_MEMORY; … … 2571 2598 #endif /* !IN_RING3 */ 2572 2599 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ 2573 -
trunk/src/VBox/Devices/Audio/DevIchHda.cpp
r53853 r54230 9 9 10 10 /* 11 * Copyright (C) 2006-201 4Oracle Corporation11 * Copyright (C) 2006-2015 Oracle Corporation 12 12 * 13 13 * This file is part of VirtualBox Open Source Edition (OSE), as … … 56 56 #endif 57 57 #include "DevIchHdaCodec.h" 58 59 #ifdef DEBUG60 //#define DEBUG_LUN61 # ifdef DEBUG_LUN62 # define DEBUG_LUN_NUM 063 # endif64 #endif /* DEBUG */65 58 66 59 /******************************************************************************* … … 2480 2473 } 2481 2474 2482 rc = pDrv->pConnector->pfnOpenIn(pDrv->pConnector, 2483 pszDesc, enmRecSource, 2484 NULL /* fnCallback */, NULL /* pvCallback */, 2485 pCfg, 2486 &pDrv->LineIn.pStrmIn); 2475 rc = pDrv->pConnector->pfnOpenIn(pDrv->pConnector, pszDesc, enmRecSource, pCfg, &pDrv->LineIn.pStrmIn); 2487 2476 LogFlowFunc(("LUN#%RU8: Opened input \"%s\", with rc=%Rrc\n", pDrv->uLUN, pszDesc, rc)); 2488 2477 if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */ … … 2509 2498 RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node) 2510 2499 { 2511 int rc2 = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszName, 2512 NULL /* fnCallback */, pDrv /* pvCallback */, 2513 pCfg, 2514 &pDrv->Out.pStrmOut); 2500 int rc2 = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszName, pCfg, &pDrv->Out.pStrmOut); 2515 2501 if (RT_FAILURE(rc2)) 2516 2502 { … … 2565 2551 PHDADRIVER pDrv; 2566 2552 uint32_t cbIn, cbOut; 2567 #ifdef DEBUG_LUN 2568 uint8_t uLUN = 0; 2569 #endif 2553 2570 2554 RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node) 2571 2555 { 2572 2556 if (!pDrv->pConnector->pfnIsOutputOK(pDrv->pConnector, pDrv->Out.pStrmOut)) 2557 { 2558 pDrv->cSamplesLive = 0; 2573 2559 continue; 2574 2575 rc = pDrv->pConnector->pfnQueryData(pDrv->pConnector, /** @todo Rename QueryStatus */ 2576 &cbIn, &cbOut, &pDrv->cSamplesLive); 2560 } 2561 2562 rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector, 2563 &cbIn, &cbOut, &pDrv->cSamplesLive); 2577 2564 if (RT_SUCCESS(rc)) 2578 2565 { 2579 #ifdef DEBUG_LUN 2580 LogFlowFunc(("\tLUN#%RU8: cbIn=%RU32, cbOut=%RU32\n",uLUN, cbIn, cbOut));2581 #endif 2566 if (cbIn || cbOut) 2567 LogFlowFunc(("\tLUN#%RU8: cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut)); 2568 2582 2569 cbInMax = RT_MAX(cbInMax, cbIn); 2583 2570 cbOutMin = RT_MIN(cbOutMin, cbOut); … … 2585 2572 else 2586 2573 pDrv->cSamplesLive = 0; 2587 2588 #ifdef DEBUG_LUN2589 uLUN++;2590 #endif2591 2574 } 2592 2575 … … 2603 2586 RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node) 2604 2587 { 2605 if (pDrv->cSamplesLive)2606 pDrv->pConnector->pfnPlayOut(pDrv->pConnector); 2588 /*if (pDrv->cSamplesLive) 2589 pDrv->pConnector->pfnPlayOut(pDrv->pConnector);*/ 2607 2590 } 2608 2591 } … … 3837 3820 RTListInit(&pThis->lstDrv); 3838 3821 3839 u nsigned uLUN = 0;3840 do3822 uint8_t uLUN; 3823 for (uLUN = 0; uLUN < UINT8_MAX; uLUN) 3841 3824 { 3842 3825 LogFunc(("Trying to attach driver for LUN #%RU32 ...\n", uLUN)); 3843 rc = hdaAttach(pDevIns, uLUN ++, PDM_TACH_FLAGS_NOT_HOT_PLUG);3826 rc = hdaAttach(pDevIns, uLUN, PDM_TACH_FLAGS_NOT_HOT_PLUG); 3844 3827 if (RT_FAILURE(rc)) 3845 3828 { … … 3850 3833 } 3851 3834 3852 } while (RT_SUCCESS(rc)); 3835 uLUN++; 3836 } 3837 3838 LogFunc(("cLUNs=%RU8, rc=%Rrc\n", uLUN, rc)); 3853 3839 3854 3840 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r53916 r54230 299 299 as.enmEndianness = PDMAUDIOHOSTENDIANESS; 300 300 301 int rc = s->pDrv->pfnOpenOut(s->pDrv, "sb16.out", 302 sb16AudioCallback /* fnCallback */, s /* pvCallback */, 303 &as, 304 &s->pGstStrmOut); 301 int rc = s->pDrv->pfnOpenOut(s->pDrv, "sb16.out", &as, &s->pGstStrmOut); 305 302 AssertRC(rc); 306 303 #else … … 459 456 as.enmEndianness = PDMAUDIOHOSTENDIANESS; 460 457 461 int rc = s->pDrv->pfnOpenOut(s->pDrv, "sb16.out", 462 sb16AudioCallback /* fnCallback */, s /* pvCallback */, 463 &as, 464 &s->pGstStrmOut); 458 int rc = s->pDrv->pfnOpenOut(s->pDrv, "sb16.out", &as, &s->pGstStrmOut); 465 459 AssertRC(rc); 466 460 #else … … 972 966 as.enmEndianness = PDMAUDIOHOSTENDIANESS; 973 967 974 int rc = s->pDrv->pfnOpenOut(s->pDrv, "sb16.out", 975 sb16AudioCallback /* fnCallback */, s /* pvContext */, 976 &as, 977 &s->pGstStrmOut); 968 int rc = s->pDrv->pfnOpenOut(s->pDrv, "sb16.out", &as, &s->pGstStrmOut); 978 969 AssertRC(rc); 979 970 #else … … 1747 1738 streamCfg.enmEndianness = PDMAUDIOHOSTENDIANESS; 1748 1739 1749 int rc = s->pDrv->pfnOpenOut(s->pDrv, "sb16.out", 1750 sb16AudioCallback /* fnCallback */, s /* pvContext */, 1751 &streamCfg, 1752 &s->pGstStrmOut); 1740 int rc = s->pDrv->pfnOpenOut(s->pDrv, "sb16.out", &streamCfg, &s->pGstStrmOut); 1753 1741 AssertRC(rc); 1754 1742 #else -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r53945 r54230 97 97 }; 98 98 99 int drvAudioAddHstOut(PDRVAUDIO pThis, PPDMAUDIOSTREAMCFG pCfg, 100 PPDMAUDIOHSTSTRMOUT *ppHstStrmOut) 101 { 102 LogFlowFuncEnter(); 99 int drvAudioAddHstOut(PDRVAUDIO pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOHSTSTRMOUT *ppHstStrmOut) 100 { 101 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 102 AssertPtrReturn(pszName, VERR_INVALID_POINTER); 103 AssertPtrReturn(pCfg, VERR_INVALID_POINTER); 103 104 104 105 PPDMAUDIOHSTSTRMOUT pHstStrmOut; … … 108 109 && conf.fixed_out.greedy) 109 110 { 110 rc = drvAudioAllocHstOut(pThis, p Cfg, &pHstStrmOut);111 rc = drvAudioAllocHstOut(pThis, pszName, pCfg, &pHstStrmOut); 111 112 } 112 113 else … … 118 119 if (!pHstStrmOut) 119 120 { 120 rc = drvAudioAllocHstOut(pThis, p Cfg, &pHstStrmOut);121 rc = drvAudioAllocHstOut(pThis, pszName, pCfg, &pHstStrmOut); 121 122 if (RT_FAILURE(rc)) 122 123 pHstStrmOut = drvAudioFindAnyHstOut(pThis, NULL /* pHstStrmOut */); … … 129 130 *ppHstStrmOut = pHstStrmOut; 130 131 131 LogFlowFuncLeaveRC(rc);132 132 return rc; 133 133 } … … 392 392 } 393 393 394 /*395 * Guest input stream handling (capturing from the host).396 */397 398 /*399 * Host output handling (playing output from the guest).400 */401 402 394 int drvAudioDestroyHstOut(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMOUT pHstStrmOut) 403 395 { … … 405 397 AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER); 406 398 407 LogFlowFunc(("% p\n", pHstStrmOut));399 LogFlowFunc(("%s\n", pHstStrmOut->MixBuf.pszName)); 408 400 409 401 int rc; … … 426 418 rc = VERR_ACCESS_DENIED; 427 419 428 LogFlowFunc(("Host output stream %p still being used, rc=%Rrc\n", 429 pHstStrmOut, rc)); 430 420 LogFlowFunc(("[%s] Still is being used, rc=%Rrc\n", pHstStrmOut->MixBuf.pszName, rc)); 431 421 return rc; 432 422 } … … 533 523 } 534 524 535 int drvAudioAllocHstOut(PDRVAUDIO pThis, PPDMAUDIOSTREAMCFG pCfg, 536 PPDMAUDIOHSTSTRMOUT *ppHstStrmOut) 525 int drvAudioAllocHstOut(PDRVAUDIO pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOHSTSTRMOUT *ppHstStrmOut) 537 526 { 538 527 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 528 AssertPtrReturn(pszName, VERR_INVALID_POINTER); 539 529 AssertPtrReturn(pCfg, VERR_INVALID_POINTER); 540 530 … … 579 569 fInitialized = true; 580 570 581 rc = audioMixBufInit(&pHstStrmOut->MixBuf, "HostOut", &pHstStrmOut->Props, cSamples);571 rc = audioMixBufInit(&pHstStrmOut->MixBuf, pszName, &pHstStrmOut->Props, cSamples); 582 572 if (RT_SUCCESS(rc)) 583 573 { … … 610 600 PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMOUT *ppGstStrmOut) 611 601 { 602 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 603 AssertPtrReturn(pszName, VERR_INVALID_POINTER); 604 AssertPtrReturn(pCfg, VERR_INVALID_POINTER); 605 612 606 PPDMAUDIOSTREAMCFG pThisCfg; 613 607 if (conf.fixed_out.enabled) … … 616 610 pThisCfg = pCfg; 617 611 618 AssertPtrReturn(pThisCfg, VERR_INVALID_P ARAMETER);612 AssertPtrReturn(pThisCfg, VERR_INVALID_POINTER); 619 613 620 614 LogFlowFunc(("Using fixed audio output settings: %RTbool\n", … … 625 619 if (!pGstStrmOut) 626 620 { 627 LogFlowFunc(("Failed to allocate memory for guest output stream \"%s\"\n", 628 pszName)); 621 LogFlowFunc(("Failed to allocate memory for guest output stream \"%s\"\n", pszName)); 629 622 return VERR_NO_MEMORY; 630 623 } 631 624 632 625 PPDMAUDIOHSTSTRMOUT pHstStrmOut; 633 int rc = drvAudioAddHstOut(pThis, p ThisCfg, &pHstStrmOut);626 int rc = drvAudioAddHstOut(pThis, pszName, pThisCfg, &pHstStrmOut); 634 627 if (RT_FAILURE(rc)) 635 628 { 636 LogFlowFunc(("Error adding host output stream \"%s\", rc=%Rrc\n", 637 pszName, rc)); 629 LogFlowFunc(("Error adding host output stream \"%s\", rc=%Rrc\n", pszName, rc)); 638 630 639 631 RTMemFree(pGstStrmOut); … … 837 829 { 838 830 PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface); 839 840 831 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 832 841 833 AssertPtrReturn(pGstStrmOut, VERR_INVALID_POINTER); 842 834 AssertPtrReturn(pvBuf, VERR_INVALID_POINTER); … … 844 836 /* pcbWritten is optional. */ 845 837 838 if (!pThis->pHostDrvAudio->pfnIsEnabled(pThis->pHostDrvAudio, PDMAUDIODIR_OUT)) 839 return VERR_NOT_AVAILABLE; 840 846 841 PPDMAUDIOHSTSTRMOUT pHstStrmOut = pGstStrmOut->pHstStrmOut; 847 842 AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER); 848 843 849 844 AssertMsg(pGstStrmOut->pHstStrmOut->fEnabled, 850 ("Writing to disabled host output stream %pnot possible\n",851 p GstStrmOut->pHstStrmOut));845 ("Writing to disabled host output stream \"%s\" not possible\n", 846 pHstStrmOut->MixBuf.pszName)); 852 847 853 848 /* … … 856 851 */ 857 852 uint32_t cWritten; 858 int rc = audioMixBufWriteAt(&pGstStrmOut->MixBuf, 859 0 /* Offset in samples */, 860 pvBuf, cbBuf, 861 &cWritten); 853 int rc = audioMixBufWriteAt(&pGstStrmOut->MixBuf, 0 /* Offset in samples */, pvBuf, cbBuf, &cWritten); 862 854 863 855 /* … … 869 861 && cWritten) 870 862 { 871 rc = audioMixBufMixToParent(&pGstStrmOut->MixBuf, 872 cWritten, &cMixed); 863 rc = audioMixBufMixToParent(&pGstStrmOut->MixBuf, cWritten, &cMixed); 873 864 } 874 865 else … … 884 875 } 885 876 886 LogFlowFunc((" Written pvBuf=%p, cbBuf=%zu, cWritten=%RU32 (%RU32 bytes), cMixed=%RU32, rc=%Rrc\n",887 p vBuf, cbBuf, cWritten, AUDIOMIXBUF_S2B(&pGstStrmOut->MixBuf, cWritten),888 cMixed, rc));877 LogFlowFunc(("%s -> %s: Written pvBuf=%p, cbBuf=%zu, cWritten=%RU32 (%RU32 bytes), cMixed=%RU32, rc=%Rrc\n", 878 pGstStrmOut->MixBuf.pszName, pHstStrmOut->MixBuf.pszName, pvBuf, cbBuf, cWritten, 879 AUDIOMIXBUF_S2B(&pGstStrmOut->MixBuf, cWritten), cMixed, rc)); 889 880 return rc; 890 881 } … … 931 922 AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER); 932 923 933 LogFlowFunc(("% p\n", pHstStrmIn));924 LogFlowFunc(("%s\n", pHstStrmIn->MixBuf.pszName)); 934 925 935 926 int rc; … … 951 942 rc = VERR_ACCESS_DENIED; 952 943 953 LogFlowFunc(("Host input stream %p still being used, rc=%Rrc\n", 954 pHstStrmIn, rc)); 955 944 LogFlowFunc(("[%s] Still is being used, rc=%Rrc\n", pHstStrmIn->MixBuf.pszName, rc)); 956 945 return rc; 957 946 } … … 961 950 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 962 951 963 LogFlowFunc(("% p\n", pGstStrmIn));952 LogFlowFunc(("%s\n", pGstStrmIn->MixBuf.pszName)); 964 953 965 954 if (pGstStrmIn) … … 984 973 } 985 974 986 static DECLCALLBACK(int) drvAudioQuery Data(PPDMIAUDIOCONNECTOR pInterface,987 uint32_t *pcbAvailIn, uint32_t *pcbFreeOut,988 uint32_t *pcSamplesLive)975 static DECLCALLBACK(int) drvAudioQueryStatus(PPDMIAUDIOCONNECTOR pInterface, 976 uint32_t *pcbAvailIn, uint32_t *pcbFreeOut, 977 uint32_t *pcSamplesLive) 989 978 { 990 979 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 980 /* pcbAvailIn is optional. */ 981 /* pcbFreeOut is optional. */ 982 /* pcSamplesLive is optional. */ 991 983 992 984 PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface); 985 986 if (!pThis->pHostDrvAudio->pfnIsEnabled(pThis->pHostDrvAudio, PDMAUDIODIR_OUT)) 987 return VERR_NOT_AVAILABLE; 993 988 994 989 int rc = VINF_SUCCESS; … … 1021 1016 pHstStrmOut->fPendingDisable = false; 1022 1017 1023 LogFunc((" %p: Disabling stream\n", pHstStrmOut));1018 LogFunc(("[%s] Disabling stream\n", pHstStrmOut->MixBuf.pszName)); 1024 1019 } 1025 1020 else 1026 LogFunc(("%p: Backend vetoed against closing output stream, rc=%Rrc\n", 1027 pHstStrmOut, rc2)); 1021 LogFunc(("[%s] Backend vetoed against closing output stream, rc=%Rrc\n", pHstStrmOut->MixBuf.pszName, rc2)); 1028 1022 1029 1023 continue; 1030 1024 } 1031 1025 1032 LogFlowFunc((" %p: Has %RU32 live samples\n", pHstStrmOut, cSamplesLive));1026 LogFlowFunc(("[%s] cSamplesLive=%RU32\n", pHstStrmOut->MixBuf.pszName, cSamplesLive)); 1033 1027 1034 1028 /* … … 1051 1045 cbFree2 = RT_MIN(cbFree2, AUDIOMIXBUF_S2B_RATIO(&pGstStrmOut->MixBuf, 1052 1046 audioMixBufFree(&pGstStrmOut->MixBuf))); 1047 1048 LogFlowFunc(("\t[%s] cbFree=%RU32\n", pGstStrmOut->MixBuf.pszName, cbFree2)); 1053 1049 } 1054 1050 } 1055 1051 1056 1052 cbFreeOut = RT_MIN(cbFreeOut, cbFree2); 1057 continue;1058 1053 } 1059 1054 } … … 1081 1076 cbAvailIn = RT_MAX(cbAvailIn, AUDIOMIXBUF_S2B(&pHstStrmIn->MixBuf, 1082 1077 audioMixBufMixed(&pHstStrmIn->MixBuf))); 1078 1079 LogFlowFunc(("\t[%s] cbFree=%RU32\n", pHstStrmIn->MixBuf.pszName, cbAvailIn)); 1083 1080 } 1084 1081 } … … 1102 1099 } 1103 1100 1104 static DECLCALLBACK(int) drvAudioPlayOut(PPDMIAUDIOCONNECTOR pInterface )1101 static DECLCALLBACK(int) drvAudioPlayOut(PPDMIAUDIOCONNECTOR pInterface, uint32_t *pcSamplesPlayed) 1105 1102 { 1106 1103 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 1107 /* pc bFreeis optional. */1104 /* pcSamplesPlayed is optional. */ 1108 1105 1109 1106 PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface); 1110 1107 1111 1108 int rc = VINF_SUCCESS; 1109 uint32_t cSamplesPlayedMax = 0; 1112 1110 1113 1111 /* … … 1117 1115 while ((pHstStrmOut = drvAudioHstFindAnyEnabledOut(pThis, pHstStrmOut))) 1118 1116 { 1117 #if 0 1119 1118 uint32_t cStreamsLive; 1120 1119 uint32_t cSamplesLive = drvAudioHstOutSamplesLive(pHstStrmOut, &cStreamsLive); … … 1139 1138 else 1140 1139 LogFunc(("\t%p: Backend vetoed against closing output stream, rc=%Rrc\n", 1141 rc2, pHstStrmOut));1140 pHstStrmOut, rc2)); 1142 1141 1143 1142 continue; 1144 1143 } 1145 1146 uint32_t cSamplesPlayed; 1144 #endif 1145 1146 uint32_t cSamplesPlayed = 0; 1147 1147 int rc2 = pThis->pHostDrvAudio->pfnPlayOut(pThis->pHostDrvAudio, pHstStrmOut, 1148 1148 &cSamplesPlayed); 1149 LogFlowFunc(("\t%p: cStreamsLive=%RU32, cSamplesLive=%RU32, cSamplesPlayed=%RU32, rc=%Rrc\n", 1150 pHstStrmOut, cStreamsLive, cSamplesLive, cSamplesPlayed, rc2)); 1149 if (RT_SUCCESS(rc2)) 1150 cSamplesPlayedMax = RT_MAX(cSamplesPlayed, cSamplesPlayedMax); 1151 1152 LogFlowFunc(("\t[%s] cSamplesPlayed=%RU32, rc=%Rrc\n", pHstStrmOut->MixBuf.pszName, cSamplesPlayed, rc2)); 1151 1153 1152 1154 bool fNeedsCleanup = false; … … 1162 1164 { 1163 1165 pGstStrmOut->State.fEmpty = true; 1164 fNeedsCleanup |= !pGstStrmOut->State.fActive 1165 && !pGstStrmOut->Callback.fn; 1166 fNeedsCleanup |= !pGstStrmOut->State.fActive; 1166 1167 } 1167 1168 } … … 1175 1176 } 1176 1177 } 1178 } 1179 1180 if (RT_SUCCESS(rc)) 1181 { 1182 if (pcSamplesPlayed) 1183 *pcSamplesPlayed = cSamplesPlayedMax; 1177 1184 } 1178 1185 … … 1386 1393 { 1387 1394 PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface); 1388 1389 1395 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 1396 1390 1397 AssertPtrReturn(pGstStrmIn, VERR_INVALID_POINTER); 1391 1398 AssertPtrReturn(pvBuf, VERR_INVALID_POINTER); … … 1393 1400 /* pcbWritten is optional. */ 1394 1401 1402 if (!pThis->pHostDrvAudio->pfnIsEnabled(pThis->pHostDrvAudio, PDMAUDIODIR_IN)) 1403 return VERR_NOT_AVAILABLE; 1404 1395 1405 PPDMAUDIOHSTSTRMIN pHstStrmIn = pGstStrmIn->pHstStrmIn; 1396 1406 AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER); 1397 1407 1398 1408 AssertMsg(pGstStrmIn->pHstStrmIn->fEnabled, 1399 ("Reading from disabled host input stream %p not possible\n", 1400 pGstStrmIn->pHstStrmIn)); 1409 ("Reading from disabled host input stream \"%s\" not possible\n", pGstStrmIn->MixBuf.pszName)); 1401 1410 1402 1411 /* … … 1423 1432 bool fMute, uint8_t uVolLeft, uint8_t uVolRight) 1424 1433 { 1425 LogFlowFunc((" pGstStrmOut=%p,fMute=%RTbool, uVolLeft=%RU8, uVolRight=%RU8\n",1426 pGstStrmOut , fMute, uVolLeft, uVolRight));1434 LogFlowFunc(("[%s] fMute=%RTbool, uVolLeft=%RU8, uVolRight=%RU8\n", 1435 pGstStrmOut->MixBuf.pszName, fMute, uVolLeft, uVolRight)); 1427 1436 1428 1437 if (pGstStrmOut) … … 1529 1538 AssertPtr(pHstStrmIn); 1530 1539 1531 LogFlowFunc((" pHstStrmIn=%p, pGstStrmIn=%p, fEnable=%RTbool\n",1532 pHstStrmIn , pGstStrmIn, fEnable));1540 LogFlowFunc(("%s -> %s, fEnable=%RTbool\n", 1541 pHstStrmIn->MixBuf.pszName, pGstStrmIn->MixBuf.pszName, fEnable)); 1533 1542 1534 1543 if (pGstStrmIn->State.fActive != fEnable) … … 1579 1588 1580 1589 static DECLCALLBACK(int) drvAudioOpenIn(PPDMIAUDIOCONNECTOR pInterface, const char *pszName, 1581 PDMAUDIORECSOURCE enmRecSource, 1582 PDMAUDIOCALLBACK_FN fnCallback, void *pvCallback, 1583 PPDMAUDIOSTREAMCFG pCfg, 1590 PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg, 1584 1591 PPDMAUDIOGSTSTRMIN *ppGstStrmIn) 1585 1592 { … … 1604 1611 && drvAudioPCMPropsAreEqual(&pGstStrmIn->Props, pCfg)) 1605 1612 { 1606 LogFunc((" Input stream %p exists and matches required configuration, skipping creation\n",1607 pGstStrmIn ));1613 LogFunc(("[%s] Exists and matches required configuration, skipping creation\n", 1614 pGstStrmIn->MixBuf.pszName)); 1608 1615 return VWRN_ALREADY_EXISTS; 1609 1616 } … … 1635 1642 pGstStrmIn->State.fMuted = RT_BOOL(nominal_volume.mute); 1636 1643 1637 pGstStrmIn->Callback.fn = fnCallback;1638 pGstStrmIn->Callback.pvContext = pvCallback;1639 1640 1644 *ppGstStrmIn = pGstStrmIn; 1641 1645 } … … 1646 1650 1647 1651 DECLCALLBACK(int) drvAudioOpenOut(PPDMIAUDIOCONNECTOR pInterface, const char *pszName, 1648 PDMAUDIOCALLBACK_FN fnCallback, void *pvCallback, 1649 PPDMAUDIOSTREAMCFG pCfg, 1650 PPDMAUDIOGSTSTRMOUT *ppGstStrmOut) 1652 PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMOUT *ppGstStrmOut) 1651 1653 { 1652 1654 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); … … 1669 1671 && drvAudioPCMPropsAreEqual(&pGstStrmOut->Props, pCfg)) 1670 1672 { 1671 LogFunc((" Output stream %p exists and matches required configuration, skipping creation\n",1672 pGstStrmOut ));1673 LogFunc(("[%s] Exists and matches required configuration, skipping creation\n", 1674 pGstStrmOut->MixBuf.pszName)); 1673 1675 return VWRN_ALREADY_EXISTS; 1674 1676 } … … 1724 1726 pGstStrmOut->State.uVolumeRight = nominal_volume.r; 1725 1727 pGstStrmOut->State.fMuted = RT_BOOL(nominal_volume.mute); 1726 pGstStrmOut->Callback.fn = fnCallback;1727 pGstStrmOut->Callback.pvContext = pvCallback;1728 1728 1729 1729 *ppGstStrmOut = pGstStrmOut; … … 1835 1835 pDrvIns->IBase.pfnQueryInterface = drvAudioQueryInterface; 1836 1836 /* IAudio. */ 1837 pThis->IAudioConnector.pfnQuery Data = drvAudioQueryData;1837 pThis->IAudioConnector.pfnQueryStatus = drvAudioQueryStatus; 1838 1838 pThis->IAudioConnector.pfnRead = drvAudioRead; 1839 1839 pThis->IAudioConnector.pfnWrite = drvAudioWrite; … … 1841 1841 pThis->IAudioConnector.pfnIsOutputOK = drvAudioIsOutputOK; 1842 1842 pThis->IAudioConnector.pfnInitNull = drvAudioInitNull; 1843 pThis->IAudioConnector.pfn IsSetOutVolume= drvAudioIsSetOutVolume;1843 pThis->IAudioConnector.pfnSetVolumeOut = drvAudioIsSetOutVolume; 1844 1844 pThis->IAudioConnector.pfnSetVolume = drvAudioSetVolume; 1845 1845 pThis->IAudioConnector.pfnEnableOut = drvAudioEnableOut; … … 1870 1870 LogRel(("Audio: Failed to query interface for underlying host driver\n")); 1871 1871 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_BELOW, 1872 N_("No audio interface below")); 1873 } 1874 1875 pThis->pDrvIns = pDrvIns; 1872 N_("Host audio backend missing or invalid")); 1873 } 1876 1874 1877 1875 #ifdef DEBUG_andy … … 1880 1878 1881 1879 rc = drvAudioInit(pCfgHandle, pDrvIns); 1880 if (RT_SUCCESS(rc)) 1881 { 1882 pThis->fTerminate = false; 1883 pThis->pDrvIns = pDrvIns; 1884 } 1882 1885 1883 1886 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/Devices/Audio/DrvHostOSSAudio.cpp
r53624 r54230 5 5 6 6 /* 7 * Copyright (C) 2014 Oracle Corporation7 * Copyright (C) 2014-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 766 766 } 767 767 768 static DECLCALLBACK(bool) drvHostOSSAudioIsEnabled(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir) 769 { 770 NOREF(pInterface); 771 NOREF(enmDir); 772 return true; /* Always all enabled. */ 773 } 774 768 775 static DECLCALLBACK(int) drvHostOSSAudioPlayOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut, 769 776 uint32_t *pcSamplesPlayed) … … 933 940 * Init the static parts. 934 941 */ 935 pThis->pDrvIns 942 pThis->pDrvIns = pDrvIns; 936 943 /* IBase */ 937 pDrvIns->IBase.pfnQueryInterface = drvHostOSSAudioQueryInterface; 938 pThis->IHostAudioR3.pfnInitIn = drvHostOSSAudioInitIn; 939 pThis->IHostAudioR3.pfnInitOut = drvHostOSSAudioInitOut; 940 pThis->IHostAudioR3.pfnControlIn = drvHostOSSAudioControlIn; 941 pThis->IHostAudioR3.pfnControlOut = drvHostOSSAudioControlOut; 942 pThis->IHostAudioR3.pfnFiniIn = drvHostOSSAudioFiniIn; 943 pThis->IHostAudioR3.pfnFiniOut = drvHostOSSAudioFiniOut; 944 pThis->IHostAudioR3.pfnCaptureIn = drvHostOSSAudioCaptureIn; 945 pThis->IHostAudioR3.pfnPlayOut = drvHostOSSAudioPlayOut; 946 pThis->IHostAudioR3.pfnGetConf = drvHostOSSAudioGetConf; 947 pThis->IHostAudioR3.pfnInit = drvHostOSSAudioInit; 944 pDrvIns->IBase.pfnQueryInterface = drvHostOSSAudioQueryInterface; 945 /* IHostAudioR3 */ 946 PDMAUDIO_IHOSTAUDIOR3_CALLBACKS(drvHostOSSAudio); 948 947 949 948 return VINF_SUCCESS; -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r54108 r54230 1450 1450 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 1451 1451 if (mAudioVRDE) 1452 mAudioVRDE->onVRDE InputIntercept(false /* fIntercept*/);1452 mAudioVRDE->onVRDEControl(false /* fEnable */, 0 /* uFlags */); 1453 1453 #else 1454 1454 mcAudioRefs--; … … 1501 1501 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 1502 1502 if (mAudioVRDE) 1503 mAudioVRDE->onVRDE InputIntercept(true /* fIntercept*/);1503 mAudioVRDE->onVRDEControl(true /* fEnable */, 0 /* uFlags */); 1504 1504 #else 1505 1505 ++mcAudioRefs; … … 2380 2380 (PFNRT)i_unplugCpu, 3, 2381 2381 this, pUVM, (VMCPUID)aCpu); 2382 2382 2383 2383 /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */ 2384 2384 alock.release(); … … 4821 4821 */ 4822 4822 bool fResume = false; 4823 int rc= i_suspendBeforeConfigChange(pUVM, NULL, &fResume);4824 if (FAILED( rc))4825 return rc;4823 HRESULT hr = i_suspendBeforeConfigChange(pUVM, NULL, &fResume); 4824 if (FAILED(hr)) 4825 return hr; 4826 4826 4827 4827 /* … … 4830 4830 * here to make requests from under the lock in order to serialize them. 4831 4831 */ 4832 PVMREQ pReq; 4833 int vrc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/, 4834 (PFNRT)i_changeNetworkAttachment, 6, 4835 this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter); 4832 int rc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/, 4833 (PFNRT)i_changeNetworkAttachment, 6, 4834 this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter); 4836 4835 4837 4836 if (fResume) 4838 4837 i_resumeAfterConfigChange(pUVM); 4839 4838 4840 if (RT_SUCCESS(vrc)) 4841 { 4842 LogFlowThisFunc(("Returns S_OK\n")); 4839 if (RT_SUCCESS(rc)) 4843 4840 return S_OK; 4844 }4845 4841 4846 4842 return setError(E_FAIL, 4847 tr("Could not change the network adaptor attachement type (%Rrc)"), 4848 vrc); 4843 tr("Could not change the network adaptor attachement type (%Rrc)"), rc); 4849 4844 } 4850 4845 -
trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
r53442 r54230 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Console VRDP Helper class3 * VBox Console VRDP helper class. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-201 4Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 651 651 size_t cbPortRange = portRange.length() + 1; 652 652 653 if (cbPortRange >= 0x10000)654 { 655 /* More than 64K seems to be an 653 if (cbPortRange >= _64K) 654 { 655 /* More than 64K seems to be an invalid port range string. */ 656 656 rc = VERR_TOO_MUCH_DATA; 657 657 break; … … 797 797 798 798 HRESULT hrc = server->mConsole->i_machine()->GetExtraData(com::Bstr(extraData).raw(), 799 bstrValue.asOutParam());799 bstrValue.asOutParam()); 800 800 if (FAILED(hrc) || bstrValue.isEmpty()) 801 801 { … … 805 805 806 806 hrc = server->mConsole->i_machine()->GetExtraData(com::Bstr(extraData).raw(), 807 bstrValue.asOutParam());807 bstrValue.asOutParam()); 808 808 if (FAILED(hrc)) 809 809 { … … 817 817 const char *pszPropertyName = &pFeature->achInfo[9]; 818 818 HRESULT hrc = server->mConsole->i_getVRDEServer()->GetVRDEProperty(Bstr(pszPropertyName).raw(), 819 bstrValue.asOutParam());819 bstrValue.asOutParam()); 820 820 if (FAILED(hrc)) 821 821 { … … 957 957 958 958 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 959 pServer->mConsole->i_getAudioVRDE()->onVRDEInputIntercept(false); 959 AudioVRDE *pVRDE = pServer->mConsole->i_getAudioVRDE(); 960 if (pVRDE) 961 pVRDE->onVRDEInputIntercept(false /* fIntercept */); 960 962 #else 961 963 PPDMIAUDIOSNIFFERPORT pPort = pServer->mConsole->i_getAudioSniffer()->getAudioSnifferPort(); … … 983 985 { 984 986 ConsoleVRDPServer *pServer = static_cast<ConsoleVRDPServer*>(pvCallback); 987 AssertPtrReturn(pServer, VERR_INVALID_POINTER); 985 988 986 989 LogFlowFunc(("%x\n", fu32Intercept)); … … 1018 1021 case VRDE_CLIENT_INTERCEPT_AUDIO_INPUT: 1019 1022 { 1020 /* This request is processed internally by the ConsoleVRDPServer. 1023 /* 1024 * This request is processed internally by the ConsoleVRDPServer. 1021 1025 * Only one client is allowed to intercept audio input. 1022 1026 */ 1023 1027 if (ASMAtomicCmpXchgU32(&pServer->mu32AudioInputClientId, u32ClientId, 0) == true) 1024 1028 { 1025 LogFunc((" Connected client %u\n", u32ClientId));1029 LogFunc(("Intercepting audio input by client %RU32\n", u32ClientId)); 1026 1030 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 1027 pServer->mConsole->i_getAudioVRDE()->onVRDEInputIntercept(true); 1031 AudioVRDE *pVRDE = pServer->mConsole->i_getAudioVRDE(); 1032 if (pVRDE) 1033 pVRDE->onVRDEInputIntercept(true /* fIntercept */); 1028 1034 #else 1029 1035 PPDMIAUDIOSNIFFERPORT pPort = pServer->mConsole->i_getAudioSniffer()->getAudioSnifferPort(); … … 1044 1050 else 1045 1051 { 1046 Log(("AUDIOIN: ignored client % u, active client %u\n", u32ClientId, pServer->mu32AudioInputClientId));1052 Log(("AUDIOIN: ignored client %RU32, active client %RU32\n", u32ClientId, pServer->mu32AudioInputClientId)); 1047 1053 rc = VERR_NOT_SUPPORTED; 1048 1054 } … … 1311 1317 #endif 1312 1318 1319 AudioVRDE *pVRDE = pServer->mConsole->i_getAudioVRDE(); 1320 if (!pVRDE) /* Nothing to do, bail out early. */ 1321 return; 1322 1313 1323 switch (u32Event) 1314 1324 { … … 1316 1326 { 1317 1327 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 1318 p Server->mConsole->i_getAudioVRDE()->onVRDEInputBegin(pvCtx, (PVRDEAUDIOINBEGIN)pvData);1328 pVRDE->onVRDEInputBegin(pvCtx, (PVRDEAUDIOINBEGIN)pvData); 1319 1329 #else 1320 1330 const VRDEAUDIOINBEGIN *pParms = (const VRDEAUDIOINBEGIN *)pvData; … … 1331 1341 case VRDE_AUDIOIN_DATA: 1332 1342 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 1333 p Server->mConsole->i_getAudioVRDE()->onVRDEInputData(pvCtx, pvData, cbData);1343 pVRDE->onVRDEInputData(pvCtx, pvData, cbData); 1334 1344 #else 1335 1345 pPort->pfnAudioInputEventData (pPort, pvCtx, pvData, cbData); … … 1339 1349 case VRDE_AUDIOIN_END: 1340 1350 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER 1341 p Server->mConsole->i_getAudioVRDE()->onVRDEInputEnd(pvCtx);1351 pVRDE->onVRDEInputEnd(pvCtx); 1342 1352 #else 1343 1353 pPort->pfnAudioInputEventEnd (pPort, pvCtx); -
trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp
r53831 r54230 5 5 6 6 /* 7 * Copyright (C) 2013-201 4Oracle Corporation7 * Copyright (C) 2013-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 50 50 /** Pointer to the driver instance structure. */ 51 51 PDMIHOSTAUDIO IHostAudioR3; 52 /** Pointer to the VRDP's console object. */ 52 53 ConsoleVRDPServer *pConsoleVRDPServer; 53 /** Pointer to the DrvAudio port interface that is above it. */54 /** Pointer to the DrvAudio port interface that is above us. */ 54 55 PPDMIAUDIOCONNECTOR pDrvAudio; 56 /** Whether this driver is enabled or not. */ 57 bool fEnabled; 55 58 } DRVAUDIOVRDE, *PDRVAUDIOVRDE; 56 59 … … 64 67 /** Critical section. */ 65 68 RTCRITSECT CritSect; 66 67 69 } VRDESTREAMIN, *PVRDESTREAMIN; 68 70 … … 82 84 } 83 85 84 static DECLCALLBACK(int) drvAudioVRDEInitOut(PPDMIHOSTAUDIO pInterface,85 PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg,86 uint32_t *pcSamples)87 {88 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudioR3);89 AssertPtrReturn(pDrv, VERR_INVALID_POINTER);90 91 LogFlowFunc(("pHstStrmOut=%p, pCfg=%p\n", pHstStrmOut, pCfg));92 93 PVRDESTREAMOUT pVRDEStrmOut = (PVRDESTREAMOUT)pHstStrmOut;94 AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER);95 96 if (pcSamples)97 *pcSamples = _4K; /** @todo Make this configurable. */98 99 return drvAudioStreamCfgToProps(pCfg, &pVRDEStrmOut->HstStrmOut.Props);100 }101 102 86 static DECLCALLBACK(int) drvAudioVRDEInitIn(PPDMIHOSTAUDIO pInterface, 103 87 PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pCfg, … … 115 99 116 100 return drvAudioStreamCfgToProps(pCfg, &pVRDEStrmIn->HstStrmIn.Props); 101 } 102 103 static DECLCALLBACK(int) drvAudioVRDEInitOut(PPDMIHOSTAUDIO pInterface, 104 PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg, 105 uint32_t *pcSamples) 106 { 107 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudioR3); 108 AssertPtrReturn(pDrv, VERR_INVALID_POINTER); 109 110 LogFlowFunc(("pHstStrmOut=%p, pCfg=%p\n", pHstStrmOut, pCfg)); 111 112 PVRDESTREAMOUT pVRDEStrmOut = (PVRDESTREAMOUT)pHstStrmOut; 113 AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER); 114 115 if (pcSamples) 116 *pcSamples = _4K; /** @todo Make this configurable. */ 117 118 return drvAudioStreamCfgToProps(pCfg, &pVRDEStrmOut->HstStrmOut.Props); 119 } 120 121 static DECLCALLBACK(bool) drvAudioVRDEIsEnabled(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir) 122 { 123 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudioR3); 124 AssertPtrReturn(pDrv, false); 125 126 NOREF(enmDir); 127 128 if (!pDrv->fEnabled) 129 return false; 130 131 return true; 117 132 } 118 133 … … 184 199 PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudioR3); 185 200 AssertPtrReturn(pDrv, VERR_INVALID_POINTER); 201 186 202 PVRDESTREAMOUT pVRDEStrmOut = (PVRDESTREAMOUT)pHstStrmOut; 187 203 AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER); … … 311 327 312 328 /* Initialize only if not already done. */ 329 int rc; 313 330 if (enmStreamCmd == PDMAUDIOSTREAMCMD_ENABLE) 314 331 { 315 int rc2= pDrv->pConsoleVRDPServer->SendAudioInputBegin(NULL, pVRDEStrmIn, audioMixBufSize(&pThisStrmIn->MixBuf),316 317 318 #ifdef DEBUG 319 if (rc2 == VERR_NOT_SUPPORTED)332 rc = pDrv->pConsoleVRDPServer->SendAudioInputBegin(NULL, pVRDEStrmIn, audioMixBufSize(&pThisStrmIn->MixBuf), 333 pThisStrmIn->Props.uHz, 334 pThisStrmIn->Props.cChannels, pThisStrmIn->Props.cBits); 335 if (rc == VERR_NOT_SUPPORTED) 336 { 320 337 LogFlowFunc(("No RDP client connected, so no input recording supported\n")); 321 #endif 338 rc = VINF_SUCCESS; 339 } 322 340 } 323 341 else if (enmStreamCmd == PDMAUDIOSTREAMCMD_DISABLE) 324 342 { 325 343 pDrv->pConsoleVRDPServer->SendAudioInputEnd(NULL /* pvUserCtx */); 326 } 327 328 return VINF_SUCCESS; 344 rc = VINF_SUCCESS; 345 } 346 347 return rc; 329 348 } 330 349 … … 334 353 pCfg->cbStreamIn = sizeof(VRDESTREAMIN); 335 354 pCfg->cMaxHstStrmsOut = 1; 336 pCfg->cMaxHstStrmsIn = 2; /* Microphone in + line in. */355 pCfg->cMaxHstStrmsIn = 2; /* Microphone in + Line in. */ 337 356 338 357 return VINF_SUCCESS; … … 367 386 } 368 387 369 int AudioVRDE::onVRDEInputIntercept(bool fIntercept) 370 { 371 LogFlowThisFunc(("fIntercept=%RTbool\n", fIntercept)); 388 int AudioVRDE::onVRDEControl(bool fEnable, uint32_t uFlags) 389 { 390 LogFlowThisFunc(("fEnable=%RTbool, uFlags=0x%x\n", fEnable, uFlags)); 391 392 mpDrv->fEnabled = fEnable; 372 393 373 394 return VINF_SUCCESS; /* Never veto. */ … … 398 419 bool fUnsigned = VRDE_AUDIO_FMT_SIGNED(audioFmt); 399 420 400 /*pVRDEStrmIn->cbSample = VRDE_AUDIO_FMT_BYTES_PER_SAMPLE(audioFmt);401 pVRDEStrmIn->uHz = iSampleHz;*/402 403 421 LogFlowFunc(("cbSample=%RU32, iSampleHz=%d, cChannels=%d, cBits=%d, fUnsigned=%RTbool\n", 404 422 VRDE_AUDIO_FMT_BYTES_PER_SAMPLE(audioFmt), iSampleHz, cChannels, cBits, fUnsigned)); … … 434 452 } 435 453 454 int AudioVRDE::onVRDEInputIntercept(bool fEnabled) 455 { 456 return VINF_SUCCESS; /* Never veto. */ 457 } 458 436 459 /** 437 460 * Construct a VRDE audio driver instance. … … 442 465 DECLCALLBACK(int) AudioVRDE::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 443 466 { 467 AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER); 468 AssertPtrReturn(pCfg, VERR_INVALID_POINTER); 469 444 470 PDRVAUDIOVRDE pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVRDE); 471 445 472 LogRel(("Audio: Initializing VRDE driver\n")); 446 473 LogFlowFunc(("fFlags=0x%x\n", fFlags)); … … 453 480 * Init the static parts. 454 481 */ 455 pThis->pDrvIns 482 pThis->pDrvIns = pDrvIns; 456 483 /* IBase */ 457 pDrvIns->IBase.pfnQueryInterface 484 pDrvIns->IBase.pfnQueryInterface = drvAudioVRDEQueryInterface; 458 485 /* IHostAudioR3 */ 459 pThis->IHostAudioR3.pfnInitIn = drvAudioVRDEInitIn; 460 pThis->IHostAudioR3.pfnInitOut = drvAudioVRDEInitOut; 461 pThis->IHostAudioR3.pfnControlOut = drvAudioVRDEControlOut; 462 pThis->IHostAudioR3.pfnControlIn = drvAudioVRDEControlIn; 463 pThis->IHostAudioR3.pfnFiniIn = drvAudioVRDEFiniIn; 464 pThis->IHostAudioR3.pfnFiniOut = drvAudioVRDEFiniOut; 465 pThis->IHostAudioR3.pfnCaptureIn = drvAudioVRDECaptureIn; 466 pThis->IHostAudioR3.pfnPlayOut = drvAudioVRDEPlayOut; 467 pThis->IHostAudioR3.pfnGetConf = drvAudioVRDEGetConf; 468 pThis->IHostAudioR3.pfnInit = drvAudioVRDEInit; 469 470 /* Get VRDPServer pointer. */ 486 PDMAUDIO_IHOSTAUDIOR3_CALLBACKS(drvAudioVRDE); 487 488 /* Init defaults. */ 489 pThis->fEnabled = false; 490 491 /* 492 * Get the ConsoleVRDPServer object pointer. 493 */ 471 494 void *pvUser; 472 495 int rc = CFGMR3QueryPtr(pCfg, "ObjectVRDPServer", &pvUser); … … 480 503 pThis->pConsoleVRDPServer = (ConsoleVRDPServer *)pvUser; 481 504 505 /* 506 * Get the AudioVRDE object pointer. 507 */ 482 508 pvUser = NULL; 483 509 rc = CFGMR3QueryPtr(pCfg, "Object", &pvUser); -
trunk/src/VBox/Main/src-client/DrvAudioVideoRec.cpp
r53442 r54230 5 5 6 6 /* 7 * Copyright (C) 2014 Oracle Corporation7 * Copyright (C) 2014-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 808 808 * Init the static parts. 809 809 */ 810 pThis->pDrvIns 810 pThis->pDrvIns = pDrvIns; 811 811 /* IBase */ 812 pDrvIns->IBase.pfnQueryInterface = drvAudioVideoRecQueryInterface; 813 pThis->IHostAudioR3.pfnInitIn = drvAudioVideoRecInitIn; 814 pThis->IHostAudioR3.pfnInitOut = drvAudioVideoRecInitOut; 815 pThis->IHostAudioR3.pfnControlOut = drvAudioVideoRecControlOut; 816 pThis->IHostAudioR3.pfnControlIn = drvAudioVideoRecControlIn; 817 pThis->IHostAudioR3.pfnFiniIn = drvAudioVideoRecFiniIn; 818 pThis->IHostAudioR3.pfnFiniOut = drvAudioVideoRecFiniOut; 819 pThis->IHostAudioR3.pfnCaptureIn = drvAudioVideoRecCaptureIn; 820 pThis->IHostAudioR3.pfnPlayOut = drvAudioVideoRecPlayOut; 821 pThis->IHostAudioR3.pfnGetConf = drvAudioVideoRecGetConf; 822 pThis->IHostAudioR3.pfnInit = drvAudioVideoRecInit; 812 pDrvIns->IBase.pfnQueryInterface = drvAudioVideoRecQueryInterface; 813 /* IHostAudioR3 */ 814 PDMAUDIO_IHOSTAUDIOR3_CALLBACKS(drvAudioVideoRec); 823 815 824 816 /* Get VRDPServer pointer. */
Note:
See TracChangeset
for help on using the changeset viewer.