2012-05-24 10:03:21 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2012-05-24 10:03:21 +04:00
|
|
|
* Server Audio Virtual Channel
|
|
|
|
*
|
|
|
|
* Copyright 2012 Vic Lee
|
2015-07-15 10:50:35 +03:00
|
|
|
* Copyright 2015 Thincast Technologies GmbH
|
|
|
|
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
|
2012-05-24 10:03:21 +04:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-12-14 09:25:48 +04:00
|
|
|
#ifndef FREERDP_CHANNEL_RDPSND_SERVER_H
|
|
|
|
#define FREERDP_CHANNEL_RDPSND_SERVER_H
|
2012-05-24 10:03:21 +04:00
|
|
|
|
|
|
|
#include <freerdp/channels/wtsvc.h>
|
|
|
|
#include <freerdp/channels/rdpsnd.h>
|
|
|
|
|
2013-08-19 05:52:55 +04:00
|
|
|
typedef struct _rdpsnd_server_context RdpsndServerContext;
|
2012-05-24 10:03:21 +04:00
|
|
|
typedef struct _rdpsnd_server_context rdpsnd_server_context;
|
2013-08-19 05:52:55 +04:00
|
|
|
typedef struct _rdpsnd_server_private RdpsndServerPrivate;
|
2012-05-24 10:03:21 +04:00
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
typedef UINT (*psRdpsndStart)(RdpsndServerContext* context);
|
|
|
|
typedef UINT (*psRdpsndStop)(RdpsndServerContext* context);
|
2012-05-24 10:03:21 +04:00
|
|
|
|
2015-08-27 15:25:09 +03:00
|
|
|
typedef UINT (*psRdpsndServerInitialize)(RdpsndServerContext* context, BOOL ownThread);
|
|
|
|
typedef UINT (*psRdpsndServerSelectFormat)(RdpsndServerContext* context, int client_format_index);
|
|
|
|
typedef UINT (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const void* buf, int nframes, UINT16 wTimestamp);
|
|
|
|
typedef UINT (*psRdpsndServerConfirmBlock)(RdpsndServerContext* context, BYTE confirmBlockNum, UINT16 wtimestamp);
|
|
|
|
typedef UINT (*psRdpsndServerSetVolume)(RdpsndServerContext* context, int left, int right);
|
|
|
|
typedef UINT (*psRdpsndServerClose)(RdpsndServerContext* context);
|
2013-08-19 05:52:55 +04:00
|
|
|
|
2014-07-02 12:31:45 +04:00
|
|
|
|
2013-08-19 05:52:55 +04:00
|
|
|
typedef void (*psRdpsndServerActivated)(RdpsndServerContext* context);
|
2012-05-24 10:03:21 +04:00
|
|
|
|
|
|
|
struct _rdpsnd_server_context
|
|
|
|
{
|
2014-02-27 22:30:04 +04:00
|
|
|
HANDLE vcm;
|
2012-05-24 10:03:21 +04:00
|
|
|
|
2013-08-19 05:52:55 +04:00
|
|
|
psRdpsndStart Start;
|
|
|
|
psRdpsndStop Stop;
|
|
|
|
|
|
|
|
RdpsndServerPrivate* priv;
|
|
|
|
|
2012-05-24 10:03:21 +04:00
|
|
|
/* Server self-defined pointer. */
|
|
|
|
void* data;
|
|
|
|
|
|
|
|
/* Server supported formats. Set by server. */
|
2013-02-26 06:46:48 +04:00
|
|
|
const AUDIO_FORMAT* server_formats;
|
2012-05-24 10:03:21 +04:00
|
|
|
int num_server_formats;
|
|
|
|
|
|
|
|
/* Server source PCM audio format. Set by server. */
|
2013-02-26 06:46:48 +04:00
|
|
|
AUDIO_FORMAT src_format;
|
2012-05-24 10:03:21 +04:00
|
|
|
|
|
|
|
/* Client supported formats. */
|
2013-02-26 06:46:48 +04:00
|
|
|
AUDIO_FORMAT* client_formats;
|
2012-05-24 10:03:21 +04:00
|
|
|
int num_client_formats;
|
|
|
|
int selected_client_format;
|
|
|
|
|
|
|
|
/* Last sent audio block number. */
|
|
|
|
int block_no;
|
|
|
|
|
|
|
|
/*** APIs called by the server. ***/
|
|
|
|
/**
|
|
|
|
* Initialize the channel. The caller should check the return value to see
|
|
|
|
* whether the initialization succeed. If not, the "Activated" callback
|
|
|
|
* will not be called and the server must not call any API on this context.
|
|
|
|
*/
|
|
|
|
psRdpsndServerInitialize Initialize;
|
|
|
|
/**
|
|
|
|
* Choose the audio format to be sent. The index argument is an index into
|
|
|
|
* the client_formats array and must be smaller than num_client_formats.
|
|
|
|
*/
|
|
|
|
psRdpsndServerSelectFormat SelectFormat;
|
|
|
|
/**
|
|
|
|
* Send audio samples. Actually bytes in the buffer must be:
|
|
|
|
* nframes * src_format.nBitsPerSample * src_format.nChannels / 8
|
|
|
|
*/
|
|
|
|
psRdpsndServerSendSamples SendSamples;
|
2014-06-05 01:59:34 +04:00
|
|
|
/**
|
|
|
|
* Called when block confirm is received from the client
|
|
|
|
*/
|
|
|
|
psRdpsndServerConfirmBlock ConfirmBlock;
|
2012-05-29 18:22:38 +04:00
|
|
|
/**
|
|
|
|
* Set the volume level of the client. Valid range is between 0 and 0xFFFF.
|
|
|
|
*/
|
|
|
|
psRdpsndServerSetVolume SetVolume;
|
2012-05-24 10:03:21 +04:00
|
|
|
/**
|
|
|
|
* Close the audio stream.
|
|
|
|
*/
|
|
|
|
psRdpsndServerClose Close;
|
|
|
|
|
|
|
|
/*** Callbacks registered by the server. ***/
|
|
|
|
/**
|
|
|
|
* The channel has been activated. The server maybe choose audio format and
|
|
|
|
* start audio stream from this point. Note that this callback is called
|
|
|
|
* from a different thread context so the server must be careful of thread
|
|
|
|
* synchronization.
|
|
|
|
*/
|
|
|
|
psRdpsndServerActivated Activated;
|
2014-09-11 13:33:10 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MS-RDPEA channel version the client announces
|
|
|
|
*/
|
|
|
|
UINT16 clientVersion;
|
2015-07-15 10:50:35 +03:00
|
|
|
|
|
|
|
rdpContext* rdpcontext;
|
2012-05-24 10:03:21 +04:00
|
|
|
};
|
|
|
|
|
2013-05-20 08:57:08 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-02-27 22:30:04 +04:00
|
|
|
FREERDP_API RdpsndServerContext* rdpsnd_server_context_new(HANDLE vcm);
|
2014-07-02 12:31:45 +04:00
|
|
|
FREERDP_API void rdpsnd_server_context_reset(RdpsndServerContext *);
|
2013-08-19 05:52:55 +04:00
|
|
|
FREERDP_API void rdpsnd_server_context_free(RdpsndServerContext* context);
|
2014-07-02 12:31:45 +04:00
|
|
|
FREERDP_API HANDLE rdpsnd_server_get_event_handle(RdpsndServerContext *context);
|
2015-08-27 15:25:09 +03:00
|
|
|
FREERDP_API UINT rdpsnd_server_handle_messages(RdpsndServerContext *context);
|
|
|
|
FREERDP_API UINT rdpsnd_server_send_formats(RdpsndServerContext* context, wStream* s);
|
2014-07-02 12:31:45 +04:00
|
|
|
|
2012-05-24 10:03:21 +04:00
|
|
|
|
2013-05-20 08:57:08 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-12-14 09:25:48 +04:00
|
|
|
#endif /* FREERDP_CHANNEL_RDPSND_SERVER_H */
|