Changeset 88819 in vbox for trunk/include/VBox
- Timestamp:
- May 3, 2021 10:26:28 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144153
- Location:
- trunk/include/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/err.h
r88638 r88819 2930 2930 /** Generic audio device enumeration error. */ 2931 2931 #define VERR_AUDIO_ENUMERATION_FAILED (-6607) 2932 /** Asynchronous stream initialization still on-going. */ 2933 #define VERR_AUDIO_STREAM_INIT_IN_PROGRESS (-6608) 2934 /** Special PDMIHOSTAUDIO::pfnStreamCreate return value for triggering 2935 * calling of PDMIHOSTAUDIO::pfnStreamInitAsync on a worker thread. */ 2936 #define VINF_AUDIO_STREAM_ASYNC_INIT_NEEDED (6609) 2932 2937 /** @} */ 2933 2938 -
trunk/include/VBox/vmm/pdmaudioifs.h
r88760 r88819 439 439 /** The size of the backend specific stream data (in bytes). */ 440 440 uint32_t cbStream; 441 /** Flags, MBZ. */441 /** PDMAUDIOBACKEND_F_XXX. */ 442 442 uint32_t fFlags; 443 443 /** Number of concurrent output (playback) streams supported on the host. … … 450 450 /** Pointer to a static host audio audio configuration. */ 451 451 typedef PDMAUDIOBACKENDCFG *PPDMAUDIOBACKENDCFG; 452 453 /** @name PDMAUDIOBACKEND_F_XXX - PDMAUDIOBACKENDCFG::fFlags 454 * @{ */ 455 /** PDMIHOSTAUDIO::pfnStreamConfigHint should preferably be called on a 456 * worker thread rather than EMT as it may take a good while. */ 457 #define PDMAUDIOBACKEND_F_ASYNC_HINT RT_BIT_32(0) 458 /** @} */ 459 452 460 453 461 /** … … 904 912 /** No flags being set. */ 905 913 #define PDMAUDIOSTREAM_STS_NONE UINT32_C(0) 906 /** Set if the backend for the stream has been initialized.914 /** Set if the backend for the stream has been created. 907 915 * 908 916 * PDMIAUDIOCONNECTOR: This is generally always set after stream creation, but 909 917 * can be cleared if the re-initialization of the stream fails later on. 918 * Asynchronous init may still be incomplete, see 910 919 * 911 920 * PDMIHOSTAUDIO: This may not be set immediately if the backend is doing some 912 * of the stream creation asynchronously. The DrvAudio code will not report 913 * this to the devices, but keep on prebuffering till it is set. */ 921 * of the stream creation asynchronously via PDMIHOSTAUDIO::pfnStreamInitAsync. 922 * The DrvAudio code will not report this to the devices, but keep on 923 * prebuffering till pfnStreamInitAsync is done and this bit is set. */ 914 924 #define PDMAUDIOSTREAM_STS_INITIALIZED RT_BIT_32(0) 915 925 /** Set if the stream is enabled, clear if disabled. */ 916 926 #define PDMAUDIOSTREAM_STS_ENABLED RT_BIT_32(1) 917 927 /** Set if the stream is paused. 918 * Requires enabledstatus to be set when used. */928 * Requires the ENABLED status to be set when used. */ 919 929 #define PDMAUDIOSTREAM_STS_PAUSED RT_BIT_32(2) 920 930 /** Output only: Set when the stream is draining. 921 * Requires the enabledstatus to be set when used.931 * Requires the ENABLED status to be set when used. 922 932 * @todo See todo in drvAudioStreamPlay() regarding the suitability of this 923 933 * for PDMIHOSTAUDIO. */ … … 929 939 * stream can resume operation where it left off.) */ 930 940 #define PDMAUDIOSTREAM_STS_NEED_REINIT RT_BIT_32(8) 941 /** PDMIAUDIOCONNECTOR: The backend is ready (PDMIHOSTAUDIO::pfnStreamInitAsync done). 942 * Requires the INITIALIZED status to be set. */ 943 #define PDMAUDIOSTREAM_STS_BACKEND_READY RT_BIT_32(9) 931 944 /** Validation mask for PDMIAUDIOCONNECTOR. */ 932 #define PDMAUDIOSTREAM_STS_VALID_MASK UINT32_C(0x00000 10f)945 #define PDMAUDIOSTREAM_STS_VALID_MASK UINT32_C(0x0000030f) 933 946 /** Asserts the validity of the given stream status mask for PDMIAUDIOCONNECTOR. */ 934 947 #define PDMAUDIOSTREAM_STS_ASSERT_VALID(a_fStreamStatus) do { \ … … 936 949 Assert(!((a_fStreamStatus) & PDMAUDIOSTREAM_STS_PAUSED) || ((a_fStreamStatus) & PDMAUDIOSTREAM_STS_ENABLED)); \ 937 950 Assert(!((a_fStreamStatus) & PDMAUDIOSTREAM_STS_PENDING_DISABLE) || ((a_fStreamStatus) & PDMAUDIOSTREAM_STS_ENABLED)); \ 951 Assert(!((a_fStreamStatus) & PDMAUDIOSTREAM_STS_BACKEND_READY) || ((a_fStreamStatus) & PDMAUDIOSTREAM_STS_INITIALIZED)); \ 938 952 } while (0) 939 953 940 954 /** PDMIHOSTAUDIO: Backend is preparing a device switch, DrvAudio should 941 955 * pre-buffer to make that smoother and quicker. 942 * Call PDMI AUDIONOTIFYFROMHOST::pfnStreamNotifyDeviceChanged when clearing. */956 * Call PDMIHOSTAUDIOPORT::pfnStreamNotifyDeviceChanged when clearing. */ 943 957 #define PDMAUDIOSTREAM_STS_PREPARING_SWITCH RT_BIT_32(16) 944 958 /** Validation mask for PDMIHOSTAUDIO. */ … … 996 1010 /** Magic value (PDMAUDIOSTREAM_MAGIC). */ 997 1011 uint32_t uMagic; 998 /** Number of references to this stream.999 * Only can be destroyed when the reference count reaches 0. */1000 uint32_t volatile cRefs;1001 /** Stream status - PDMAUDIOSTREAM_STS_XXX. */1002 uint32_t fStatus;1003 1012 /** Audio direction of this stream. */ 1004 1013 PDMAUDIODIR enmDir; … … 1021 1030 1022 1031 /** Magic value for PDMAUDIOSTREAM. */ 1023 #define PDMAUDIOSTREAM_MAGIC PDM_VERSION_MAKE(0xa0d3, 3, 0)1032 #define PDMAUDIOSTREAM_MAGIC PDM_VERSION_MAKE(0xa0d3, 4, 0) 1024 1033 1025 1034 … … 1303 1312 1304 1313 /** 1314 * Callback for genric on-worker-thread requests initiated by the backend itself. 1315 * 1316 * This is the counterpart to PDMIHOSTAUDIOPORT::pfnDoOnWorkerThread that will 1317 * be invoked on a worker thread when the backend requests it - optional. 1318 * 1319 * This does not return a value, so the backend must keep track of 1320 * failure/success on its own. 1321 * 1322 * This method is optional. A non-NULL will, together with pfnStreamInitAsync 1323 * and PDMAUDIOBACKEND_F_ASYNC_HINT, force DrvAudio to create the thread pool. 1324 * 1325 * @param pInterface Pointer to this interface. 1326 * @param pStream Optionally a backend stream if specified in the 1327 * PDMIHOSTAUDIOPORT::pfnDoOnWorkerThread() call. 1328 * @param uUser User specific value as specified in the 1329 * PDMIHOSTAUDIOPORT::pfnDoOnWorkerThread() call. 1330 * @param pvUser User specific pointer as specified in the 1331 * PDMIHOSTAUDIOPORT::pfnDoOnWorkerThread() call. 1332 */ 1333 DECLR3CALLBACKMEMBER(void, pfnDoOnWorkerThread,(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 1334 uintptr_t uUser, void *pvUser)); 1335 1336 /** 1305 1337 * Gives the audio backend a hint about a typical configuration (optional). 1306 1338 * … … 1311 1343 * configuring host audio. 1312 1344 * 1345 * The backend can return PDMAUDIOBACKEND_F_ASYNC_HINT in 1346 * PDMIHOSTAUDIO::pfnGetConfig to avoid having EMT making this call and thereby 1347 * speeding up VM construction. 1348 * 1313 1349 * @param pInterface Pointer to this interface. 1314 1350 * @param pCfg The typical configuration. (Feel free to change it … … 1325 1361 * 1326 1362 * @returns VBox status code. 1363 * @retval VINF_AUDIO_STREAM_ASYNC_INIT_NEEDED if 1364 * PDMIHOSTAUDIO::pfnStreamInitAsync should be called. 1327 1365 * @param pInterface Pointer to the interface structure containing the called function pointer. 1328 1366 * @param pStream Pointer to audio stream. … … 1336 1374 1337 1375 /** 1376 * Asynchronous stream initialization step, optional. 1377 * 1378 * This is called on a worker thread iff the PDMIHOSTAUDIO::pfnStreamCreate 1379 * method returns VINF_AUDIO_STREAM_ASYNC_INIT_NEEDED. 1380 * 1381 * @returns VBox status code. 1382 * @param pInterface Pointer to this interface. 1383 * @param pStream Pointer to audio stream to continue 1384 * initialization of. 1385 * @param fDestroyed Set to @c true if the stream has been destroyed 1386 * before the worker thread got to making this 1387 * call. The backend should just ready the stream 1388 * for destruction in that case. 1389 */ 1390 DECLR3CALLBACKMEMBER(int, pfnStreamInitAsync, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, bool fDestroyed)); 1391 1392 /** 1338 1393 * Destroys an audio stream. 1339 1394 * … … 1345 1400 1346 1401 /** 1347 * Called from PDMI AUDIONOTIFYFROMHOST::pfnNotifyDeviceChanged so the backend1348 * can startthe device change for a stream.1402 * Called from PDMIHOSTAUDIOPORT::pfnNotifyDeviceChanged so the backend can start 1403 * the device change for a stream. 1349 1404 * 1350 1405 * This is mainly to avoid the need for a list of streams in the backend. … … 1353 1408 * @param pStream Pointer to audio stream. 1354 1409 * @param pvUser Backend specific parameter from the call to 1355 * PDMI AUDIONOTIFYFROMHOST::pfnNotifyDeviceChanged.1410 * PDMIHOSTAUDIOPORT::pfnNotifyDeviceChanged. 1356 1411 */ 1357 1412 DECLR3CALLBACKMEMBER(void, pfnStreamNotifyDeviceChanged,(PPDMIHOSTAUDIO pInterface, … … 1449 1504 1450 1505 /** PDMIHOSTAUDIO interface ID. */ 1451 #define PDMIHOSTAUDIO_IID " faab0061-c3c8-481e-b875-abbe81baf94a"1506 #define PDMIHOSTAUDIO_IID "b320d6ab-6cbc-46a8-8011-57e7f7eb0e25" 1452 1507 1453 1508 1454 1509 /** Pointer to a audio notify from host interface. */ 1455 typedef struct PDMIAUDIONOTIFYFROMHOST *PPDMIAUDIONOTIFYFROMHOST; 1456 1457 /** 1458 * PDM audio notification interface, for use by host audio. 1459 * 1460 * @todo better name? 1461 */ 1462 typedef struct PDMIAUDIONOTIFYFROMHOST 1463 { 1510 typedef struct PDMIHOSTAUDIOPORT *PPDMIHOSTAUDIOPORT; 1511 1512 /** 1513 * PDM host audio port interface, upwards sibling of PDMIHOSTAUDIO. 1514 */ 1515 typedef struct PDMIHOSTAUDIOPORT 1516 { 1517 /** 1518 * Ask DrvAudio to call PDMIHOSTAUDIO::pfnDoOnWorkerThread on a worker thread. 1519 * 1520 * Generic method for doing asynchronous work using the DrvAudio thread pool. 1521 * 1522 * This function will not wait for PDMIHOSTAUDIO::pfnDoOnWorkerThread to 1523 * complete, but returns immediately after submitting the request to the thread 1524 * pool. 1525 * 1526 * @returns VBox status code. 1527 * @param pInterface Pointer to this interface. 1528 * @param pStream Optional backend stream structure to pass along. The 1529 * reference count will be increased till the call 1530 * completes to make sure the stream stays valid. 1531 * @param uUser User specific value. 1532 * @param pvUser User specific pointer. 1533 */ 1534 DECLR3CALLBACKMEMBER(int, pfnDoOnWorkerThread,(PPDMIHOSTAUDIOPORT pInterface, PPDMAUDIOBACKENDSTREAM pStream, 1535 uintptr_t uUser, void *pvUser)); 1536 1464 1537 /** 1465 1538 * The device for the given direction changed. … … 1475 1548 * PDMIHOSTAUDIO::pfnStreamNotifyDeviceChanged. 1476 1549 */ 1477 DECLR3CALLBACKMEMBER(void, pfnNotifyDeviceChanged,(PPDMI AUDIONOTIFYFROMHOST pInterface, PDMAUDIODIR enmDir, void *pvUser));1550 DECLR3CALLBACKMEMBER(void, pfnNotifyDeviceChanged,(PPDMIHOSTAUDIOPORT pInterface, PDMAUDIODIR enmDir, void *pvUser)); 1478 1551 1479 1552 /** … … 1485 1558 * @param fReInit Set if a re-init is required, clear if not. 1486 1559 */ 1487 DECLR3CALLBACKMEMBER(void, pfnStreamNotifyDeviceChanged,(PPDMI AUDIONOTIFYFROMHOST pInterface,1560 DECLR3CALLBACKMEMBER(void, pfnStreamNotifyDeviceChanged,(PPDMIHOSTAUDIOPORT pInterface, 1488 1561 PPDMAUDIOBACKENDSTREAM pStream, bool fReInit)); 1489 1562 … … 1499 1572 * @param pInterface Pointer to this interface. 1500 1573 */ 1501 DECLR3CALLBACKMEMBER(void, pfnNotifyDevicesChanged,(PPDMI AUDIONOTIFYFROMHOST pInterface));1502 } PDMI AUDIONOTIFYFROMHOST;1503 1504 /** PDMI AUDIONOTIFYFROMHOST interface ID. */1505 #define PDMI AUDIONOTIFYFROMHOST_IID "603f9d72-4b8b-4e0a-aa00-a76982931039"1574 DECLR3CALLBACKMEMBER(void, pfnNotifyDevicesChanged,(PPDMIHOSTAUDIOPORT pInterface)); 1575 } PDMIHOSTAUDIOPORT; 1576 1577 /** PDMIHOSTAUDIOPORT interface ID. */ 1578 #define PDMIHOSTAUDIOPORT_IID "4d513a11-5be1-4f6f-9a06-a2f628cf67ac" 1506 1579 1507 1580 /** @} */
Note:
See TracChangeset
for help on using the changeset viewer.