|
Packit Service |
fa4841 |
/**
|
|
Packit Service |
fa4841 |
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
Packit Service |
fa4841 |
* Server Audio Input 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_AUDIN_SERVER_H
|
|
Packit Service |
fa4841 |
#define FREERDP_CHANNEL_AUDIN_SERVER_H
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
#include <freerdp/codec/audio.h>
|
|
Packit Service |
fa4841 |
#include <freerdp/channels/wtsvc.h>
|
|
Packit Service |
fa4841 |
#include <freerdp/channels/rdpsnd.h>
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
typedef struct _audin_server_context audin_server_context;
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
bb5c11 |
typedef UINT(*psAudinServerSelectFormat)(audin_server_context* context, size_t client_format_index);
|
|
Packit Service |
fa4841 |
typedef BOOL (*psAudinServerOpen)(audin_server_context* context);
|
|
Packit Service |
fa4841 |
typedef BOOL (*psAudinServerIsOpen)(audin_server_context* context);
|
|
Packit Service |
fa4841 |
typedef BOOL (*psAudinServerClose)(audin_server_context* context);
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
bb5c11 |
typedef UINT(*psAudinServerOpening)(audin_server_context* context);
|
|
Packit Service |
bb5c11 |
typedef UINT(*psAudinServerOpenResult)(audin_server_context* context, UINT32 result);
|
|
Packit Service |
bb5c11 |
typedef UINT(*psAudinServerReceiveSamples)(audin_server_context* context,
|
|
Packit Service |
bb5c11 |
const AUDIO_FORMAT* format, wStream* buf,
|
|
Packit Service |
bb5c11 |
size_t nframes);
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
struct _audin_server_context
|
|
Packit Service |
fa4841 |
{
|
|
Packit Service |
fa4841 |
HANDLE vcm;
|
|
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 destination PCM audio format. Set by server. */
|
|
Packit Service |
fa4841 |
AUDIO_FORMAT* dst_format;
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
/* Server preferred frames per packet. */
|
|
Packit Service |
fa4841 |
int frames_per_packet;
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
/* Client supported formats. */
|
|
Packit Service |
fa4841 |
AUDIO_FORMAT* client_formats;
|
|
Packit Service |
fa4841 |
size_t num_client_formats;
|
|
Packit Service |
fa4841 |
SSIZE_T selected_client_format;
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
/*** APIs called by the server. ***/
|
|
Packit Service |
fa4841 |
/**
|
|
Packit Service |
fa4841 |
* Choose the audio format to be received. 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 |
psAudinServerSelectFormat SelectFormat;
|
|
Packit Service |
fa4841 |
/**
|
|
Packit Service |
fa4841 |
* Open the audio input stream.
|
|
Packit Service |
fa4841 |
*/
|
|
Packit Service |
fa4841 |
psAudinServerOpen Open;
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
psAudinServerIsOpen IsOpen;
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
/**
|
|
Packit Service |
fa4841 |
* Close the audio stream.
|
|
Packit Service |
fa4841 |
*/
|
|
Packit Service |
fa4841 |
psAudinServerClose Close;
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
/*** Callbacks registered by the server. ***/
|
|
Packit Service |
fa4841 |
/**
|
|
Packit Service |
fa4841 |
* It's ready to open the audio input stream. The server should examine client
|
|
Packit Service |
fa4841 |
* formats and call SelectFormat to choose the desired one in this callback.
|
|
Packit Service |
fa4841 |
*/
|
|
Packit Service |
fa4841 |
psAudinServerOpening Opening;
|
|
Packit Service |
fa4841 |
/**
|
|
Packit Service |
fa4841 |
* Client replied HRESULT of the open operation.
|
|
Packit Service |
fa4841 |
*/
|
|
Packit Service |
fa4841 |
psAudinServerOpenResult OpenResult;
|
|
Packit Service |
fa4841 |
/**
|
|
Packit Service |
fa4841 |
* Receive audio samples. Actual bytes in the buffer is:
|
|
Packit Service |
fa4841 |
* nframes * dst_format.nBitsPerSample * dst_format.nChannels / 8
|
|
Packit Service |
fa4841 |
* Note that this callback is called from a different thread context so the
|
|
Packit Service |
fa4841 |
* server must be careful of thread synchronization.
|
|
Packit Service |
fa4841 |
*/
|
|
Packit Service |
fa4841 |
psAudinServerReceiveSamples ReceiveSamples;
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
rdpContext* rdpcontext;
|
|
Packit Service |
fa4841 |
};
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
#ifdef __cplusplus
|
|
Packit Service |
bb5c11 |
extern "C" {
|
|
Packit Service |
fa4841 |
#endif
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
bb5c11 |
FREERDP_API audin_server_context* audin_server_context_new(HANDLE vcm);
|
|
Packit Service |
bb5c11 |
FREERDP_API void audin_server_context_free(audin_server_context* 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_AUDIN_SERVER_H */
|