Blame include/freerdp/server/rdpsnd.h

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