Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: [PATCH] softdevice-0.0.5 for vdr-1.3.7



Stefan Lucke wrote:
Could you prepare a patch based on softdevice-0.0.5 + xv-patch08 so
that it compiles with vdr-1.2.x and 1.3.7 ?

Stefan Lucke
The included patch is based on softdevice-0.0.5 + xv-patch08 and
compiles with vdr-1.3.7 and vdr-1.2.x . If you run vdr < 1.3.7
after vdr-1.3.7, remove the setup.conf file, because vdr-1.3.7
makes some changes in that file and older vdr versions do not show
any OSD after that. Only the vidix driver is working now, comment
the other drivers in the Makefile if you compile for vdr-1.3.7.
I'll send a patch for DirectFB later.

Vadim Catana
diff -urN ./softdevice-0.0.5/Makefile ./softdevice/Makefile
--- ./softdevice-0.0.5/Makefile	2004-05-18 19:55:17.000000000 +0300
+++ ./softdevice/Makefile	2004-05-19 08:13:26.608559376 +0300
@@ -22,26 +22,26 @@
 ###############################
 
 #XV support by Stefan Lucke (NOT tested in this release)
-XV_SUPPORT=1
+#XV_SUPPORT=1
 
 # DFB is very experimental (works only with my matrox G200, comments are welcome)
 #DFB_SUPPORT=1
 
 # FB is unaccellerated and should work with any FB with 16bit color depth
-FB_SUPPORT=1
+#FB_SUPPORT=1
 
 # Vidix support by Vadim Catana
 VIDIX_SUPPORT=1
 
-FBDEV = /dev/fb0
-VIDIX_DIR    = /usr/local/
-VIDIX_DRIVER = mga_vid.so
+FBDEV = /dev/fb/0
+VIDIX_DIR    = /opt/vidix
+VIDIX_DRIVER = radeon_vid.so
 
 # Set up these paths!
 # If you installed ffmpeg's lib (make installlib)
-LIBAVCODEC=/usr/local/include/ffmpeg/
-#LIBAVCODEC = ../../../../ffmpeg/libavcodec
-DVBDIR 	   = ../../../../DVB
+#LIBAVCODEC=/opt/ffmpeg
+LIBAVCODEC = ../../../../ffmpeg/libavcodec
+DVBDIR 	   = ../../../../dvb-kernel
 VDRDIR     = ../../..
 LIBDIR     = ../../lib
 TMPDIR     = /tmp
@@ -90,8 +90,8 @@
 ifdef DFB_SUPPORT
 OBJS     += video-dfb.o
 DEFINES  += -DDFB_SUPPORT
-INCLUDES += `directfb-config --cflags` 
-LIBS 	 += `directfb-config --libs` -ldfb++
+INCLUDES += -I/opt/directfb/include/directfb -I/opt/directfb/include
+LIBS 	 += -L/opt/directfb/lib -ldfb++
 endif
 
 ifdef FB_SUPPORT
diff -urN ./softdevice-0.0.5/softdevice.c ./softdevice/softdevice.c
--- ./softdevice-0.0.5/softdevice.c	2004-05-18 19:55:17.000000000 +0300
+++ ./softdevice/softdevice.c	2004-05-19 08:16:53.916043848 +0300
@@ -11,7 +11,13 @@
 #include <vdr/interface.h>
 #include <vdr/plugin.h>
 #include <vdr/player.h>
+
+#if VDRVERSNUM >= 10307
+#include <vdr/osd.h>
+#else
 #include <vdr/osdbase.h>
+#endif
+
 
 #include <sys/mman.h>
 #include <sys/ioctl.h>
@@ -150,6 +156,76 @@
 }
 #endif
 
