Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] [PATCH] softdevice-0.0.5 for vdr-1.3.7
Hi,
This patch updates the OSD handling of the softdevice-0.0.5
plugin according to the changes from vdr-1.3.7.
Only the vidix driver is working now, i will also update
the DirectFB part soon.
Roland Praml, could you apply this and the patch
from Stefan Lucke and release a new version of
the plugin ?
Regards,
Vadim Catana
vcatana@registru.md
diff -urN ./softdevice-0.0.5/Makefile ./softdevice/Makefile
--- ./softdevice-0.0.5/Makefile 2004-01-26 23:49:32.000000000 +0200
+++ ./softdevice/Makefile 2004-05-18 10:31:30.985697904 +0300
@@ -31,15 +31,15 @@
#FB_SUPPORT=1
# Vidix support by Vadim Catana
-#VIDIX_SUPPORT=1
+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!
LIBAVCODEC = ../../../../ffmpeg/libavcodec
-DVBDIR = ../../../../DVB
+DVBDIR = ../../../../dvb-kernel
VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
diff -urN ./softdevice-0.0.5/softdevice.c ./softdevice/softdevice.c
--- ./softdevice-0.0.5/softdevice.c 2004-01-23 22:17:07.000000000 +0200
+++ ./softdevice/softdevice.c 2004-05-18 11:26:51.459909096 +0300
@@ -11,7 +11,7 @@
#include <vdr/interface.h>
#include <vdr/plugin.h>
#include <vdr/player.h>
-#include <vdr/osdbase.h>
+#include <vdr/osd.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
@@ -23,21 +23,25 @@
#ifdef VIDIX_SUPPORT
#include "video-vidix.h"
+#undef VDEVICE
#define VDEVICE cVidixVideoOut
#endif
#ifdef FB_SUPPORT
#include "video-fb.h"
+#undef VDEVICE
#define VDEVICE cFBVideoOut
#endif
#ifdef DFB_SUPPORT
#include "video-dfb.h"
+#undef VDEVICE
#define VDEVICE cDFBVideoOut
#endif
#ifdef XV_SUPPORT
#include "video-xv.h"
+#undef VDEVICE
#define VDEVICE cXvVideoOut
#endif
@@ -51,61 +55,68 @@
#define INBUF_SIZE 4096
// --- cSoftOsd -----------------------------------------------
-class cSoftOsd : public cOsdBase {
+class cSoftOsd : public cOsd {
private:
- int xOfs, yOfs;
- cVideoOut *videoOut;
+ cVideoOut *videoOut;
protected:
- virtual bool OpenWindow(cWindow *Window);
- virtual void CommitWindow(cWindow *Window);
- virtual void ShowWindow(cWindow *Window);
- virtual void HideWindow(cWindow *Window, bool Hide);
- virtual void MoveWindow(cWindow *Window, int X, int Y);
- virtual void CloseWindow(cWindow *Window);
public:
- cSoftOsd(cVideoOut *VideoOut, int XOfs, int XOfs);
- virtual ~cSoftOsd();
+ 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)
- :cOsdBase(X, Y) {
- videoOut=VideoOut;
- xOfs=X; // this position should be recalculated
- yOfs=Y;
- printf("[softdevice] OSD-Position at %d x %d\n",X,Y);
- videoOut->OpenOSD(X, Y);
+cSoftOsd::cSoftOsd(cVideoOut *VideoOut, int X, int Y) : cOsd(X, Y)
+{
+ videoOut = VideoOut;
+ videoOut->OpenOSD(X, Y);
}
-cSoftOsd::~cSoftOsd() {
+
+cSoftOsd::~cSoftOsd()
+{
if (videoOut) {
videoOut->CloseOSD();
videoOut=0;
}
- printf("[softdevice] OSD is off now\n");
}
-bool cSoftOsd::OpenWindow(cWindow *Window) {
- return videoOut->OpenWindow(Window);
-}
+eOsdError cSoftOsd::CanHandleAreas(const tArea *Areas, int NumAreas)
+{
+ eOsdError Result = cOsd::CanHandleAreas(Areas, NumAreas);
-void cSoftOsd::CommitWindow(cWindow *Window) {
- videoOut->CommitWindow(Window);
+ return Result;
}
-void cSoftOsd::ShowWindow(cWindow *Window) {
- videoOut->ShowWindow(Window);
-}
-void cSoftOsd::HideWindow(cWindow *Window, bool Hide) {
- videoOut->HideWindow(Window, Hide);
-}
+void cSoftOsd::Flush(void)
+{
+ cBitmap *Bitmap;
-void cSoftOsd::MoveWindow(cWindow *Window, int x, int y) {
- videoOut->MoveWindow(Window, x, y);
+ for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++)
+ {
+ videoOut->Refresh(Bitmap);
+ }
}
-void cSoftOsd::CloseWindow(cWindow *Window) {
- videoOut->CloseWindow(Window);
+// --- 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;
+}
// --- cSoftDevice ------------------------------------------------------------
class cPluginSoftDevice : public cPlugin {
@@ -133,7 +144,6 @@
class cSoftDevice : public cDevice {
private:
cMpeg2Decoder *decoder;
- cOsdBase *OSD;
cVideoOut *videoOut;
cAudioOut *audioOut;
public:
@@ -150,11 +160,17 @@
virtual void StillPicture(const uchar *Data, int Length);
virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
virtual int PlayVideo(const uchar *Data, int Length);
- int ProvidesCa(int Ca);
- virtual cOsdBase *NewOsd(int x, int y);
-
+ virtual int ProvidesCa(const cChannel *Channel) const;
+ virtual void MakePrimaryDevice(bool On);
};
+void cSoftDevice::MakePrimaryDevice(bool On)
+{
+ printf("cSoftDevice::MakePrimaryDevice\n");
+
+ new cSoftOsdProvider(videoOut);
+}
+
cSoftDevice::cSoftDevice()
{
printf("[softdevice] Initializing Video Out\n");
@@ -174,10 +190,6 @@
delete(videoOut);
}
-cOsdBase *cSoftDevice::NewOsd(int X, int Y) {
- return new cSoftOsd(videoOut,X,Y);
-}
-
bool cSoftDevice::HasDecoder(void) const
{
return true; // We can decode MPEG2
@@ -238,7 +250,8 @@
return true; // FIXME: what does this function
}
-int cSoftDevice::ProvidesCa(int Ca) {
+int cSoftDevice::ProvidesCa(const cChannel *Channel) const
+{
return 0;
}
diff -urN ./softdevice-0.0.5/video.c ./softdevice/video.c
--- ./softdevice-0.0.5/video.c 2004-01-26 23:32:23.000000000 +0200
+++ ./softdevice/video.c 2004-05-18 11:19:53.887389768 +0300
@@ -12,160 +12,20 @@
#include <vdr/plugin.h>
#include "video.h"
#include "utils.h"
-#ifdef VIDIX
-#include <vidix/vidixlib.h>
-#include <vidix/fourcc.h>
-#endif
-cVideoOut::~cVideoOut() {
-printf("Das wars\n");
-}
-bool cVideoOut::OpenWindow(cWindow *Window) {
- layer[Window->Handle()]= new cWindowLayer(Window->X0()+OSDxOfs, Window->Y0()+OSDyOfs,
- Window->Width(), Window->Height(), Bpp, Xres, Yres);
- return true;
+cVideoOut::~cVideoOut()
+{
}
void cVideoOut::OpenOSD(int X, int Y)
{
- // initialize Layers.
- OSDxOfs = (Xres - 720) / 2 + X;
- OSDyOfs = (Yres - 576) / 2 + Y;
- for (int i = 0; i < MAXNUMWINDOWS; i++)
- {
- layer[i]=0;
- }
- OSDpresent=true;
+ OSDxOfs = X;
+ OSDyOfs = Y;
+
+ OSDpresent=true;
}
void cVideoOut::CloseOSD()
{
- OSDpresent=false;
- for (int i = 0; i < MAXNUMWINDOWS; i++)
- {
- if (layer[i])
- {
- delete(layer[i]);
- layer[i]=0;
- }
- }
-}
-
-void cVideoOut::CommitWindow(cWindow *Window) {
- layer[Window->Handle()]->Render(Window);
- Refresh();
-}
-
-void cVideoOut::ShowWindow(cWindow *Window) {
- layer[Window->Handle()]->visible=true;
- layer[Window->Handle()]->Render(Window);
- Refresh();
-}
-void cVideoOut::HideWindow(cWindow *Window, bool Hide) {
- layer[Window->Handle()]->visible= ! Hide ;
- Refresh();
-}
-
-void cVideoOut::MoveWindow(cWindow *Window, int x, int y) {
- layer[Window->Handle()]->Move(x,y);
- layer[Window->Handle()]->Render(Window);
- Refresh();
-}
-
-void cVideoOut::CloseWindow(cWindow *Window) {
- delete (layer[Window->Handle()]);
- Refresh();
-}
-
-
-// --- cWindowLayer --------------------------------------------------
-cWindowLayer::cWindowLayer(int X, int Y, int W, int H, int Bpp, int Xres, int Yres) {
- left=X;
- top=Y;
- width=W;
- height=H;
- bpp=Bpp;
- xres=Xres;
- yres=Yres;
- visible=false;
- imagedata=(unsigned char *)malloc(W*H*4); // RGBA Screen memory
- printf("[video] Creating WindowLayer at %d x %d, (%d x %d)\n",X,Y,W,H);
-}
-
-void cWindowLayer::Region (int *x, int *y, int *w, int *h) {
- *x = left;
- *y = top;
- *w = width;
- *h = height;
-}
-
-
-cWindowLayer::~cWindowLayer() {
- free(imagedata);
-}
-
-
-void cWindowLayer::Render(cWindow *Window) {
- unsigned char * buf;
- buf=imagedata;
- for (int yp = 0; yp < height; yp++) {
- for (int ix = 0; ix < width; ix++) {
- eDvbColor c = Window->GetColor(*Window->Data(ix,yp));
- buf[0]=c & 255; //Red
- buf[1]=(c >> 8) & 255; //Green
- buf[2]=(c >> 16) & 255; //Blue
- buf[3]=(c >> 24) & 255; //Alpha*/
- buf+=4;
- }
- }
-}
-
-void cWindowLayer::Move(int x, int y) {
- left=x;
- top=y;
-}
-
-void cWindowLayer::Draw(unsigned char * buf, int linelen, unsigned char * keymap) {
- unsigned char * im;
- im = imagedata;
- int depth = (bpp + 7) / 8;
- int dx = linelen - width * depth;
- buf += top * linelen + left * depth; // upper left corner
- for (int y = top; y < top+height; y++) {
- for (int x = left; x < left+width; x++) {
- if ( (im[3] != 0)
- && (x >= 0) && (x < xres)
- && (y >= 0) && (y < yres)) { // Alpha != 0 and in the screen
-
- //if (keymap) keymap[(x+y*linelen / depth) / 8] |= (1 << (x % 8));
- switch (depth) {
- case 4:
- *(buf++)=im[2];
- *(buf++)=im[1];
- *(buf++)=im[0];
- *(buf++)=im[3];
- //buf++;
- break;
- case 3:
- *(buf++)=im[2];
- *(buf++)=im[1];
- *(buf++)=im[0];
- break;
- case 2: // 565 RGB
- *(buf++)= ((im[2] >> 3)& 0x1F) | ((im[1] & 0x1C) << 3);
- *(buf++)= (im[0] & 0xF8) | (im[1] >> 5);
- break;
- default:
- printf("[video] Unsupported depth %d\n",depth);
- exit(1);
- }
-
- } else {
- buf += depth; // skip this pixel
- }
- im +=4;
- }
- buf += dx;
- }
- return;
+ OSDpresent=false;
}
diff -urN ./softdevice-0.0.5/video-dummy.c ./softdevice/video-dummy.c
--- ./softdevice-0.0.5/video-dummy.c 2004-01-23 22:28:45.000000000 +0200
+++ ./softdevice/video-dummy.c 2004-05-18 10:27:28.641539816 +0300
@@ -21,13 +21,15 @@
{
}
-void cDummyVideoOut::Refresh() {
+void cDummyVideoOut::Refresh(cBitmap *Bitmap)
+{
}
void cDummyVideoOut::YUV(uint8_t *Py, uint8_t *Pu, uint8_t *Pv, int Width, int Height, int Ystride, int UVstride)
{
}
-cDummyVideoOut::~cDummyVideoOut() {
+cDummyVideoOut::~cDummyVideoOut()
+{
}
diff -urN ./softdevice-0.0.5/video-dummy.h ./softdevice/video-dummy.h
--- ./softdevice-0.0.5/video-dummy.h 2004-01-23 02:04:49.000000000 +0200
+++ ./softdevice/video-dummy.h 2004-05-18 10:26:08.655699512 +0300
@@ -15,7 +15,7 @@
public:
cDummyVideoOut();
virtual ~cDummyVideoOut();
- virtual void Refresh();
+ virtual void Refresh(cBitmap *Bitmap);
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-01-26 23:45:53.000000000 +0200
+++ ./softdevice/video.h 2004-05-18 10:56:41.364085488 +0300
@@ -10,44 +10,22 @@
#define VIDEO_H
#include <vdr/plugin.h>
-class cWindowLayer {
- private:
- int left, top;
- int width, height, bpp, xres, yres;
- unsigned char *imagedata;
- public:
- cWindowLayer(int X, int Y, int W, int H, int Bpp, int Xres, int Yres);
- ~cWindowLayer();
- void Render(cWindow *Window);
- void Draw(unsigned char * buf, int linelen, unsigned char * keymap);
- void Move(int x, int y);
- void Region (int *x, int *y, int *w, int *h);
- bool visible;
-};
class cVideoOut {
private:
protected:
+
int OSDxOfs, OSDyOfs;
bool OSDpresent;
int Xres, Yres, Bpp; // the child class MUST set these params (for OSD Drawing)
public:
- cWindowLayer *layer[MAXNUMWINDOWS];
- uint8_t *PixelMask;
- virtual bool OpenWindow(cWindow *Window);
- virtual void CommitWindow(cWindow *Window);
- virtual void ShowWindow(cWindow *Window);
- virtual void HideWindow(cWindow *Window, bool Hide);
- virtual void MoveWindow(cWindow *Window, int X, int Y);
- virtual void CloseWindow(cWindow *Window);
- virtual void CloseOSD();
- virtual void OpenOSD(int X, int Y);
virtual ~cVideoOut();
- virtual void Refresh() {return;};
- virtual void YUV(uint8_t *Py, uint8_t *Pu, uint8_t *Pv, int Width, int Height, int Ystride, int UVstride){return;};
+ 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;};
};
-
#endif // VIDEO_H
diff -urN ./softdevice-0.0.5/video-vidix.c ./softdevice/video-vidix.c
--- ./softdevice-0.0.5/video-vidix.c 2004-01-26 23:37:44.000000000 +0200
+++ ./softdevice/video-vidix.c 2004-05-18 11:13:28.351000208 +0300
@@ -1,5 +1,5 @@
/*
- * video.c: A plugin for the Video Disk Recorder
+ * video-vidix.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
@@ -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()
{
@@ -117,28 +115,25 @@
printf("cVidixVideoOut: looking for driver: %s in %s\n", VIDIX_DRIVER, VIDIX_DIR);
- // Hmm. These drivers doesn't work like expected :-(
vidix_handler = vdlOpen(VIDIX_DIR, VIDIX_DRIVER, TYPE_OUTPUT, 1);
- //vidix_handler = vdlOpen("/usr/src/MPlayer-1.0pre2/vidix/drivers/", VIDIX_DRIVER, 0, 0);
- //vidix_handler = vdlOpen("/sat/vidix/vidix/drivers/", "mga_vid", 0, 0);
if( !vidix_handler )
{
printf("cVidixVideoOut: Couldn't find working VIDIX driver\n");
exit(1);
}
-
+
if( (err = vdlGetCapability(vidix_handler,&vidix_cap)) != 0)
{
printf("cVidixVideoOut: Couldn't get capability: %s\n", strerror(err) );
exit(1);
}
- // vidix_fourcc.fourcc = IMGFMT_I420; // my matrox can't handle this
- vidix_fourcc.fourcc = IMGFMT_YV12;
+ // if you got swapped (wrong) colors: try the other format
+ vidix_fourcc.fourcc = IMGFMT_I420;
+ //vidix_fourcc.fourcc = IMGFMT_YV12;
vdlQueryFourcc(vidix_handler, &vidix_fourcc);
-
memset(&vidix_play, 0, sizeof(vidix_playback_t));
vidix_play.fourcc = vidix_fourcc.fourcc;
@@ -169,7 +164,6 @@
}
}
-
void cVidixVideoOut::Pause(void)
{
}
@@ -255,7 +249,7 @@
printf("cVidixVideoOut : dstrides.u=%d\n", dstrides.u);
printf("cVidixVideoOut : dstrides.v=%d\n", dstrides.v);
}
-
+
// Plane Y
dst = (uint8_t *) vidix_play.dga_addr + vidix_play.offsets[next_frame] + vidix_play.offset.y;
@@ -302,13 +296,28 @@
next_frame = (next_frame+1) % vidix_play.num_frames;
}
-
-void cVidixVideoOut::Refresh()
+void cVidixVideoOut::Refresh(cBitmap *Bitmap)
{
+ const tIndex *adr;
+ tIndex *buf;
+ tColor c;
- for (int i = 0; i < MAXNUMWINDOWS; i++)
+ for (int y = 0; y < Bitmap->Height(); y++)
{
- if (layer[i] && layer[i]->visible) layer[i]->Draw(fb, fb_line_len, NULL);
+ 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;
+ }
}
}
@@ -356,8 +365,3 @@
if (osd) free(osd);
if (fbdev) close(fbdev);
}
-
-
-
-
-
diff -urN ./softdevice-0.0.5/video-vidix.h ./softdevice/video-vidix.h
--- ./softdevice-0.0.5/video-vidix.h 2004-01-26 23:28:55.000000000 +0200
+++ ./softdevice/video-vidix.h 2004-05-18 11:10:07.937467696 +0300
@@ -29,19 +29,19 @@
__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();
- virtual void Refresh();
+ virtual void Refresh(cBitmap *Bitmap);
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