From 9746106c48bf8e2bc4601f38e7f7b40cec938ff2 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Fri, 6 May 2016 19:18:30 +0200 Subject: Try to be compatible with celt 0.7.1 and 0.11 --- configure.ac | 10 +++++++++- src/audio.c | 5 +++++ src/audio.h | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index de8a9ff..864792c 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,15 @@ PKG_CHECK_MODULES(PROTOBUF, [libprotobuf-c],[], [ PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.28]) PKG_CHECK_MODULES(GIO, [gio-2.0]) PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10 gstreamer-app-0.10]) -PKG_CHECK_MODULES(CELT, [celt]) +PKG_CHECK_MODULES(CELT, [celt], [have_celt=yes], [have_celt=no]) +if test "x$have_celt" = xno; then + PKG_CHECK_MODULES(CELT, [celt071], [have_celt071=yes], [have_celt071=no]) + if test "x$have_celt071" = xno; then + AC_MSG_ERROR([Neither celt nor celt071 found.]) + fi + AC_DEFINE([HAVE_CELT071], [1], [Defined if we're using celt071]) +fi + GST_ELEMENTS="appsrc appsink celtdec celtenc capsfilter audioconvert audioresample autoaudiosrc autoaudiosink" diff --git a/src/audio.c b/src/audio.c index 65af769..cf18c78 100644 --- a/src/audio.c +++ b/src/audio.c @@ -211,7 +211,12 @@ setup_playback_gst_pipeline(struct cmumble *cm) { cm->audio.celt_mode = celt_mode_create(SAMPLERATE, SAMPLERATE / 100, NULL); + +#ifdef HAVE_CELT_071 celt_header_init(&cm->audio.celt_header, cm->audio.celt_mode, CHANNELS); +#else + celt_header_init(&cm->audio.celt_header, cm->audio.celt_mode, SAMPLERATE/100, CHANNELS); +#endif celt_header_to_packet(&cm->audio.celt_header, cm->audio.celt_header_packet, sizeof(CELTHeader)); diff --git a/src/audio.h b/src/audio.h index 1e1c47c..0f7aaa2 100644 --- a/src/audio.h +++ b/src/audio.h @@ -8,8 +8,13 @@ #include #include +#ifdef HAVE_CELT071 +#include +#include +#else #include #include +#endif struct cmumble_audio { GstElement *record_pipeline; -- cgit