2012-06-26 10:49:39 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2012-06-26 10:49:39 +04:00
|
|
|
* Server Audio Input Virtual Channel
|
|
|
|
*
|
|
|
|
* Copyright 2012 Vic Lee
|
2015-06-02 10:50:38 +03:00
|
|
|
* Copyright 2015 Thincast Technologies GmbH
|
|
|
|
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
|
2012-06-26 10:49:39 +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_AUDIN_SERVER_H
|
|
|
|
#define FREERDP_CHANNEL_AUDIN_SERVER_H
|
2012-06-26 10:49:39 +04:00
|
|
|
|
2013-03-29 03:33:31 +04:00
|
|
|
#include <freerdp/codec/audio.h>
|
2012-06-26 10:49:39 +04:00
|
|
|
#include <freerdp/channels/wtsvc.h>
|
|
|
|
#include <freerdp/channels/rdpsnd.h>
|
2015-06-02 10:50:38 +03:00
|
|
|
#include <winpr/win32error.h>
|
2012-06-26 10:49:39 +04:00
|
|
|
|
|
|
|
typedef struct _audin_server_context audin_server_context;
|
|
|
|
|
2015-06-02 10:50:38 +03:00
|
|
|
typedef WIN32ERROR (*psAudinServerSelectFormat)(audin_server_context* context, int client_format_index);
|
2012-10-09 10:38:39 +04:00
|
|
|
typedef BOOL (*psAudinServerOpen)(audin_server_context* context);
|
|
|
|
typedef BOOL (*psAudinServerClose)(audin_server_context* context);
|
2012-06-26 10:49:39 +04:00
|
|
|
|
2015-06-02 10:50:38 +03:00
|
|
|
typedef WIN32ERROR (*psAudinServerOpening)(audin_server_context* context);
|
|
|
|
typedef WIN32ERROR (*psAudinServerOpenResult)(audin_server_context* context, UINT32 result);
|
|
|
|
typedef WIN32ERROR (*psAudinServerReceiveSamples)(audin_server_context* context, const void* buf, int nframes);
|
2012-06-26 10:49:39 +04:00
|
|
|
|
|
|
|
struct _audin_server_context
|
|
|
|
{
|
2014-02-17 08:00:58 +04:00
|
|
|
HANDLE vcm;
|
2012-06-26 10:49:39 +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-06-26 10:49:39 +04:00
|
|
|
int num_server_formats;
|
|
|
|
|
|
|
|
/* Server destination PCM audio format. Set by server. */
|
2013-02-26 06:46:48 +04:00
|
|
|
AUDIO_FORMAT dst_format;
|
2012-06-26 10:49:39 +04:00
|
|
|
|
|
|
|
/* Server preferred frames per packet. */
|
|
|
|
int frames_per_packet;
|
|
|
|
|
|
|
|
/* Client supported formats. */
|
2013-02-26 06:46:48 +04:00
|
|
|
AUDIO_FORMAT* client_formats;
|
2012-06-26 10:49:39 +04:00
|
|
|
int num_client_formats;
|
|
|
|
int selected_client_format;
|
|
|
|
|
|
|
|
/*** APIs called by the server. ***/
|
|
|
|
/**
|
|
|
|
* Choose the audio format to be received. The index argument is an index into
|
|
|
|
* the client_formats array and must be smaller than num_client_formats.
|
|
|
|
*/
|
|
|
|
psAudinServerSelectFormat SelectFormat;
|
|
|
|
/**
|
|
|
|
* Open the audio input stream.
|
|
|
|
*/
|
|
|
|
psAudinServerOpen Open;
|
|
|
|
/**
|
|
|
|
* Close the audio stream.
|
|
|
|
*/
|
|
|
|
psAudinServerClose Close;
|
|
|
|
|
|
|
|
/*** Callbacks registered by the server. ***/
|
|
|
|
/**
|
|
|
|
* It's ready to open the audio input stream. The server should examine client
|
|
|
|
* formats and call SelectFormat to choose the desired one in this callback.
|
|
|
|
*/
|
|
|
|
psAudinServerOpening Opening;
|
|
|
|
/**
|
|
|
|
* Client replied HRESULT of the open operation.
|
|
|
|
*/
|
|
|
|
psAudinServerOpenResult OpenResult;
|
|
|
|
/**
|
|
|
|
* Receive audio samples. Actual bytes in the buffer is:
|
|
|
|
* nframes * dst_format.nBitsPerSample * dst_format.nChannels / 8
|
|
|
|
* Note that this callback is called from a different thread context so the
|
|
|
|
* server must be careful of thread synchronization.
|
|
|
|
*/
|
|
|
|
psAudinServerReceiveSamples ReceiveSamples;
|
|
|
|
};
|
|
|
|
|
2013-05-20 08:57:08 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-02-27 22:30:04 +04:00
|
|
|
FREERDP_API audin_server_context* audin_server_context_new(HANDLE vcm);
|
2012-06-26 10:49:39 +04:00
|
|
|
FREERDP_API void audin_server_context_free(audin_server_context* context);
|
|
|
|
|
2013-05-20 08:57:08 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-12-14 09:25:48 +04:00
|
|
|
#endif /* FREERDP_CHANNEL_AUDIN_SERVER_H */
|