move sound-driver selection code in rdpsnd_init

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1271 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Michael Gernoth 2006-09-21 19:00:11 +00:00
parent 162bc366b3
commit 6e6853dff8
3 changed files with 42 additions and 52 deletions

View File

@ -164,8 +164,7 @@ void rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out);
BOOL rdpdr_abort_io(uint32 fd, uint32 major, NTSTATUS status);
/* rdpsnd.c */
void rdpsnd_send_completion(uint16 tick, uint8 packet_index);
BOOL rdpsnd_init(void);
BOOL rdpsnd_select_driver(char *driver, char *options);
BOOL rdpsnd_init(char *optarg);
void rdpsnd_show_help(void);
void rdpsnd_play(void);
/* secure.c */

View File

@ -408,6 +408,7 @@ main(int argc, char *argv[])
BOOL geometry_option = False;
int run_count = 0; /* Session Directory support */
BOOL continue_connect = True; /* Session Directory support */
char *rdpsnd_optarg = NULL;
#ifdef HAVE_LOCALE_H
/* Set locale according to environment */
@ -669,37 +670,10 @@ main(int argc, char *argv[])
if (str_startswith(optarg, "local"))
#ifdef WITH_RDPSND
{
char *driver = NULL, *options =
NULL;
if ((driver =
next_arg(optarg, ':')))
{
if (!strlen(driver))
{
driver = NULL;
}
else if ((options =
next_arg(driver,
':')))
{
if (!strlen
(options))
options =
NULL;
}
}
if (!rdpsnd_select_driver
(driver, options))
{
warning("Driver not available\n");
}
else
{
rdpsnd_optarg =
next_arg(optarg, ':');
g_rdpsnd = True;
}
}
#else
warning("Not compiled with sound support\n");
@ -718,14 +692,7 @@ main(int argc, char *argv[])
else
{
#ifdef WITH_RDPSND
if (!rdpsnd_select_driver(NULL, NULL))
{
warning("No sound-driver available\n");
}
else
{
g_rdpsnd = True;
}
#else
warning("Not compiled with sound support\n");
#endif
@ -920,7 +887,12 @@ main(int argc, char *argv[])
#ifdef WITH_RDPSND
if (g_rdpsnd)
rdpsnd_init();
{
if (!rdpsnd_init(rdpsnd_optarg))
{
warning("Initializing sound-support failed!\n");
}
}
#endif
if (lspci_enabled)

View File

@ -276,16 +276,6 @@ rdpsnd_process(STREAM s)
}
}
BOOL
rdpsnd_init(void)
{
rdpsnd_channel =
channel_register("rdpsnd", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP,
rdpsnd_process);
return (rdpsnd_channel != NULL);
}
BOOL
rdpsnd_auto_open(void)
{
@ -347,12 +337,41 @@ rdpsnd_register_drivers(char *options)
}
BOOL
rdpsnd_select_driver(char *driver, char *options)
rdpsnd_init(char *optarg)
{
static struct audio_driver auto_driver;
struct audio_driver *pos;
char *driver = NULL, *options = NULL;
drivers = NULL;
rdpsnd_channel =
channel_register("rdpsnd", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP,
rdpsnd_process);
if (rdpsnd_channel == NULL)
{
error("channel_register\n");
return False;
}
if (optarg != NULL && strlen(optarg) > 0)
{
driver = options = optarg;
while (*options != '\0' && *options != ':')
options++;
if (*options == ':')
{
*options = '\0';
options++;
}
if (*options == '\0')
options = NULL;
}
rdpsnd_register_drivers(options);
if (!driver)