FreeRDP
client/rdpsnd_main.c File Reference
#include <sys/time.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <winpr/crt.h>
#include <winpr/wlog.h>
#include <winpr/stream.h>
#include <winpr/cmdline.h>
#include <winpr/sysinfo.h>
#include <winpr/collections.h>
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/codec/dsp.h>
#include "rdpsnd_common.h"
#include "rdpsnd_main.h"

Macros

#define VirtualChannelEntryEx   rdpsnd_VirtualChannelEntryEx
 

Functions

static void rdpsnd_recv_close_pdu (rdpsndPlugin *rdpsnd)
 
static void rdpsnd_virtual_channel_event_terminated (rdpsndPlugin *rdpsnd)
 
static UINT rdpsnd_virtual_channel_write (rdpsndPlugin *rdpsnd, wStream *s)
 
static UINT rdpsnd_send_quality_mode_pdu (rdpsndPlugin *rdpsnd)
 
static void rdpsnd_select_supported_audio_formats (rdpsndPlugin *rdpsnd)
 
static UINT rdpsnd_send_client_audio_formats (rdpsndPlugin *rdpsnd)
 
static UINT rdpsnd_recv_server_audio_formats_pdu (rdpsndPlugin *rdpsnd, wStream *s)
 
static UINT rdpsnd_send_training_confirm_pdu (rdpsndPlugin *rdpsnd, UINT16 wTimeStamp, UINT16 wPackSize)
 
static UINT rdpsnd_recv_training_pdu (rdpsndPlugin *rdpsnd, wStream *s)
 
static BOOL rdpsnd_ensure_device_is_open (rdpsndPlugin *rdpsnd, UINT32 wFormatNo, const AUDIO_FORMAT *format)
 
static UINT rdpsnd_recv_wave_info_pdu (rdpsndPlugin *rdpsnd, wStream *s, UINT16 BodySize)
 
static UINT rdpsnd_send_wave_confirm_pdu (rdpsndPlugin *rdpsnd, UINT16 wTimeStamp, BYTE cConfirmedBlockNo)
 
static UINT rdpsnd_treat_wave (rdpsndPlugin *rdpsnd, wStream *s, size_t size)
 
static UINT rdpsnd_recv_wave_pdu (rdpsndPlugin *rdpsnd, wStream *s)
 
static UINT rdpsnd_recv_wave2_pdu (rdpsndPlugin *rdpsnd, wStream *s, UINT16 BodySize)
 
static UINT rdpsnd_recv_volume_pdu (rdpsndPlugin *rdpsnd, wStream *s)
 
static UINT rdpsnd_recv_pdu (rdpsndPlugin *rdpsnd, wStream *s)
 
static void rdpsnd_register_device_plugin (rdpsndPlugin *rdpsnd, rdpsndDevicePlugin *device)
 
static UINT rdpsnd_load_device_plugin (rdpsndPlugin *rdpsnd, const char *name, ADDIN_ARGV *args)
 
static BOOL rdpsnd_set_subsystem (rdpsndPlugin *rdpsnd, const char *subsystem)
 
BOOL rdpsnd_set_device_name (rdpsndPlugin *rdpsnd, const char *device_name)
 
static UINT rdpsnd_process_addin_args (rdpsndPlugin *rdpsnd, ADDIN_ARGV *args)
 
static UINT rdpsnd_process_connect (rdpsndPlugin *rdpsnd)
 
static void rdpsnd_process_disconnect (rdpsndPlugin *rdpsnd)
 
