Index: SoftOsd.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/SoftOsd.c,v
retrieving revision 1.37
diff -p -u -r1.37 SoftOsd.c
--- SoftOsd.c	17 Apr 2011 16:06:31 -0000	1.37
+++ SoftOsd.c	15 Nov 2013 15:03:17 -0000
@@ -25,7 +25,6 @@
 //#define SCALEDEBV(out...) printf(out)
 //#define SCALEDEBH(out...) printf(out)
 
-
 #ifndef OSDDEB
 #define OSDDEB(out...)
 #endif
@@ -55,16 +54,17 @@
 #define COLOR_64BIT(x) ( ((x)<<32) | (x) )
 #define ALPHA_VALUE(x) ( (x) << 24 )
 
-// the same constants for MMX mode
+//#undef USE_MMX
+//#undef USE_MMX2
+
+#ifdef USE_MMX2
 static uint64_t transparent_thr= COLOR_64BIT(ALPHA_VALUE(TRANSPARENT_THRESHOLD>>1));
 static uint64_t opacity_thr= COLOR_64BIT(ALPHA_VALUE(OPACITY_THRESHOLD>>1));
 static uint64_t pseudo_transparent = COLOR_64BIT(COLOR_KEY);
+#endif // USE_MMX2
 
 int cSoftOsd::colorkey;
 
-//#undef USE_MMX
-//#undef USE_MMX2
-
 #undef SPLAT_U16
 #ifdef USE_MMX2
 #define SPLAT_U16(X)   " pshufw $0b0, " X ", " X " \n"
@@ -77,69 +77,59 @@ int cSoftOsd::colorkey;
  */
 #if VDRVERSNUM >= 10509
 cSoftOsd::cSoftOsd(cVideoOut *VideoOut, int X, int Y, uint level)
