Conditionally compile audio support.
This commit is contained in:
parent
8c0e0e019b
commit
8e732ed2ab
@ -42,23 +42,30 @@ AM_CFLAGS = -Werror -Wall -pedantic -Iinclude @LIBGUAC_INCLUDE@
|
||||
lib_LTLIBRARIES = libguac-client-vnc.la
|
||||
|
||||
libguac_client_vnc_la_SOURCES = \
|
||||
src/client.c \
|
||||
src/vnc_handlers.c \
|
||||
src/guac_handlers.c \
|
||||
src/pa_handlers.c \
|
||||
src/queue.c \
|
||||
src/buffer.c \
|
||||
src/convert.c
|
||||
client.c \
|
||||
vnc_handlers.c \
|
||||
guac_handlers.c \
|
||||
convert.c
|
||||
|
||||
noinst_HEADERS = \
|
||||
include/client.h \
|
||||
include/vnc_handlers.h \
|
||||
include/guac_handlers.h \
|
||||
include/pa_handlers.h \
|
||||
include/queue.h \
|
||||
include/buffer.h \
|
||||
include/convert.h
|
||||
noinst_HEADERS = \
|
||||
client.h \
|
||||
vnc_handlers.h \
|
||||
guac_handlers.h \
|
||||
convert.h
|
||||
|
||||
libguac_client_vnc_la_LDFLAGS = -version-info 0:0:0 @VNC_LIBS@ @CAIRO_LIBS@
|
||||
# Optional PulseAudio support
|
||||
if ENABLE_PULSE
|
||||
libguac_client_vnc_la_SOURCES += \
|
||||
pa_handlers.c \
|
||||
queue.c \
|
||||
buffer.c
|
||||
|
||||
noinst_HEADERS += \
|
||||
pa_handlers.h \
|
||||
queue.h \
|
||||
buffer.h
|
||||
endif
|
||||
|
||||
libguac_client_vnc_la_LDFLAGS = -version-info 0:0:0 @VNC_LIBS@ @CAIRO_LIBS@ @PULSE_LIBS@
|
||||
libguac_client_vnc_la_LIBADD = @LIBGUAC_LTLIB@
|
||||
|
||||
|
@ -54,7 +54,10 @@
|
||||
#include "client.h"
|
||||
#include "vnc_handlers.h"
|
||||
#include "guac_handlers.h"
|
||||
|
||||
#ifdef ENABLE_PULSE
|
||||
#include "pa_handlers.h"
|
||||
#endif
|
||||
|
||||
/* Client plugin arguments */
|
||||
const char* GUAC_CLIENT_ARGS[] = {
|
||||
@ -65,11 +68,16 @@ const char* GUAC_CLIENT_ARGS[] = {
|
||||
"password",
|
||||
"swap-red-blue",
|
||||
"color-depth",
|
||||
|
||||
#ifdef ENABLE_VNC_REPEATER
|
||||
"dest-host",
|
||||
"dest-port",
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_PULSE
|
||||
"disable-audio",
|
||||
#endif
|
||||
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -82,10 +90,16 @@ enum VNC_ARGS_IDX {
|
||||
IDX_PASSWORD,
|
||||
IDX_SWAP_RED_BLUE,
|
||||
IDX_COLOR_DEPTH,
|
||||
|
||||
#ifdef ENABLE_VNC_REPEATER
|
||||
IDX_DEST_HOST,
|
||||
IDX_DEST_PORT,
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_PULSE
|
||||
IDX_DISABLE_AUDIO,
|
||||
#endif
|
||||
|
||||
VNC_ARGS_COUNT
|
||||
};
|
||||
|
||||
@ -155,12 +169,13 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||
rfb_client->GetPassword = guac_vnc_get_password;
|
||||
|
||||
/* Depth */
|
||||
guac_vnc_set_pixel_format(rfb_client, atoi(argv[6]));
|
||||
guac_vnc_set_pixel_format(rfb_client, atoi(argv[IDX_COLOR_DEPTH]));
|
||||
|
||||
guac_client_data->audio_enabled = (strcmp(argv[7], "true") != 0);
|
||||
#ifdef ENABLE_PULSE
|
||||
guac_client_data->audio_enabled = (strcmp(argv[IDX_DISABLE_AUDIO], "true") != 0);
|
||||
|
||||
/* If audio enabled, choose an encoder */
|
||||
if (guac_client_data->audio_enabled) {
|
||||
/* If audio enabled, choose an encoder */
|
||||
if (guac_client_data->audio_enabled) {
|
||||
|
||||
/* Choose an encoding */
|
||||
for (i=0; client->info.audio_mimetypes[i] != NULL; i++) {
|
||||
@ -217,6 +232,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||
guac_client_log_info(client, "No available audio encoding. Sound disabled.");
|
||||
|
||||
} /* end if audio enabled */
|
||||
#endif
|
||||
|
||||
/* Hook into allocation so we can handle resize. */
|
||||
guac_client_data->rfb_MallocFrameBuffer = rfb_client->MallocFrameBuffer;
|
||||
|
@ -47,7 +47,10 @@
|
||||
|
||||
#include "client.h"
|
||||
#include "convert.h"
|
||||
|
||||
#ifdef ENABLE_PULSE
|
||||
#include "pa_handlers.h"
|
||||
#endif
|
||||
|
||||
int vnc_guac_client_handle_messages(guac_client* client) {
|
||||
|
||||
@ -126,6 +129,7 @@ int vnc_guac_client_free_handler(guac_client* client) {
|
||||
vnc_guac_client_data* guac_client_data = (vnc_guac_client_data*) client->data;
|
||||
rfbClient* rfb_client = guac_client_data->rfb_client;
|
||||
|
||||
#ifdef ENABLE_PULSE
|
||||
if (guac_client_data->audio_enabled) {
|
||||
|
||||
/* Wait for audio read and send threads to join */
|
||||
@ -139,6 +143,7 @@ int vnc_guac_client_free_handler(guac_client* client) {
|
||||
if(guac_client_data->audio_buffer)
|
||||
guac_pa_buffer_free(guac_client_data->audio_buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Free encodings string, if used */
|
||||
if (guac_client_data->encodings != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user