static UINT rdpsnd_virtual_channel_event_data_received (rdpsndPlugin *plugin, void *pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
 
static VOID VCAPITYPE rdpsnd_virtual_channel_open_event_ex (LPVOID lpUserParam, DWORD openHandle, UINT event, LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags)
 
static DWORD WINAPI rdpsnd_virtual_channel_client_thread (LPVOID arg)
 
static void rdpsnd_queue_free (void *data)
 
static UINT rdpsnd_virtual_channel_event_initialized (rdpsndPlugin *rdpsnd, LPVOID pData, UINT32 dataLength)
 
static UINT rdpsnd_virtual_channel_event_connected (rdpsndPlugin *rdpsnd, LPVOID pData, UINT32 dataLength)
 
static UINT rdpsnd_virtual_channel_event_disconnected (rdpsndPlugin *rdpsnd)
 
static VOID VCAPITYPE rdpsnd_virtual_channel_init_event_ex (LPVOID lpUserParam, LPVOID pInitHandle, UINT event, LPVOID pData, UINT dataLength)
 
BOOL VCAPITYPE VirtualChannelEntryEx (PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID pInitHandle)
 

Variables

static COMMAND_LINE_ARGUMENT_A rdpsnd_args []
 

Macro Definition Documentation

#define VirtualChannelEntryEx   rdpsnd_VirtualChannelEntryEx

Function Documentation

static BOOL rdpsnd_ensure_device_is_open ( rdpsndPlugin *  rdpsnd,
UINT32  wFormatNo,
const AUDIO_FORMAT format 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_load_device_plugin ( rdpsndPlugin *  rdpsnd,
const char *  name,
ADDIN_ARGV *  args 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_process_addin_args ( rdpsndPlugin *  rdpsnd,
ADDIN_ARGV *  args 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_process_connect ( rdpsndPlugin *  rdpsnd)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static void rdpsnd_process_disconnect ( rdpsndPlugin *  rdpsnd)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void rdpsnd_queue_free ( void data)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void rdpsnd_recv_close_pdu ( rdpsndPlugin *  rdpsnd)
static

Here is the caller graph for this function:

static UINT rdpsnd_recv_pdu ( rdpsndPlugin *  rdpsnd,
wStream *  s 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_recv_server_audio_formats_pdu ( rdpsndPlugin *  rdpsnd,
wStream *  s 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_recv_training_pdu ( rdpsndPlugin *  rdpsnd,
wStream *  s 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_recv_volume_pdu ( rdpsndPlugin *  rdpsnd,
wStream *  s 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_recv_wave2_pdu ( rdpsndPlugin *  rdpsnd,
wStream *  s,
UINT16  BodySize 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_recv_wave_info_pdu ( rdpsndPlugin *  rdpsnd,
wStream *  s,
UINT16  BodySize 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_recv_wave_pdu ( rdpsndPlugin *  rdpsnd,
wStream *  s 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

The Wave PDU is a special case: it is always sent after a Wave Info PDU, and we do not process its header. Instead, the header is pad that needs to be filled with the first four bytes of the audio sample data sent as part of the preceding Wave Info PDU.

Here is the call graph for this function:

Here is the caller graph for this function:

static void rdpsnd_register_device_plugin ( rdpsndPlugin *  rdpsnd,
rdpsndDevicePlugin *  device 
)
static

Here is the caller graph for this function:

static void rdpsnd_select_supported_audio_formats ( rdpsndPlugin *  rdpsnd)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_send_client_audio_formats ( rdpsndPlugin *  rdpsnd)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_send_quality_mode_pdu ( rdpsndPlugin *  rdpsnd)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_send_training_confirm_pdu ( rdpsndPlugin *  rdpsnd,
UINT16  wTimeStamp,
UINT16  wPackSize 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_send_wave_confirm_pdu ( rdpsndPlugin *  rdpsnd,
UINT16  wTimeStamp,
BYTE  cConfirmedBlockNo 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL rdpsnd_set_device_name ( rdpsndPlugin *  rdpsnd,
const char *  device_name 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL rdpsnd_set_subsystem ( rdpsndPlugin *  rdpsnd,
const char *  subsystem 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_treat_wave ( rdpsndPlugin *  rdpsnd,
wStream *  s,
size_t  size 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static DWORD WINAPI rdpsnd_virtual_channel_client_thread ( LPVOID  arg)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_virtual_channel_event_connected ( rdpsndPlugin *  rdpsnd,
LPVOID  pData,
UINT32  dataLength 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_virtual_channel_event_data_received ( rdpsndPlugin *  plugin,
void pData,
UINT32  dataLength,
UINT32  totalLength,
UINT32  dataFlags 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_virtual_channel_event_disconnected ( rdpsndPlugin *  rdpsnd)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_virtual_channel_event_initialized ( rdpsndPlugin *  rdpsnd,
LPVOID  pData,
UINT32  dataLength 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void rdpsnd_virtual_channel_event_terminated ( rdpsndPlugin *  rdpsnd)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static VOID VCAPITYPE rdpsnd_virtual_channel_init_event_ex ( LPVOID  lpUserParam,
LPVOID  pInitHandle,
UINT  event,
LPVOID  pData,
UINT  dataLength 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static VOID VCAPITYPE rdpsnd_virtual_channel_open_event_ex ( LPVOID  lpUserParam,
DWORD  openHandle,
UINT  event,
LPVOID  pData,
UINT32  dataLength,
UINT32  totalLength,
UINT32  dataFlags 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

UINT rdpsnd_virtual_channel_write ( rdpsndPlugin *  rdpsnd,
wStream *  s 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL VCAPITYPE VirtualChannelEntryEx ( PCHANNEL_ENTRY_POINTS  pEntryPoints,
PVOID  pInitHandle 
)

Here is the call graph for this function:

Variable Documentation

COMMAND_LINE_ARGUMENT_A rdpsnd_args[]
static
Initial value:
=
{
{ "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", NULL, NULL, -1, NULL, "format" },
{ "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", NULL, NULL, -1, NULL, "rate" },
{ "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", NULL, NULL, -1, NULL, "channel" },
{ "latency", COMMAND_LINE_VALUE_REQUIRED, "<latency>", NULL, NULL, -1, NULL, "latency" },
{ "quality", COMMAND_LINE_VALUE_REQUIRED, "<quality mode>", NULL, NULL, -1, NULL, "quality mode" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
}
#define COMMAND_LINE_VALUE_REQUIRED
Definition: winpr/include/winpr/cmdline.h:34
if availableBytes return NULL
Definition: TPCircularBuffer.h:104