+
+
+#if VDRVERSNUM >= 10307
+
+// --- cSoftOsd -----------------------------------------------
+class cSoftOsd : public cOsd {
+private:
+    cVideoOut *videoOut;
+protected:
+public:
+    cSoftOsd(cVideoOut *VideoOut, int XOfs, int XOfs);
+    virtual ~cSoftOsd();
+    virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas);
+    virtual void Flush(void);
+};
+
+cSoftOsd::cSoftOsd(cVideoOut *VideoOut, int X, int Y) : cOsd(X, Y)
+{
+    videoOut = VideoOut;
+    videoOut->OpenOSD(X, Y);
+}
+
+cSoftOsd::~cSoftOsd()
+{
+    if (videoOut) {
+	videoOut->CloseOSD();
+	videoOut=0;
+    }
+}
+
+eOsdError cSoftOsd::CanHandleAreas(const tArea *Areas, int NumAreas)
+{
+    eOsdError Result = cOsd::CanHandleAreas(Areas, NumAreas);
+
+    return Result;
+}
+
+void cSoftOsd::Flush(void)
+{
+    cBitmap *Bitmap;
+
+    for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++)
+    {
+	videoOut->Refresh(Bitmap);
+    }
+}
+
+// --- cSoftOsdProvider -----------------------------------------------
+class cSoftOsdProvider : public cOsdProvider {
+private:
+    cVideoOut *videoOut;
+    cOsd *osd;
+public:
+    cSoftOsdProvider(cVideoOut *VideoOut);
+    virtual cOsd *CreateOsd(int Left, int Top);
+};
+
+cSoftOsdProvider::cSoftOsdProvider(cVideoOut *VideoOut)
+{
+    videoOut = VideoOut;
+}
+
+cOsd * cSoftOsdProvider::CreateOsd(int Left, int Top)
+{
+    osd = new cSoftOsd(videoOut, Left, Top);
+    return osd;
+}
+
+#else
+
 // --- cSoftOsd -----------------------------------------------
 class cSoftOsd : public cOsdBase {
 private:
@@ -206,6 +282,7 @@
     videoOut->CloseWindow(Window);
 }
 
+#endif
 
 // --- cSoftDevice ------------------------------------------------------------
 class cPluginSoftDevice : public cPlugin {
@@ -235,7 +312,11 @@
 class cSoftDevice : public cDevice {
 private:
   cMpeg2Decoder *decoder;
+
+#if VDRVERSNUM < 10307
   cOsdBase *OSD;
+#endif
+
   cVideoOut *videoOut;
   cAudioOut *audioOut;
   int       outMethod;
@@ -259,9 +340,13 @@
   virtual void StillPicture(const uchar *Data, int Length);
   virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
   virtual int PlayVideo(const uchar *Data, int Length);
+#if VDRVERSNUM >= 10307
+  virtual int ProvidesCa(const cChannel *Channel) const;
+  virtual void MakePrimaryDevice(bool On);
+#else
   int ProvidesCa(int Ca);
   virtual cOsdBase *NewOsd(int x, int y);
-
+#endif
 };
 
 cSoftDevice::cSoftDevice(int method)
@@ -313,10 +398,39 @@
     delete(videoOut);
 }
 
