- Timestamp:
- Apr 5, 2021 12:31:17 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioifs.h
r88359 r88362 993 993 994 994 995 /**996 * Audio backend callback types.997 * Those callbacks are being sent from the backend -> audio connector.998 */999 typedef enum PDMAUDIOBACKENDCBTYPE1000 {1001 /** Invalid, do not use. */1002 PDMAUDIOBACKENDCBTYPE_INVALID = 0,1003 /** The backend's status has changed. */1004 PDMAUDIOBACKENDCBTYPE_STATUS,1005 /** One or more host audio devices have changed. */1006 PDMAUDIOBACKENDCBTYPE_DEVICES_CHANGED,1007 /** Hack to blow the type up to 32-bit. */1008 PDMAUDIOBACKENDCBTYPE_32BIT_HACK = 0x7fffffff1009 } PDMAUDIOBACKENDCBTYPE;1010 1011 /** Pointer to a host audio interface. */1012 typedef struct PDMIHOSTAUDIO *PPDMIHOSTAUDIO;1013 1014 /**1015 * Host audio callback function.1016 *1017 * This function will be called from a backend to communicate with the host audio interface.1018 *1019 * @returns VBox status code.1020 * @param pDrvIns Pointer to driver instance which called us.1021 * @param enmType Callback type.1022 * @param pvUser User argument.1023 * @param cbUser Size (in bytes) of user argument.1024 */1025 typedef DECLCALLBACKTYPE(int, FNPDMHOSTAUDIOCALLBACK,(PPDMDRVINS pDrvIns, PDMAUDIOBACKENDCBTYPE enmType,1026 void *pvUser, size_t cbUser));1027 /** Pointer to a FNPDMHOSTAUDIOCALLBACK(). */1028 typedef FNPDMHOSTAUDIOCALLBACK *PFNPDMHOSTAUDIOCALLBACK;1029 1030 995 1031 996 /** @todo r=bird: What is this exactly? */ 1032 997 #define PPDMAUDIOBACKENDSTREAM void * 998 1033 999 1034 1000 /** Pointer to a audio connector interface. */ … … 1238 1204 1239 1205 1206 /** Pointer to a host audio interface. */ 1207 typedef struct PDMIHOSTAUDIO *PPDMIHOSTAUDIO; 1208 1240 1209 /** 1241 1210 * PDM host audio interface. … … 1287 1256 */ 1288 1257 DECLR3CALLBACKMEMBER(PDMAUDIOBACKENDSTS, pfnGetStatus, (PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)); 1289 1290 /**1291 * Sets a callback the audio backend can call. Optional.1292 *1293 * @returns VBox status code.1294 * @param pInterface Pointer to the interface structure containing the called function pointer.1295 * @param pfnCallback The callback function to use, or NULL when unregistering.1296 */1297 DECLR3CALLBACKMEMBER(int, pfnSetCallback, (PPDMIHOSTAUDIO pInterface, PFNPDMHOSTAUDIOCALLBACK pfnCallback));1298 1258 1299 1259 /** … … 1449 1409 1450 1410 /** PDMIHOSTAUDIO interface ID. */ 1451 #define PDMIHOSTAUDIO_IID " be34182b-d579-41e8-96e0-abb94900460f"1411 #define PDMIHOSTAUDIO_IID "fafc2dfb-eaa8-4e8f-9d13-ffe9163e7c51" 1452 1412 1453 1413 -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88359 r88362 1892 1892 } 1893 1893 1894 #ifdef VBOX_WITH_AUDIO_CALLBACKS /** @todo r=bird: All this is non-sense that shall be replaced by a PDMIHOSTAUDIO partner interface. */1895 1896 /**1897 * @callback_method_impl{FNPDMHOSTAUDIOCALLBACK, Backend callback implementation.}1898 *1899 * @par Important:1900 * No calls back to the backend within this function, as the backend1901 * might hold any locks / critical sections while executing this1902 * callback. Will result in some ugly deadlocks (or at least locking1903 * order violations) then.1904 *1905 * @todo r=bird: The above warning is extremely bogus. You enter the critical1906 * section of the driver here, if anything, that will be the lock order1907 * violation.1908 */1909 static DECLCALLBACK(int) drvAudioBackendCallback(PPDMDRVINS pDrvIns, PDMAUDIOBACKENDCBTYPE enmType, void *pvUser, size_t cbUser)1910 {1911 AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER);1912 RT_NOREF(pvUser, cbUser);1913 /* pvUser and cbUser are optional. */1914 1915 /** @todo r=bird: WTF *is* this? Seriously?!?1916 *1917 * DrvAudio will provide the host driver with a "callback" interface1918 * with methods like pfnNotifyDevicesChanged and pfnNotifyStatusChanged.1919 * The host drivers that implements callbacks can query the callback1920 * interface and make use of it.1921 */1922 1923 /* Get the upper driver (PDMIAUDIOCONNECTOR). */1924 AssertPtr(pDrvIns->pUpBase);1925 PPDMIAUDIOCONNECTOR pInterface = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIAUDIOCONNECTOR);1926 AssertPtr(pInterface);1927 PDRVAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVAUDIO, IAudioConnector);1928 AssertPtr(pThis);1929 1930 int rc = RTCritSectEnter(&pThis->CritSect);1931 AssertRCReturn(rc, rc);1932 1933 LogFunc(("pThis=%p, enmType=%RU32, pvUser=%p, cbUser=%zu\n", pThis, enmType, pvUser, cbUser));1934 1935 switch (enmType)1936 {1937 case PDMAUDIOBACKENDCBTYPE_DEVICES_CHANGED:1938 LogRel(("Audio: Device configuration of driver '%s' has changed\n", pThis->szName));1939 drvAudioScheduleReInitInternal(pThis);1940 break;1941 1942 default:1943 AssertMsgFailed(("Not supported\n"));1944 break;1945 }1946 1947 RTCritSectLeave(&pThis->CritSect);1948 1949 LogFlowFunc(("Returning %Rrc\n", rc));1950 return rc;1951 }1952 1953 #endif /* VBOX_WITH_AUDIO_CALLBACKS */1954 1955 1894 #ifdef VBOX_WITH_AUDIO_ENUM 1956 1895 /** … … 2053 1992 AssertPtrNullReturn(pHostDrvAudio->pfnGetDevices, VERR_INVALID_POINTER); 2054 1993 AssertPtrNullReturn(pHostDrvAudio->pfnGetStatus, VERR_INVALID_POINTER); 2055 AssertPtrNullReturn(pHostDrvAudio->pfnSetCallback, VERR_INVALID_POINTER);2056 1994 AssertPtrReturn(pHostDrvAudio->pfnStreamCreate, VERR_INVALID_POINTER); 2057 1995 AssertPtrReturn(pHostDrvAudio->pfnStreamDestroy, VERR_INVALID_POINTER); … … 2107 2045 RT_NOREF(rc2); 2108 2046 /* Ignore rc. */ 2109 #endif2110 2111 #ifdef VBOX_WITH_AUDIO_CALLBACKS2112 /*2113 * If the backend supports it, offer a callback to this connector.2114 */2115 /** @todo r=bird: Total misdesign. If the backend wants to talk to us, it2116 * should use PDMIBASE_QUERY_INTERFACE to get an interface from us. */2117 if (pThis->pHostDrvAudio->pfnSetCallback)2118 {2119 rc2 = pThis->pHostDrvAudio->pfnSetCallback(pThis->pHostDrvAudio, drvAudioBackendCallback);2120 if (RT_FAILURE(rc2))2121 LogRel(("Audio: Error registering callback for host driver '%s', rc=%Rrc\n", pThis->szName, rc2));2122 /* Not fatal. */2123 }2124 2047 #endif 2125 2048 … … 3405 3328 3406 3329 3407 #ifdef VBOX_WITH_AUDIO_CALLBACKS3408 3330 /********************************************************************************************************************************* 3409 3331 * PDMIAUDIONOTIFYFROMHOST interface implementation. * 3410 3332 *********************************************************************************************************************************/ 3411 3333 #ifdef VBOX_WITH_AUDIO_CALLBACKS 3412 3334 /** 3413 3335 * @interface_method_impl{PDMIAUDIONOTIFYFROMHOST,pfnNotifyDevicesChanged} -
trunk/src/VBox/Devices/Audio/DrvHostAudioAlsa.cpp
r88283 r88362 1504 1504 pThis->IHostAudio.pfnStreamPlay = drvHostAlsaAudioHA_StreamPlay; 1505 1505 pThis->IHostAudio.pfnStreamCapture = drvHostAlsaAudioHA_StreamCapture; 1506 pThis->IHostAudio.pfnSetCallback = NULL;1507 1506 pThis->IHostAudio.pfnGetDevices = NULL; 1508 1507 pThis->IHostAudio.pfnStreamGetPending = drvHostALSAStreamGetPending; -
trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp
r88360 r88362 2563 2563 pThis->IHostAudio.pfnStreamPlay = drvHostCoreAudioHA_StreamPlay; 2564 2564 pThis->IHostAudio.pfnStreamCapture = drvHostCoreAudioHA_StreamCapture; 2565 pThis->IHostAudio.pfnSetCallback = NULL;2566 2565 pThis->IHostAudio.pfnGetDevices = drvHostCoreAudioHA_GetDevices; 2567 2566 pThis->IHostAudio.pfnStreamGetPending = NULL; -
trunk/src/VBox/Devices/Audio/DrvHostAudioDSound.cpp
r88361 r88362 2629 2629 pThis->IHostAudio.pfnStreamPlay = drvHostDSoundHA_StreamPlay; 2630 2630 pThis->IHostAudio.pfnStreamCapture = drvHostDSoundHA_StreamCapture; 2631 pThis->IHostAudio.pfnSetCallback = NULL;2632 2631 pThis->IHostAudio.pfnGetDevices = drvHostDSoundHA_GetDevices; 2633 2632 pThis->IHostAudio.pfnStreamGetPending = drvHostDSoundHA_StreamGetPending; -
trunk/src/VBox/Devices/Audio/DrvHostAudioDebug.cpp
r88357 r88362 422 422 pThis->IHostAudio.pfnStreamPlay = drvHostDebugAudioHA_StreamPlay; 423 423 pThis->IHostAudio.pfnStreamCapture = drvHostDebugAudioHA_StreamCapture; 424 pThis->IHostAudio.pfnSetCallback = NULL;425 424 pThis->IHostAudio.pfnGetDevices = NULL; 426 425 pThis->IHostAudio.pfnStreamGetPending = NULL; -
trunk/src/VBox/Devices/Audio/DrvHostAudioNull.cpp
r88286 r88362 360 360 pThis->IHostAudio.pfnStreamPlay = drvHostNullAudioHA_StreamPlay; 361 361 pThis->IHostAudio.pfnStreamCapture = drvHostNullAudioHA_StreamCapture; 362 pThis->IHostAudio.pfnSetCallback = NULL;363 362 pThis->IHostAudio.pfnGetDevices = NULL; 364 363 pThis->IHostAudio.pfnStreamGetPending = NULL; -
trunk/src/VBox/Devices/Audio/DrvHostAudioOss.cpp
r88291 r88362 758 758 pThis->IHostAudio.pfnStreamPlay = drvHostOssAudioHA_StreamPlay; 759 759 pThis->IHostAudio.pfnStreamCapture = drvHostOssAudioHA_StreamCapture; 760 pThis->IHostAudio.pfnSetCallback = NULL;761 760 pThis->IHostAudio.pfnGetDevices = NULL; 762 761 pThis->IHostAudio.pfnStreamGetPending = NULL; -
trunk/src/VBox/Devices/Audio/DrvHostAudioPulseAudio.cpp
r88282 r88362 1702 1702 pThis->IHostAudio.pfnStreamPlay = drvHostPulseAudioHA_StreamPlay; 1703 1703 pThis->IHostAudio.pfnStreamCapture = drvHostPulseAudioHA_StreamCapture; 1704 pThis->IHostAudio.pfnSetCallback = NULL;1705 1704 pThis->IHostAudio.pfnGetDevices = NULL; 1706 1705 pThis->IHostAudio.pfnStreamGetPending = NULL; -
trunk/src/VBox/Devices/Audio/DrvHostAudioValidationKit.cpp
r88235 r88362 425 425 pThis->IHostAudio.pfnStreamPlay = drvHostValKitAudioHA_StreamPlay; 426 426 pThis->IHostAudio.pfnStreamCapture = drvHostValKitAudioHA_StreamCapture; 427 pThis->IHostAudio.pfnSetCallback = NULL;428 427 pThis->IHostAudio.pfnGetDevices = NULL; 429 428 pThis->IHostAudio.pfnStreamGetPending = NULL; -
trunk/src/VBox/Main/src-client/DrvAudioRec.cpp
r88300 r88362 1156 1156 pThis->IHostAudio.pfnStreamPlay = drvAudioVideoRecHA_StreamPlay; 1157 1157 pThis->IHostAudio.pfnStreamCapture = drvAudioVideoRecHA_StreamCapture; 1158 pThis->IHostAudio.pfnSetCallback = NULL;1159 1158 pThis->IHostAudio.pfnGetDevices = NULL; 1160 1159 pThis->IHostAudio.pfnStreamGetPending = NULL; -
trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp
r88300 r88362 721 721 pThis->IHostAudio.pfnGetDevices = NULL; 722 722 pThis->IHostAudio.pfnGetStatus = drvAudioVrdeHA_GetStatus; 723 pThis->IHostAudio.pfnSetCallback = NULL;724 723 pThis->IHostAudio.pfnStreamCreate = drvAudioVrdeHA_StreamCreate; 725 724 pThis->IHostAudio.pfnStreamDestroy = drvAudioVrdeHA_StreamDestroy;
Note:
See TracChangeset
for help on using the changeset viewer.