1 | /* $Id: vkatInternal.h 89401 2021-05-31 13:17:26Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VKAT - Internal header file for common definitions + structs.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2021 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 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef VBOX_INCLUDED_SRC_audio_vkatInternal_h
|
---|
28 | #define VBOX_INCLUDED_SRC_audio_vkatInternal_h
|
---|
29 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
30 | # pragma once
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include "VBoxDD.h"
|
---|
34 |
|
---|
35 | #include <VBox/vmm/pdmaudioinline.h>
|
---|
36 | #include <VBox/vmm/pdmaudiohostenuminline.h>
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Audio driver stack.
|
---|
40 | *
|
---|
41 | * This can be just be backend driver alone or DrvAudio with a backend.
|
---|
42 | * @todo add automatic resampling via mixer so we can test more of the audio
|
---|
43 | * stack used by the device emulations.
|
---|
44 | */
|
---|
45 | typedef struct AUDIOTESTDRVSTACK
|
---|
46 | {
|
---|
47 | /** The device registration record for the backend. */
|
---|
48 | PCPDMDRVREG pDrvReg;
|
---|
49 | /** The backend driver instance. */
|
---|
50 | PPDMDRVINS pDrvBackendIns;
|
---|
51 | /** The backend's audio interface. */
|
---|
52 | PPDMIHOSTAUDIO pIHostAudio;
|
---|
53 |
|
---|
54 | /** The DrvAudio instance. */
|
---|
55 | PPDMDRVINS pDrvAudioIns;
|
---|
56 | /** This is NULL if we don't use DrvAudio. */
|
---|
57 | PPDMIAUDIOCONNECTOR pIAudioConnector;
|
---|
58 | } AUDIOTESTDRVSTACK;
|
---|
59 | /** Pointer to an audio driver stack. */
|
---|
60 | typedef AUDIOTESTDRVSTACK *PAUDIOTESTDRVSTACK;
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Backend-only stream structure.
|
---|
64 | */
|
---|
65 | typedef struct AUDIOTESTDRVSTACKSTREAM
|
---|
66 | {
|
---|
67 | /** The public stream data. */
|
---|
68 | PDMAUDIOSTREAM Core;
|
---|
69 | /** The acquired config. */
|
---|
70 | PDMAUDIOSTREAMCFG Cfg;
|
---|
71 | /** The backend data (variable size). */
|
---|
72 | PDMAUDIOBACKENDSTREAM Backend;
|
---|
73 | } AUDIOTESTDRVSTACKSTREAM;
|
---|
74 | /** Pointer to a backend-only stream structure. */
|
---|
75 | typedef AUDIOTESTDRVSTACKSTREAM *PAUDIOTESTDRVSTACKSTREAM;
|
---|
76 |
|
---|
77 | /** Maximum audio streams a test environment can handle. */
|
---|
78 | #define AUDIOTESTENV_MAX_STREAMS 8
|
---|
79 |
|
---|
80 | /** The test handle. */
|
---|
81 | extern RTTEST g_hTest;
|
---|
82 | extern unsigned g_uVerbosity;
|
---|
83 | extern bool g_fDrvAudioDebug;
|
---|
84 | extern const char *g_pszDrvAudioDebug;
|
---|
85 |
|
---|
86 | /** @name Driver stack
|
---|
87 | * @{ */
|
---|
88 | void audioTestDriverStackDelete(PAUDIOTESTDRVSTACK pDrvStack);
|
---|
89 | int audioTestDriverStackInit(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, bool fWithDrvAudio);
|
---|
90 | int audioTestDriverStackSetDevice(PAUDIOTESTDRVSTACK pDrvStack, PDMAUDIODIR enmDir, const char *pszDevId);
|
---|
91 | /** @} */
|
---|
92 |
|
---|
93 | /** @name Driver
|
---|
94 | * @{ */
|
---|
95 | int audioTestDrvConstruct(PAUDIOTESTDRVSTACK pDrvStack, PCPDMDRVREG pDrvReg, PPDMDRVINS pParentDrvIns, PPPDMDRVINS ppDrvIns);
|
---|
96 | /** @} */
|
---|
97 |
|
---|
98 | /** @name Driver stack stream
|
---|
99 | * @{ */
|
---|
100 | int audioTestDriverStackStreamCapture(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream,
|
---|
101 | void *pvBuf, uint32_t cbBuf, uint32_t *pcbCaptured);
|
---|
102 | int audioTestDriverStackStreamCreateInput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
|
---|
103 | uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
|
---|
104 | PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
|
---|
105 | int audioTestDriverStackStreamCreateOutput(PAUDIOTESTDRVSTACK pDrvStack, PCPDMAUDIOPCMPROPS pProps,
|
---|
106 | uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint,
|
---|
107 | PPDMAUDIOSTREAM *ppStream, PPDMAUDIOSTREAMCFG pCfgAcq);
|
---|
108 | void audioTestDriverStackStreamDestroy(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
109 | int audioTestDriverStackStreamDrain(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, bool fSync);
|
---|
110 | int audioTestDriverStackStreamEnable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
111 | uint32_t audioTestDriverStackStreamGetWritable(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
112 | bool audioTestDriverStackStreamIsOkay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream);
|
---|
113 | int audioTestDriverStackStreamPlay(PAUDIOTESTDRVSTACK pDrvStack, PPDMAUDIOSTREAM pStream, void const *pvBuf, uint32_t cbBuf, uint32_t *pcbPlayed);
|
---|
114 | /** @} */
|
---|
115 |
|
---|
116 | #endif /* !VBOX_INCLUDED_SRC_audio_vkatInternal_h */
|
---|
117 |
|
---|