-cOsdBase *cSoftDevice::NewOsd(int X, int Y) {
+
+
+#if VDRVERSNUM >= 10307
+
+void cSoftDevice::MakePrimaryDevice(bool On)
+{
+  printf("cSoftDevice::MakePrimaryDevice\n");
+
+  new cSoftOsdProvider(videoOut);
+}
+
+int cSoftDevice::ProvidesCa(const cChannel *Channel) const
+{
+    return 0;
+}
+
+#else
+
+cOsdBase *cSoftDevice::NewOsd(int X, int Y)
+{
     return new cSoftOsd(videoOut,X,Y);
 }
 
+int cSoftDevice::ProvidesCa(int Ca)
+{
+    return 0;
+}
+
+#endif
+
+
+
+
 bool cSoftDevice::HasDecoder(void) const
 {
     return true; // We can decode MPEG2
@@ -392,9 +506,6 @@
   return true;
 }
 
-int cSoftDevice::ProvidesCa(int Ca) {
-    return 0;
-}
 
 int cSoftDevice::PlayVideo(const uchar *Data, int Length)
 {
diff -urN ./softdevice-0.0.5/video.c ./softdevice/video.c
--- ./softdevice-0.0.5/video.c	2004-05-18 19:55:17.000000000 +0300
+++ ./softdevice/video.c	2004-05-19 08:17:44.271388672 +0300
@@ -12,10 +12,29 @@
 #include <vdr/plugin.h>
 #include "video.h"
 #include "utils.h"
-#ifdef VIDIX
-#include <vidix/vidixlib.h>
-#include <vidix/fourcc.h>
-#endif
+
+
+#if VDRVERSNUM >= 10307
+
+cVideoOut::~cVideoOut()
+{
+}
+
+void cVideoOut::OpenOSD(int X, int Y)
+{
+    OSDxOfs = X;
+    OSDyOfs = Y;
+
+    OSDpresent=true;
+}
+
+void cVideoOut::CloseOSD()
+{
+    OSDpresent=false;
+}
+
+#else
+
 
 cVideoOut::~cVideoOut() {
 printf("Das wars\n");
@@ -181,3 +200,5 @@
     }
     return;
 }
+
+#endif
diff -urN ./softdevice-0.0.5/video-dfb.c ./softdevice/video-dfb.c
--- ./softdevice-0.0.5/video-dfb.c	2004-05-18 19:55:17.000000000 +0300
+++ ./softdevice/video-dfb.c	2004-05-18 18:28:21.000000000 +0300
@@ -53,7 +53,7 @@
 	try {
     	    *layer = DFBWrapper->GetDisplayLayer(id);
 	} catch (DFBException *ex) {
-	    cerr << "Caught: " << ex << endl;
+//	    cerr << "Caught: " << ex << endl;
 	    return DFENUM_CANCEL;
 	}
     }
diff -urN ./softdevice-0.0.5/video-dummy.c ./softdevice/video-dummy.c
--- ./softdevice-0.0.5/video-dummy.c	2004-05-18 19:55:17.000000000 +0300
+++ ./softdevice/video-dummy.c	2004-05-19 08:17:07.549971176 +0300
@@ -21,8 +21,15 @@
 {
 }
 
