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.
This commit is contained in:
Tim-Philipp Müller 2010-06-08 13:26:53 +01:00
parent 3f3691085a
commit 164a91d10d
3 changed files with 32 additions and 13 deletions

View file

@ -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

View file

@ -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)

View file

@ -50,10 +50,11 @@
#include <gst/audio/audio.h>
#include <gst/base/gstbasetransform.h>
#ifndef DISABLE_ORC
#include <orc/orc.h>
#include <orc-test/orctest.h>
#include <orc-test/orcprofile.h>
#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,