Add disable-audio option.
This commit is contained in:
parent
0459299569
commit
dceda44d67
@ -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.
|
||||||
*/
|
*/
|
||||||
|
@ -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,42 +132,49 @@ 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.");
|
||||||
|
|
||||||
/* Choose an encoding */
|
/* If audio enabled, choose an encoder */
|
||||||
for (i=0; client->info.audio_mimetypes[i] != NULL; i++) {
|
if (guac_client_data->audio_enabled) {
|
||||||
|
|
||||||
const char* mimetype = client->info.audio_mimetypes[i];
|
/* Choose an encoding */
|
||||||
|
for (i=0; client->info.audio_mimetypes[i] != NULL; i++) {
|
||||||
|
|
||||||
|
const char* mimetype = client->info.audio_mimetypes[i];
|
||||||
|
|
||||||
#ifdef ENABLE_OGG
|
#ifdef ENABLE_OGG
|
||||||
/* 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,
|
||||||
break;
|
ogg_encoder);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 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,
|
||||||
break;
|
wav_encoder);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/* If an encoding is available, load the sound plugin */
|
||||||
|
if (guac_client_data->audio != NULL) {
|
||||||
|
|
||||||
/* If an encoding is available, load the sound plugin */
|
/* Load sound plugin */
|
||||||
if (guac_client_data->audio != NULL) {
|
if (freerdp_channels_load_plugin(channels, instance->settings,
|
||||||
|
"guac_rdpsnd", guac_client_data->audio))
|
||||||
|
guac_client_log_error(client,
|
||||||
|
"Failed to load guac_rdpsnd plugin.");
|
||||||
|
|
||||||
/* Load sound plugin */
|
}
|
||||||
if (freerdp_channels_load_plugin(channels, instance->settings,
|
else
|
||||||
"guac_rdpsnd", guac_client_data->audio))
|
guac_client_log_info(client,
|
||||||
guac_client_log_error(client,
|
"No available audio encoding. Sound disabled.");
|
||||||
"Failed to load guac_rdpsnd plugin.");
|
|
||||||
|
|
||||||
}
|
} /* end if audio enabled */
|
||||||
else
|
|
||||||
guac_client_log_info(client,
|
|
||||||
"No available audio encoding. Sound disabled.");
|
|
||||||
|
|
||||||
/* Init color conversion structure */
|
/* Init color conversion structure */
|
||||||
clrconv = xnew(CLRCONV);
|
clrconv = xnew(CLRCONV);
|
||||||
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user