-void cDummyVideoOut::Refresh() {
+#if VDRVERSNUM >= 10307
+void cDummyVideoOut::Refresh(cBitmap *Bitmap)
+{
+}
+#else
+void cDummyVideoOut::Refresh()
+{
 }
+#endif
 
 void cDummyVideoOut::YUV(uint8_t *Py, uint8_t *Pu, uint8_t *Pv, int Width, int Height, int Ystride, int UVstride)
 {
diff -urN ./softdevice-0.0.5/video-dummy.h ./softdevice/video-dummy.h
--- ./softdevice-0.0.5/video-dummy.h	2004-05-18 19:55:17.000000000 +0300
+++ ./softdevice/video-dummy.h	2004-05-19 08:17:15.328788616 +0300
@@ -15,7 +15,13 @@
 public:
   cDummyVideoOut();
   virtual ~cDummyVideoOut();
+
+#if VDRVERSNUM >= 10307
+  virtual void Refresh(cBitmap *Bitmap);
+#else
   virtual void Refresh();
+#endif
+
   virtual void YUV(uint8_t *Py, uint8_t *Pu, uint8_t *Pv, int Width, int Height, int Ystride, int UVstride);
   virtual void Pause(void);
 };
diff -urN ./softdevice-0.0.5/video.h ./softdevice/video.h
--- ./softdevice-0.0.5/video.h	2004-05-18 19:55:17.000000000 +0300
+++ ./softdevice/video.h	2004-05-19 08:17:52.185185592 +0300
@@ -12,6 +12,29 @@
 #include <vdr/plugin.h>
 #include <avcodec.h>
 
+#if VDRVERSNUM >= 10307
+
+class cVideoOut {
+private:
+protected:
+
+    int OSDxOfs, OSDyOfs;
+    bool OSDpresent;
+    int Xres, Yres, Bpp; // the child class MUST set these params (for OSD Drawing)
+    
+public:
+    virtual ~cVideoOut();
+    virtual void OpenOSD(int X, int Y);
+    virtual void CloseOSD();
+    virtual void Refresh(cBitmap *Bitmap) { return; };
+    virtual void YUV(uint8_t *Py, uint8_t *Pu, uint8_t *Pv, int Width, int Height, int Ystride, int UVstride) { return; };
+    virtual void Pause(void) {return;};
+    virtual void CheckAspectDimensions (AVFrame *picture, AVCodecContext *context) { return; };
+
+};
+
+#else
+
 class cWindowLayer {
   private:
     int left, top;
@@ -59,5 +82,6 @@
     virtual bool GetInfo(int *fmt, unsigned char **dest,int *w, int *h) {return false;};
 };
 
+#endif
 
 #endif // VIDEO_H
diff -urN ./softdevice-0.0.5/video-vidix.c ./softdevice/video-vidix.c
--- ./softdevice-0.0.5/video-vidix.c	2004-05-18 19:55:17.000000000 +0300
+++ ./softdevice/video-vidix.c	2004-05-19 08:17:25.520239280 +0300
@@ -12,8 +12,6 @@
 #include <vdr/plugin.h>
 #include "video-vidix.h"
 #include "utils.h"
-#include <vidix/vidixlib.h>
-#include <vidix/fourcc.h>
 
 cVidixVideoOut::cVidixVideoOut()
 {
@@ -299,6 +297,34 @@
     next_frame = (next_frame+1) % vidix_play.num_frames;
 }
 
+#if VDRVERSNUM >= 10307
+
+void cVidixVideoOut::Refresh(cBitmap *Bitmap)
+{
+    const tIndex *adr;
+    tIndex *buf;
+    tColor c;
+
+    for (int y = 0; y < Bitmap->Height(); y++)
+    {
+	buf = (tIndex *) fb + fb_line_len * ( OSDyOfs + y ) + OSDxOfs * 4;
+
+	for (int x = 0; x < Bitmap->Width(); x++)
+	{
+	    adr = Bitmap->Data(x, y);
+	    c = Bitmap->Color(*adr);
+
+	    buf[3] = (c >> 24) & 255; //Alpha
+	    buf[2] = (c >> 16) & 255; //Red
+	    buf[1] = (c >> 8) & 255;  //Green
+	    buf[0] = c & 255;         //Blue
+
+	    buf+=4;
+	}
+    }
+}
+
+#else
 
 void cVidixVideoOut::Refresh()
 {
@@ -309,6 +335,8 @@
     }
 }
 
+#endif
+
 void cVidixVideoOut::CloseOSD() 
 {
     memset(fb, 0, fb_line_len * Yres);
diff -urN ./softdevice-0.0.5/video-vidix.h ./softdevice/video-vidix.h
--- ./softdevice-0.0.5/video-vidix.h	2004-05-18 19:55:17.000000000 +0300
+++ ./softdevice/video-vidix.h	2004-05-19 08:17:35.178770960 +0300
@@ -14,6 +14,7 @@
 #include "vidixlib.h"
 #include "fourcc.h"
 
+
 class cVidixVideoOut : public cVideoOut {
 private:
     uint8_t * osd;
@@ -29,19 +30,25 @@
     __u16 * orig_cmap;
 
     char               * vidix_name;
-    int                        vidix_version;
+    int                vidix_version;
     VDL_HANDLE         vidix_handler;
     vidix_capability_t vidix_cap;
     vidix_playback_t   vidix_play;
     vidix_fourcc_t     vidix_fourcc;
-    vidix_yuv_t                dstrides;
+    vidix_yuv_t        dstrides;
     vidix_grkey_t      gr_key;
     uint8_t            next_frame;
 
 public:
   cVidixVideoOut();
   virtual ~cVidixVideoOut();
+
+#if VDRVERSNUM >= 10307
+  virtual void Refresh(cBitmap *Bitmap);
+#else
   virtual void Refresh();
+#endif
+
   virtual void CloseOSD();
 //  virtual void OpenOSD();  
   virtual void YUV(uint8_t *Py, uint8_t *Pu, uint8_t *Pv, int Width, int Height, int Ystride, int UVstride);

Home | Main Index | Thread Index