-        : cOsd(X, Y, level),active(false),close(false) {
+        : cOsd(X, Y, level), shown(false) {
 #else
 cSoftOsd::cSoftOsd(cVideoOut *VideoOut, int X, int Y)
-        : cOsd(X, Y),active(false),close(false) {
+        : cOsd(X, Y), shown(false) {
 #endif
         OSDDEB("cSoftOsd constructor\n");
         OutputConvert=&cSoftOsd::ARGB_to_ARGB32;
         bitmap_Format=PF_None; // forces a clear after first SetMode
-        OSD_Bitmap=new uint32_t[OSD_STRIDE*(OSD_HEIGHT+4)];
+        OSD_Bitmap=new tColor[OSD_STRIDE*(OSD_HEIGHT+4)];
 
         videoOut = VideoOut;
         xPan = yPan = 0;
-        shown = false;
-        voutMutex.Lock();
         videoOut->OpenOSD();
         colorkey=videoOut->GetOSDColorkey();
+#ifdef USE_MMX2
         pseudo_transparent=(uint64_t)colorkey | ((uint64_t) colorkey)<<32;
+#endif // USE_MMX2
 
-        xOfs=X;yOfs=Y;
         ScreenOsdWidth=ScreenOsdHeight=0;
         int Depth=16; bool HasAlpha=false; bool AlphaInversed=false;
         bool IsYUV=false;
         videoOut->AdjustOSDMode();
         videoOut->GetOSDMode(Depth,HasAlpha,AlphaInversed,IsYUV);
         SetMode(Depth,HasAlpha,AlphaInversed,IsYUV);
-        voutMutex.Unlock();
 };
 
 /*--------------------------------------------------------------------------*/
 void cSoftOsd::Clear() {
         OSDDEB("Clear\n");
-        uint32_t blank=0x00000000; //COLOR_KEY;
+#if VDRVERSNUM >= 10509
+        if (!cOsd::Active()) return;
+#endif
+        tColor blank=tColor(COLOR_KEY);
         ConvertPalette((tColor *)&blank,(tColor *)&blank,1);
 
         register uint32_t fill=blank;
-        for (int i=OSD_STRIDE*(OSD_HEIGHT+2)-1; i!=0; i--)
-                OSD_Bitmap[i]=fill;
-        OSD_Bitmap[0]=fill;
 
-        // no dirty lines, everything has to be redrawn anyway
-        memset(dirty_lines,false,sizeof(dirty_lines));
+        if (fill == (fill & 0xff) * 0x1010101) {
+                memset(OSD_Bitmap, fill,
+                       OSD_STRIDE*(OSD_HEIGHT+4) * sizeof *OSD_Bitmap);
+        } else {
+                register tColor *b=OSD_Bitmap;
+                register const tColor *const e=b + OSD_STRIDE*(OSD_HEIGHT+4);
+                while (b < e) *b++=fill;
+        }
+
+        memset(dirty_lines,true,sizeof(dirty_lines));
 }
 
 /* --------------------------------------------------------------------------*/
 cSoftOsd::~cSoftOsd() {
         OSDDEB("cSoftOsd destructor\n");
-        close=true;
-        active=false;
         Cancel(3);
-        if (videoOut
-#if VDRVERSNUM >= 10509
-            && cOsd::Active()
-#endif
-            ) {
-                voutMutex.Lock();
-                videoOut->CloseOSD();
-#ifdef HAVE_YAEPGPATCH
-                if (vidWin.bpp!=0)
-                        videoOut->SetVidWin(0,0,0,0,0);
-#endif
-                videoOut=0;
-                voutMutex.Unlock();
-        }
         delete[] OSD_Bitmap;
 }
 
@@ -148,10 +138,6 @@ eOsdError cSoftOsd::SetAreas(const tArea
 {
         if (shown) {
                 Clear();
-#if VDRVERSNUM >= 10509
-                if (cOsd::Active())
-#endif
-                        videoOut->ClearOSD();
                 shown = false;
         }
         return cOsd::SetAreas(Areas, NumAreas);
@@ -176,22 +162,25 @@ void cSoftOsd::SetActive(bool On)
 /* -------------------------------------------------------------------------*/
 void cSoftOsd::Action() {
         OSDDEB("OSD thread started\n");
-        active=true;
-        while(active && videoOut && !close) {
+
+        voutMutex.Lock();
+
+        while (Running() && videoOut) {
                 int newOsdWidth;
                 int newOsdHeight;
                 int newXPan, newYPan;
 
-                voutMutex.Lock();
                 if (!videoOut
 #if VDRVERSNUM >= 10509
                     || !cOsd::Active()
 #endif
-                    ) {
+                ) {
+sleep:
                         voutMutex.Unlock();
                         usleep(17000);
+                        voutMutex.Lock();
                         continue;
-                };
+                }
 
                 videoOut->AdjustOSDMode();
                 videoOut->GetOSDDimension(newOsdWidth,newOsdHeight,newXPan,newYPan);
@@ -216,14 +205,22 @@ void cSoftOsd::Action() {
                                 ScreenOsdHeight!=newOsdHeight  ||
                                 modeChanged ) {
                         OSDDEB("Resolution or mode changed!\n");
-                        if (modeChanged)
-                                videoOut->ClearOSD();
                         OsdCommit();
                 }
-                voutMutex.Unlock();
 
-                usleep(17000);
+                goto sleep;
         }
+
+        if (
+#if VDRVERSNUM >= 10509
+            cOsd::Active()
+#else
+            true
+#endif
+        ) {
+                if (videoOut) videoOut->ClearOSD();
+        }
+        voutMutex.Unlock();
         OSDDEB("OSD thread ended\n");
 }
 
@@ -373,9 +370,7 @@ void cSoftOsd::Flush(void) {
         pthread_yield();
 #endif
 
-        if (!active && !close)
-                Start();
-
+        Start();
         shown = true;
 }
 
@@ -385,8 +380,16 @@ bool cSoftOsd::FlushBitmaps(bool OnlyDir
         bool OSD_changed=false;
         OSDDEB("FlushBitmaps (OnlyDirty: %d)\n",OnlyDirty);
 
-        for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) {
-                OSD_changed |= DrawConvertBitmap(Bitmap,OnlyDirty);
+        if (IsTrueColor()) {
+                LOCK_PIXMAPS;
+                while (cPixmapMemory *pm = RenderPixmaps()) {
+                        OSD_changed |= DrawConvertPixmap(pm);
+                        delete pm;
+                }
+        } else {
+                for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) {
+                        OSD_changed |= DrawConvertBitmap(Bitmap,OnlyDirty);
+                }
         }
         return OSD_changed;
 };
@@ -435,7 +438,7 @@ bool cSoftOsd::DrawConvertBitmap(cBitmap
         cMutexLock dirty(&dirty_Mutex);
         OSDDEB("DrawConvertBitmap %p, OnlyDirty %d\n",bitmap,OnlyDirty);
 
-        if ( !bitmap->Dirty(x1,y1,x2,y2) && OnlyDirty)
+        if (OnlyDirty && !bitmap->Dirty(x1,y1,x2,y2))
                 return false;
 
         if (!OnlyDirty) {
@@ -458,14 +461,14 @@ bool cSoftOsd::DrawConvertBitmap(cBitmap
 
         y2++;
         x2++;
-        y2= yOfs+y2+bitmap->Y0() > OSD_HEIGHT ?
-                OSD_HEIGHT-bitmap->Y0()-yOfs : y2;
-        x2= xOfs+x2+bitmap->X0() > OSD_WIDTH ?
-                OSD_WIDTH-bitmap->X0()-xOfs : x2;
+        y2= Top()+y2+bitmap->Y0() > OSD_HEIGHT ?
+                OSD_HEIGHT-bitmap->Y0()-Top() : y2;
+        x2= Left()+x2+bitmap->X0() > OSD_WIDTH ?
+                OSD_WIDTH-bitmap->X0()-Left() : x2;
 
-        int bitmap_yOfs=yOfs+bitmap->Y0()+Y_OFFSET;
+        int bitmap_yOfs=Top()+bitmap->Y0();
         uint32_t *OSD_pointer=&OSD_Bitmap[(bitmap_yOfs+y1)*OSD_STRIDE+
-                xOfs+bitmap->X0()+x1+X_OFFSET];
+                Left()+bitmap->X0()+x1];
         int missing_line_length=OSD_STRIDE-(x2-x1);
         bool *dirty_line=&dirty_lines[bitmap_yOfs+y1];
 
@@ -480,6 +483,42 @@ bool cSoftOsd::DrawConvertBitmap(cBitmap
         return true;
 };
 
+bool cSoftOsd::DrawConvertPixmap(cPixmapMemory *pm)
+{
+        int x1,x2,y1,y2;
+        const tColor *src=reinterpret_cast<const tColor*>(pm->Data());
+        OSDDEB("DrawConvertPixmap %p\n",pm);
+
+        x1=Left();
+        y1=Top();
+
+        x1+=pm->ViewPort().X();
+        x2=x1 + pm->ViewPort().Width();
+        y1+=pm->ViewPort().Y();
+        y2=y1 + pm->ViewPort().Height();
+        src+=pm->DrawPort().X() + pm->DrawPort().Y() * pm->DrawPort().Width();
+
+        OSDDEB("drawing pixmap %p from (%d,%d) to (%d,%d)\n",
+                        pm,x1,y1,x2,y2);
+
+        if (y1 > OSD_HEIGHT) y1=OSD_HEIGHT;
+        if (x1 > OSD_WIDTH) x1=OSD_WIDTH;
+        if (y2 > OSD_HEIGHT) y2=OSD_HEIGHT;
+        if (x2 > OSD_WIDTH) x2=OSD_WIDTH;
+
+        cMutexLock dirty(&dirty_Mutex);
+
+        tColor *dst=&OSD_Bitmap[y1*OSD_STRIDE+x1];
+
+        for (int y=y1; y<y2; dirty_lines[y++] = true) {
+                memcpy(dst, src, (x2 - x1) * sizeof(tColor));
+                src += pm->DrawPort().Width();
+                dst += OSD_STRIDE;
+        }
+
+        return y1 != y2;
+}
+
 /*----------------------------------------------------------------------*/
 
 void cSoftOsd::ARGB_to_AYUV(uint32_t * dest, color * pixmap, int Pixel) {
Index: SoftOsd.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/SoftOsd.h,v
retrieving revision 1.21
diff -p -u -r1.21 SoftOsd.h
--- SoftOsd.h	17 Apr 2011 17:22:18 -0000	1.21
+++ SoftOsd.h	15 Nov 2013 15:03:17 -0000
@@ -17,11 +17,11 @@
 #include <vdr/thread.h>
 
 // osd some constants and macros
-#define OPACITY_THRESHOLD 0x9FLL
-#define TRANSPARENT_THRESHOLD 0x1FLL
+#define OPACITY_THRESHOLD 0x1FLL
+#define TRANSPARENT_THRESHOLD 0x0FLL
 #define COLOR_KEY 0x00000000LL
 
-#if VDRVERSNUM <= 10707
+#if 1//VDRVERSNUM <= 10707
 
 #define OSD_WIDTH   720
 #define OSD_HEIGHT  576
@@ -35,18 +35,11 @@
 
 #endif
 
-#define IS_BACKGROUND(a) (((a) < OPACITY_THRESHOLD) && ((a) > TRANSPARENT_THRESHOLD))
+#define IS_BACKGROUND(a) (((a) < OPACITY_THRESHOLD) && ((a) >= TRANSPARENT_THRESHOLD))
 #define IS_TRANSPARENT(a) ((a) < TRANSPARENT_THRESHOLD)
-#define IS_OPAQUE(a) ((a) > OPACITY_THRESHOLD)
 
 #include "video.h"
 
-#define X_OFFSET 0
-#define Y_OFFSET 0
-
-
-#define COLOR_RGB16(r,g,b) (((b >> 3)& 0x1F) | ((g & 0xF8) << 2)| ((r & 0xF8)<<10) )
-
 #define GET_A(x) ((x) >> 24 & 0xFF)
 #define GET_R(x) ((x) >> 16 & 0xFF)
 #define GET_G(x) ((x) >>  8 & 0xFF)
@@ -56,31 +49,23 @@
 #define SET_R(x) ((x) << 16 & 0x00FF0000)
 #define SET_G(x) ((x) <<  8 & 0x0000FF00)
 #define SET_B(x) ((x) <<  0 & 0x000000FF)
-/*
-struct color {
-    unsigned char b;
-    unsigned char g;
-    unsigned char r;
-    unsigned char a;
-};
-*/
-typedef uint32_t color;
+
+typedef tColor color;
 
 class cVideoOut;
 
 /* ---------------------------------------------------------------------------
  */
-class cSoftOsd : public cOsd,cThread {
+class cSoftOsd : public cOsd, cThread {
 private:
     cMutex voutMutex; // lock all operations on videoOut!
     cVideoOut *videoOut;
 protected:
     static int colorkey;
-    int      xOfs, yOfs;
     int      xPan, yPan;
-    uint32_t *OSD_Bitmap;
     bool dirty_lines[OSD_HEIGHT+10];
     cMutex dirty_Mutex;
+    tColor*  OSD_Bitmap;
 
     void (*OutputConvert)(uint8_t * dest, color * pixmap, int Pixel, int odd);
     enum PixFormat {
@@ -96,8 +81,6 @@ protected:
     void ConvertPalette(tColor *dest_palette, const tColor *orig_palette,
                     int maxColors);
 
-    bool active;
-    bool close;
     bool shown;
     int ScreenOsdWidth;
     int ScreenOsdHeight;
@@ -126,6 +109,7 @@ protected:
 
     bool FlushBitmaps(bool OnlyDirty);
     bool DrawConvertBitmap(cBitmap *Bitmap, bool OnlyDirty);
+    bool DrawConvertPixmap(cPixmapMemory* pm);
 
     void OsdCommit(bool forced = false);
     // may only be called if the caller holds voutMutex
Index: VideoFilter.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/VideoFilter.c,v
retrieving revision 1.11
diff -p -u -r1.11 VideoFilter.c
--- VideoFilter.c	18 Apr 2008 15:10:35 -0000	1.11
+++ VideoFilter.c	15 Nov 2013 15:03:17 -0000
@@ -286,7 +286,7 @@ void cImageConvert::Filter(sPicBuffer *&
 #ifdef USE_SWSCALE
        sws_scale(img_convert_ctx, avpic_src.data, avpic_src.linesize,
                         0, orig->height, avpic_dest.data, avpic_dest.linesize);
-#else
+#elif 0
         if (img_convert(&avpic_dest,PIX_FMT_YUV420P,
                                 &avpic_src, orig->format,
                                 orig->width, orig->height) < 0) {
@@ -295,6 +295,9 @@ void cImageConvert::Filter(sPicBuffer *&
                                 "[softdevice] error, libavcodec img_convert failure\n");
                 return;
         }
+#else
+	dest = orig;
+	return;
 #endif
         CopyPicBufferContext(dest,orig);
 }
Index: configure
===================================================================
RCS file: /cvsroot/softdevice/softdevice/configure,v
retrieving revision 1.50
diff -p -u -r1.50 configure
--- configure	21 Sep 2008 12:55:57 -0000	1.50
+++ configure	15 Nov 2013 15:03:17 -0000
@@ -218,7 +218,7 @@ if test "${use_pkgconfig}" = "yes" ; the
   if test "${ffmpeg_use_path}" = "no" ; then
 
 echo "try to use pkg-config." >> config.log
-ffmpeg_l1="libavformat libavcodec"
+ffmpeg_l1="libavformat libavcodec libavutil zlib"
 
 pkg-config --libs libpostproc >> config.log 2>&1 && { ffmpeg_l1="$ffmpeg_l1 libpostproc";libpostproc="yes"; }
 
Index: i18n.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/i18n.c,v
retrieving revision 1.25
diff -p -u -r1.25 i18n.c
--- i18n.c	14 Apr 2008 02:28:09 -0000	1.25
+++ i18n.c	15 Nov 2013 15:03:18 -0000
@@ -7,6 +7,7 @@
  */
 
 #include "i18n.h"
+#if 0
 
 const tI18nPhrase Phrases[] = {
   { "Softdevice",   //  1
@@ -1343,3 +1344,4 @@ const tI18nPhrase Phrases[] = {
   },
   { NULL }
   };
+#endif
Index: i18n.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/i18n.h,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 i18n.h
--- i18n.h	1 Aug 2004 05:07:04 -0000	1.1.1.1
+++ i18n.h	15 Nov 2013 15:03:18 -0000
@@ -11,6 +11,4 @@
 
 #include <vdr/i18n.h>
 
-extern const tI18nPhrase Phrases[];
-
 #endif //_I18N__H
Index: mpeg2decoder.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/mpeg2decoder.c,v
retrieving revision 1.90
diff -p -u -r1.90 mpeg2decoder.c
--- mpeg2decoder.c	17 Apr 2011 17:22:18 -0000	1.90
+++ mpeg2decoder.c	15 Nov 2013 15:03:18 -0000
@@ -162,7 +162,7 @@ cStreamDecoder::cStreamDecoder(AVCodecCo
 #if HAS_ERROR_RECOGNITION
         context->error_recognition=1;
 #else
-        context->error_resilience=1;
+        context->error_concealment=1;
 #endif
   CMDDEB("Neuer StreamDecoder Pid: %d context %p type %d\n",
         getpid(),context,context->codec_type );
Index: shm-common.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/shm-common.h,v
retrieving revision 1.9
diff -p -u -r1.9 shm-common.h
--- shm-common.h	10 May 2007 19:49:51 -0000	1.9
+++ shm-common.h	15 Nov 2013 15:03:18 -0000
@@ -81,14 +81,14 @@ struct ShmCtlBlock {
         int setup_shmid;
 };
 
-inline void sem_wait_lock(int semid, int idx, int flag=0) 
+inline void sem_wait_lock(int semid, unsigned short idx, short int flag=0) 
 {
         struct sembuf sem_op = { idx, -1, flag };
         
         semop(semid, &sem_op,1);
 };
 
-inline void sem_sig_unlock(int semid, int idx,int flag=0) 
+inline void sem_sig_unlock(int semid, unsigned short idx, short int flag=0) 
 {
         struct sembuf sem_op = { idx, 1, flag };
         
Index: softdevice.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/softdevice.c,v
retrieving revision 1.99
diff -p -u -r1.99 softdevice.c
--- softdevice.c	17 Apr 2011 17:22:19 -0000	1.99
+++ softdevice.c	15 Nov 2013 15:03:19 -0000
@@ -1306,7 +1306,7 @@ bool cPluginSoftDevice::Service(const ch
 bool cPluginSoftDevice::Start(void)
 {
   // Start any background activities the plugin shall perform.
-  RegisterI18n(Phrases);
+  I18nRegister("softdevice");
   return true;
 }
 
Index: sync-timer.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/sync-timer.h,v
retrieving revision 1.5
diff -p -u -r1.5 sync-timer.h
--- sync-timer.h	25 Mar 2007 08:54:12 -0000	1.5
+++ sync-timer.h	15 Nov 2013 15:03:19 -0000
@@ -39,7 +39,7 @@ class cSigTimer : public cRelTimer {
      bool got_signal;
 
    public:
-      cSigTimer() : cRelTimer()
+      cSigTimer() : cRelTimer(), got_signal(false)
       {
         pthread_mutex_init(&mutex, NULL);
         pthread_cond_init(&cond, NULL);
Index: video-dfb.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.c,v
retrieving revision 1.86
diff -p -u -r1.86 video-dfb.c
--- video-dfb.c	14 Jun 2009 18:00:58 -0000	1.86
+++ video-dfb.c	15 Nov 2013 15:03:19 -0000
@@ -183,7 +183,19 @@ static DFBEnumerationResult EnumVideoMod
 /* ---------------------------------------------------------------------------
  */
 cDFBVideoOut::cDFBVideoOut(cSetupStore *setupStore, cSetupSoftlog *softlog)
-              : cVideoOut(setupStore, softlog)
+              : cVideoOut(setupStore, softlog),
+ osdLayer(0),videoLayer(0),scrDsc(),osdDsc(),vidDsc(),
+ osdLayerDescription(),videoLayerDescription(),osdLayerConfiguration(),
+ osdSurface(0),videoSurface(0),scrSurface(0),
+ pixelformat(),dfbRemote(0),events(0),
+ deinterlace(false),alphablend(false),
+ useStretchBlit(false),useSetSourceRectangle(false),
+ osdClrBack(false),isVIAUnichrome(false),
+ clearAlpha(0),
+ clearBackCount(2), // by default for double buffering
+ clearBackground(0),
+ prevOsdMode(setupStore->osdMode),videoLayerLevel(1),
+ dirtyLines(0),tmpOsdSurface(0)
 {
     tLayerSelectItem              *layerInfo;
 
@@ -195,16 +207,9 @@ cDFBVideoOut::cDFBVideoOut(cSetupStore *
   swidth  = fwidth  = 720;
   sheight = fheight = 576;
 
-  tmpOsdSurface = NULL;
   screenPixelAspect = -1;
   currentPixelFormat = setupStore->pixelFormat;
-  prevOsdMode = setupStore->osdMode;
   setupStore->osdMode = 0;
-  isVIAUnichrome = false;
-  clearAlpha = 0x00;
-  clearBackground = 0;
-  clearBackCount = 2; // by default for double buffering;
-  videoLayerLevel = 1;
   OSDpresent = false;
 
   if(setupStore->viaTv)
@@ -1054,7 +1059,7 @@ void cDFBVideoOut::SetParams()
             videoSurface->Release();
           }
           if (setupStore->useMGAtv) {
-            vidDsc.caps = DFB_ADD_SURFACE_CAPS(vidDsc.caps, DSCAPS_INTERLACED);
+            DFB_ADD_SURFACE_CAPS(vidDsc.caps, DSCAPS_INTERLACED);
           }
 
           videoSurface=dfb->CreateSurface(vidDsc);
@@ -1120,16 +1125,15 @@ void cDFBVideoOut::Pause(void)
 
 /* ----------------------------------------------------------------------------
  */
-void cDFBVideoOut::OpenOSD ()
+void cDFBVideoOut::ClearOSD()
 {
-    IDirectFBSurface  *tmpSurface;
-
   if (!videoInitialized)
     return;
 
-  cVideoOut::OpenOSD();
   try
   {
+    IDirectFBSurface  *tmpSurface;
+
     tmpSurface = (useStretchBlit) ? osdSurface : scrSurface;
     tmpSurface->Clear(0,0,0,clearAlpha);
     tmpSurface->Flip();
@@ -1138,7 +1142,7 @@ void cDFBVideoOut::OpenOSD ()
   catch (DFBException *ex)
   {
     softlog->Log(SOFT_LOG_ERROR, 0,
-              "[dfb] OpenOSD: action=%s, result=%s\n",
+              "[dfb] ClearOSD: action=%s, result=%s\n",
               ex->GetAction(), ex->GetResult());
     delete ex;
   }
@@ -1221,14 +1225,14 @@ void cDFBVideoOut::CommitUnlockOsdSurfac
     int maxy=0;
     tmpOsdSurface->SetBlittingFlags(DSBLIT_NOFX);
     do {
-      while (!dirtyLines[miny] && miny < Yres)
+      while (miny < Yres && !dirtyLines[miny])
         miny++;
 
       if (miny >= Yres)
         break;
 
       maxy=miny;
-      while (dirtyLines[maxy] && maxy < Yres)
+      while (maxy < Yres && dirtyLines[maxy])
         maxy++;
 
       osdsrc.x = 0;
@@ -1289,39 +1293,8 @@ bool cDFBVideoOut::IsSoftOSDMode()
  */
 void cDFBVideoOut::CloseOSD()
 {
-    IDirectFBSurface  *tmpSurface;
-
-  if (!videoInitialized)
-    return;
-
+  ClearOSD();
   cVideoOut::CloseOSD();
-  tmpSurface = (useStretchBlit) ? osdSurface : scrSurface;
-  try
-  {
-    if (useStretchBlit)
-    {
-      OSDpresent  = false;
-      clearBackground = clearBackCount;
-      tmpSurface->Clear(COLORKEY,clearAlpha); //clear and
-    }
-    else
-    {
-      tmpSurface->Clear(COLORKEY,clearAlpha); //clear and
-      tmpSurface->Flip(); // Flip the field
-      if (!isVIAUnichrome)
-      {
-        tmpSurface->Clear(COLORKEY,clearAlpha); //clear and
-        tmpSurface->Flip(); // Flip the field
-      }
-    }
-  }
-  catch (DFBException *ex)
-  {
-    softlog->Log(SOFT_LOG_ERROR, 0,
-              "[dfb] CloseOSD: action=%s, result=%s\n",
-              ex->GetAction(), ex->GetResult());
-    delete ex;
-  }
 }
 
 /* ---------------------------------------------------------------------------
Index: video-dfb.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-dfb.h,v
retrieving revision 1.30
diff -p -u -r1.30 video-dfb.h
--- video-dfb.h	14 Jun 2009 18:00:58 -0000	1.30
+++ video-dfb.h	15 Nov 2013 15:03:19 -0000
@@ -74,7 +74,7 @@ class cDFBVideoOut : public cVideoOut {
 
     bool *dirtyLines;
     IDirectFBSurface  *tmpOsdSurface;
-    virtual void OpenOSD();
+    virtual void ClearOSD();
     virtual void GetOSDMode(int &Depth, bool &HasAlpha, bool &AlphaInversed,
                             bool &IsYUV);
     virtual void GetOSDDimension(int &OsdWidth,int &OsdHeight,
Index: video-shm.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video-shm.c,v
retrieving revision 1.20
diff -p -u -r1.20 video-shm.c
--- video-shm.c	13 Oct 2007 11:17:48 -0000	1.20
+++ video-shm.c	15 Nov 2013 15:03:19 -0000
@@ -238,7 +238,7 @@ void cShmVideoOut::CheckShmIDs() {
                                 case PIX_FMT_YUV422:
                                         SHMDEB("new format YUV422\n");
                                         privBuf.pixel[0]=curr_pict+ctl->offset0;
-                                        privBuf.pixel[1]=privBuf.pixel[1]=NULL;
+                                        privBuf.pixel[1]=privBuf.pixel[2]=NULL;
                                         privBuf.stride[0]=ctl->stride0;
                                         privBuf.stride[1]=privBuf.stride[2]=0;
                                         break;
Index: video.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video.c,v
retrieving revision 1.80
diff -p -u -r1.80 video.c
--- video.c	17 Apr 2011 17:22:19 -0000	1.80
+++ video.c	15 Nov 2013 15:03:20 -0000
@@ -53,6 +53,9 @@ cVideoOut::cVideoOut(cSetupStore *setupS
   freezeMode=false;
   videoInitialized = false;
   oldPicture = NULL;
+  zoomCenterX = zoomCenterY = 0;
+  expandTopBottom = expandLeftRight = 0;
+  frametime = 0;
 
   hurryUp = 0;
   delay   = 0;
@@ -65,6 +68,7 @@ cVideoOut::cVideoOut(cSetupStore *setupS
   offsetClampHigh =   2;
   offsetUse       =   1;
   useAverage4Drop =   false;
+  current_osdMode = OSDMODE_PSEUDO;
 
   for (int i = 0; i < SETUP_VIDEOASPECTNAMES_COUNT; ++i)
     parValues [i] = 1.0;
Index: video.h
===================================================================
RCS file: /cvsroot/softdevice/softdevice/video.h,v
retrieving revision 1.60
diff -p -u -r1.60 video.h
--- video.h	17 Apr 2011 17:22:19 -0000	1.60
+++ video.h	15 Nov 2013 15:03:20 -0000
@@ -28,7 +28,7 @@
 #define DV_FORMAT_NORMAL  1
 #define DV_FORMAT_WIDE    2
 
-#if  VDRVERSNUM <= 10707
+#if 1//VDRVERSNUM <= 10707
 
 #define OSD_FULL_WIDTH    736
 #define OSD_FULL_HEIGHT   576
