diff -ruN softdevice-20100118/Makefile softdevice-20100118-darwin/Makefile
--- softdevice-20100118/Makefile	2008-04-14 05:52:10.000000000 +0300
+++ softdevice-20100118-darwin/Makefile	2010-04-19 21:58:05.000000000 +0300
@@ -9,6 +9,9 @@
 #
 PLUGIN = softdevice
 
+APPLE_DARWIN = $(shell gcc -dumpmachine | grep -q 'apple-darwin' && echo "1" || echo "0")
+MAC_OS_X_VERSION_10_5 = $(shell gcc -dumpmachine | grep -q 'apple-darwin9' && echo "1" || echo "0")
+
 ### The version number of this plugin (taken from the main source file):
 
 VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
@@ -27,6 +30,10 @@
 TMPDIR     = /tmp
 PLUGINLIBDIR = ./PLUGINS/lib
 
+ifeq ($(MAC_OS_X_VERSION_10_5), 1)
+LDFLAGS = -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
+endif
+
 # for older file-utils, option -f had the same effect
 CPOPTS = --remove-destination
 
@@ -199,19 +206,23 @@
 ### normally you shoudn't have to touch something below this line
 
 CXX      ?= g++
-CXXFLAGS ?= -O2 -g -Wall -fPIC -Woverloaded-virtual 
+CXXFLAGS ?= -O2 -g -Wall -fPIC -Woverloaded-virtual -fpermissive
 CXXFLAGS += $(ADD_CXXFLAGS)
 DEFINES  += -D__STDC_CONSTANT_MACROS
 
 SHARED_FLAG ?= -shared
 
+ifeq ($(APPLE_DARWIN), 1)
+CXXFLAGS += -arch i386
+endif
+
 ### The directory environment:
 
 
 ### The version number of VDR (taken from VDR's "config.h"):
 
 VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
-APIVERSION = $(shell sed -ne '/define APIVERSION/ { s/^.*"\(.*\)".*$$/\1/; p }' $(VDRDIR)/config.h)
+APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
 
 ifeq ($(APIVERSION),)
 	APIVERSION = $(VDRVERSION)
@@ -225,6 +236,9 @@
 ### Includes and Defines (add further entries here):
 
 INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include $(FFMPEGCFLAGS)
+ifeq ($(APPLE_DARWIN), 1)
+INCLUDES += -I/sw/include -I/opt/local/include
+endif
 
 DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -D_GNU_SOURCE
 DEFINES += -DPLUGINLIBDIR='"$(PLUGINLIBDIR)"'
@@ -330,7 +344,7 @@
 
 
 %.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
+	$(CXX) $(LDFLAGS) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
 
 # Dependencies:
 
@@ -371,29 +385,29 @@
 all: $(TARGETS) i18n
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) $(SHARED_FLAG) $(OBJS) $(LIBS) -o $@
+	$(CXX) $(LDFLAGS) $(CXXFLAGS) $(SHARED_FLAG) $(OBJS) $(LIBS) -o $@
 	@cp $(CPOTS) $@ $(LIBDIR)/$@.$(APIVERSION)
 
 ifdef USE_SUBPLUGINS
 
 lib$(PLUGIN)-dfb.so: $(DFB_OBJS)
-	$(CXX) $(CXXFLAGS) $(SHARED_FLAG) $(DFB_OBJS) $(DFB_LIBS) -o $@
+	$(CXX) $(LDFLAGS) $(CXXFLAGS) $(SHARED_FLAG) $(DFB_OBJS) $(DFB_LIBS) -o $@
 	@cp $(CPOPTS) $@ $(LIBDIR)/$@.$(APIVERSION)
 
 lib$(PLUGIN)-fb.so: $(FB_OBJS)
