server/rdpsnd: add SetVolume support.

This commit is contained in:
Vic Lee 2012-05-29 22:22:38 +08:00
parent 02ce0dba3b
commit 106b20cbb0
2 changed files with 19 additions and 0 deletions

View File

@ -28,6 +28,7 @@ typedef struct _rdpsnd_server_context rdpsnd_server_context;
typedef boolean (*psRdpsndServerInitialize)(rdpsnd_server_context* context);
typedef void (*psRdpsndServerSelectFormat)(rdpsnd_server_context* context, int client_format_index);
typedef boolean (*psRdpsndServerSendSamples)(rdpsnd_server_context* context, const void* buf, int nframes);
typedef boolean (*psRdpsndServerSetVolume)(rdpsnd_server_context* context, int left, int right);
typedef boolean (*psRdpsndServerClose)(rdpsnd_server_context* context);
typedef void (*psRdpsndServerActivated)(rdpsnd_server_context* context);
@ -71,6 +72,10 @@ struct _rdpsnd_server_context
* nframes * src_format.nBitsPerSample * src_format.nChannels / 8
*/
psRdpsndServerSendSamples SendSamples;
/**
* Set the volume level of the client. Valid range is between 0 and 0xFFFF.
*/
psRdpsndServerSetVolume SetVolume;
/**
* Close the audio stream.
*/

View File

@ -392,6 +392,19 @@ static boolean rdpsnd_server_send_samples(rdpsnd_server_context* context, const
return true;
}
static boolean rdpsnd_server_set_volume(rdpsnd_server_context* context, int left, int right)
{
rdpsnd_server* rdpsnd = (rdpsnd_server*) context;
STREAM* s = rdpsnd->rdpsnd_pdu;
RDPSND_PDU_INIT(s, SNDC_SETVOLUME);
stream_write_uint16(s, left);
stream_write_uint16(s, right);
RDPSND_PDU_FINISH(s);
}
static boolean rdpsnd_server_close(rdpsnd_server_context* context)
{
rdpsnd_server* rdpsnd = (rdpsnd_server*) context;
@ -422,6 +435,7 @@ rdpsnd_server_context* rdpsnd_server_context_new(WTSVirtualChannelManager* vcm)
rdpsnd->context.Initialize = rdpsnd_server_initialize;
rdpsnd->context.SelectFormat = rdpsnd_server_select_format;
rdpsnd->context.SendSamples = rdpsnd_server_send_samples;
rdpsnd->context.SetVolume = rdpsnd_server_set_volume;
rdpsnd->context.Close = rdpsnd_server_close;
rdpsnd->dsp_context = freerdp_dsp_context_new();