diff --git a/proto.h b/proto.h index b6a7520..6520141 100644 --- a/proto.h +++ b/proto.h @@ -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 */ diff --git a/rdesktop.c b/rdesktop.c index 10cc0e9..8446188 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -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,36 +670,9 @@ 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 - { - g_rdpsnd = True; - } + rdpsnd_optarg = + next_arg(optarg, ':'); + g_rdpsnd = True; } #else @@ -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; - } + 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) diff --git a/rdpsnd.c b/rdpsnd.c index 7f7b7ac..2536fa9 100644 --- a/rdpsnd.c +++ b/rdpsnd.c @@ -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)