summaryrefslogtreecommitdiff
path: root/src/xine-utils/cpu_accel.c
diff options
context:
space:
mode:
authorRobin KAY <komadori@users.sourceforge.net>2003-10-20 00:33:28 +0000
committerRobin KAY <komadori@users.sourceforge.net>2003-10-20 00:33:28 +0000
commit8c7d24b606e3b5b02f20424abee1c240d7696a1f (patch)
tree653f8fe4b70e11a23e768b015002d5764e19f2bb /src/xine-utils/cpu_accel.c
parent9fd15a6bb66fbdc762ef385d0cdf72d39cb73367 (diff)
downloadxine-lib-8c7d24b606e3b5b02f20424abee1c240d7696a1f.tar.gz
xine-lib-8c7d24b606e3b5b02f20424abee1c240d7696a1f.tar.bz2
Allow lazy loading of Sun mediaLib. Update ChangeLog.
CVS patchset: 5553 CVS date: 2003/10/20 00:33:28
Diffstat (limited to 'src/xine-utils/cpu_accel.c')
-rw-r--r--src/xine-utils/cpu_accel.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c
index 6794143f7..d0f328112 100644
--- a/src/xine-utils/cpu_accel.c
+++ b/src/xine-utils/cpu_accel.c
@@ -26,6 +26,7 @@
#include <inttypes.h>
#include <signal.h>
#include <setjmp.h>
+#include <dlfcn.h>
#include "xineutils.h"
@@ -174,16 +175,32 @@ static uint32_t arch_accel (void)
uint32_t xine_mm_accel (void)
{
-#if defined (ARCH_X86) || (defined (ARCH_PPC) && defined (ENABLE_ALTIVEC))
+ static int initialized = 0;
static uint32_t accel;
- static int initialized;
if (!initialized) {
+#if defined (ARCH_X86) || (defined (ARCH_PPC) && defined (ENABLE_ALTIVEC))
accel = arch_accel ();
+#elif defined (HAVE_MLIB)
+#ifdef MLIB_LAZYLOAD
+ void *hndl;
+
+ if ((hndl = dlopen("libmlib.so.2", RTLD_LAZY | RTLD_GLOBAL | RTLD_NODELETE)) == NULL) {
+ accel = 0;
+ }
+ else {
+ dlclose(hndl);
+ accel = MM_ACCEL_MLIB;
+ }
+#else
+ accel = MM_ACCEL_MLIB;
+#endif
+#else
+ accel = 0;
+#endif
#if defined(ARCH_X86) || defined(ARCH_X86_64)
#ifndef _MSC_VER
-
/* test OS support for SSE */
if( accel & MM_ACCEL_X86_SSE ) {
void (*old_sigill_handler)(int);
@@ -202,22 +219,14 @@ uint32_t xine_mm_accel (void)
signal (SIGILL, old_sigill_handler);
}
#endif /* _MSC_VER */
-#endif /* ARCH_X86 */
+#endif /* ARCH_X86 || ARCH_X86_64 */
- if( getenv("XINE_NO_ACCEL") )
+ if(getenv("XINE_NO_ACCEL")) {
accel = 0;
+ }
- initialized++;
+ initialized = 1;
}
return accel;
-
-#else /* !ARCH_X86 && !ARCH_PPC/ENABLE_ALTIVEC */
-#ifdef HAVE_MLIB
- return MM_ACCEL_MLIB;
-#else
- return 0;
-#endif
-#endif /* !ARCH_X86 && !ARCH_PPC/ENABLE_ALTIVEC */
}
-