diff -u --recursive --new-file xine-lib-1-beta4-vanilla/configure xine-lib-1-beta4/configure
--- xine-lib-1-beta4-vanilla/configure	Wed Jan 29 20:08:13 2003
+++ xine-lib-1-beta4/configure	Fri Feb 14 14:48:42 2003
@@ -11524,7 +11524,7 @@
 
 
 case "$host" in
-  *-*-freebsd*)
+  *-*-freebsd*|*-*-openbsd*)
     THREAD_LIBS="-L/usr/local/lib -pthread"
     THREAD_CFLAGS="-I/usr/local/include -D_THREAD_SAFE"
 
diff -u --recursive --new-file xine-lib-1-beta4-vanilla/configure.ac xine-lib-1-beta4/configure.ac
--- xine-lib-1-beta4-vanilla/configure.ac	Wed Jan 29 19:44:40 2003
+++ xine-lib-1-beta4/configure.ac	Fri Feb 14 14:48:43 2003
@@ -171,7 +171,7 @@
 dnl threads
 dnl ---------------------------------------------
 case "$host" in
-  *-*-freebsd*)
+  *-*-freebsd*|*-*-openbsd*)
     THREAD_LIBS="-L/usr/local/lib -pthread"
     THREAD_CFLAGS="-I/usr/local/include -D_THREAD_SAFE"

diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/audio_out/audio_alsa_out.c xine-lib-1-beta4/src/audio_out/audio_alsa_out.c
--- xine-lib-1-beta4-vanilla/src/audio_out/audio_alsa_out.c	Sat Dec 21 13:56:46 2002
+++ xine-lib-1-beta4/src/audio_out/audio_alsa_out.c	Fri Feb 14 14:47:48 2003
@@ -978,13 +978,17 @@
   /* Create a thread which wait/handle mixer events */
   {
     pthread_attr_t       pth_attrs;
+#if ! defined (__OpenBSD__)
     struct sched_param   pth_params;
+#endif
     
     pthread_attr_init(&pth_attrs);
     
+#if ! defined (__OpenBSD__)
     pthread_attr_getschedparam(&pth_attrs, &pth_params);
     pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
     pthread_attr_setschedparam(&pth_attrs, &pth_params);
+#endif
     
     pthread_create(&this->mixer.thread, &pth_attrs, ao_alsa_handle_event_thread, (void *) this);
   }
diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/audio_out/audio_sun_out.c xine-lib-1-beta4/src/audio_out/audio_sun_out.c
--- xine-lib-1-beta4-vanilla/src/audio_out/audio_sun_out.c	Sat Dec 21 13:56:46 2002
+++ xine-lib-1-beta4/src/audio_out/audio_sun_out.c	Fri Feb 14 14:47:49 2003
@@ -65,6 +65,9 @@
 #define GAP_NONRT_TOLERANCE   AO_MAX_GAP
 #define	NOT_REAL_TIME		-1
 
+#if defined(__OpenBSD__)
+typedef unsigned int uint_t;
+#endif
 
 typedef struct {
   audio_driver_class_t driver_class;
@@ -770,7 +773,8 @@
     if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) < 0)
       return 0;
     return info.play.gain * 100 / AUDIO_MAX_GAIN;
-#if !defined(__NetBSD__)    /* audio_info.output_muted is missing on NetBSD */
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
+/* audio_info.output_muted is missing on NetBSD and OpenBSD */
   case AO_PROP_MUTE_VOL:
     if (ioctl(this->audio_fd, AUDIO_GETINFO, &info) < 0)
       return 0;
@@ -798,7 +802,8 @@
     if (ioctl(this->audio_fd, AUDIO_SETINFO, &info) < 0)
       return ~value;
     return value;
-#if !defined(__NetBSD__)    /* audio_info.output_muted is missing on NetBSD */
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
+/* audio_info.output_muted is missing on NetBSD and OpenBSD */
   case AO_PROP_MUTE_VOL:
     info.output_muted = value != 0;
     if (ioctl(this->audio_fd, AUDIO_SETINFO, &info) < 0)
diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/input/input_dvd.c xine-lib-1-beta4/src/input/input_dvd.c
--- xine-lib-1-beta4-vanilla/src/input/input_dvd.c	Fri Dec 27 17:47:10 2002
+++ xine-lib-1-beta4/src/input/input_dvd.c	Fri Feb 14 14:48:04 2003
@@ -50,15 +50,20 @@
 #include <errno.h>
 #include <dlfcn.h>
 
+#if defined(__OpenBSD__)
+#include <sys/param.h>
+#endif
 #include <sys/mount.h>
 #include <sys/wait.h>
 
 #include <sys/poll.h>
 #include <sys/ioctl.h>
 
