1 | /* $Id: AudioTestService.h 89273 2021-05-25 14:12:33Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * AudioTestService - Audio test execution server, Public Header.
|
---|
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 |
|
---|
18 | #ifndef VBOX_INCLUDED_SRC_Audio_AudioTestService_h
|
---|
19 | #define VBOX_INCLUDED_SRC_Audio_AudioTestService_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "AudioTestServiceInternal.h"
|
---|
25 |
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Structure for keeping an Audio Test Service (ATS) callback table.
|
---|
29 | */
|
---|
30 | typedef struct ATSCALLBACKS
|
---|
31 | {
|
---|
32 | /**
|
---|
33 | * Plays a test tone.
|
---|
34 | *
|
---|
35 | * @returns VBox status code.
|
---|
36 | * @param pvUser User-supplied pointer to context data. Optional.
|
---|
37 | * @param pStreamCfg Audio stream configuration to use for stream to play tone on.
|
---|
38 | * @param pToneParms Tone parameters to use for playback.
|
---|
39 | */
|
---|
40 | DECLR3CALLBACKMEMBER(int, pfnTonePlay, (void const *pvUser, PPDMAUDIOSTREAMCFG pStreamCfg, PAUDIOTESTTONEPARMS pToneParms));
|
---|
41 | /** Pointer to opaque user-provided context data. */
|
---|
42 | void const *pvUser;
|
---|
43 | } ATSCALLBACKS;
|
---|
44 | /** Pointer to a const ATS callbacks table. */
|
---|
45 | typedef const struct ATSCALLBACKS *PCATSCALLBACKS;
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Structure for keeping an Audio Test Service (ATS) instance.
|
---|
49 | */
|
---|
50 | typedef struct ATSSERVER
|
---|
51 | {
|
---|
52 | /** The selected transport layer. */
|
---|
53 | PCATSTRANSPORT pTransport;
|
---|
54 | /** The callbacks table. */
|
---|
55 | ATSCALLBACKS Callbacks;
|
---|
56 | /** Whether server is in started state or not. */
|
---|
57 | bool volatile fStarted;
|
---|
58 | /** Whether to terminate or not. */
|
---|
59 | bool volatile fTerminate;
|
---|
60 | /** The main thread's poll set to handle new clients. */
|
---|
61 | RTPOLLSET hPollSet;
|
---|
62 | /** Pipe for communicating with the serving thread about new clients. - read end */
|
---|
63 | RTPIPE hPipeR;
|
---|
64 | /** Pipe for communicating with the serving thread about new clients. - write end */
|
---|
65 | RTPIPE hPipeW;
|
---|
66 | /** Main thread waiting for connections. */
|
---|
67 | RTTHREAD hThreadMain;
|
---|
68 | /** Thread serving connected clients. */
|
---|
69 | RTTHREAD hThreadServing;
|
---|
70 | /** Critical section protecting the list of new clients. */
|
---|
71 | RTCRITSECT CritSectClients;
|
---|
72 | /** List of new clients waiting to be picked up by the client worker thread. */
|
---|
73 | RTLISTANCHOR LstClientsNew;
|
---|
74 | } ATSSERVER;
|
---|
75 | /** Pointer to an Audio Test Service (ATS) instance. */
|
---|
76 | typedef ATSSERVER *PATSSERVER;
|
---|
77 |
|
---|
78 |
|
---|
79 | int AudioTestSvcInit(PATSSERVER pThis, PCATSCALLBACKS pCallbacks);
|
---|
80 | int AudioTestSvcDestroy(PATSSERVER pThis);
|
---|
81 | int AudioTestSvcStart(PATSSERVER pThis);
|
---|
82 | int AudioTestSvcShutdown(PATSSERVER pThis);
|
---|
83 |
|
---|
84 | #endif /* !VBOX_INCLUDED_SRC_Audio_AudioTestService_h */
|
---|
85 |
|
---|