From 164a91d10d7b8b4f35e9efd5cb1c4db9620509cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 8 Jun 2010 13:26:53 +0100 Subject: [PATCH] Fix build if orc is not installed Orc is not a hard requirement. Things should still compile and work without orc, but slow fallback code may be used in this case. Fix up configure to not error out if orc is not installed and wrap use of orc profiling in audioresample in #ifdefs. Fixes #620136 some more. --- configure.ac | 17 +++++++++-------- gst/audioresample/Makefile.am | 9 ++++++++- gst/audioresample/gstaudioresample.c | 19 +++++++++++++++---- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 1494223643..c43f963b0c 100644 --- a/configure.ac +++ b/configure.ac @@ -265,14 +265,15 @@ esac ORC_REQ=0.4.5 if test "x$enable_orc" = "xyes" ; then - PKG_CHECK_MODULES(ORC, orc-0.4 >= $ORC_REQ, HAVE_ORC=yes, HAVE_ORC=no) - if test "x$HAVE_ORC" != "xyes"; then - AC_ERROR([orc-$ORC_REQ or later is required]) - fi - AC_DEFINE(HAVE_ORC, 1, [Use Orc]) - - ORCC=`$PKG_CONFIG --variable=orcc orc-0.4` - AC_SUBST(ORCC) + PKG_CHECK_MODULES(ORC, orc-0.4 >= $ORC_REQ, [ + AC_DEFINE(HAVE_ORC, 1, [Use Orc]) + ORCC=`$PKG_CONFIG --variable=orcc orc-0.4` + AC_SUBST(ORCC) + HAVE_ORC=yes + ], [ + AC_DEFINE(DISABLE_ORC, 1, [Disable Orc]) + HAVE_ORC=no + ]) else AC_DEFINE(DISABLE_ORC, 1, [Disable Orc]) HAVE_ORC=no diff --git a/gst/audioresample/Makefile.am b/gst/audioresample/Makefile.am index 7f4e466d43..6118ec1bcd 100644 --- a/gst/audioresample/Makefile.am +++ b/gst/audioresample/Makefile.am @@ -1,5 +1,12 @@ plugin_LTLIBRARIES = libgstaudioresample.la +# FIXME: we still link against orc if it's there, even if --disable-orc was used +if HAVE_ORC +ORC_TEST_LIBS = -lorc-test-0.4 +else +ORC_TEST_LIBS = +endif + libgstaudioresample_la_SOURCES = \ gstaudioresample.c \ speex_resampler_int.c \ @@ -16,7 +23,7 @@ libgstaudioresample_la_LIBADD = \ $(GST_PLUGINS_BASE_LIBS) \ $(GST_BASE_LIBS) \ $(GST_LIBS) \ - $(ORC_LIBS) -lorc-test-0.4 \ + $(ORC_LIBS) $(ORC_TEST_LIBS) \ $(LIBM) libgstaudioresample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c index 6ec4213b45..d3b465adfb 100644 --- a/gst/audioresample/gstaudioresample.c +++ b/gst/audioresample/gstaudioresample.c @@ -50,10 +50,11 @@ #include #include +#ifndef DISABLE_ORC #include #include #include - +#endif GST_DEBUG_CATEGORY (audio_resample_debug); #define GST_CAT_DEFAULT audio_resample_debug @@ -1338,7 +1339,9 @@ gst_audio_resample_get_property (GObject * object, guint prop_id, } } -#if defined AUDIORESAMPLE_FORMAT_AUTO +/* FIXME: should have a benchmark fallback for the case where orc is disabled */ +#if defined(AUDIORESAMPLE_FORMAT_AUTO) && !defined(DISABLE_ORC) + #define BENCHMARK_SIZE 512 static gboolean @@ -1449,16 +1452,24 @@ error: return FALSE; } -#endif +#endif /* defined(AUDIORESAMPLE_FORMAT_AUTO) && !defined(DISABLE_ORC) */ static gboolean plugin_init (GstPlugin * plugin) { GST_DEBUG_CATEGORY_INIT (audio_resample_debug, "audioresample", 0, "audio resampling element"); -#if defined AUDIORESAMPLE_FORMAT_AUTO + +#if defined(AUDIORESAMPLE_FORMAT_AUTO) && !defined(DISABLE_ORC) if (!_benchmark_integer_resampling ()) return FALSE; +#else + GST_WARNING ("Orc disabled, can't benchmark int vs. float resampler"); + { + GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE); + GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); + GST_CAT_WARNING (GST_CAT_PERFORMANCE, "orc disabled, no benchmarking done"); + } #endif if (!gst_element_register (plugin, "audioresample", GST_RANK_PRIMARY,