[MPlayer-dev-eng] fixes for mplayer needed on OpenBSD

Robert Nagy robert at openbsd.org
Mon Jul 12 00:53:31 CEST 2004


Moo. Diego asked me to post the patches here.
Have fun with them.

--- Makefile.orig	Tue Apr 13 13:22:37 2004
+++ Makefile	Mon Jul 12 00:51:31 2004
@@ -229,7 +229,7 @@
 ifeq ($(MENCODER),yes)
 $(PRG_MENCODER): $(MENCODER_DEP)
 	./darwinfixlib.sh $(MENCODER_DEP) libmpcodecs/libmpencoders.a
-	$(CC) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) libmpcodecs/libmpencoders.a $(ENCORE_LIB) $(COMMON_LIBS) $(EXTRA_LIB) $(MLIB_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(ARCH_LIB) $(I18NLIBS) -lm 
+	$(CXX) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) libmpcodecs/libmpencoders.a $(ENCORE_LIB) $(COMMON_LIBS) $(EXTRA_LIB) $(MLIB_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(ARCH_LIB) $(I18NLIBS) -lm 
 endif
 
 codecs.conf.h: $(PRG_CFG) etc/codecs.conf
@@ -287,8 +287,6 @@
 	@echo "*** Download skin(s) at http://www.mplayerhq.hu/homepage/dload.html"
 	@echo "*** for GUI, and extract to $(DATADIR)/Skin/"
 endif
-	@if test ! -d $(CONFDIR) ; then mkdir -p $(CONFDIR) ; fi
-	@if test -f $(CONFDIR)/codecs.conf ; then mv -f $(CONFDIR)/codecs.conf $(CONFDIR)/codecs.conf.old ; fi
 ifeq ($(DVDKIT_SHARED),yes)
 ifeq ($(DVDKIT2),yes)
 	if test ! -d $(LIBDIR) ; then mkdir -p $(LIBDIR) ; fi
--- TOOLS/subfont-c/subfont.c.orig	Sun Jul 13 23:25:22 2003
+++ TOOLS/subfont-c/subfont.c	Mon Jul 12 00:51:31 2004
@@ -834,6 +834,18 @@
 }
 
 
+// Returns current time in microseconds
+
+#include <sys/time.h>
+
+unsigned int GetTimer(){
+  struct timeval tv;
+  struct timezone tz;
+//  float s;
+  gettimeofday(&tv,&tz);
+//  s=tv.tv_usec;s*=0.000001;s+=tv.tv_sec;
+  return (tv.tv_sec*1000000+tv.tv_usec);
+}  
 void alpha() {
     unsigned int ttime;
     int const g_r = ceil(radius);
--- configure.orig	Mon Apr 26 11:44:06 2004
+++ configure	Mon Jul 12 00:51:31 2004
@@ -440,7 +440,7 @@
       i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686) host_arch=i386 ;;
       ia64) host_arch=ia64 ;;
       x86_64|amd64) host_arch=x86_64 ;;
-      ppc) host_arch=ppc ;;
+      macppc|ppc) host_arch=ppc ;;
       alpha) host_arch=alpha ;;
       sparc*) host_arch=sparc ;;
       parisc*|hppa*|9000*) host_arch=hppa ;;
@@ -4148,7 +4148,7 @@
 
 
 echocheck "VCD support"
-if linux || bsdos || freebsd || netbsd || sunos ; then
+if linux || bsdos || freebsd || netbsd || openbsd || sunos ; then
   _inputmodules="vcd $_inputmodules"
   _def_vcd='#define HAVE_VCD 1'
   echores "ok"
@@ -4991,7 +4991,7 @@
 
 
 echocheck "iconv"
-if test "$_iconv" = auto ; then
+if test "$_iconv" != no ; then
   _iconv_tmp='#include <iconv.h>'
 
   cat > $TMPC << EOF
@@ -6458,6 +6458,9 @@
 #define DEFAULT_DVD_DEVICE	"D:"
 #elif defined(SYS_DARWIN)
 #define DEFAULT_CDROM_DEVICE    "/dev/rdiskN"
+#define DEFAULT_DVD_DEVICE	DEFAULT_CDROM_DEVICE
+#elif defined(__OpenBSD__)
+#define DEFAULT_CDROM_DEVICE	"/dev/rcd0a"
 #define DEFAULT_DVD_DEVICE	DEFAULT_CDROM_DEVICE
 #else
 #define DEFAULT_CDROM_DEVICE    "/dev/cdrom"
--- libmpdemux/demux_real.c.orig	Tue Apr 27 22:04:26 2004
+++ libmpdemux/demux_real.c	Mon Jul 12 00:51:31 2004
@@ -1193,10 +1193,6 @@
 		    sh->wf->cbSize = 0;
 		    sh->format = MKTAG(buf[0], buf[1], buf[2], buf[3]);
 
