FreeRDP
server/rdpsnd.h
1 
22 #ifndef FREERDP_CHANNEL_RDPSND_SERVER_H
23 #define FREERDP_CHANNEL_RDPSND_SERVER_H
24 
25 #include <freerdp/channels/wtsvc.h>
26 #include <freerdp/channels/rdpsnd.h>
27 
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32 
33  typedef struct s_rdpsnd_server_context RdpsndServerContext;
34  typedef struct s_rdpsnd_server_context rdpsnd_server_context;
35  typedef struct s_rdpsnd_server_private RdpsndServerPrivate;
36 
37  typedef UINT (*psRdpsndStart)(RdpsndServerContext* context);
38  typedef UINT (*psRdpsndStop)(RdpsndServerContext* context);
39 
40  typedef BOOL (*psRdpsndChannelIdAssigned)(RdpsndServerContext* context, UINT32 channelId);
41 
42  typedef UINT (*psRdpsndServerInitialize)(RdpsndServerContext* context, BOOL ownThread);
43  typedef UINT (*psRdpsndServerSendFormats)(RdpsndServerContext* context);
44  typedef UINT (*psRdpsndServerSelectFormat)(RdpsndServerContext* context,
45  UINT16 client_format_index);
46  typedef UINT (*psRdpsndServerTraining)(RdpsndServerContext* context, UINT16 timestamp,
47  UINT16 packsize, BYTE* data);
48  typedef UINT (*psRdpsndServerTrainingConfirm)(RdpsndServerContext* context, UINT16 timestamp,
49  UINT16 packsize);
50  typedef UINT (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const void* buf,
51  size_t nframes, UINT16 wTimestamp);
52  typedef UINT (*psRdpsndServerSendSamples2)(RdpsndServerContext* context, UINT16 formatNo,
53  const void* buf, size_t size, UINT16 timestamp,
54  UINT32 audioTimeStamp);
55  typedef UINT (*psRdpsndServerConfirmBlock)(RdpsndServerContext* context, BYTE confirmBlockNum,
56  UINT16 wtimestamp);
57  typedef UINT (*psRdpsndServerSetVolume)(RdpsndServerContext* context, UINT16 left,
58  UINT16 right);
59  typedef UINT (*psRdpsndServerClose)(RdpsndServerContext* context);
60 
61  typedef void (*psRdpsndServerActivated)(RdpsndServerContext* context);
62 
64  {
65  HANDLE vcm;
66 
67  psRdpsndStart Start;
68  psRdpsndStop Stop;
69 
70  RdpsndServerPrivate* priv;
71 
72  /* Server self-defined pointer. */
73  void* data;
74 
75  /* Server to request to use dynamic virtual channel. */
76  BOOL use_dynamic_virtual_channel;
77 
78  /* Server supported formats. Set by server. */
79  AUDIO_FORMAT* server_formats;
80  size_t num_server_formats;
81 
82  /* Server source PCM audio format. Set by server. */
83  AUDIO_FORMAT* src_format;
84 
85  /* Server audio latency, or buffer size, in milli-seconds. Set by server. */
86  UINT32 latency;
87 
88  /* Client supported formats. */
89  AUDIO_FORMAT* client_formats;
90  UINT16 num_client_formats;
91  UINT16 selected_client_format;
92 
93  /* Last sent audio block number. */
94  UINT8 block_no;
95 
96  /*** APIs called by the server. ***/
102  psRdpsndServerInitialize Initialize;
103 
108  psRdpsndServerSelectFormat SelectFormat;
113  psRdpsndServerSendSamples SendSamples;
114 
118  psRdpsndServerConfirmBlock ConfirmBlock;
122  psRdpsndServerSetVolume SetVolume;
126  psRdpsndServerClose Close;
127 
128  /*** Callbacks registered by the server. ***/
135  psRdpsndServerActivated Activated;
136 
141 
142  rdpContext* rdpcontext;
143 
144  /* dwFlags in CLIENT_AUDIO_VERSION_AND_FORMATS */
145  UINT32 capsFlags;
146  /* dwVolume in CLIENT_AUDIO_VERSION_AND_FORMATS */
147  UINT32 initialVolume;
148  /* dwPitch in CLIENT_AUDIO_VERSION_AND_FORMATS */
149  UINT32 initialPitch;
150 
151  UINT16 qualityMode;
152 
158  psRdpsndServerSendFormats SendFormats;
162  psRdpsndServerTraining Training;
163 
168  psRdpsndServerSendSamples2 SendSamples2;
169 
173  psRdpsndServerTrainingConfirm TrainingConfirm;
174 
179  psRdpsndChannelIdAssigned ChannelIdAssigned;
180  };
181 
182  FREERDP_API void rdpsnd_server_context_free(RdpsndServerContext* context);
183 
184  WINPR_ATTR_MALLOC(rdpsnd_server_context_free, 1)
185  FREERDP_API RdpsndServerContext* rdpsnd_server_context_new(HANDLE vcm);
186 
187  FREERDP_API void rdpsnd_server_context_reset(RdpsndServerContext*);
188 
189  FREERDP_API HANDLE rdpsnd_server_get_event_handle(RdpsndServerContext* context);
190  FREERDP_API UINT rdpsnd_server_handle_messages(RdpsndServerContext* context);
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 #endif /* FREERDP_CHANNEL_RDPSND_SERVER_H */
psRdpsndServerSendSamples2 SendSamples2
psRdpsndServerSendSamples SendSamples
psRdpsndServerSelectFormat SelectFormat
psRdpsndServerSendFormats SendFormats
psRdpsndServerTrainingConfirm TrainingConfirm
psRdpsndServerInitialize Initialize
psRdpsndServerClose Close
psRdpsndServerTraining Training
psRdpsndServerSetVolume SetVolume
psRdpsndServerActivated Activated
psRdpsndServerConfirmBlock ConfirmBlock
psRdpsndChannelIdAssigned ChannelIdAssigned