Add disable-audio option.

This commit is contained in:
Michael Jumper 2012-11-22 19:07:03 -08:00
parent 0459299569
commit dceda44d67
2 changed files with 45 additions and 27 deletions

View File

@ -139,6 +139,11 @@ typedef struct rdp_guac_client_data {
*/ */
char* clipboard; char* clipboard;
/**
* Whether audio is enabled.
*/
int audio_enabled;
/** /**
* Audio output, if any. * Audio output, if any.
*/ */

View File

@ -91,6 +91,7 @@ const char* GUAC_CLIENT_ARGS[] = {
"height", "height",
"initial-program", "initial-program",
"color-depth", "color-depth",
"disable-audio",
NULL NULL
}; };
@ -103,7 +104,8 @@ enum ARGS_IDX {
IDX_WIDTH, IDX_WIDTH,
IDX_HEIGHT, IDX_HEIGHT,
IDX_INITIAL_PROGRAM, IDX_INITIAL_PROGRAM,
IDX_COLOR_DEPTH IDX_COLOR_DEPTH,
IDX_DISABLE_AUDIO
}; };
int __guac_receive_channel_data(freerdp* rdp_inst, int channelId, uint8* data, int size, int flags, int total_size) { int __guac_receive_channel_data(freerdp* rdp_inst, int channelId, uint8* data, int size, int flags, int total_size) {
@ -130,6 +132,9 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
"cliprdr", NULL)) "cliprdr", NULL))
guac_client_log_error(client, "Failed to load cliprdr plugin."); guac_client_log_error(client, "Failed to load cliprdr plugin.");
/* If audio enabled, choose an encoder */
if (guac_client_data->audio_enabled) {
/* Choose an encoding */ /* Choose an encoding */
for (i=0; client->info.audio_mimetypes[i] != NULL; i++) { for (i=0; client->info.audio_mimetypes[i] != NULL; i++) {
@ -139,7 +144,8 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
/* If Ogg is supported, done. */ /* If Ogg is supported, done. */
if (strcmp(mimetype, ogg_encoder->mimetype) == 0) { if (strcmp(mimetype, ogg_encoder->mimetype) == 0) {
guac_client_log_info(client, "Loading Ogg Vorbis encoder."); guac_client_log_info(client, "Loading Ogg Vorbis encoder.");
guac_client_data->audio = audio_stream_alloc(client, ogg_encoder); guac_client_data->audio = audio_stream_alloc(client,
ogg_encoder);
break; break;
} }
#endif #endif
@ -147,7 +153,8 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
/* If wav is supported, done. */ /* If wav is supported, done. */
if (strcmp(mimetype, wav_encoder->mimetype) == 0) { if (strcmp(mimetype, wav_encoder->mimetype) == 0) {
guac_client_log_info(client, "Loading wav encoder."); guac_client_log_info(client, "Loading wav encoder.");
guac_client_data->audio = audio_stream_alloc(client, wav_encoder); guac_client_data->audio = audio_stream_alloc(client,
wav_encoder);
break; break;
} }
@ -167,6 +174,8 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
guac_client_log_info(client, guac_client_log_info(client,
"No available audio encoding. Sound disabled."); "No available audio encoding. Sound disabled.");
} /* end if audio enabled */
/* Init color conversion structure */ /* Init color conversion structure */
clrconv = xnew(CLRCONV); clrconv = xnew(CLRCONV);
clrconv->alpha = 1; clrconv->alpha = 1;
@ -437,6 +446,10 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
argv[IDX_WIDTH], settings->color_depth); argv[IDX_WIDTH], settings->color_depth);
} }
/* Audio enable/disable */
guac_client_data->audio_enabled =
(strcmp(argv[IDX_DISABLE_AUDIO], "true") != 0);
/* Order support */ /* Order support */
bitmap_cache = settings->bitmap_cache; bitmap_cache = settings->bitmap_cache;
settings->os_major_type = OSMAJORTYPE_UNSPECIFIED; settings->os_major_type = OSMAJORTYPE_UNSPECIFIED;