-		    if ((version != 3) && (hdr_size != 0x4e)) {
-		    	mp_msg(MSGT_DEMUX,MSGL_V,"skipping %d extra header bytes\n", hdr_size-0x4e);
-		    	stream_skip(demuxer->stream, hdr_size-0x4e);
-		    }
 #if 0
 		    switch (sh->format){
 			case MKTAG('d', 'n', 'e', 't'):
--- loader/Makefile.orig	Thu Jan 29 13:01:26 2004
+++ loader/Makefile	Mon Jul 12 00:51:31 2004
@@ -32,9 +32,6 @@
 
 libloader.a:  $(LIB_OBJECTS) stubs.s
 	$(CC) -c ./stubs.s -o stubs.o
-ifeq ($(TARGET_OS),OpenBSD)
-	./loader_objfix.sh
-endif
 	$(AR) -r libloader.a $(LIB_OBJECTS) stubs.o
 
 dep:
--- loader/stubs.S.orig	Mon Jul 12 00:51:31 2004
+++ loader/stubs.S	Mon Jul 12 00:51:31 2004
@@ -0,0 +1,36 @@
+#include "../mangle.h"
+	.data
+.LC0:	.string	"Called unk_%s\n"
+       .balign 4
+.globl MANGLEA(unk_exp1)
+MANGLEA(unk_exp1):
+	pushl %ebp
+	movl %esp,%ebp
+	subl $4,%esp
+	movl $1,-4(%ebp)
+	movl -4(%ebp),%eax
+	movl %eax,%ecx
+	movl %ecx,%edx
+	sall $4,%edx
+	subl %eax,%edx
+	leal 0(,%edx,2),%eax
+	movl %eax,%edx
+	addl $MANGLEA(export_names),%edx
+	pushl %edx
+	pushl $.LC0
+	call MANGLEA(printf)
+	addl $8,%esp
+	xorl %eax,%eax
+	leave
+	ret
+.globl MANGLEA(exp_EH_prolog)
+MANGLEA(exp_EH_prolog):
+	pushl $0xff
+	pushl %eax
+	pushl %fs:0
+	movl  %esp, %fs:0
+	movl  12(%esp), %eax
+	movl  %ebp, 12(%esp)
+	leal  12(%esp), %ebp
+	pushl %eax
+	ret
--- loader/wrapper.S.orig	Mon Nov 25 21:37:12 2002
+++ loader/wrapper.S	Mon Jul 12 00:51:31 2004
@@ -1,27 +1,36 @@
+#include "../mangle.h"
+#if defined(__OpenBSD__) && !defined(__ELF__)
+.data
+#else
 .section .data
-.globl caller_return
-caller_return:
+#endif
+.globl MANGLEA(caller_return)
+MANGLEA(caller_return):
 	.long 0
-.globl report_entry
-report_entry:
-	.long null_call
-.globl report_ret
-report_ret:	
-	.long null_call
-.global wrapper_target
-wrapper_target:	
-	.long null_call
+.globl MANGLEA(report_entry)
+MANGLEA(report_entry):
+	.long MANGLEA(null_call)
+.globl MANGLEA(report_ret)
+MANGLEA(report_ret):	
+	.long MANGLEA(null_call)
+.global MANGLEA(wrapper_target)
+MANGLEA(wrapper_target):	
+	.long MANGLEA(null_call)
 
+#if defined(__OpenBSD__) && !defined(__ELF__)
+.text
+#else
 .section .text
-.globl null_call
-	.type null_call, @function
+#endif
+.globl MANGLEA(null_call)
+	.type MANGLEA(null_call), @function
 	.balign 16,0x90
-null_call:
+MANGLEA(null_call):
 	ret
-.globl wrapper
-	.type wrapper, @function
+.globl MANGLEA(wrapper)
+	.type MANGLEA(wrapper), @function
 	.balign 16,0x90
-wrapper:
+MANGLEA(wrapper):
 	pusha			# store registers (EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI) 
 	pushf			# store flags
 	
@@ -39,7 +48,7 @@
 	push %eax
 	push %edx
 	
-	call *report_entry	# report entry
+	call *MANGLEA(report_entry)	# report entry
 	
 	test %eax, %eax
 	jnz .Ldone
@@ -48,14 +57,14 @@
 	popf			# restore flags
 	popa			# restore registers
 	
-	popl caller_return	# switch return addresses
+	popl MANGLEA(caller_return)	# switch return addresses
 	pushl $.Lwrapper_return 
 	
-	jmp *wrapper_target	# wrapper_target should return at .Lwrapper_return
+	jmp *MANGLEA(wrapper_target)	# wrapper_target should return at .Lwrapper_return
 
 	.balign 16, 0x90
 .Lwrapper_return:	
-	pushl caller_return	# restore the original return address
+	pushl MANGLEA(caller_return)	# restore the original return address
 	pusha			# more for reference sake here
 	pushf
 	
@@ -73,7 +82,7 @@
 	push %eax
 	push %edx
 
-	call *report_ret	# report the return information (same args)
+	call *MANGLEA(report_ret)	# report the return information (same args)
 .Ldone:	
 
 	leave
--- mangle.h.orig	Sun Mar 30 22:11:05 2003
+++ mangle.h	Mon Jul 12 00:51:31 2004
@@ -11,8 +11,10 @@
 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__OS2__) || \
    (defined(__OpenBSD__) && !defined(__ELF__))
 #define MANGLE(a) "_" #a
+#define MANGLEA(a) _ ## a
 #else
 #define MANGLE(a) #a
+#define MANGLEA(a) a
 #endif
 
 #endif /* !__MANGLE_H */




More information about the MPlayer-dev-eng mailing list