-#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__)
 #include <sys/dvdio.h>
 #include <sys/cdio.h> /* CDIOCALLOW etc... */
+#elif defined(__OpenBSD__)
+#include <sys/cdio.h> /* CDIOCALLOW etc... */
 #elif defined(HAVE_LINUX_CDROM_H)
 #include <linux/cdrom.h>
 #elif defined(HAVE_SYS_CDIO_H)
@@ -133,6 +138,10 @@
 #define MAX_DIR_ENTRIES 1250
 #define MAX_STR_LEN     255  
 
+#if defined(__OpenBSD__)
+typedef int64_t off64_t; /* Where does this off64_t come from on other sys.? */
+#endif
+
 typedef struct {
   input_plugin_t    input_plugin; /* Parent input plugin type        */
 
@@ -1309,7 +1318,11 @@
     /* Read DVD name */
     fd=open(intended_dvd_device, O_RDONLY);
     if (fd > 0) { 
+#if ! defined(__OpenBSD__) /* I think this means OBSD will be broken. */
       off = lseek64( fd, 32 * (int64_t) DVD_VIDEO_LB_LEN, SEEK_SET );
+#else
+      off = lseek( fd, 32 * (int64_t) DVD_VIDEO_LB_LEN, SEEK_SET );
+#endif
       if( off == ( 32 * (int64_t) DVD_VIDEO_LB_LEN ) ) {
         off = read( fd, data, DVD_VIDEO_LB_LEN ); 
         close(fd);

diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/input/libdvdnav/vm.c xine-lib-1-beta4/src/input/libdvdnav/vm.c
--- xine-lib-1-beta4-vanilla/src/input/libdvdnav/vm.c	Sun Jan 26 00:18:40 2003
+++ xine-lib-1-beta4/src/input/libdvdnav/vm.c	Fri Feb 14 14:48:04 2003
@@ -48,6 +48,9 @@
 
 #define STRICT
 
+#if defined(__OpenBSD__)
+typedef int64_t off64_t; /* Where does this off64_t come from on other sys.? */
+#endif
 
 /* Local prototypes */
 
diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/input/libreal/rmff.h xine-lib-1-beta4/src/input/libreal/rmff.h
--- xine-lib-1-beta4-vanilla/src/input/libreal/rmff.h	Sun Dec 22 17:46:27 2002
+++ xine-lib-1-beta4/src/input/libreal/rmff.h	Fri Feb 14 14:48:02 2003
@@ -23,6 +23,9 @@
  * adopted from joschkas real tools
  */
 
+#if defined(__OpenBSD__)
+#include <sys/types.h>
+#endif
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>
diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/input/librtsp/rtsp_session.c xine-lib-1-beta4/src/input/librtsp/rtsp_session.c
--- xine-lib-1-beta4-vanilla/src/input/librtsp/rtsp_session.c	Tue Dec 24 02:10:53 2002
+++ xine-lib-1-beta4/src/input/librtsp/rtsp_session.c	Fri Feb 14 14:48:02 2003
@@ -22,6 +22,9 @@
  * high level interface to rtsp servers.
  */
 
+#if defined(__OpenBSD__)
+#include <sys/types.h>
+#endif
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>

diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/video_out/video_out_syncfb.c xine-lib-1-beta4/src/video_out/video_out_syncfb.c
--- xine-lib-1-beta4-vanilla/src/video_out/video_out_syncfb.c	Wed Jan 29 18:26:07 2003
+++ xine-lib-1-beta4/src/video_out/video_out_syncfb.c	Fri Feb 14 14:47:59 2003
@@ -41,7 +41,7 @@
 #endif
 
 #include <sys/ioctl.h>
-#if defined (__FreeBSD__)
+#if defined (__FreeBSD__) || defined (__OpenBSD__)
 #include <sys/types.h>
 #endif
 #include <sys/mman.h>

diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/xine-engine/audio_decoder.c xine-lib-1-beta4/src/xine-engine/audio_decoder.c
--- xine-lib-1-beta4-vanilla/src/xine-engine/audio_decoder.c	Sun Jan 26 00:18:51 2003
+++ xine-lib-1-beta4/src/xine-engine/audio_decoder.c	Fri Feb 14 14:48:20 2003
@@ -328,7 +328,9 @@
 void audio_decoder_init (xine_stream_t *stream) {
 
   pthread_attr_t       pth_attrs;
+#if ! defined (__OpenBSD__)
   struct sched_param   pth_params;
+#endif
   int                  err;
 
   if (stream->audio_out == NULL) {
@@ -354,9 +356,11 @@
   */
 
   pthread_attr_init(&pth_attrs);
+#if ! defined (__OpenBSD__)
   pthread_attr_getschedparam(&pth_attrs, &pth_params);
   pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
   pthread_attr_setschedparam(&pth_attrs, &pth_params);
+#endif
   pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
   
   if ((err = pthread_create (&stream->audio_thread,
diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/xine-engine/load_plugins.c xine-lib-1-beta4/src/xine-engine/load_plugins.c
--- xine-lib-1-beta4-vanilla/src/xine-engine/load_plugins.c	Wed Jan 29 18:26:09 2003
+++ xine-lib-1-beta4/src/xine-engine/load_plugins.c	Fri Feb 14 14:48:20 2003
@@ -294,7 +294,11 @@
 	    printf("load_plugins: %s not cached\n", str);
 #endif
 
+#if defined(__OpenBSD__) /* OpenBSD does not have RTLD_GLOBAL. */
+	  if(!info && !(lib = dlopen (str, RTLD_LAZY))) {
+#else
 	  if(!info && !(lib = dlopen (str, RTLD_LAZY | RTLD_GLOBAL))) {
+#endif
 
 	    if (this->verbosity) {
 	      char *dl_error_msg = dlerror();
@@ -408,7 +412,11 @@
 
   void *lib;
 
+#if defined(__OpenBSD__) /* OpenBSD does not have RTLD_GLOBAL. */
+  if(!(lib = dlopen (filename, RTLD_LAZY))) {
+#else
   if(!(lib = dlopen (filename, RTLD_LAZY | RTLD_GLOBAL))) {
+#endif
 
     xine_log (this, XINE_LOG_PLUGIN,
 	      _("load_plugins: cannot (stage 2) open plugin lib %s:\n%s\n"),
diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/xine-engine/video_decoder.c xine-lib-1-beta4/src/xine-engine/video_decoder.c
--- xine-lib-1-beta4-vanilla/src/xine-engine/video_decoder.c	Sun Jan 26 00:18:51 2003
+++ xine-lib-1-beta4/src/xine-engine/video_decoder.c	Fri Feb 14 14:48:20 2003
@@ -363,7 +363,9 @@
 void video_decoder_init (xine_stream_t *stream) {
   
   pthread_attr_t       pth_attrs;
+#if ! defined (__OpenBSD__)
   struct sched_param   pth_params;
+#endif
   int		       err;
 
   /* The fifo size is based on dvd playback where buffers are filled
@@ -377,9 +379,11 @@
   stream->spu_track_map_entries = 0;
 
   pthread_attr_init(&pth_attrs);
+#if ! defined (__OpenBSD__)
   pthread_attr_getschedparam(&pth_attrs, &pth_params);
   pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
   pthread_attr_setschedparam(&pth_attrs, &pth_params);
+#endif
   pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
   
   if ((err = pthread_create (&stream->video_thread,

diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/xine-utils/memcpy.c xine-lib-1-beta4/src/xine-utils/memcpy.c
--- xine-lib-1-beta4-vanilla/src/xine-utils/memcpy.c	Sat Jan 25 23:18:43 2003
+++ xine-lib-1-beta4/src/xine-utils/memcpy.c	Fri Feb 14 14:47:47 2003
@@ -406,7 +406,8 @@
     __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
     return x;
   } else {
-    return times(NULL);
+    struct tms tp;
+    return times(&tp); /* Passing NULL does not work with OpenBSD. */
   }
 }
 #else
@@ -414,7 +415,8 @@
 {
   /* FIXME: implement an equivalent for using optimized memcpy on other
             architectures */
-  return times(NULL);
+  struct tms tp;
+  return times(&tp); /* Passing NULL does not work on OpenBSD. */
 }
 #endif
 
diff -u --recursive --new-file xine-lib-1-beta4-vanilla/src/xine-utils/ppcasm_string.S xine-lib-1-beta4/src/xine-utils/ppcasm_string.S
--- xine-lib-1-beta4-vanilla/src/xine-utils/ppcasm_string.S	Sat Oct 12 06:29:06 2002
+++ xine-lib-1-beta4/src/xine-utils/ppcasm_string.S	Fri Feb 14 14:47:47 2003
@@ -22,10 +22,13 @@
 #define __ASSEMBLY__
 
 #include "ppc_asm.tmpl"
+
+#if defined(__linux__)
 #include <linux/config.h>
 #include <asm/processor.h>
 #include <asm/cache.h>
 #include <asm/errno.h>
+#endif /* __linux__ */
 
 #define COPY_16_BYTES		\
 	lwz	r7,4(r4);	\
