summaryrefslogtreecommitdiff
path: root/src/xine-utils
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2003-04-20 21:13:21 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2003-04-20 21:13:21 +0000
commitfeacf7fa8788c911b241385e40c631362af50395 (patch)
tree20491c9acd09fc0240ba7e349dbebd343a7fafc4 /src/xine-utils
parent5031bfdd4c2a17d09804e99447d4f9cbae81a7b8 (diff)
downloadxine-lib-feacf7fa8788c911b241385e40c631362af50395.tar.gz
xine-lib-feacf7fa8788c911b241385e40c631362af50395.tar.bz2
merging in win32 port
CVS patchset: 4643 CVS date: 2003/04/20 21:13:21
Diffstat (limited to 'src/xine-utils')
-rw-r--r--src/xine-utils/compat.h10
-rw-r--r--src/xine-utils/cpu_accel.c8
-rw-r--r--src/xine-utils/memcpy.c30
-rw-r--r--src/xine-utils/utils.c8
-rw-r--r--src/xine-utils/xineutils.h39
5 files changed, 84 insertions, 11 deletions
diff --git a/src/xine-utils/compat.h b/src/xine-utils/compat.h
index c18e8b442..a6592b030 100644
--- a/src/xine-utils/compat.h
+++ b/src/xine-utils/compat.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: compat.h,v 1.2 2001/12/14 21:03:03 f1rmb Exp $
+ * $Id: compat.h,v 1.3 2003/04/20 21:13:26 guenter Exp $
*
*/
@@ -30,10 +30,12 @@
extern "C" {
#endif
-#ifndef __GNUC__
-#define __XINE_FUNCTION__ __func__
-#else
+#if defined _MSC_VER
+#define __XINE_FUNCTION__ __FILE__
+#elif defined __GNUC__
#define __XINE_FUNCTION__ __FUNCTION__
+#else
+#define __XINE_FUNCTION__ __func__
#endif
#ifndef NAME_MAX
diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c
index feca22e51..965c89271 100644
--- a/src/xine-utils/cpu_accel.c
+++ b/src/xine-utils/cpu_accel.c
@@ -36,6 +36,8 @@
#ifdef ARCH_X86
static uint32_t arch_accel (void)
{
+#ifndef _MSC_VER
+
uint32_t eax, ebx, ecx, edx;
int AMD;
uint32_t caps;
@@ -111,6 +113,9 @@ static uint32_t arch_accel (void)
caps |= MM_ACCEL_X86_MMXEXT;
return caps;
+#else /* _MSC_VER */
+ return 0;
+#endif
}
static jmp_buf sigill_return;
@@ -165,6 +170,8 @@ uint32_t xine_mm_accel (void)
accel = arch_accel ();
#ifdef ARCH_X86
+#ifndef _MSC_VER
+
/* test OS support for SSE */
if( accel & MM_ACCEL_X86_SSE ) {
void (*old_sigill_handler)(int);
@@ -182,6 +189,7 @@ uint32_t xine_mm_accel (void)
signal (SIGILL, old_sigill_handler);
}
+#endif /* _MSC_VER */
#endif /* ARCH_X86 */
initialized++;
diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c
index c2f3b2a84..68094364f 100644
--- a/src/xine-utils/memcpy.c
+++ b/src/xine-utils/memcpy.c
@@ -36,7 +36,10 @@
#ifdef ARCH_PPC
#include "ppcasm_string.h"
#endif
+
+#ifndef _MSC_VER
#include <sys/times.h>
+#endif
#include <stdlib.h>
#include <string.h>
@@ -111,6 +114,7 @@ quote of the day:
#ifdef ARCH_X86
+#ifndef _MSC_VER
/* for small memory blocks (<256 bytes) this version is faster */
#define small_memcpy(to,from,n)\
{\
@@ -371,19 +375,25 @@ void * mmx2_memcpy(void * to, const void * from, size_t len)
static void *linux_kernel_memcpy(void *to, const void *from, size_t len) {
return __memcpy(to,from,len);
}
-
+#endif /* _MSC_VER */
#endif /* ARCH_X86 */
static struct {
char *name;
void *(* function)(void *to, const void *from, size_t len);
+
+#ifdef _MSC_VER
+ uint64_t time; /* This type could be used for non-MSC build too! */
+#else
unsigned long long time;
+#endif /* _MSC_VER */
+
uint32_t cpu_require;
} memcpy_method[] =
{
{ NULL, NULL, 0, 0 },
{ "glibc memcpy()", memcpy, 0, 0 },
-#ifdef ARCH_X86
+#if defined(ARCH_X86) && !defined(_MSC_VER)
{ "linux kernel memcpy()", linux_kernel_memcpy, 0, 0 },
{ "MMX optimized memcpy()", mmx_memcpy, 0, MM_MMX },
{ "MMXEXT optimized memcpy()", mmx2_memcpy, 0, MM_MMXEXT },
@@ -396,7 +406,7 @@ static struct {
{ NULL, NULL, 0, 0 }
};
-#ifdef ARCH_X86
+#if defined(ARCH_X86) && !defined(_MSC_VER)
static unsigned long long int rdtsc(int config_flags)
{
unsigned long long int x;
@@ -410,11 +420,16 @@ static unsigned long long int rdtsc(int config_flags)
}
}
#else
-static unsigned long long int rdtsc(int config_flags)
+
+static uint64_t rdtsc(int config_flags)
{
/* FIXME: implement an equivalent for using optimized memcpy on other
architectures */
+#ifndef _MSC_VER
return times(NULL);
+#else
+ return ((uint64_t)0);
+#endif /* _MSC_VER */
}
#endif
@@ -443,13 +458,18 @@ static void update_fast_memcpy(void *this_gen, xine_cfg_entry_t *entry) {
#define BUFSIZE 1024*1024
void xine_probe_fast_memcpy(config_values_t *config)
{
+#ifdef _MSC_VER
+ uint64_t t;
+#else
unsigned long long t;
+#endif /* _MSC_VER */
+
char *buf1, *buf2;
int i, j, best;
int config_flags = -1;
static char *memcpy_methods[] = {
"probe", "glibc",
-#ifdef ARCH_X86
+#if defined(ARCH_X86) && !defined(_MSC_VER)
"kernel", "mmx", "mmxext", "sse",
#endif
#ifdef ARCH_PPC
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index 828d7d934..d79388cea 100644
--- a/src/xine-utils/utils.c
+++ b/src/xine-utils/utils.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: utils.c,v 1.12 2003/03/03 17:29:07 mroi Exp $
+ * $Id: utils.c,v 1.13 2003/04/20 21:13:28 guenter Exp $
*
*/
#define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */
@@ -77,6 +77,11 @@ void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base) {
#endif
const char *xine_get_homedir(void) {
+
+#ifdef WIN32
+ return XINE_HOMEDIR;
+#else
+
struct passwd pwd, *pw = NULL;
static char homedir[BUFSIZ] = {0,};
@@ -104,6 +109,7 @@ const char *xine_get_homedir(void) {
}
return homedir;
+#endif /* _MSC_VER */
}
char *xine_chomp(char *str) {
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index 2fe21dca2..1aa6899a6 100644
--- a/src/xine-utils/xineutils.h
+++ b/src/xine-utils/xineutils.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xineutils.h,v 1.47 2003/03/25 21:26:01 heikos Exp $
+ * $Id: xineutils.h,v 1.48 2003/04/20 21:13:28 guenter Exp $
*
*/
#ifndef XINEUTILS_H
@@ -101,8 +101,13 @@ uint32_t xine_mm_accel (void);
#ifdef ARCH_X86
typedef union {
+#ifdef _MSC_VER
+ int64_t q; /* Quadword (64-bit) value */
+ uint64_t uq; /* Unsigned Quadword */
+#else
long long q; /* Quadword (64-bit) value */
unsigned long long uq; /* Unsigned Quadword */
+#endif
int d[2]; /* 2 Doubleword (32-bit) values */
unsigned int ud[2]; /* 2 Unsigned Doubleword */
short w[4]; /* 4 Word (16-bit) values */
@@ -569,7 +574,18 @@ typedef union {
/* Optimized/fast memcpy */
+/*
+ TODO : fix dll linkage problem for xine_fast_memcpy on win32
+
+ xine_fast_memcpy dll linkage is screwy here.
+ declairing as dllinport seems to fix the problem
+ but causes compiler warning with libxineutils
+*/
+#ifdef _MSC_VER
+void __declspec( dllimport ) *(* xine_fast_memcpy)(void *to, const void *from, size_t len);
+#else
extern void *(* xine_fast_memcpy)(void *to, const void *from, size_t len);
+#endif
#ifdef HAVE_XINE_INTERNAL_H
/* Benchmark available memcpy methods */
@@ -820,6 +836,25 @@ void xine_print_trace(void);
} \
} while(0)
#else /* not GNU C, assume we have a C99 compiler */
+
+#ifdef _MSC_VER
+/*
+ #define XINE_ASSERT(exp, desc) ((void)((exp) || \
+ (printf desc, _assert(#exp, __FILE__, __LINE__), 0)))
+
+*/
+# define XINE_ASSERT(exp, desc) \
+ do { \
+ if (!(exp)) { \
+ printf("%s:%s:%d: assertion `%s' failed. ", \
+ __FILE__, __XINE_FUNCTION__, __LINE__, #exp); \
+ printf(desc); \
+ printf("\n\n"); \
+ xine_print_trace(); \
+ XINE_ABORT(); \
+ } \
+ } while(0)
+#else
# define XINE_ASSERT(exp, ...) \
do { \
if (!(exp)) { \
@@ -831,6 +866,8 @@ void xine_print_trace(void);
XINE_ABORT(); \
} \
} while(0)
+#endif /* _MSC_VER */
+
#endif