Changeset 88760 in vbox for trunk/include/VBox/vmm
- Timestamp:
- Apr 29, 2021 12:54:45 AM (4 years ago)
- Location:
- trunk/include/VBox/vmm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioifs.h
r88731 r88760 903 903 * @{ */ 904 904 /** No flags being set. */ 905 #define PDMAUDIOSTREAM_STS_NONE UINT32_C(0)905 #define PDMAUDIOSTREAM_STS_NONE UINT32_C(0) 906 906 /** Set if the backend for the stream has been initialized. 907 * This is generally always set after stream creation, but can be cleared if the 908 * re-initialization of the stream fails later on. */ 909 #define PDMAUDIOSTREAM_STS_INITIALIZED RT_BIT_32(0) 907 * 908 * PDMIAUDIOCONNECTOR: This is generally always set after stream creation, but 909 * can be cleared if the re-initialization of the stream fails later on. 910 * 911 * 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. */ 914 #define PDMAUDIOSTREAM_STS_INITIALIZED RT_BIT_32(0) 910 915 /** Set if the stream is enabled, clear if disabled. */ 911 #define PDMAUDIOSTREAM_STS_ENABLED RT_BIT_32(1)916 #define PDMAUDIOSTREAM_STS_ENABLED RT_BIT_32(1) 912 917 /** Set if the stream is paused. 913 918 * Requires enabled status to be set when used. */ 914 #define PDMAUDIOSTREAM_STS_PAUSED RT_BIT_32(2)919 #define PDMAUDIOSTREAM_STS_PAUSED RT_BIT_32(2) 915 920 /** Output only: Set when the stream is draining. 916 * Requires the enabled status to be set when used. */ 917 #define PDMAUDIOSTREAM_STS_PENDING_DISABLE RT_BIT_32(3) 918 /** Set if the stream needs to be re-initialized by the device (i.e. call 919 * PDMIAUDIOCONNECTOR::pfnStreamReInit). 920 * (The other status bits are preserved and are worked as normal while in this 921 * state, so that the stream can resume operation where it left off.) 922 * @note This is not appropriate for PDMIHOSTAUDIO::pfnStreamGetStatus. */ 923 #define PDMAUDIOSTREAM_STS_NEED_REINIT RT_BIT_32(4) 924 /** Validation mask. */ 925 #define PDMAUDIOSTREAM_STS_VALID_MASK UINT32_C(0x0000001f) 926 /** Asserts the validity of the given stream status mask. */ 921 * Requires the enabled status to be set when used. 922 * @todo See todo in drvAudioStreamPlay() regarding the suitability of this 923 * for PDMIHOSTAUDIO. */ 924 #define PDMAUDIOSTREAM_STS_PENDING_DISABLE RT_BIT_32(3) 925 926 /** PDMIAUDIOCONNECTOR: Set if the stream needs to be re-initialized by the 927 * device (i.e. call PDMIAUDIOCONNECTOR::pfnStreamReInit). (The other status 928 * bits are preserved and are worked as normal while in this state, so that the 929 * stream can resume operation where it left off.) */ 930 #define PDMAUDIOSTREAM_STS_NEED_REINIT RT_BIT_32(8) 931 /** Validation mask for PDMIAUDIOCONNECTOR. */ 932 #define PDMAUDIOSTREAM_STS_VALID_MASK UINT32_C(0x0000010f) 933 /** Asserts the validity of the given stream status mask for PDMIAUDIOCONNECTOR. */ 927 934 #define PDMAUDIOSTREAM_STS_ASSERT_VALID(a_fStreamStatus) do { \ 928 935 AssertMsg(!((a_fStreamStatus) & ~PDMAUDIOSTREAM_STS_VALID_MASK), ("%#x\n", (a_fStreamStatus))); \ 936 Assert(!((a_fStreamStatus) & PDMAUDIOSTREAM_STS_PAUSED) || ((a_fStreamStatus) & PDMAUDIOSTREAM_STS_ENABLED)); \ 937 Assert(!((a_fStreamStatus) & PDMAUDIOSTREAM_STS_PENDING_DISABLE) || ((a_fStreamStatus) & PDMAUDIOSTREAM_STS_ENABLED)); \ 938 } while (0) 939 940 /** PDMIHOSTAUDIO: Backend is preparing a device switch, DrvAudio should 941 * pre-buffer to make that smoother and quicker. 942 * Call PDMIAUDIONOTIFYFROMHOST::pfnStreamNotifyDeviceChanged when clearing. */ 943 #define PDMAUDIOSTREAM_STS_PREPARING_SWITCH RT_BIT_32(16) 944 /** Validation mask for PDMIHOSTAUDIO. */ 945 #define PDMAUDIOSTREAM_STS_VALID_MASK_BACKEND UINT32_C(0x0001000f) 946 /** Asserts the validity of the given stream status mask for PDMIHOSTAUDIO. */ 947 #define PDMAUDIOSTREAM_STS_ASSERT_VALID_BACKEND(a_fStreamStatus) do { \ 948 AssertMsg(!((a_fStreamStatus) & ~PDMAUDIOSTREAM_STS_VALID_MASK_BACKEND), ("%#x\n", (a_fStreamStatus))); \ 929 949 Assert(!((a_fStreamStatus) & PDMAUDIOSTREAM_STS_PAUSED) || ((a_fStreamStatus) & PDMAUDIOSTREAM_STS_ENABLED)); \ 930 950 Assert(!((a_fStreamStatus) & PDMAUDIOSTREAM_STS_PENDING_DISABLE) || ((a_fStreamStatus) & PDMAUDIOSTREAM_STS_ENABLED)); \ … … 979 999 * Only can be destroyed when the reference count reaches 0. */ 980 1000 uint32_t volatile cRefs; 981 /** Stream status flag. */982 uint32_t fStatus;1001 /** Stream status - PDMAUDIOSTREAM_STS_XXX. */ 1002 uint32_t fStatus; 983 1003 /** Audio direction of this stream. */ 984 1004 PDMAUDIODIR enmDir; … … 1325 1345 1326 1346 /** 1347 * Called from PDMIAUDIONOTIFYFROMHOST::pfnNotifyDeviceChanged so the backend 1348 * can start the device change for a stream. 1349 * 1350 * This is mainly to avoid the need for a list of streams in the backend. 1351 * 1352 * @param pInterface Pointer to this interface. 1353 * @param pStream Pointer to audio stream. 1354 * @param pvUser Backend specific parameter from the call to 1355 * PDMIAUDIONOTIFYFROMHOST::pfnNotifyDeviceChanged. 1356 */ 1357 DECLR3CALLBACKMEMBER(void, pfnStreamNotifyDeviceChanged,(PPDMIHOSTAUDIO pInterface, 1358 PPDMAUDIOBACKENDSTREAM pStream, void *pvUser)); 1359 1360 /** 1327 1361 * Controls an audio stream. 1328 1362 * … … 1415 1449 1416 1450 /** PDMIHOSTAUDIO interface ID. */ 1417 #define PDMIHOSTAUDIO_IID " 109d8c74-dfed-4056-b5ad-022de4d249c2"1451 #define PDMIHOSTAUDIO_IID "faab0061-c3c8-481e-b875-abbe81baf94a" 1418 1452 1419 1453 … … 1429 1463 { 1430 1464 /** 1465 * The device for the given direction changed. 1466 * 1467 * The driver above backend (DrvAudio) will call the backend back 1468 * (PDMIHOSTAUDIO::pfnStreamNotifyDeviceChanged) for all open streams in the 1469 * given direction. (This ASSUMES the backend uses one output device and one 1470 * input devices for all streams.) 1471 * 1472 * @param pInterface Pointer to this interface. 1473 * @param enmDir The audio direction. 1474 * @param pvUser Backend specific parameter for 1475 * PDMIHOSTAUDIO::pfnStreamNotifyDeviceChanged. 1476 */ 1477 DECLR3CALLBACKMEMBER(void, pfnNotifyDeviceChanged,(PPDMIAUDIONOTIFYFROMHOST pInterface, PDMAUDIODIR enmDir, void *pvUser)); 1478 1479 /** 1480 * The stream has changed its device and left the 1481 * PDMAUDIOSTREAM_STS_PREPARING_SWITCH state. 1482 * 1483 * @param pInterface Pointer to this interface. 1484 * @param pStream The stream that changed device (backend variant). 1485 * @param fReInit Set if a re-init is required, clear if not. 1486 */ 1487 DECLR3CALLBACKMEMBER(void, pfnStreamNotifyDeviceChanged,(PPDMIAUDIONOTIFYFROMHOST pInterface, 1488 PPDMAUDIOBACKENDSTREAM pStream, bool fReInit)); 1489 1490 /** 1431 1491 * One or more audio devices have changed in some way. 1432 1492 * 1433 1493 * The upstream driver/device should re-evaluate the devices they're using. 1434 1494 * 1435 * @param pInterface Pointer to this interface. 1495 * @todo r=bird: The upstream driver/device does not know which host audio 1496 * devices they are using. This is mainly for triggering enumeration and 1497 * logging of the audio devices. 1498 * 1499 * @param pInterface Pointer to this interface. 1436 1500 */ 1437 1501 DECLR3CALLBACKMEMBER(void, pfnNotifyDevicesChanged,(PPDMIAUDIONOTIFYFROMHOST pInterface)); … … 1439 1503 1440 1504 /** PDMIAUDIONOTIFYFROMHOST interface ID. */ 1441 #define PDMIAUDIONOTIFYFROMHOST_IID " ec10f36b-ec2d-4b97-9044-2a59fba837ad"1505 #define PDMIAUDIONOTIFYFROMHOST_IID "603f9d72-4b8b-4e0a-aa00-a76982931039" 1442 1506 1443 1507 /** @} */ -
trunk/include/VBox/vmm/pdmaudioinline.h
r88731 r88760 423 423 * @returns @c true if ready to be read from, @c false if not. 424 424 * @param fStatus Stream status to evaluate, PDMAUDIOSTREAM_STS_XXX. 425 * @note Not for backend statuses (use PDMAudioStrmStatusBackendCanRead)! 425 426 */ 426 427 DECLINLINE(bool) PDMAudioStrmStatusCanRead(uint32_t fStatus) … … 428 429 PDMAUDIOSTREAM_STS_ASSERT_VALID(fStatus); 429 430 AssertReturn(!(fStatus & ~PDMAUDIOSTREAM_STS_VALID_MASK), false); 431 return (fStatus & ( PDMAUDIOSTREAM_STS_INITIALIZED 432 | PDMAUDIOSTREAM_STS_ENABLED 433 | PDMAUDIOSTREAM_STS_PAUSED 434 | PDMAUDIOSTREAM_STS_NEED_REINIT)) 435 == ( PDMAUDIOSTREAM_STS_INITIALIZED 436 | PDMAUDIOSTREAM_STS_ENABLED); 437 } 438 439 /** 440 * Checks if the stream status is one that can be read from. 441 * 442 * @returns @c true if ready to be read from, @c false if not. 443 * @param fStatus Stream status to evaluate, PDMAUDIOSTREAM_STS_XXX. 444 * @note Only for backend statuses. 445 */ 446 DECLINLINE(bool) PDMAudioStrmStatusBackendCanRead(uint32_t fStatus) 447 { 448 PDMAUDIOSTREAM_STS_ASSERT_VALID_BACKEND(fStatus); 449 AssertReturn(!(fStatus & ~PDMAUDIOSTREAM_STS_VALID_MASK_BACKEND), false); 430 450 return (fStatus & ( PDMAUDIOSTREAM_STS_INITIALIZED 431 451 | PDMAUDIOSTREAM_STS_ENABLED … … 441 461 * @returns @c true if ready to be written to, @c false if not. 442 462 * @param fStatus Stream status to evaluate, PDMAUDIOSTREAM_STS_XXX. 463 * @note Not for backend statuses (use PDMAudioStrmStatusBackendCanWrite)! 443 464 */ 444 465 DECLINLINE(bool) PDMAudioStrmStatusCanWrite(uint32_t fStatus) … … 456 477 457 478 /** 479 * Checks if the stream status is one that can be written to, backend edition. 480 * 481 * @returns @c true if ready to be written to, @c false if not. 482 * @param fStatus Stream status to evaluate, PDMAUDIOSTREAM_STS_XXX. 483 * @note Only for backend statuses. 484 */ 485 DECLINLINE(bool) PDMAudioStrmStatusBackendCanWrite(uint32_t fStatus) 486 { 487 PDMAUDIOSTREAM_STS_ASSERT_VALID_BACKEND(fStatus); 488 AssertReturn(!(fStatus & ~PDMAUDIOSTREAM_STS_VALID_MASK_BACKEND), false); 489 return (fStatus & ( PDMAUDIOSTREAM_STS_INITIALIZED 490 | PDMAUDIOSTREAM_STS_ENABLED 491 | PDMAUDIOSTREAM_STS_PAUSED 492 | PDMAUDIOSTREAM_STS_PENDING_DISABLE)) 493 == ( PDMAUDIOSTREAM_STS_INITIALIZED 494 | PDMAUDIOSTREAM_STS_ENABLED); 495 } 496 497 /** 458 498 * Checks if the stream status is a read-to-operate one. 459 499 * 460 500 * @returns @c true if ready to operate, @c false if not. 461 501 * @param fStatus Stream status to evaluate, PDMAUDIOSTREAM_STS_XXX. 502 * @note Not for backend statuses! 462 503 */ 463 504 DECLINLINE(bool) PDMAudioStrmStatusIsReady(uint32_t fStatus)
Note:
See TracChangeset
for help on using the changeset viewer.