Skip to content

Commit

Permalink
+ audin OSS support (un tested now)
Browse files Browse the repository at this point in the history
+ add: COMMAND_LINE_IGN_UNKNOWN_KEYWORD flag for CommandLineParseArgumentsA to ignory unknown keys without fail
+ add: lot of WLog_DBG() in drdynvc, add function names in existing
* change: error text in rdpsnd OSS
* fix: dev in rdpsnd does not work
* fix/change: audio-dev renamed to dev and now work in audin
* fix dynamic channels now work again
  • Loading branch information
rozhuk-im committed Mar 12, 2015
1 parent 0f3b639 commit 7b3a552
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 52 deletions.
4 changes: 4 additions & 0 deletions channels/audin/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_ADDIN_PATH} EXPORT FreeRDPT

set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Client")

if(WITH_OSS)
add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "oss" "")
endif()

if(WITH_ALSA)
add_channel_client_subsystem(${MODULE_PREFIX} ${CHANNEL_NAME} "alsa" "")
endif()
Expand Down
6 changes: 3 additions & 3 deletions channels/audin/client/alsa/audin_alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ static void audin_alsa_close(IAudinDevice* device)

COMMAND_LINE_ARGUMENT_A audin_alsa_args[] =
{
{ "audio-dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};

Expand All @@ -387,7 +387,7 @@ static void audin_alsa_parse_addin_args(AudinALSADevice* device, ADDIN_ARGV* arg
COMMAND_LINE_ARGUMENT_A* arg;
AudinALSADevice* alsa = (AudinALSADevice*) device;

flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;

status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv, audin_alsa_args, flags, alsa, NULL, NULL);

Expand All @@ -400,7 +400,7 @@ static void audin_alsa_parse_addin_args(AudinALSADevice* device, ADDIN_ARGV* arg

CommandLineSwitchStart(arg)

CommandLineSwitchCase(arg, "audio-dev")
CommandLineSwitchCase(arg, "dev")
{
alsa->device_name = _strdup(arg->Value);
}
Expand Down
33 changes: 21 additions & 12 deletions channels/audin/client/audin_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, w

Stream_Read_UINT32(s, Version);

DEBUG_DVC("Version=%d", Version);
DEBUG_DVC("process_version: Version=%d", Version);

out = Stream_New(NULL, 5);
Stream_Write_UINT8(out, MSG_SNDIN_VERSION);
Expand Down Expand Up @@ -130,7 +130,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
UINT32 cbSizeFormatsPacket;

Stream_Read_UINT32(s, NumFormats);
DEBUG_DVC("NumFormats %d", NumFormats);
DEBUG_DVC("process_formats: NumFormats %d", NumFormats);
if ((NumFormats < 1) || (NumFormats > 1000))
{
WLog_ERR(TAG, "bad NumFormats %d", NumFormats);
Expand Down Expand Up @@ -158,7 +158,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
format.data = Stream_Pointer(s);
Stream_Seek(s, format.cbSize);

DEBUG_DVC("wFormatTag=%d nChannels=%d nSamplesPerSec=%d "
DEBUG_DVC("process_formats: wFormatTag=%d nChannels=%d nSamplesPerSec=%d "
"nBlockAlign=%d wBitsPerSample=%d cbSize=%d",
format.wFormatTag, format.nChannels, format.nSamplesPerSec,
format.nBlockAlign, format.wBitsPerSample, format.cbSize);
Expand All @@ -171,7 +171,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
continue;
if (audin->device && audin->device->FormatSupported(audin->device, &format))
{
DEBUG_DVC("format ok");
DEBUG_DVC("process_formats: format ok");

/* Store the agreed format in the corresponding index */
callback->formats[callback->formats_count++] = format;
Expand Down Expand Up @@ -257,7 +257,7 @@ static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, wStr
Stream_Read_UINT32(s, FramesPerPacket);
Stream_Read_UINT32(s, initialFormat);

DEBUG_DVC("FramesPerPacket=%d initialFormat=%d",
DEBUG_DVC("process_open: FramesPerPacket=%d initialFormat=%d",
FramesPerPacket, initialFormat);

if (initialFormat >= (UINT32) callback->formats_count)
Expand Down Expand Up @@ -289,7 +289,7 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb

Stream_Read_UINT32(s, NewFormat);

DEBUG_DVC("NewFormat=%d", NewFormat);
DEBUG_DVC("process_format_change: NewFormat=%d", NewFormat);

if (NewFormat >= (UINT32) callback->formats_count)
{
Expand Down Expand Up @@ -319,7 +319,7 @@ static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,

Stream_Read_UINT8(data, MessageId);

DEBUG_DVC("MessageId=0x%x", MessageId);
DEBUG_DVC("on_data_received: MessageId=0x%x", MessageId);

switch (MessageId)
{
Expand Down Expand Up @@ -353,7 +353,7 @@ static int audin_on_close(IWTSVirtualChannelCallback* pChannelCallback)
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) callback->plugin;

DEBUG_DVC("");
DEBUG_DVC("on_close");

if (audin->device)
IFCALL(audin->device->Close, audin->device);
Expand All @@ -371,7 +371,7 @@ static int audin_on_new_channel_connection(IWTSListenerCallback* pListenerCallba
AUDIN_CHANNEL_CALLBACK* callback;
AUDIN_LISTENER_CALLBACK* listener_callback = (AUDIN_LISTENER_CALLBACK*) pListenerCallback;

DEBUG_DVC("");
DEBUG_DVC("on_new_channel_connection");

callback = (AUDIN_CHANNEL_CALLBACK*) malloc(sizeof(AUDIN_CHANNEL_CALLBACK));
ZeroMemory(callback, sizeof(AUDIN_CHANNEL_CALLBACK));
Expand All @@ -391,7 +391,7 @@ static int audin_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage
{
AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) pPlugin;

DEBUG_DVC("");
DEBUG_DVC("plugin_initialize");

audin->listener_callback = (AUDIN_LISTENER_CALLBACK*) malloc(sizeof(AUDIN_LISTENER_CALLBACK));
ZeroMemory(audin->listener_callback, sizeof(AUDIN_LISTENER_CALLBACK));
Expand All @@ -408,7 +408,7 @@ static int audin_plugin_terminated(IWTSPlugin* pPlugin)
{
AUDIN_PLUGIN* audin = (AUDIN_PLUGIN*) pPlugin;

DEBUG_DVC("");
DEBUG_DVC("plugin_terminated");

if (audin->device)
{
Expand Down Expand Up @@ -438,7 +438,7 @@ static void audin_register_device_plugin(IWTSPlugin* pPlugin, IAudinDevice* devi
return;
}

DEBUG_DVC("device registered.");
DEBUG_DVC("register_device_plugin: device registered.");

audin->device = device;
}
Expand Down Expand Up @@ -589,6 +589,15 @@ int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
}
#endif

#if defined(WITH_OSS)
if (!audin->device)
{
audin_set_subsystem(audin, "oss");
audin_set_device_name(audin, "default");
audin_load_device_plugin((IWTSPlugin*) audin, audin->subsystem, args);
}
#endif

#if defined(WITH_ALSA)
if (!audin->device)
{
Expand Down
6 changes: 3 additions & 3 deletions channels/audin/client/opensles/audin_opensl_es.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ static void audin_opensles_close(IAudinDevice* device)

static COMMAND_LINE_ARGUMENT_A audin_opensles_args[] =
{
{ "audio-dev", COMMAND_LINE_VALUE_REQUIRED, "<device>",
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>",
NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};
Expand All @@ -348,7 +348,7 @@ static int audin_opensles_parse_addin_args(AudinOpenSLESDevice* device,

DEBUG_DVC("device=%p, args=%p", device, args);

flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;

status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
audin_opensles_args, flags, opensles, NULL, NULL);
Expand All @@ -364,7 +364,7 @@ static int audin_opensles_parse_addin_args(AudinOpenSLESDevice* device,

CommandLineSwitchStart(arg)

CommandLineSwitchCase(arg, "audio-dev")
CommandLineSwitchCase(arg, "dev")
{
opensles->device_name = _strdup(arg->Value);
}
Expand Down
6 changes: 3 additions & 3 deletions channels/audin/client/pulse/audin_pulse.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ static void audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u

static COMMAND_LINE_ARGUMENT_A audin_pulse_args[] =
{
{ "audio-dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};

Expand All @@ -461,7 +461,7 @@ static void audin_pulse_parse_addin_args(AudinPulseDevice* device, ADDIN_ARGV* a
COMMAND_LINE_ARGUMENT_A* arg;
AudinPulseDevice* pulse = (AudinPulseDevice*) device;

flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;

status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv, audin_pulse_args, flags, pulse, NULL, NULL);

Expand All @@ -474,7 +474,7 @@ static void audin_pulse_parse_addin_args(AudinPulseDevice* device, ADDIN_ARGV* a

CommandLineSwitchStart(arg)

CommandLineSwitchCase(arg, "audio-dev")
CommandLineSwitchCase(arg, "dev")
{
pulse->device_name = _strdup(arg->Value);
}
Expand Down
6 changes: 3 additions & 3 deletions channels/audin/client/winmm/audin_winmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ static void audin_winmm_open(IAudinDevice* device, AudinReceive receive, void* u

static COMMAND_LINE_ARGUMENT_A audin_winmm_args[] =
{
{ "audio-dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "audio device name" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
};

Expand All @@ -252,7 +252,7 @@ static void audin_winmm_parse_addin_args(AudinWinmmDevice* device, ADDIN_ARGV* a
COMMAND_LINE_ARGUMENT_A* arg;
AudinWinmmDevice* winmm = (AudinWinmmDevice*) device;

flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;

status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv, audin_winmm_args, flags, winmm, NULL, NULL);

Expand All @@ -265,7 +265,7 @@ static void audin_winmm_parse_addin_args(AudinWinmmDevice* device, ADDIN_ARGV* a

CommandLineSwitchStart(arg)

CommandLineSwitchCase(arg, "audio-dev")
CommandLineSwitchCase(arg, "dev")
{
winmm->device_name = _strdup(arg->Value);
}
Expand Down
26 changes: 14 additions & 12 deletions channels/drdynvc/client/drdynvc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr,

if (dvcman->num_listeners < MAX_PLUGINS)
{
WLog_DBG(TAG, "%d.%s.", dvcman->num_listeners, pszChannelName);
WLog_DBG(TAG, "create_listener: %d.%s.", dvcman->num_listeners, pszChannelName);

listener = (DVCMAN_LISTENER*) malloc(sizeof(DVCMAN_LISTENER));
ZeroMemory(listener, sizeof(DVCMAN_LISTENER));
Expand All @@ -67,7 +67,7 @@ static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr,
}
else
{
WLog_WARN(TAG, "Maximum DVC listener number reached.");
WLog_WARN(TAG, "create_listener: Maximum DVC listener number reached.");
return 1;
}
}
Expand All @@ -78,14 +78,14 @@ static int dvcman_register_plugin(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const cha

if (dvcman->num_plugins < MAX_PLUGINS)
{
WLog_DBG(TAG, "num_plugins %d", dvcman->num_plugins);
dvcman->plugin_names[dvcman->num_plugins] = name;
dvcman->plugins[dvcman->num_plugins++] = pPlugin;
WLog_DBG(TAG, "register_plugin: num_plugins %d", dvcman->num_plugins);
return 0;
}
else
{
WLog_WARN(TAG, "Maximum DVC plugin number reached.");
WLog_WARN(TAG, "register_plugin: Maximum DVC plugin number reached.");
return 1;
}
}
Expand Down Expand Up @@ -335,7 +335,7 @@ static int dvcman_close_channel_iface(IWTSVirtualChannel* pChannel)
{
DVCMAN_CHANNEL* channel = (DVCMAN_CHANNEL*) pChannel;

WLog_DBG(TAG, "id=%d", channel->channel_id);
WLog_DBG(TAG, "close_channel_iface: id=%d", channel->channel_id);

return 1;
}
Expand Down Expand Up @@ -409,6 +409,7 @@ int dvcman_open_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 ChannelId
pCallback = channel->channel_callback;
if (pCallback->OnOpen)
pCallback->OnOpen(pCallback);
WLog_DBG(TAG, "open_channel: ChannelId %d", ChannelId);
}

return 0;
Expand Down Expand Up @@ -569,7 +570,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UIN
UINT32 chunkLength;
int status;

WLog_DBG(TAG, "ChannelId=%d size=%d", ChannelId, dataSize);
WLog_DBG(TAG, "write_data: ChannelId=%d size=%d", ChannelId, dataSize);

if (drdynvc->channel_error != CHANNEL_RC_OK)
return 1;
Expand Down Expand Up @@ -656,6 +657,7 @@ static int drdynvc_send_capability_response(drdynvcPlugin* drdynvc)
int status;
wStream* s;

WLog_DBG(TAG, "capability_response");
s = Stream_New(NULL, 4);
Stream_Write_UINT16(s, 0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */
Stream_Write_UINT16(s, drdynvc->version);
Expand All @@ -676,7 +678,7 @@ static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, in
{
int status;

WLog_DBG(TAG, "Sp=%d cbChId=%d", Sp, cbChId);
WLog_DBG(TAG, "capability_request Sp=%d cbChId=%d", Sp, cbChId);

Stream_Seek(s, 1); /* pad */
Stream_Read_UINT16(s, drdynvc->version);
Expand Down Expand Up @@ -746,7 +748,7 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb

ChannelId = drdynvc_read_variable_uint(s, cbChId);
pos = Stream_GetPosition(s);
WLog_DBG(TAG, "ChannelId=%d ChannelName=%s", ChannelId, Stream_Pointer(s));
WLog_DBG(TAG, "process_create_request: ChannelId=%d ChannelName=%s", ChannelId, Stream_Pointer(s));

channel_status = dvcman_create_channel(drdynvc->channel_mgr, ChannelId, (char*) Stream_Pointer(s));

Expand Down Expand Up @@ -792,7 +794,7 @@ static int drdynvc_process_data_first(drdynvcPlugin* drdynvc, int Sp, int cbChId

ChannelId = drdynvc_read_variable_uint(s, cbChId);
Length = drdynvc_read_variable_uint(s, Sp);
WLog_DBG(TAG, "ChannelId=%d Length=%d", ChannelId, Length);
WLog_DBG(TAG, "process_data_first: Sp=%d cbChId=%d, ChannelId=%d Length=%d", Sp, cbChId, ChannelId, Length);

status = dvcman_receive_channel_data_first(drdynvc->channel_mgr, ChannelId, Length);

Expand All @@ -807,7 +809,7 @@ static int drdynvc_process_data(drdynvcPlugin* drdynvc, int Sp, int cbChId, wStr
UINT32 ChannelId;

ChannelId = drdynvc_read_variable_uint(s, cbChId);
WLog_DBG(TAG, "ChannelId=%d", ChannelId);
WLog_DBG(TAG, "process_data: Sp=%d cbChId=%d, ChannelId=%d", Sp, cbChId, ChannelId);

return dvcman_receive_channel_data(drdynvc->channel_mgr, ChannelId, s);
}
Expand All @@ -821,7 +823,7 @@ static int drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp, int cbC

ChannelId = drdynvc_read_variable_uint(s, cbChId);

WLog_DBG(TAG, "ChannelId=%d", ChannelId);
WLog_DBG(TAG, "process_close_request: Sp=%d cbChId=%d, ChannelId=%d", Sp, cbChId, ChannelId);

dvcman_close_channel(drdynvc->channel_mgr, ChannelId);

Expand Down Expand Up @@ -858,7 +860,7 @@ static void drdynvc_order_recv(drdynvcPlugin* drdynvc, wStream* s)
Sp = (value & 0x0c) >> 2;
cbChId = (value & 0x03) >> 0;

WLog_DBG(TAG, "Cmd=0x%x", Cmd);
WLog_DBG(TAG, "order_recv: Cmd=0x%x, Sp=%d cbChId=%d, ChannelId=%d", Cmd, Sp, cbChId);

switch (Cmd)
{
Expand Down
2 changes: 1 addition & 1 deletion channels/rdpsnd/client/alsa/rdpsnd_alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ static int rdpsnd_alsa_parse_addin_args(rdpsndDevicePlugin* device, ADDIN_ARGV*
COMMAND_LINE_ARGUMENT_A* arg;
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*) device;

flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;

status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv, rdpsnd_alsa_args, flags, alsa, NULL, NULL);
if (status < 0)
Expand Down
2 changes: 1 addition & 1 deletion channels/rdpsnd/client/opensles/rdpsnd_opensles.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ static int rdpsnd_opensles_parse_addin_args(rdpsndDevicePlugin* device,

DEBUG_SND("opensles=%p, args=%p", opensles, args);

flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;

status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
rdpsnd_opensles_args, flags, opensles, NULL, NULL);
Expand Down
Loading

0 comments on commit 7b3a552

Please sign in to comment.