Changeset 88045 in vbox
- Timestamp:
- Mar 9, 2021 1:27:51 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioifs.h
r88044 r88045 310 310 typedef uint32_t PDMAUDIODEVLATSPECSEC; 311 311 312 /** @name PDMAUDIO DEV_FLAGS_XXX312 /** @name PDMAUDIOHOSTDEV_F_XXX 313 313 * @{ */ 314 314 /** No flags set. */ 315 #define PDMAUDIO DEV_FLAGS_NONE UINT32_C(0)315 #define PDMAUDIOHOSTDEV_F_NONE UINT32_C(0) 316 316 /** The device marks the default device within the host OS. */ 317 #define PDMAUDIO DEV_FLAGS_DEFAULT RT_BIT_32(0)317 #define PDMAUDIOHOSTDEV_F_DEFAULT RT_BIT_32(0) 318 318 /** The device can be removed at any time and we have to deal with it. */ 319 #define PDMAUDIO DEV_FLAGS_HOTPLUG RT_BIT_32(1)319 #define PDMAUDIOHOSTDEV_F_HOTPLUG RT_BIT_32(1) 320 320 /** The device is known to be buggy and needs special treatment. */ 321 #define PDMAUDIO DEV_FLAGS_BUGGY RT_BIT_32(2)321 #define PDMAUDIOHOSTDEV_F_BUGGY RT_BIT_32(2) 322 322 /** Ignore the device, no matter what. */ 323 #define PDMAUDIO DEV_FLAGS_IGNORE RT_BIT_32(3)323 #define PDMAUDIOHOSTDEV_F_IGNORE RT_BIT_32(3) 324 324 /** The device is present but marked as locked by some other application. */ 325 #define PDMAUDIO DEV_FLAGS_LOCKED RT_BIT_32(4)325 #define PDMAUDIOHOSTDEV_F_LOCKED RT_BIT_32(4) 326 326 /** The device is present but not in an alive state (dead). */ 327 #define PDMAUDIO DEV_FLAGS_DEAD RT_BIT_32(5)327 #define PDMAUDIOHOSTDEV_F_DEAD RT_BIT_32(5) 328 328 /** Set if the extra backend specific data cannot be duplicated. */ 329 #define PDMAUDIO DEV_FLAGS_NO_DUP RT_BIT_32(31)329 #define PDMAUDIOHOSTDEV_F_NO_DUP RT_BIT_32(31) 330 330 /** @} */ 331 331 … … 346 346 /** The device is an (external) USB device. */ 347 347 PDMAUDIODEVICETYPE_USB, 348 /** End of valid values. */ 349 PDMAUDIODEVICETYPE_END, 348 350 /** Hack to blow the type up to 32-bit. */ 349 351 PDMAUDIODEVICETYPE_32BIT_HACK = 0x7fffffff … … 351 353 352 354 /** 353 * Audio device info (enumeration result). 355 * Host audio device info, part of enumeration result. 356 * 354 357 * @sa PDMAUDIOHOSTENUM, PDMIHOSTAUDIO::pfnGetDevices 355 358 */ 356 typedef struct PDMAUDIO DEVICE359 typedef struct PDMAUDIOHOSTDEV 357 360 { 358 361 /** List entry (like PDMAUDIOHOSTENUM::LstDevices). */ 359 362 RTLISTNODE Node; 360 /** Magic value (PDMAUDIO DEVICE_MAGIC). */363 /** Magic value (PDMAUDIOHOSTDEV_MAGIC). */ 361 364 uint32_t uMagic; 362 365 /** Size of this structure and whatever backend specific data that follows it. */ … … 366 369 /** Usage of the device. */ 367 370 PDMAUDIODIR enmUsage; 368 /** Device flags, PDMAUDIO DEV_FLAGS_XXX. */371 /** Device flags, PDMAUDIOHOSTDEV_F_XXX. */ 369 372 uint32_t fFlags; 370 373 /** Reference count indicating how many audio streams currently are relying on this device. */ … … 388 391 uint64_t uPadding[ARCH_BITS >= 64 ? 3 : 4]; 389 392 } Type; 390 /** Friendly name of the device, if any. */393 /** Friendly name of the device, if any. Could be truncated. */ 391 394 char szName[64]; 392 } PDMAUDIO DEVICE;393 AssertCompileSizeAlignment(PDMAUDIO DEVICE, 32);395 } PDMAUDIOHOSTDEV; 396 AssertCompileSizeAlignment(PDMAUDIOHOSTDEV, 16); 394 397 /** Pointer to audio device info (enum result). */ 395 typedef PDMAUDIO DEVICE *PPDMAUDIODEVICE;398 typedef PDMAUDIOHOSTDEV *PPDMAUDIOHOSTDEV; 396 399 /** Pointer to a const audio device info (enum result). */ 397 typedef PDMAUDIO DEVICE const *PCPDMAUDIODEVICE;398 399 /** Magic value for PDMAUDIO DEVICE. (Armando Anthony "Chick" Corea) */400 #define PDMAUDIO DEVICE_MAGICUINT32_C(0x19410612)401 /** Magic value for PDMAUDIO DEVICEafter free. */402 #define PDMAUDIO DEVICE_MAGIC_DEADUINT32_C(0x20210209)400 typedef PDMAUDIOHOSTDEV const *PCPDMAUDIOHOSTDEV; 401 402 /** Magic value for PDMAUDIOHOSTDEV. (Armando Anthony "Chick" Corea) */ 403 #define PDMAUDIOHOSTDEV_MAGIC UINT32_C(0x19410612) 404 /** Magic value for PDMAUDIOHOSTDEV after free. */ 405 #define PDMAUDIOHOSTDEV_MAGIC_DEAD UINT32_C(0x20210209) 403 406 404 407 … … 414 417 /** Number of audio devices in the list. */ 415 418 uint32_t cDevices; 416 /** List of audio devices (PDMAUDIO DEVICE). */419 /** List of audio devices (PDMAUDIOHOSTDEV). */ 417 420 RTLISTANCHOR LstDevices; 418 421 } PDMAUDIOHOSTENUM; -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88044 r88045 2171 2171 LogRel(("Audio: Found %RU16 devices for driver '%s'\n", DevEnum.cDevices, pThis->szName)); 2172 2172 2173 PPDMAUDIO DEVICEpDev;2174 RTListForEach(&DevEnum.LstDevices, pDev, PDMAUDIO DEVICE, Node)2173 PPDMAUDIOHOSTDEV pDev; 2174 RTListForEach(&DevEnum.LstDevices, pDev, PDMAUDIOHOSTDEV, Node) 2175 2175 { 2176 2176 if (fLog) -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r88044 r88045 209 209 /** @name Audio device methods. 210 210 * @{ */ 211 PPDMAUDIO DEVICEPDMAudioDeviceAlloc(size_t cb);212 void PDMAudioDeviceFree(PPDMAUDIO DEVICEpDev);213 PPDMAUDIO DEVICE PDMAudioDeviceDup(const PPDMAUDIODEVICEpDev, bool fOnlyCoreData);211 PPDMAUDIOHOSTDEV PDMAudioDeviceAlloc(size_t cb); 212 void PDMAudioDeviceFree(PPDMAUDIOHOSTDEV pDev); 213 PPDMAUDIOHOSTDEV PDMAudioDeviceDup(const PPDMAUDIOHOSTDEV pDev, bool fOnlyCoreData); 214 214 /** @} */ 215 215 … … 218 218 void PDMAudioHostEnumInit(PPDMAUDIOHOSTENUM pDevEnm); 219 219 void PDMAudioHostEnumDelete(PPDMAUDIOHOSTENUM pDevEnm); 220 void PDMAudioHostEnumAppend(PPDMAUDIOHOSTENUM pDevEnm, PPDMAUDIO DEVICEpDev);220 void PDMAudioHostEnumAppend(PPDMAUDIOHOSTENUM pDevEnm, PPDMAUDIOHOSTDEV pDev); 221 221 int PDMAudioHostEnumCopy(PPDMAUDIOHOSTENUM pDstDevEnm, PCPDMAUDIOHOSTENUM pSrcDevEnm, 222 222 PDMAUDIODIR enmUsage, bool fOnlyCoreData); 223 PPDMAUDIO DEVICEPDMAudioHostEnumGetDefault(PCPDMAUDIOHOSTENUM pDevEnm, PDMAUDIODIR enmDir);223 PPDMAUDIOHOSTDEV PDMAudioHostEnumGetDefault(PCPDMAUDIOHOSTENUM pDevEnm, PDMAUDIODIR enmDir); 224 224 uint32_t PDMAudioHostEnumCountMatching(PCPDMAUDIOHOSTENUM pDevEnm, PDMAUDIODIR enmUsage); 225 225 void PDMAudioHostEnumLog(PCPDMAUDIOHOSTENUM pDevEnm, const char *pszDesc); -
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r88044 r88045 148 148 * @returns Newly allocated audio device, or NULL on failure. 149 149 * @param cb The total device structure size. This must be at least the 150 * size of PDMAUDIO DEVICE. The idea is that the caller extends151 * the PDMAUDIO DEVICEstructure and appends additional data150 * size of PDMAUDIOHOSTDEV. The idea is that the caller extends 151 * the PDMAUDIOHOSTDEV structure and appends additional data 152 152 * after it in its private structure. 153 153 */ 154 PPDMAUDIO DEVICEPDMAudioDeviceAlloc(size_t cb)155 { 156 AssertReturn(cb >= sizeof(PDMAUDIO DEVICE), NULL);154 PPDMAUDIOHOSTDEV PDMAudioDeviceAlloc(size_t cb) 155 { 156 AssertReturn(cb >= sizeof(PDMAUDIOHOSTDEV), NULL); 157 157 AssertReturn(cb < _4M, NULL); 158 158 159 PPDMAUDIO DEVICE pDev = (PPDMAUDIODEVICE)RTMemAllocZ(RT_ALIGN_Z(cb, 64));159 PPDMAUDIOHOSTDEV pDev = (PPDMAUDIOHOSTDEV)RTMemAllocZ(RT_ALIGN_Z(cb, 64)); 160 160 if (pDev) 161 161 { 162 pDev->uMagic = PDMAUDIO DEVICE_MAGIC;162 pDev->uMagic = PDMAUDIOHOSTDEV_MAGIC; 163 163 pDev->cbSelf = (uint32_t)cb; 164 164 RTListInit(&pDev->Node); … … 175 175 * @param pDev The device to free. NULL is ignored. 176 176 */ 177 void PDMAudioDeviceFree(PPDMAUDIO DEVICEpDev)177 void PDMAudioDeviceFree(PPDMAUDIOHOSTDEV pDev) 178 178 { 179 179 if (pDev) 180 180 { 181 Assert(pDev->uMagic == PDMAUDIO DEVICE_MAGIC);181 Assert(pDev->uMagic == PDMAUDIOHOSTDEV_MAGIC); 182 182 Assert(pDev->cRefCount == 0); 183 pDev->uMagic = PDMAUDIO DEVICE_MAGIC_DEAD;183 pDev->uMagic = PDMAUDIOHOSTDEV_MAGIC_DEAD; 184 184 pDev->cbSelf = 0; 185 185 … … 195 195 * @param fOnlyCoreData 196 196 */ 197 PPDMAUDIO DEVICE PDMAudioDeviceDup(PPDMAUDIODEVICEpDev, bool fOnlyCoreData)197 PPDMAUDIOHOSTDEV PDMAudioDeviceDup(PPDMAUDIOHOSTDEV pDev, bool fOnlyCoreData) 198 198 { 199 199 AssertPtrReturn(pDev, NULL); 200 Assert(pDev->uMagic == PDMAUDIO DEVICE_MAGIC);201 Assert(fOnlyCoreData || !(pDev->fFlags & PDMAUDIO DEV_FLAGS_NO_DUP));202 203 uint32_t cbToDup = fOnlyCoreData ? sizeof(PDMAUDIO DEVICE) : pDev->cbSelf;200 Assert(pDev->uMagic == PDMAUDIOHOSTDEV_MAGIC); 201 Assert(fOnlyCoreData || !(pDev->fFlags & PDMAUDIOHOSTDEV_F_NO_DUP)); 202 203 uint32_t cbToDup = fOnlyCoreData ? sizeof(PDMAUDIOHOSTDEV) : pDev->cbSelf; 204 204 AssertReturn(cbToDup >= sizeof(*pDev), NULL); 205 205 206 PPDMAUDIO DEVICEpDevDup = PDMAudioDeviceAlloc(cbToDup);206 PPDMAUDIOHOSTDEV pDevDup = PDMAudioDeviceAlloc(cbToDup); 207 207 if (pDevDup) 208 208 { … … 244 244 AssertReturnVoid(pDevEnm->uMagic == PDMAUDIOHOSTENUM_MAGIC); 245 245 246 PPDMAUDIO DEVICEpDev, pDevNext;247 RTListForEachSafe(&pDevEnm->LstDevices, pDev, pDevNext, PDMAUDIO DEVICE, Node)246 PPDMAUDIOHOSTDEV pDev, pDevNext; 247 RTListForEachSafe(&pDevEnm->LstDevices, pDev, pDevNext, PDMAUDIOHOSTDEV, Node) 248 248 { 249 249 RTListNodeRemove(&pDev->Node); … … 268 268 * @param pDev Device to add. The pointer will be owned by the device enumeration then. 269 269 */ 270 void PDMAudioHostEnumAppend(PPDMAUDIOHOSTENUM pDevEnm, PPDMAUDIO DEVICEpDev)270 void PDMAudioHostEnumAppend(PPDMAUDIOHOSTENUM pDevEnm, PPDMAUDIOHOSTDEV pDev) 271 271 { 272 272 AssertPtr(pDevEnm); … … 286 286 * @param enmUsage The usage to match for copying. 287 287 * Use PDMAUDIODIR_INVALID to match all entries. 288 * @param fOnlyCoreData Set this to only copy the PDMAUDIO DEVICEpart.288 * @param fOnlyCoreData Set this to only copy the PDMAUDIOHOSTDEV part. 289 289 * Careful with passing @c false here as not all 290 290 * backends have data that can be copied. … … 299 299 AssertReturn(pSrcDevEnm->uMagic == PDMAUDIOHOSTENUM_MAGIC, VERR_WRONG_ORDER); 300 300 301 PPDMAUDIO DEVICEpSrcDev;302 RTListForEach(&pSrcDevEnm->LstDevices, pSrcDev, PDMAUDIO DEVICE, Node)301 PPDMAUDIOHOSTDEV pSrcDev; 302 RTListForEach(&pSrcDevEnm->LstDevices, pSrcDev, PDMAUDIOHOSTDEV, Node) 303 303 { 304 304 if ( enmUsage == pSrcDev->enmUsage 305 305 || enmUsage == PDMAUDIODIR_INVALID /*all*/) 306 306 { 307 PPDMAUDIO DEVICEpDstDev = PDMAudioDeviceDup(pSrcDev, fOnlyCoreData);307 PPDMAUDIOHOSTDEV pDstDev = PDMAudioDeviceDup(pSrcDev, fOnlyCoreData); 308 308 AssertReturn(pDstDev, VERR_NO_MEMORY); 309 309 … … 325 325 * @param enmUsage Usage to get default device for. 326 326 * Pass PDMAUDIODIR_INVALID to get the first device with 327 * PDMAUDIO DEV_FLAGS_DEFAULT set.328 */ 329 PPDMAUDIO DEVICEPDMAudioHostEnumGetDefault(PCPDMAUDIOHOSTENUM pDevEnm, PDMAUDIODIR enmUsage)327 * PDMAUDIOHOSTDEV_F_DEFAULT set. 328 */ 329 PPDMAUDIOHOSTDEV PDMAudioHostEnumGetDefault(PCPDMAUDIOHOSTENUM pDevEnm, PDMAUDIODIR enmUsage) 330 330 { 331 331 AssertPtrReturn(pDevEnm, NULL); 332 332 AssertReturn(pDevEnm->uMagic == PDMAUDIOHOSTENUM_MAGIC, NULL); 333 333 334 PPDMAUDIO DEVICEpDev;335 RTListForEach(&pDevEnm->LstDevices, pDev, PDMAUDIO DEVICE, Node)336 { 337 if (pDev->fFlags & PDMAUDIO DEV_FLAGS_DEFAULT)334 PPDMAUDIOHOSTDEV pDev; 335 RTListForEach(&pDevEnm->LstDevices, pDev, PDMAUDIOHOSTDEV, Node) 336 { 337 if (pDev->fFlags & PDMAUDIOHOSTDEV_F_DEFAULT) 338 338 { 339 339 if ( enmUsage == pDev->enmUsage … … 363 363 364 364 uint32_t cDevs = 0; 365 PPDMAUDIO DEVICEpDev;366 RTListForEach(&pDevEnm->LstDevices, pDev, PDMAUDIO DEVICE, Node)365 PPDMAUDIOHOSTDEV pDev; 366 RTListForEach(&pDevEnm->LstDevices, pDev, PDMAUDIOHOSTDEV, Node) 367 367 { 368 368 if (enmUsage == pDev->enmUsage) … … 387 387 LogFunc(("%s: %RU32 devices\n", pszDesc, pDevEnm->cDevices)); 388 388 389 PPDMAUDIO DEVICEpDev;390 RTListForEach(&pDevEnm->LstDevices, pDev, PDMAUDIO DEVICE, Node)389 PPDMAUDIOHOSTDEV pDev; 390 RTListForEach(&pDevEnm->LstDevices, pDev, PDMAUDIOHOSTDEV, Node) 391 391 { 392 392 char *pszFlags = DrvAudioHlpAudDevFlagsToStrA(pDev->fFlags); … … 397 397 LogFunc((" Input channels = %RU8\n", pDev->cMaxInputChannels)); 398 398 LogFunc((" Output channels = %RU8\n", pDev->cMaxOutputChannels)); 399 LogFunc((" cbExtra = %RU32 bytes\n", pDev->cbSelf - sizeof(PDMAUDIO DEVICE)));399 LogFunc((" cbExtra = %RU32 bytes\n", pDev->cbSelf - sizeof(PDMAUDIOHOSTDEV))); 400 400 401 401 if (pszFlags) … … 409 409 * @returns Stringified audio flags. Must be free'd with RTStrFree(). 410 410 * NULL if no flags set. 411 * @param fFlags Audio flags (PDMAUDIO DEV_FLAGS_XXX) to convert.411 * @param fFlags Audio flags (PDMAUDIOHOSTDEV_F_XXX) to convert. 412 412 */ 413 413 char *DrvAudioHlpAudDevFlagsToStrA(uint32_t fFlags) 414 414 { 415 415 #define APPEND_FLAG_TO_STR(_aFlag) \ 416 if (fFlags & PDMAUDIO DEV_FLAGS_##_aFlag) \416 if (fFlags & PDMAUDIOHOSTDEV_F_##_aFlag) \ 417 417 { \ 418 418 if (pszFlags) \ -
trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
r88044 r88045 73 73 { 74 74 /** The core PDM structure. */ 75 PDMAUDIO DEVICECore;75 PDMAUDIOHOSTDEV Core; 76 76 77 77 /** Pointer to driver instance this device is bound to. */ … … 561 561 /* Is the device the default device? */ 562 562 if (curDevID == defaultDeviceID) 563 pDev->Core.fFlags |= PDMAUDIO DEV_FLAGS_DEFAULT;563 pDev->Core.fFlags |= PDMAUDIOHOSTDEV_F_DEFAULT; 564 564 565 565 AudioObjectPropertyAddress propAddrCfg = { kAudioDevicePropertyStreamConfiguration, … … 643 643 && !uAlive) 644 644 { 645 pDev->Core.fFlags |= PDMAUDIO DEV_FLAGS_DEAD;645 pDev->Core.fFlags |= PDMAUDIOHOSTDEV_F_DEAD; 646 646 } 647 647 … … 657 657 && (pid != -1)) 658 658 { 659 pDev->Core.fFlags |= PDMAUDIO DEV_FLAGS_LOCKED;659 pDev->Core.fFlags |= PDMAUDIOHOSTDEV_F_LOCKED; 660 660 } 661 661 … … 757 757 758 758 /* Handle flags. */ 759 if (pDevSrcIn->Core.fFlags & PDMAUDIO DEV_FLAGS_DEFAULT)760 pDevDst->Core.fFlags |= PDMAUDIO DEV_FLAGS_DEFAULT;759 if (pDevSrcIn->Core.fFlags & PDMAUDIOHOSTDEV_F_DEFAULT) 760 pDevDst->Core.fFlags |= PDMAUDIOHOSTDEV_F_DEFAULT; 761 761 /** @todo Handle hot plugging? */ 762 762 … … 775 775 pDevDst->Core.cMaxOutputChannels = pDevSrcOut->Core.cMaxOutputChannels; 776 776 777 if (pDevSrcOut->Core.fFlags & PDMAUDIO DEV_FLAGS_DEFAULT)778 pDevDst->Core.fFlags |= PDMAUDIO DEV_FLAGS_DEFAULT;777 if (pDevSrcOut->Core.fFlags & PDMAUDIOHOSTDEV_F_DEFAULT) 778 pDevDst->Core.fFlags |= PDMAUDIOHOSTDEV_F_DEFAULT; 779 779 break; 780 780 } … … 819 819 820 820 /* Handle flags. */ 821 if (pDevSrcOut->Core.fFlags & PDMAUDIO DEV_FLAGS_DEFAULT)822 pDevDst->Core.fFlags |= PDMAUDIO DEV_FLAGS_DEFAULT;821 if (pDevSrcOut->Core.fFlags & PDMAUDIOHOSTDEV_F_DEFAULT) 822 pDevDst->Core.fFlags |= PDMAUDIOHOSTDEV_F_DEFAULT; 823 823 /** @todo Handle hot plugging? */ 824 824 … … 2180 2180 if (pDeviceEnum) 2181 2181 { 2182 /* Return a copy with only PDMAUDIO DEVICE, none of the extra bits in COREAUDIODEVICEDATA. */2182 /* Return a copy with only PDMAUDIOHOSTDEV, none of the extra bits in COREAUDIODEVICEDATA. */ 2183 2183 PDMAudioHostEnumInit(pDeviceEnum); 2184 2184 rc = PDMAudioHostEnumCopy(pDeviceEnum, &pThis->Devices, PDMAUDIODIR_INVALID /*all*/, true /*fOnlyCoreData*/); -
trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
r88044 r88045 185 185 typedef struct DSOUNDDEV 186 186 { 187 PDMAUDIO DEVICECore;187 PDMAUDIOHOSTDEV Core; 188 188 /** The GUID if handy. */ 189 189 GUID Guid; … … 1592 1592 1593 1593 if (pGUID == NULL) 1594 pDev->Core.fFlags = PDMAUDIO DEV_FLAGS_DEFAULT;1594 pDev->Core.fFlags = PDMAUDIOHOSTDEV_F_DEFAULT; 1595 1595 1596 1596 char *pszName;
Note:
See TracChangeset
for help on using the changeset viewer.