-	$(CXX) $(CXXFLAGS) $(SHARED_FLAG) $(FB_OBJS) $(FB_LIBS) -o $@
+	$(CXX) $(LDFLAGS) $(CXXFLAGS) $(SHARED_FLAG) $(FB_OBJS) $(FB_LIBS) -o $@
 	@cp $(CPOPTS) $@ $(LIBDIR)/$@.$(APIVERSION)
 
 lib$(PLUGIN)-xv.so: $(XV_OBJS)
-	$(CXX) $(CXXFLAGS) $(SHARED_FLAG) $(XV_OBJS) $(XV_LIBS) -o $@
+	$(CXX) $(LDFLAGS) $(CXXFLAGS) $(SHARED_FLAG) $(XV_OBJS) $(XV_LIBS) -o $@
 	@cp $(CPOPTS) $@ $(LIBDIR)/$@.$(APIVERSION)
 
 lib$(PLUGIN)-vidix.so: $(VIDIX_OBJS)
-	$(CXX) $(CXXFLAGS) $(SHARED_FLAG) $(VIDIX_OBJS) $(VIDIX_LIBS) -o $@
+	$(CXX) $(LDFLAGS) $(CXXFLAGS) $(SHARED_FLAG) $(VIDIX_OBJS) $(VIDIX_LIBS) -o $@
 	@cp $(CPOPTS) $@ $(LIBDIR)/$@.$(APIVERSION)
 
 lib$(PLUGIN)-shm.so: $(SHM_OBJS)
-	$(CXX) $(CXXFLAGS) $(SHARED_FLAG) $(SHM_OBJS) $(SHM_LIBS) -o $@
+	$(CXX) $(LDFLAGS) $(CXXFLAGS) $(SHARED_FLAG) $(SHM_OBJS) $(SHM_LIBS) -o $@
 	@cp $(CPOPTS) $@ $(LIBDIR)/$@.$(APIVERSION)
 
 endif
@@ -423,13 +437,13 @@
 		   ShmClient_shm.o PicBuffer_shm.o
 
 %_shm.o: %.c
-	$(CXX) $(CXXFLAGS) -c $(DEFINES) -DSTAND_ALONE $(INCLUDES) $< -o $@
+	$(CXX) $(LDFLAGS) $(CXXFLAGS) -c $(DEFINES) -DSTAND_ALONE $(INCLUDES) $< -o $@
 
 ShmClient: $(SHM_CLIENT_OBJS)
-	$(CXX) $(CXXFLAGS) $(XV_LIBS)  $(SHM_CLIENT_OBJS) -lpthread -o $@
+	$(CXX) $(LDFLAGS) $(CXXFLAGS) $(XV_LIBS)  $(SHM_CLIENT_OBJS) -lpthread -o $@
 
 
 MacVdrClient_obj = video_shm.o video-quartz_shm.o setup-softdevice_shm.o utils_shm.o VdrReplacements_shm.o PicBuffer_shm.o setup-softlog_shm.o MacVdrClient_shm.o
 MacVdrClient: $(MacVdrClient_obj)
-	$(CXX) $(LDFLAGS) $(MacVdrClient_obj)  -framework Carbon -framework AGL -framework OpenGL -lpthread -o $@
+	$(CXX) $(LDFLAGS) $(MacVdrClient_obj) -arch i386 -framework Carbon -framework AGL -framework OpenGL -lpthread -o $@
 	cp $@ ./MacVdrClient.app/Contents/MacOS/MacVdrClient
diff -ruN softdevice-20100118/PicBuffer.c softdevice-20100118-darwin/PicBuffer.c
--- softdevice-20100118/PicBuffer.c	2008-07-27 20:34:42.000000000 +0300
+++ softdevice-20100118-darwin/PicBuffer.c	2010-04-18 12:57:07.000000000 +0300
@@ -84,7 +84,7 @@
                         memset(Pic->pixel[2],(color&0xFF),
                                         (Pic->max_height>>1)*Pic->stride[2]);
                         break;
