rdpsnd: restore old behavior and fixes

* oss: fix function signature
* autodetection - if only /sound is given all enabled
  plugins are tried in order and the first successful loaded is used.
	- this restores the previous behavior
* alsa/pulse fix command line parsing - no parameters shouldn't be
  treated as error
This commit is contained in:
Bernhard Miklautz 2015-07-20 12:28:49 +02:00
parent e682329eeb
commit f992568432
4 changed files with 88 additions and 103 deletions

View File

@ -670,10 +670,13 @@ WIN32ERROR freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_PO
alsa->device.Free = rdpsnd_alsa_free;
args = pEntryPoints->args;
if ((error = rdpsnd_alsa_parse_addin_args((rdpsndDevicePlugin*) alsa, args)))
if (args->argc > 1)
{
WLog_ERR(TAG, "rdpsnd_alsa_parse_addin_args failed with error %lu", error);
goto error_parse_args;
if ((error = rdpsnd_alsa_parse_addin_args((rdpsndDevicePlugin *) alsa, args)))
{
WLog_ERR(TAG, "rdpsnd_alsa_parse_addin_args failed with error %lu", error);
goto error_parse_args;
}
}

View File

@ -654,11 +654,14 @@ WIN32ERROR freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_PO
pulse->device.Free = rdpsnd_pulse_free;
args = pEntryPoints->args;
ret = rdpsnd_pulse_parse_addin_args((rdpsndDevicePlugin*) pulse, args);
if (ret != CHANNEL_RC_OK)
if (args->argc > 1)
{
WLog_ERR(TAG, "error parsing arguments");
goto error;
ret = rdpsnd_pulse_parse_addin_args((rdpsndDevicePlugin *) pulse, args);
if (ret != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "error parsing arguments");
goto error;
}
}
ret = CHANNEL_RC_NO_MEMORY;

View File

@ -36,9 +36,6 @@
#include <winpr/crt.h>
#include <winpr/wlog.h>
#include <winpr/synch.h>
#include <winpr/print.h>
#include <winpr/thread.h>
#include <winpr/stream.h>
#include <winpr/cmdline.h>
#include <winpr/sysinfo.h>
@ -46,9 +43,6 @@
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/constants.h>
#include <freerdp/channels/log.h>
#include <freerdp/utils/signal.h>
#include "rdpsnd_main.h"
@ -751,75 +745,78 @@ static WIN32ERROR rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* ar
rdpsnd->wQualityMode = HIGH_QUALITY; /* default quality mode */
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
rdpsnd_args, flags, rdpsnd, NULL, NULL);
if (status < 0)
return CHANNEL_RC_INITIALIZATION_ERROR;
arg = rdpsnd_args;
do
if (args->argc > 1)
{
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
continue;
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
status = CommandLineParseArgumentsA(args->argc, (const char **) args->argv,
rdpsnd_args, flags, rdpsnd, NULL, NULL);
CommandLineSwitchStart(arg)
if (status < 0)
return CHANNEL_RC_INITIALIZATION_ERROR;
CommandLineSwitchCase(arg, "sys")
{
if (!rdpsnd_set_subsystem(rdpsnd, arg->Value))
return CHANNEL_RC_NO_MEMORY;
}
CommandLineSwitchCase(arg, "dev")
{
if (!rdpsnd_set_device_name(rdpsnd, arg->Value))
return CHANNEL_RC_NO_MEMORY;
}
CommandLineSwitchCase(arg, "format")
{
rdpsnd->fixedFormat = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "rate")
{
rdpsnd->fixedRate = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "channel")
{
rdpsnd->fixedChannel = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "latency")
{
rdpsnd->latency = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "quality")
{
int wQualityMode = DYNAMIC_QUALITY;
arg = rdpsnd_args;
if (_stricmp(arg->Value, "dynamic") == 0)
wQualityMode = DYNAMIC_QUALITY;
else if (_stricmp(arg->Value, "medium") == 0)
wQualityMode = MEDIUM_QUALITY;
else if (_stricmp(arg->Value, "high") == 0)
wQualityMode = HIGH_QUALITY;
else
wQualityMode = atoi(arg->Value);
if ((wQualityMode < 0) || (wQualityMode > 2))
wQualityMode = DYNAMIC_QUALITY;
rdpsnd->wQualityMode = (UINT16) wQualityMode;
}
CommandLineSwitchDefault(arg)
do
{
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
continue;
CommandLineSwitchStart(arg)
CommandLineSwitchCase(arg, "sys")
{
if (!rdpsnd_set_subsystem(rdpsnd, arg->Value))
return CHANNEL_RC_NO_MEMORY;
}
CommandLineSwitchCase(arg, "dev")
{
if (!rdpsnd_set_device_name(rdpsnd, arg->Value))
return CHANNEL_RC_NO_MEMORY;
}
CommandLineSwitchCase(arg, "format")
{
rdpsnd->fixedFormat = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "rate")
{
rdpsnd->fixedRate = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "channel")
{
rdpsnd->fixedChannel = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "latency")
{
rdpsnd->latency = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "quality")
{
int wQualityMode = DYNAMIC_QUALITY;
if (_stricmp(arg->Value, "dynamic") == 0)
wQualityMode = DYNAMIC_QUALITY;
else if (_stricmp(arg->Value, "medium") == 0)
wQualityMode = MEDIUM_QUALITY;
else if (_stricmp(arg->Value, "high") == 0)
wQualityMode = HIGH_QUALITY;
else
wQualityMode = atoi(arg->Value);
if ((wQualityMode < 0) || (wQualityMode > 2))
wQualityMode = DYNAMIC_QUALITY;
rdpsnd->wQualityMode = (UINT16) wQualityMode;
}
CommandLineSwitchDefault(arg)
{
}
CommandLineSwitchEnd(arg)
}
CommandLineSwitchEnd(arg)
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
}
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
return CHANNEL_RC_OK;
}
@ -827,7 +824,7 @@ static WIN32ERROR rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* ar
static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
{
ADDIN_ARGV* args;
WIN32ERROR status;
WIN32ERROR status = ERROR_INTERNAL_ERROR;
char *subsystem_name = NULL, *device_name = NULL;
rdpsnd->latency = -1;
@ -859,10 +856,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "ios";
device_name = "";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
}
#endif
@ -872,10 +866,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "opensles";
device_name = "";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
}
#endif
@ -885,10 +876,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "pulse";
device_name = "";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
}
#endif
@ -898,10 +886,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "alsa";
device_name = "default";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
}
#endif
@ -911,10 +896,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "oss";
device_name = "";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
}
#endif
@ -925,10 +907,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "mac";
device_name = "default";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
}
#endif
@ -938,12 +917,11 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "winmm";
device_name = "";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
}
#endif
if (status)
return status;
if (rdpsnd->device)
{

View File

@ -211,8 +211,9 @@ static UINT64 tsmf_oss_get_latency(ITSMFAudioDevice* audio)
return latency;
}
static void tsmf_oss_flush(ITSMFAudioDevice* audio)
static BOOL tsmf_oss_flush(ITSMFAudioDevice* audio)
{
return TRUE;
}
static void tsmf_oss_free(ITSMFAudioDevice* audio)