1 | /* $Id: HDAStreamMap.h 88112 2021-03-12 20:41:05Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * HDAStreamMap.h - Stream map functions for HD Audio.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2017-2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef VBOX_INCLUDED_SRC_Audio_HDAStreamMap_h
|
---|
19 | #define VBOX_INCLUDED_SRC_Audio_HDAStreamMap_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Audio stream data mapping.
|
---|
26 | */
|
---|
27 | typedef struct HDASTREAMMAP
|
---|
28 | {
|
---|
29 | /** The guest stream properties that is being mapped from/to.
|
---|
30 | * The host properties are found in HDASTREAMSTATE::Cfg::Props. */
|
---|
31 | PDMAUDIOPCMPROPS GuestProps;
|
---|
32 | /** The stream's layout. */
|
---|
33 | PDMAUDIOSTREAMLAYOUT enmLayout;
|
---|
34 | /** The guest side frame size in bytes. */
|
---|
35 | uint8_t cbGuestFrame;
|
---|
36 | /** Set if mapping is needed. */
|
---|
37 | bool fMappingNeeded;
|
---|
38 | /** Number of mappings in paMappings. */
|
---|
39 | uint8_t cMappings;
|
---|
40 | uint8_t aPadding[1];
|
---|
41 | /** Array of stream mappings.
|
---|
42 | * Note: The mappings *must* be layed out in an increasing order, e.g.
|
---|
43 | * how the data appears in the given data block. */
|
---|
44 | R3PTRTYPE(PPDMAUDIOSTREAMMAP) paMappings;
|
---|
45 | #if HC_ARCH_BITS == 32
|
---|
46 | RTR3PTR Padding1;
|
---|
47 | #endif
|
---|
48 | #ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
|
---|
49 | /** Circular buffer holding for holding audio data for this mapping. */
|
---|
50 | R3PTRTYPE(PRTCIRCBUF) pCircBuf;
|
---|
51 | #endif
|
---|
52 | /**
|
---|
53 | * Converts guest data to host data.
|
---|
54 | *
|
---|
55 | * @param pvDst The destination (host) buffer.
|
---|
56 | * @param pvSrc The source (guest) data. Does not overlap @a pvDst.
|
---|
57 | * @param cFrames Number of frames to convert.
|
---|
58 | * @param pMapping Pointer to this structure.
|
---|
59 | */
|
---|
60 | DECLCALLBACKMEMBER(void, pfnGuestToHost,(void *pvDst, void const *pvSrc, uint32_t cFrames,
|
---|
61 | struct HDASTREAMMAP const *pMapping));
|
---|
62 | /**
|
---|
63 | * Converts host data to guest data.
|
---|
64 | *
|
---|
65 | * @param pvDst The destination (guest) buffer.
|
---|
66 | * @param pvSrc The source (host) data. Does not overlap @a pvDst.
|
---|
67 | * @param cFrames Number of frames to convert.
|
---|
68 | * @param pMapping Pointer to this structure.
|
---|
69 | */
|
---|
70 | DECLCALLBACKMEMBER(void, pfnHostToGuest,(void *pvDst, void const *pvSrc, uint32_t cFrames,
|
---|
71 | struct HDASTREAMMAP const *pMapping));
|
---|
72 | } HDASTREAMMAP;
|
---|
73 | AssertCompileSizeAlignment(HDASTREAMMAP, 8);
|
---|
74 | /** Pointer to an audio stream data mapping. */
|
---|
75 | typedef HDASTREAMMAP *PHDASTREAMMAP;
|
---|
76 |
|
---|
77 | /** @name Stream mapping functions.
|
---|
78 | * @{
|
---|
79 | */
|
---|
80 | #ifdef IN_RING3
|
---|
81 | int hdaR3StreamMapInit(PHDASTREAMMAP pMapping, uint8_t cHostChannels, PPDMAUDIOPCMPROPS pProps);
|
---|
82 | void hdaR3StreamMapDestroy(PHDASTREAMMAP pMapping);
|
---|
83 | void hdaR3StreamMapReset(PHDASTREAMMAP pMapping);
|
---|
84 | #endif
|
---|
85 | /** @} */
|
---|
86 |
|
---|
87 | #endif /* !VBOX_INCLUDED_SRC_Audio_HDAStreamMap_h */
|
---|
88 |
|
---|