-                case PIX_FMT_RGBA32 :
+                case PIX_FMT_ARGB :
                 case PIX_FMT_YUV422 :
                         {
                                 uint32_t *tmp=(uint32_t *)Pic->pixel[0];
@@ -109,7 +109,7 @@
         int pixel_size=GetFormatBPP(Pic->format);
 
         switch (Pic->format) {
-                case PIX_FMT_RGBA32 :
+                case PIX_FMT_ARGB :
                 case PIX_FMT_RGB24 :
                 case PIX_FMT_BGR24 :
                 case PIX_FMT_RGB555 :
@@ -140,7 +140,7 @@
 
 yuv420_convert_fct GetYuv420ConvertFct(PixelFormat pix_fmt) {
         switch (pix_fmt) {
-                case PIX_FMT_RGBA32:
+                case PIX_FMT_ARGB:
                         return &yuv420_to_rgb32;
                 case PIX_FMT_BGR24:
                         return &yuv420_to_bgr24;
@@ -255,7 +255,7 @@
         case PIX_FMT_YUV422:
         case PIX_FMT_RGB24:
         case PIX_FMT_BGR24:
-        case PIX_FMT_RGBA32:
+        case PIX_FMT_ARGB:
                 return false;
             break;
         default:
@@ -286,7 +286,7 @@
         case PIX_FMT_BGR24:
             pixel_size=3;
             break;
-        case PIX_FMT_RGBA32:
+        case PIX_FMT_ARGB:
             pixel_size=4;
             break;
         default:
@@ -318,7 +318,13 @@
         if ( !isPlanar(pix_fmt) ) {
                 buf->stride[0]=ALIGN(pixel_size*w,16);
 
+#ifndef __APPLE__
                 if (posix_memalign((void **) &buf->pixel[0], 16, buf->stride[0]*h+16)) {
+#else
+                buf->pixel[0]=(uint8_t*)malloc((buf->stride[0]*h)+16);
+                
+                if (buf->pixel[0]==NULL) {
+#endif
                     printf("could not allocate memory for picture buffer!\n") ;
                     exit(-1);
                     return false;
@@ -337,7 +343,13 @@
             buf->stride[i]= ALIGN(pixel_size*w>>h_shift,
                             STRIDE_ALIGN<<(h_chroma_shift-h_shift));
 
+#ifndef __APPLE__
             if(posix_memalign((void **) &buf->pixel[i], 16, (buf->stride[i]*h>>v_shift)+16)) { //FIXME 16
+#else
+            buf->pixel[i]= (uint8_t*)malloc((buf->stride[i]*h>>v_shift)+16); //FIXME 16
+
+            if(buf->pixel[i]==NULL) {
+#endif
                     printf("could not allocate memory for picture buffer!\n") ;
                     exit(-1);
                     return false;
diff -ruN softdevice-20100118/utils.c softdevice-20100118-darwin/utils.c
--- softdevice-20100118/utils.c	2009-02-27 19:02:35.000000000 +0200
+++ softdevice-20100118-darwin/utils.c	2010-04-18 12:57:07.000000000 +0300
@@ -163,9 +163,14 @@
    }
 #endif
    for ( ; i>=2; i-=2 ) {
+#ifdef __i386__
+	*((uint32_t *)dest1) = (yc1[1] << 24)+ (vc[0] << 16) + (yc1[0] << 8) + (uc[0] << 0);
+	*((uint32_t *)dest2) = (yc2[1] << 24)+ (vc[0] << 16) + (yc2[0] << 8) + (uc[0] << 0);
+#else
       *((uint32_t *)dest1) = (yc1[0] << 0)+ (uc[0] << 8) + (yc1[1] << 16) + (vc[0] << 24);
       *((uint32_t *)dest2) = (yc2[0] << 0)+ (uc[0] << 8) + (yc2[1] << 16) + (vc[0] << 24);
       //*idst++ = (yc[0] << 0)+ (uc[0] << 8) + (yc[1] << 16) + (vc[0] << 24);
+#endif
       dest1+=4;
       dest2+=4;
       yc1 += 2;
diff -ruN softdevice-20100118/utils.h softdevice-20100118-darwin/utils.h
--- softdevice-20100118/utils.h	2009-02-27 19:02:35.000000000 +0200
+++ softdevice-20100118-darwin/utils.h	2010-04-18 12:57:07.000000000 +0300
@@ -13,6 +13,10 @@
 #include "config.h"
 #include "mmx.h"
 
+#ifdef __APPLE__
+typedef unsigned long long   vuint64_t; // temp fix
+#endif
+
 // for MMX2 CPU's
 #ifdef USE_MMX2
 #define movntq(src,dest) do { movntq_r2m (src, dest); } while (0);
diff -ruN softdevice-20100118/video-quartz.c softdevice-20100118-darwin/video-quartz.c
--- softdevice-20100118/video-quartz.c	2007-05-10 22:54:44.000000000 +0300
+++ softdevice-20100118-darwin/video-quartz.c	2010-04-18 12:57:07.000000000 +0300
@@ -530,7 +530,7 @@
 					
 	windowAttrs &= (~kWindowResizableAttribute);
 					
-        CreateWindow(IMAGE_WIDTH/2, IMAGE_HEIGHT/2, windowAttrs);
+        CreateWindow(IMAGE_WIDTH, IMAGE_HEIGHT, windowAttrs);
 		
         if (theWindow == NULL) {
                 esyslog("Quartz error: Couldn't create window !!!!!\n");
@@ -687,7 +687,7 @@
 
         aglEnable(aglCtx, AGL_SWAP_INTERVAL);
         
-        long interval = 1;
+        const GLint interval = 1;
         aglSetInteger(aglCtx, AGL_SWAP_INTERVAL, &interval);
         
 
diff -ruN softdevice-20100118/video-quartz.h softdevice-20100118-darwin/video-quartz.h
--- softdevice-20100118/video-quartz.h	2007-05-10 22:54:44.000000000 +0300
+++ softdevice-20100118-darwin/video-quartz.h	2010-04-18 12:57:07.000000000 +0300
@@ -13,6 +13,9 @@
 
 #undef always_inline
 namespace MacOs {
+#ifdef __i386__
+#undef Status
+#endif
 #include <Carbon/Carbon.h>
 #include <OpenGL/gl.h>
 #include <OpenGL/glext.h>
diff -ruN softdevice-20100118/video-xv.c softdevice-20100118-darwin/video-xv.c
--- softdevice-20100118/video-xv.c	2009-06-14 21:24:11.000000000 +0300
+++ softdevice-20100118-darwin/video-xv.c	2010-04-18 12:57:07.000000000 +0300
@@ -28,6 +28,7 @@
 #include "xscreensaver.h"
 #include "utils.h"
 #include "setup-softdevice.h"
+#include <libavutil/pixfmt.h>
 
 #define PATCH_VERSION "2007-12-25"
 
@@ -1034,7 +1035,7 @@
                           osd_max_width, osd_max_height,
                           osd_image->bytes_per_line,osd_image->bits_per_pixel);
           switch (osd_image->bits_per_pixel) {
-                  case 32 : osdBuf.format=PIX_FMT_RGBA32;
+                  case 32 : osdBuf.format=PIX_FMT_ARGB;
                             break;
                   case 24 : osdBuf.format=PIX_FMT_RGB24;
                             break;
@@ -1240,7 +1241,7 @@
   attributeStore.Save();
 
   switch (osdBuf.format) {
-          case PIX_FMT_RGBA32:
+          case PIX_FMT_ARGB:
                   ARGB_TO_RGB(RGB32,&colorkey,COLOR_KEY);
                   break;
           case PIX_FMT_RGB24:
