FreeRDP
audin_main.c File Reference
#include <freerdp/config.h>
#include <errno.h>
#include <winpr/assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <winpr/cmdline.h>
#include <winpr/wlog.h>
#include <freerdp/addin.h>
#include <winpr/stream.h>
#include <freerdp/freerdp.h>
#include <freerdp/codec/dsp.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/audin.h>
#include "audin_main.h"

Macros

#define SNDIN_VERSION   0x02
 

Enumerations

enum  MSG_SNDIN {
  MSG_SNDIN_VERSION = 0x01 , MSG_SNDIN_FORMATS = 0x02 , MSG_SNDIN_OPEN = 0x03 , MSG_SNDIN_OPEN_REPLY = 0x04 ,
  MSG_SNDIN_DATA_INCOMING = 0x05 , MSG_SNDIN_DATA = 0x06 , MSG_SNDIN_FORMATCHANGE = 0x07 , MSG_SNDIN_VERSION = 0x01 ,
  MSG_SNDIN_FORMATS = 0x02 , MSG_SNDIN_OPEN = 0x03 , MSG_SNDIN_OPEN_REPLY = 0x04 , MSG_SNDIN_DATA_INCOMING = 0x05 ,
  MSG_SNDIN_DATA = 0x06 , MSG_SNDIN_FORMATCHANGE = 0x07
}
 

Functions

static BOOL audin_process_addin_args (AUDIN_PLUGIN *audin, const ADDIN_ARGV *args)
 
static UINT audin_channel_write_and_free (AUDIN_CHANNEL_CALLBACK *callback, wStream *out, BOOL freeStream)
 
static UINT audin_process_version (AUDIN_PLUGIN *audin, AUDIN_CHANNEL_CALLBACK *callback, wStream *s)
 
static UINT audin_send_incoming_data_pdu (AUDIN_CHANNEL_CALLBACK *callback)
 
static UINT audin_process_formats (AUDIN_PLUGIN *audin, AUDIN_CHANNEL_CALLBACK *callback, wStream *s)
 
static UINT audin_send_format_change_pdu (AUDIN_PLUGIN *audin, AUDIN_CHANNEL_CALLBACK *callback, UINT32 NewFormat)
 
static UINT audin_send_open_reply_pdu (AUDIN_PLUGIN *audin, AUDIN_CHANNEL_CALLBACK *callback, UINT32 Result)
 
static UINT audin_receive_wave_data (const AUDIO_FORMAT *format, const BYTE *data, size_t size, void *user_data)
 
static BOOL audin_open_device (AUDIN_PLUGIN *audin, AUDIN_CHANNEL_CALLBACK *callback)
 
static UINT audin_process_open (AUDIN_PLUGIN *audin, AUDIN_CHANNEL_CALLBACK *callback, wStream *s)
 
static UINT audin_process_format_change (AUDIN_PLUGIN *audin, AUDIN_CHANNEL_CALLBACK *callback, wStream *s)
 
static UINT audin_on_data_received (IWTSVirtualChannelCallback *pChannelCallback, wStream *data)
 
static UINT audin_on_close (IWTSVirtualChannelCallback *pChannelCallback)
 
static UINT audin_on_new_channel_connection (IWTSListenerCallback *pListenerCallback, IWTSVirtualChannel *pChannel, BYTE *Data, BOOL *pbAccept, IWTSVirtualChannelCallback **ppCallback)
 
static UINT audin_plugin_initialize (IWTSPlugin *pPlugin, IWTSVirtualChannelManager *pChannelMgr)
 
static UINT audin_plugin_terminated (IWTSPlugin *pPlugin)
 
static UINT audin_plugin_attached (IWTSPlugin *pPlugin)
 
static UINT audin_plugin_detached (IWTSPlugin *pPlugin)
 
static UINT audin_register_device_plugin (IWTSPlugin *pPlugin, IAudinDevice *device)
 
static UINT audin_load_device_plugin (AUDIN_PLUGIN *audin, const char *name, const ADDIN_ARGV *args)
 
static UINT audin_set_subsystem (AUDIN_PLUGIN *audin, const char *subsystem)
 
