diff --git a/ext/a52dec/gsta52dec.c b/ext/a52dec/gsta52dec.c index e9e1e3a4d9..e59ee0d762 100644 --- a/ext/a52dec/gsta52dec.c +++ b/ext/a52dec/gsta52dec.c @@ -45,7 +45,9 @@ #include #include -#include +#if !defined(A52_ACCEL_DETECT) +# include +#endif #include "gsta52dec.h" #if HAVE_ORC @@ -136,7 +138,7 @@ gst_a52dec_class_init (GstA52DecClass * klass) GObjectClass *gobject_class; GstElementClass *gstelement_class; GstAudioDecoderClass *gstbase_class; - guint cpuflags; + guint cpuflags = 0; gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; @@ -199,24 +201,23 @@ gst_a52dec_class_init (GstA52DecClass * klass) * generic software djbfft based one when available in the used liba52 */ #ifdef MM_ACCEL_DJBFFT klass->a52_cpuflags = MM_ACCEL_DJBFFT; +#elif defined(A52_ACCEL_DETECT) + klass->a52_cpuflags = A52_ACCEL_DETECT; #else klass->a52_cpuflags = 0; #endif -#if HAVE_ORC +#if HAVE_ORC && !defined(A52_ACCEL_DETECT) cpuflags = orc_target_get_default_flags (orc_target_get_by_name ("mmx")); - if (cpuflags & ORC_TARGET_MMX_MMX) klass->a52_cpuflags |= MM_ACCEL_X86_MMX; if (cpuflags & ORC_TARGET_MMX_3DNOW) klass->a52_cpuflags |= MM_ACCEL_X86_3DNOW; if (cpuflags & ORC_TARGET_MMX_MMXEXT) klass->a52_cpuflags |= MM_ACCEL_X86_MMXEXT; -#else - cpuflags = 0; #endif - GST_LOG ("CPU flags: a52=%08x, liboil=%08x", klass->a52_cpuflags, cpuflags); + GST_LOG ("CPU flags: a52=%08x, orc=%08x", klass->a52_cpuflags, cpuflags); } static void @@ -245,7 +246,13 @@ gst_a52dec_start (GstAudioDecoder * dec) GST_DEBUG_OBJECT (dec, "start"); klass = GST_A52DEC_CLASS (G_OBJECT_GET_CLASS (a52dec)); +#if defined(A52_ACCEL_DETECT) + a52dec->state = a52_init (); + /* This line is just to avoid being accused of not using klass */ + a52_accel (klass->a52_cpuflags & A52_ACCEL_DETECT); +#else a52dec->state = a52_init (klass->a52_cpuflags); +#endif if (!a52dec->state) { GST_ELEMENT_ERROR (GST_ELEMENT (a52dec), LIBRARY, INIT, (NULL), diff --git a/m4/a52.m4 b/m4/a52.m4 index 0065deeb15..e5625817b9 100644 --- a/m4/a52.m4 +++ b/m4/a52.m4 @@ -79,14 +79,18 @@ int main () { a52_state_t *state; +#if defined(A52_ACCEL_DETECT) + state = a52_init (); +#else state = a52_init (0); +#endif a52_free (state); return 0; } ],, HAVE_A52DEC=no, [echo $ac_n "cross compiling; assumed OK... $ac_c"]) if test HAVE_A52DEC = "no"; then - echo "*** Your a52dec is borked somehow. Please update to 0.7.4." + echo "*** Your a52dec is borked somehow. Please update to 0.7.4 or newer." else AC_TRY_RUN([ #include @@ -102,7 +106,7 @@ main () ], HAVE_A52DEC=no,, [echo $ac_n "cross compiling; assumed OK... $ac_c"]) if test HAVE_A52DEC = "no"; then - echo "*** Your a52dec is too old. Please update to 0.7.4." + echo "*** Your a52dec is too old. Please update to 0.7.4 or newer." fi fi CFLAGS="$ac_save_CFLAGS"