Changeset 89229 in vbox for trunk/include/VBox
- Timestamp:
- May 23, 2021 1:21:16 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144572
- Location:
- trunk/include/VBox/vmm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudiohostenuminline.h
r88355 r89229 91 91 { 92 92 Assert(pDev->uMagic == PDMAUDIOHOSTDEV_MAGIC); 93 Assert(pDev->cRefCount == 0);94 93 pDev->uMagic = ~PDMAUDIOHOSTDEV_MAGIC; 95 94 pDev->cbSelf = 0; … … 192 191 * Appends copies of matching host device entries from one to another enumeration. 193 192 * 194 * @returns IPRTstatus code.193 * @returns VBox status code. 195 194 * @param pDstDevEnm The target to append copies of matching device to. 196 195 * @param pSrcDevEnm The source to copy matching devices from. … … 227 226 228 227 /** 228 * Moves all the device entries from one enumeration to another, destroying the 229 * former. 230 * 231 * @returns VBox status code. 232 * @param pDstDevEnm The target to put move @a pSrcDevEnm to. This 233 * does not need to be initialized, but if it is it 234 * must not have any device entries. 235 * @param pSrcDevEnm The source to move from. This will be empty 236 * upon successful return. 237 */ 238 DECLINLINE(int) PDMAudioHostEnumMove(PPDMAUDIOHOSTENUM pDstDevEnm, PPDMAUDIOHOSTENUM pSrcDevEnm) 239 { 240 AssertPtrReturn(pDstDevEnm, VERR_INVALID_POINTER); 241 AssertReturn(pDstDevEnm->uMagic != PDMAUDIOHOSTENUM_MAGIC || pDstDevEnm->cDevices == 0, VERR_WRONG_ORDER); 242 243 AssertPtrReturn(pSrcDevEnm, VERR_INVALID_POINTER); 244 AssertReturn(pSrcDevEnm->uMagic == PDMAUDIOHOSTENUM_MAGIC, VERR_WRONG_ORDER); 245 246 pDstDevEnm->uMagic = PDMAUDIOHOSTENUM_MAGIC; 247 RTListInit(&pDstDevEnm->LstDevices); 248 pDstDevEnm->cDevices = pSrcDevEnm->cDevices; 249 if (pSrcDevEnm->cDevices) 250 { 251 PPDMAUDIOHOSTDEV pCur; 252 while ((pCur = RTListRemoveFirst(&pSrcDevEnm->LstDevices, PDMAUDIOHOSTDEV, ListEntry)) != NULL) 253 RTListAppend(&pDstDevEnm->LstDevices, &pCur->ListEntry); 254 } 255 return VINF_SUCCESS; 256 } 257 258 /** 229 259 * Get the default device with the given usage. 230 260 * … … 236 266 * @param enmUsage Usage to get default device for. 237 267 * Pass PDMAUDIODIR_INVALID to get the first device with 238 * PDMAUDIOHOSTDEV_F_DEFAULT set. 268 * either PDMAUDIOHOSTDEV_F_DEFAULT_OUT or 269 * PDMAUDIOHOSTDEV_F_DEFAULT_IN set. 239 270 */ 240 271 DECLINLINE(PPDMAUDIOHOSTDEV) PDMAudioHostEnumGetDefault(PCPDMAUDIOHOSTENUM pDevEnm, PDMAUDIODIR enmUsage) … … 243 274 AssertReturn(pDevEnm->uMagic == PDMAUDIOHOSTENUM_MAGIC, NULL); 244 275 276 Assert(enmUsage == PDMAUDIODIR_IN || enmUsage == PDMAUDIODIR_OUT || enmUsage == PDMAUDIODIR_INVALID); 277 uint32_t const fFlags = enmUsage == PDMAUDIODIR_IN ? PDMAUDIOHOSTDEV_F_DEFAULT_IN 278 : enmUsage == PDMAUDIODIR_OUT ? PDMAUDIOHOSTDEV_F_DEFAULT_OUT 279 : enmUsage == PDMAUDIODIR_INVALID ? PDMAUDIOHOSTDEV_F_DEFAULT_IN | PDMAUDIOHOSTDEV_F_DEFAULT_OUT 280 : 0; 281 245 282 PPDMAUDIOHOSTDEV pDev; 246 283 RTListForEach(&pDevEnm->LstDevices, pDev, PDMAUDIOHOSTDEV, ListEntry) 247 284 { 248 if (pDev->fFlags & PDMAUDIOHOSTDEV_F_DEFAULT)285 if (pDev->fFlags & fFlags) 249 286 { 250 if ( enmUsage == pDev->enmUsage 251 || enmUsage == PDMAUDIODIR_INVALID) 252 return pDev; 287 Assert(pDev->enmUsage == enmUsage || pDev->enmUsage == PDMAUDIODIR_DUPLEX || enmUsage == PDMAUDIODIR_INVALID); 288 return pDev; 253 289 } 254 290 } … … 286 322 /** The max string length for all PDMAUDIOHOSTDEV_F_XXX. 287 323 * @sa PDMAudioHostDevFlagsToString */ 288 #define PDMAUDIOHOSTDEV_MAX_FLAGS_STRING_LEN (7 * 8)324 #define PDMAUDIOHOSTDEV_MAX_FLAGS_STRING_LEN sizeof("DEFAULT_OUT DEFAULT_IN HOTPLUG BUGGY IGNORE LOCKED DEAD NO_DUP ") 289 325 290 326 /** … … 301 337 static const struct { const char *pszMnemonic; uint32_t cchMnemonic; uint32_t fFlag; } s_aFlags[] = 302 338 { 303 { RT_STR_TUPLE("DEFAULT "), PDMAUDIOHOSTDEV_F_DEFAULT }, 339 { RT_STR_TUPLE("DEFAULT_OUT "), PDMAUDIOHOSTDEV_F_DEFAULT_OUT }, 340 { RT_STR_TUPLE("DEFAULT_IN "), PDMAUDIOHOSTDEV_F_DEFAULT_IN }, 304 341 { RT_STR_TUPLE("HOTPLUG "), PDMAUDIOHOSTDEV_F_HOTPLUG }, 305 342 { RT_STR_TUPLE("BUGGY "), PDMAUDIOHOSTDEV_F_BUGGY }, -
trunk/include/VBox/vmm/pdmaudioifs.h
r89218 r89229 313 313 /** No flags set. */ 314 314 #define PDMAUDIOHOSTDEV_F_NONE UINT32_C(0) 315 /** The device marks the default device within the host OS. */ 316 #define PDMAUDIOHOSTDEV_F_DEFAULT RT_BIT_32(0) 315 /** The default input (capture/recording) device (for the user). */ 316 #define PDMAUDIOHOSTDEV_F_DEFAULT_IN RT_BIT_32(0) 317 /** The default output (playback) device (for the user). */ 318 #define PDMAUDIOHOSTDEV_F_DEFAULT_OUT RT_BIT_32(1) 317 319 /** The device can be removed at any time and we have to deal with it. */ 318 #define PDMAUDIOHOSTDEV_F_HOTPLUG RT_BIT_32( 1)320 #define PDMAUDIOHOSTDEV_F_HOTPLUG RT_BIT_32(2) 319 321 /** The device is known to be buggy and needs special treatment. */ 320 #define PDMAUDIOHOSTDEV_F_BUGGY RT_BIT_32( 2)322 #define PDMAUDIOHOSTDEV_F_BUGGY RT_BIT_32(3) 321 323 /** Ignore the device, no matter what. */ 322 #define PDMAUDIOHOSTDEV_F_IGNORE RT_BIT_32( 3)324 #define PDMAUDIOHOSTDEV_F_IGNORE RT_BIT_32(4) 323 325 /** The device is present but marked as locked by some other application. */ 324 #define PDMAUDIOHOSTDEV_F_LOCKED RT_BIT_32( 4)326 #define PDMAUDIOHOSTDEV_F_LOCKED RT_BIT_32(5) 325 327 /** The device is present but not in an alive state (dead). */ 326 #define PDMAUDIOHOSTDEV_F_DEAD RT_BIT_32( 5)328 #define PDMAUDIOHOSTDEV_F_DEAD RT_BIT_32(6) 327 329 /** Set if the extra backend specific data cannot be duplicated. */ 328 330 #define PDMAUDIOHOSTDEV_F_NO_DUP RT_BIT_32(31) … … 370 372 /** Device flags, PDMAUDIOHOSTDEV_F_XXX. */ 371 373 uint32_t fFlags; 372 /** Reference count indicating how many audio streams currently are relying on this device. */373 uint8_t cRefCount;374 374 /** Maximum number of input audio channels the device supports. */ 375 375 uint8_t cMaxInputChannels; 376 376 /** Maximum number of output audio channels the device supports. */ 377 377 uint8_t cMaxOutputChannels; 378 uint8_t bAlignment; 379 /** Device type union, based on enmType. */ 380 union 381 { 382 /** USB type specifics. */ 383 struct 384 { 385 /** Vendor ID. */ 386 uint16_t idVendor; 387 /** Product ID. */ 388 uint16_t idProduct; 389 } USB; 390 uint64_t uPadding[ARCH_BITS >= 64 ? 3 : 4]; 391 } Type; 378 uint8_t abAlignment[ARCH_BITS == 32 ? 2 + 12 : 2]; 379 /** Device identifier, OS specific, can be NULL. It it isn't, it'll point to 380 * the non-public part (or into szName if creative). */ 381 const char *pszId; 392 382 /** Friendly name of the device, if any. Could be truncated. */ 393 383 char szName[64]; … … 400 390 401 391 /** Magic value for PDMAUDIOHOSTDEV. */ 402 #define PDMAUDIOHOSTDEV_MAGIC PDM_VERSION_MAKE(0xa0d0, 1, 0)392 #define PDMAUDIOHOSTDEV_MAGIC PDM_VERSION_MAKE(0xa0d0, 2, 0) 403 393 404 394 … … 1525 1515 1526 1516 /** PDMIHOSTAUDIO interface ID. */ 1527 #define PDMIHOSTAUDIO_IID "a d56b303-0c1f-4b79-9bd1-4ec04ae08c4f"1517 #define PDMIHOSTAUDIO_IID "a6b33abc-1393-4548-92ab-a308d54de1e8" 1528 1518 1529 1519
Note:
See TracChangeset
for help on using the changeset viewer.