FreeRDP
rdpsnd_alsa.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <winpr/cmdline.h>
#include <winpr/sysinfo.h>
#include <winpr/collections.h>
#include <alsa/asoundlib.h>
#include <freerdp/types.h>
#include <freerdp/codec/dsp.h>
#include <freerdp/channels/log.h>
#include "rdpsnd_main.h"

Macros

#define SND_PCM_CHECK(_func, _status)
 
#define freerdp_rdpsnd_client_subsystem_entry   FREERDP_API freerdp_rdpsnd_client_subsystem_entry
 

Functions

static int rdpsnd_alsa_set_hw_params (rdpsndAlsaPlugin *alsa)
 
static int rdpsnd_alsa_set_sw_params (rdpsndAlsaPlugin *alsa)
 
static int rdpsnd_alsa_validate_params (rdpsndAlsaPlugin *alsa)
 
static int rdpsnd_alsa_set_params (rdpsndAlsaPlugin *alsa)
 
static BOOL rdpsnd_alsa_set_format (rdpsndDevicePlugin *device, const AUDIO_FORMAT *format, UINT32 latency)
 
static void rdpsnd_alsa_close_mixer (rdpsndAlsaPlugin *alsa)
 
static BOOL rdpsnd_alsa_open_mixer (rdpsndAlsaPlugin *alsa)
 
static void rdpsnd_alsa_pcm_close (rdpsndAlsaPlugin *alsa)
 
static BOOL rdpsnd_alsa_open (rdpsndDevicePlugin *device, const AUDIO_FORMAT *format, UINT32 latency)
 
static void rdpsnd_alsa_close (rdpsndDevicePlugin *device)
 
static void rdpsnd_alsa_free (rdpsndDevicePlugin *device)
 
static BOOL rdpsnd_alsa_format_supported (rdpsndDevicePlugin *device, const AUDIO_FORMAT *format)
 
static UINT32 rdpsnd_alsa_get_volume (rdpsndDevicePlugin *device)
 
static BOOL rdpsnd_alsa_set_volume (rdpsndDevicePlugin *device, UINT32 value)
 
static UINT rdpsnd_alsa_play (rdpsndDevicePlugin *device, const BYTE *data, size_t size)
 
static UINT rdpsnd_alsa_parse_addin_args (rdpsndDevicePlugin *device, ADDIN_ARGV *args)
 
UINT freerdp_rdpsnd_client_subsystem_entry (PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
 

Variables

static COMMAND_LINE_ARGUMENT_A rdpsnd_alsa_args []
 

Macro Definition Documentation

#define freerdp_rdpsnd_client_subsystem_entry   FREERDP_API freerdp_rdpsnd_client_subsystem_entry
#define SND_PCM_CHECK (   _func,
  _status 
)
Value:
if (_status < 0) \
{ \
WLog_ERR(TAG, "%s: %d\n", _func, _status); \
return -1; \
}
return(void *)((char *) buffer-> buffer+buffer->tail)
#define TAG
Definition: audin_main.h:33
#define WLog_ERR(tag,...)
Definition: include/winpr/wlog.h:158

Function Documentation

UINT freerdp_rdpsnd_client_subsystem_entry ( PFREERDP_RDPSND_DEVICE_ENTRY_POINTS  pEntryPoints)

Function description

Returns
0 on success, otherwise a Win32 error code

Here is the call graph for this function:

static void rdpsnd_alsa_close ( rdpsndDevicePlugin *  device)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void rdpsnd_alsa_close_mixer ( rdpsndAlsaPlugin *  alsa)
static

Here is the caller graph for this function:

static BOOL rdpsnd_alsa_format_supported ( rdpsndDevicePlugin *  device,
const AUDIO_FORMAT format 
)
static

Here is the caller graph for this function:

static void rdpsnd_alsa_free ( rdpsndDevicePlugin *  device)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT32 rdpsnd_alsa_get_volume ( rdpsndDevicePlugin *  device)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL rdpsnd_alsa_open ( rdpsndDevicePlugin *  device,
const AUDIO_FORMAT format,
UINT32  latency 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL rdpsnd_alsa_open_mixer ( rdpsndAlsaPlugin *  alsa)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static UINT rdpsnd_alsa_parse_addin_args ( rdpsndDevicePlugin *  device,
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 void rdpsnd_alsa_pcm_close ( rdpsndAlsaPlugin *  alsa)
static

Here is the caller graph for this function:

static UINT rdpsnd_alsa_play ( rdpsndDevicePlugin *  device,
const BYTE data,
size_t  size 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL rdpsnd_alsa_set_format ( rdpsndDevicePlugin *  device,
const AUDIO_FORMAT format,
UINT32  latency 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int rdpsnd_alsa_set_hw_params ( rdpsndAlsaPlugin *  alsa)
static

ALSA Parameters

http://www.alsa-project.org/main/index.php/FramesPeriods

buffer_size = period_size * periods period_bytes = period_size * bytes_per_frame bytes_per_frame = channels * bytes_per_sample

A frame is equivalent of one sample being played, irrespective of the number of channels or the number of bits

A period is the number of frames in between each hardware interrupt.

The buffer size always has to be greater than one period size. Commonly this is (2 * period_size), but some hardware can do 8 periods per buffer. It is also possible for the buffer size to not be an integer multiple of the period size.

Here is the caller graph for this function:

static int rdpsnd_alsa_set_params ( rdpsndAlsaPlugin *  alsa)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int rdpsnd_alsa_set_sw_params ( rdpsndAlsaPlugin *  alsa)
static

Here is the caller graph for this function:

static BOOL rdpsnd_alsa_set_volume ( rdpsndDevicePlugin *  device,
UINT32  value 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int rdpsnd_alsa_validate_params ( rdpsndAlsaPlugin *  alsa)
static

Here is the caller graph for this function:

Variable Documentation

COMMAND_LINE_ARGUMENT_A rdpsnd_alsa_args[]
static
Initial value:
=
{
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
{ 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