Make vorbis support conditional.

This commit is contained in:
Michael Jumper 2012-11-22 18:42:27 -08:00
parent 6e3f04536b
commit 9e9ecca022
3 changed files with 32 additions and 4 deletions

View File

@ -43,11 +43,11 @@ lib_LTLIBRARIES = libguac-client-rdp.la
freerdp_LTLIBRARIES = guac_rdpsnd.la
libguac_client_rdp_la_SOURCES = \
$(OGG_SOURCES) \
src/audio.c \
src/client.c \
src/default_pointer.c \
src/guac_handlers.c \
src/ogg_encoder.c \
src/rdp_bitmap.c \
src/rdp_cliprdr.c \
src/rdp_gdi.c \
@ -64,13 +64,13 @@ guac_rdpsnd_la_SOURCES = \
src/audio.c
noinst_HEADERS = \
$(OGG_HEADERS) \
guac_rdpsnd/messages.h \
guac_rdpsnd/service.h \
include/audio.h \
include/client.h \
include/default_pointer.h \
include/guac_handlers.h \
include/ogg_encoder.h \
include/rdp_bitmap.h \
include/rdp_cliprdr.h \
include/rdp_gdi.h \
@ -79,6 +79,13 @@ noinst_HEADERS = \
include/rdp_pointer.h \
include/wav_encoder.h
# Compile OGG support if available
if ENABLE_OGG
libguac_client_rdp_la_SOURCES += src/ogg_encoder.c
noinst_HEADERS += include/ogg_encoder.h
endif
libguac_client_rdp_la_LDFLAGS = -version-info 0:0:0
guac_rdpsnd_la_LDFLAGS = -module -avoid-version -shared

View File

@ -53,7 +53,23 @@ AC_CHECK_LIB([freerdp-utils], [xzalloc],, AC_MSG_ERROR("libfreerdp-utils is requ
AC_CHECK_LIB([freerdp-codec], [freerdp_image_convert],, AC_MSG_ERROR("libfreerdp-codec is required (part of FreeRDP)"))
AC_CHECK_LIB([pthread], [pthread_mutex_init],, AC_MSG_ERROR("libpthread is required"))
AC_CHECK_LIB([vorbisenc], [vorbis_encode_init],, AC_MSG_ERROR("libvorbisenc is required for sound"))
# Check for libvorbisenc
have_vorbisenc=no
AC_CHECK_HEADER(vorbis/vorbisenc.h,
AC_CHECK_LIB([vorbisenc], [vorbis_encode_init], [have_vorbisenc=yes]))
AM_CONDITIONAL([ENABLE_OGG], [test "x${have_vorbisenc}" = "xyes"])
if test "x${have_vorbisenc}" = "xno"
then
AC_MSG_WARN([
--------------------------------------------
Unable to find libvorbisenc.
Sound will not be encoded with Ogg Vorbis.
--------------------------------------------])
else
AC_DEFINE([ENABLE_OGG])
fi
# Checks for header files.
AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h freerdp/locale/keyboard.h freerdp/kbd/layouts.h])

View File

@ -65,9 +65,12 @@
#include <guacamole/error.h>
#include "audio.h"
#include "ogg_encoder.h"
#include "wav_encoder.h"
#ifdef ENABLE_OGG
#include "ogg_encoder.h"
#endif
#include "client.h"
#include "guac_handlers.h"
#include "rdp_keymap.h"
@ -132,12 +135,14 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
const char* mimetype = client->info.audio_mimetypes[i];
#ifdef ENABLE_OGG
/* If Ogg is supported, done. */
if (strcmp(mimetype, ogg_encoder->mimetype) == 0) {
guac_client_log_info(client, "Loading Ogg Vorbis encoder.");
guac_client_data->audio = audio_stream_alloc(client, ogg_encoder);
break;
}
#endif
/* If wav is supported, done. */
if (strcmp(mimetype, wav_encoder->mimetype) == 0) {