static UINT audin_set_device_name (AUDIN_PLUGIN *audin, const char *device_name)
 
 WINPR_ASSERT (pEntryPoints)
 
 WINPR_ASSERT (pEntryPoints->GetPlugin)
 
 if (audin !=NULL)
 
 if (!audin->fixed_format) goto out
 
 if (args)
 
 if (audin->subsystem)
 

Variables

UINT error = CHANNEL_RC_INITIALIZATION_ERROR
 
struct SubsystemEntry entries []
 
struct SubsystemEntry * entry = &entries[0]
 
AUDIN_PLUGIN * audin = (AUDIN_PLUGIN*)pEntryPoints->GetPlugin(pEntryPoints, AUDIN_CHANNEL_NAME)
 
audin log = WLog_Get(TAG)
 
audin data = Stream_New(NULL, 4096)
 
audin fixed_format = audio_format_new()
 
audin dsp_context = freerdp_dsp_context_new(TRUE)
 
audin attached = TRUE
 
audin iface Initialize = audin_plugin_initialize
 
audin iface Connected = NULL
 
audin iface Disconnected = NULL
 
audin iface Terminated = audin_plugin_terminated
 
audin iface Attached = audin_plugin_attached
 
audin iface Detached = audin_plugin_detached
 
const ADDIN_ARGVargs = pEntryPoints->GetPluginData(pEntryPoints)
 
audin rdpcontext = pEntryPoints->GetRdpContext(pEntryPoints)
 
 else
 

Macro Definition Documentation

◆ SNDIN_VERSION

#define SNDIN_VERSION   0x02

FreeRDP: A Remote Desktop Protocol Implementation Audio Input Redirection Virtual Channel

Copyright 2010-2011 Vic Lee Copyright 2015 Thincast Technologies GmbH Copyright 2015 DI (FH) Martin Haimberger marti.nosp@m.n.ha.nosp@m.imber.nosp@m.ger@.nosp@m.thinc.nosp@m.ast..nosp@m.com Copyright 2015 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m

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.

Enumeration Type Documentation

◆ MSG_SNDIN

enum MSG_SNDIN
Enumerator
MSG_SNDIN_VERSION 
MSG_SNDIN_FORMATS 
MSG_SNDIN_OPEN 
MSG_SNDIN_OPEN_REPLY 
MSG_SNDIN_DATA_INCOMING 
MSG_SNDIN_DATA 
MSG_SNDIN_FORMATCHANGE 
MSG_SNDIN_VERSION 
MSG_SNDIN_FORMATS 
MSG_SNDIN_OPEN 
MSG_SNDIN_OPEN_REPLY 
MSG_SNDIN_DATA_INCOMING 
MSG_SNDIN_DATA 
MSG_SNDIN_FORMATCHANGE 

Function Documentation

◆ audin_channel_write_and_free()

static UINT audin_channel_write_and_free ( AUDIN_CHANNEL_CALLBACK *  callback,
wStream out,
BOOL  freeStream 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ audin_load_device_plugin()

static UINT audin_load_device_plugin ( AUDIN_PLUGIN *  audin,
const char *  name,
const 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:

◆ audin_on_close()

static UINT audin_on_close ( IWTSVirtualChannelCallback *  pChannelCallback)
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:

◆ audin_on_data_received()

static UINT audin_on_data_received ( IWTSVirtualChannelCallback *  pChannelCallback,
wStream data 
)
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:

◆ audin_on_new_channel_connection()

static UINT audin_on_new_channel_connection ( IWTSListenerCallback *  pListenerCallback,
IWTSVirtualChannel *  pChannel,
BYTE Data,
BOOL *  pbAccept,
IWTSVirtualChannelCallback **  ppCallback 
)
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:

◆ audin_open_device()

static BOOL audin_open_device ( AUDIN_PLUGIN *  audin,
AUDIN_CHANNEL_CALLBACK *  callback 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ audin_plugin_attached()

static UINT audin_plugin_attached ( IWTSPlugin *  pPlugin)
static
Here is the call graph for this function:

◆ audin_plugin_detached()

static UINT audin_plugin_detached ( IWTSPlugin *  pPlugin)
static
Here is the call graph for this function:

◆ audin_plugin_initialize()

static UINT audin_plugin_initialize ( IWTSPlugin *  pPlugin,
IWTSVirtualChannelManager *  pChannelMgr 
)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:

◆ audin_plugin_terminated()

static UINT audin_plugin_terminated ( IWTSPlugin *  pPlugin)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the call graph for this function:

◆ audin_process_addin_args()

BOOL audin_process_addin_args ( AUDIN_PLUGIN *  audin,
const ADDIN_ARGV args 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ audin_process_format_change()

static UINT audin_process_format_change ( AUDIN_PLUGIN *  audin,
AUDIN_CHANNEL_CALLBACK *  callback,
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:

◆ audin_process_formats()

static UINT audin_process_formats ( AUDIN_PLUGIN *  audin,
AUDIN_CHANNEL_CALLBACK *  callback,
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:

◆ audin_process_open()

static UINT audin_process_open ( AUDIN_PLUGIN *  audin,
AUDIN_CHANNEL_CALLBACK *  callback,
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:

◆ audin_process_version()

static UINT audin_process_version ( AUDIN_PLUGIN *  audin,
AUDIN_CHANNEL_CALLBACK *  callback,
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:

◆ audin_receive_wave_data()

static UINT audin_receive_wave_data ( const AUDIO_FORMAT format,
const BYTE data,
size_t  size,
void *  user_data 
)
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:

◆ audin_register_device_plugin()

static UINT audin_register_device_plugin ( IWTSPlugin *  pPlugin,
IAudinDevice *  device 
)
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:

◆ audin_send_format_change_pdu()

static UINT audin_send_format_change_pdu ( AUDIN_PLUGIN *  audin,
AUDIN_CHANNEL_CALLBACK *  callback,
UINT32  NewFormat 
)
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:

◆ audin_send_incoming_data_pdu()

static UINT audin_send_incoming_data_pdu ( AUDIN_CHANNEL_CALLBACK *  callback)
static

Function description

Returns
0 on success, otherwise a Win32 error code
Here is the caller graph for this function:

◆ audin_send_open_reply_pdu()

static UINT audin_send_open_reply_pdu ( AUDIN_PLUGIN *  audin,
AUDIN_CHANNEL_CALLBACK *  callback,
UINT32  Result 
)
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:

◆ audin_set_device_name()

static UINT audin_set_device_name ( AUDIN_PLUGIN *  audin,
const char *  device_name 
)
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:

◆ audin_set_subsystem()

static UINT audin_set_subsystem ( AUDIN_PLUGIN *  audin,
const char *  subsystem 
)
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:

◆ if() [1/4]

if ( !audin->  fixed_format)

◆ if() [2/4]

if ( args  )
Here is the call graph for this function:

◆ if() [3/4]

if ( audin = NULL)

◆ if() [4/4]

if ( audin->  subsystem)
Here is the call graph for this function:

◆ WINPR_ASSERT() [1/2]

WINPR_ASSERT ( pEntryPoints  )
Here is the caller graph for this function:

◆ WINPR_ASSERT() [2/2]

WINPR_ASSERT ( pEntryPoints->  GetPlugin)

Variable Documentation

◆ args

const ADDIN_ARGV* args = pEntryPoints->GetPluginData(pEntryPoints)

◆ attached

audin attached = TRUE

◆ Attached

audin iface Attached = audin_plugin_attached

◆ audin

AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*)pEntryPoints->GetPlugin(pEntryPoints, AUDIN_CHANNEL_NAME)

◆ Connected

audin iface Connected = NULL

◆ data

audin data = Stream_New(NULL, 4096)

◆ Detached

audin iface Detached = audin_plugin_detached

◆ Disconnected

audin iface Disconnected = NULL

◆ dsp_context

audin dsp_context = freerdp_dsp_context_new(TRUE)

◆ else

else

◆ entries

struct SubsystemEntry entries[]
Initial value:
=
{
{ NULL, NULL }
}
if availableBytes return NULL
Definition: TPCircularBuffer.h:109

◆ entry

struct SubsystemEntry* entry = &entries[0]

◆ error

Function description

Returns
0 on success, otherwise a Win32 error code

◆ fixed_format

audin fixed_format = audio_format_new()

◆ Initialize

audin iface Initialize = audin_plugin_initialize

◆ log

audin log = WLog_Get(TAG)

◆ rdpcontext

audin rdpcontext = pEntryPoints->GetRdpContext(pEntryPoints)

◆ Terminated

audin iface Terminated = audin_plugin_terminated