Patch: dxr3plugin OSD don't turn pink

Message ID 1112556049.24368.75.camel@bobcat.mine.nu
State New
Headers

Commit Message

Ville Skyttä April 3, 2005, 7:20 p.m. UTC
  On Sun, 2005-04-03 at 19:07 +0200, Martin Cap wrote:
> Hi !
> 
> The OSD still sucks, but I guess we made it suck a little less :)

Indeed, seems so, at least mostly.

This change introduces/triggers one new crash here, though.  Not that
tvonscreen >= 0.6.0 would be usable with DXR3 here anyway, I gave 0.7.0
a try with Martin's change applied; the exact change against vdr-
dxr3-0-2 branch I'm using is attached.  Every time the tvonscreen OSD is
closed, I get a crash, backtrace attached.  If I don't apply the patch,
there's no crash, but parts of the tvonscreen OSD remain visible
seemingly forever after closing it.  Tvonscreen 0.5.2 continues to work
pretty much ok with or without the patch applied.

Fixes to the above are of course welcome, but unless I see more new
issues while testing this patch some more, I'll go ahead and apply it
next week.

> Bye,
> Martin Cap
> 
> Luca Olivetti wrote:
> > Martin Cap wrote:
> > 
> >> Hi, Luca works great !
> >
> > 
> > It works here too, even with yaepg. If you remove the logo display it's 
> > also possible to use the elchi skin with text2skin 1.0 (both with 
> > cDxr3PaletteManager or cPalette). Unfortunately  the other skins 
> > available for text2skin 1.0 need more than the 16 colours the dxr3 is 
> > capable of showing.
#0  0x00ad5c2e in cSPUEncoder::Cmd (this=0xb13440, cmd=11613248, color=0,
    x0=0, y0=0, x1=-84280061, y1=2, data=0x5060506)
    at dxr3interface_spu_encoder.c:405
405                                             *(cp+xx) = 0x00;
(gdb) bt
#0  0x00ad5c2e in cSPUEncoder::Cmd (this=0xb13440, cmd=11613248, color=0,
    x0=0, y0=0, x1=-84280061, y1=2, data=0x5060506)
    at dxr3interface_spu_encoder.c:405
#1  0x00add81b in cDxr3SubpictureOsd::~cDxr3SubpictureOsd () at streambuf:187
  

Comments

Luca Olivetti April 3, 2005, 9:25 p.m. UTC | #1
Ville Skyttä wrote:
> On Sun, 2005-04-03 at 19:07 +0200, Martin Cap wrote:
> 
>>Hi !
>>
>>The OSD still sucks, but I guess we made it suck a little less :)
> 
> 
> Indeed, seems so, at least mostly.
> 
> This change introduces/triggers one new crash here, though.  Not that
> tvonscreen >= 0.6.0 would be usable with DXR3 here anyway, 

That's why I use yaepg ;-)

[...]
>>>@@ -449,7 +441,7 @@
>>> 
>>> 		// This should be done in cSPUEncoder::cSPUEncoder
>>> 
>>>-		m_palManager.Clear();
>>>+		m_palManager.Reset();
>>> 		return 0;
>>> 		break;

I'm not sure this hunk is correct, the display is cleared various times 
throughout the osd life, the palette should be freed only upon close, 
shouldn't it?

Bye
  

Patch

Index: Makefile
===================================================================
RCS file: /cvsroot/dxr3plugin/dxr3/Makefile,v
retrieving revision 1.1.2.10
diff -u -r1.1.2.10 Makefile
--- Makefile	30 Mar 2005 21:22:48 -0000	1.1.2.10
+++ Makefile	3 Apr 2005 18:29:13 -0000
@@ -60,7 +60,7 @@ 
 ### The object files (add further files here):
 
 OBJS = $(PLUGIN).o dxr3multichannelaudio.o dxr3sysclock.o dxr3colormanager.o dxr3syncbuffer.o dxr3audiodecoder.o \
-dxr3blackframe.o dxr3palettemanager.o dxr3nextpts.o dxr3pesframe.o dxr3demuxdevice.o dxr3configdata.o \
+dxr3blackframe.o dxr3nextpts.o dxr3pesframe.o dxr3demuxdevice.o dxr3configdata.o \
 dxr3log.o dxr3ffmpeg.o dxr3interface_spu_encoder.o dxr3i18n.o \
 dxr3interface.o dxr3device.o dxr3outputthread.o dxr3osd.o dxr3osd_subpicture.o dxr3spudecoder.o \
 dxr3cpu.o dxr3memcpy.o
Index: dxr3interface_spu_encoder.c
===================================================================
RCS file: /cvsroot/dxr3plugin/dxr3/Attic/dxr3interface_spu_encoder.c,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 dxr3interface_spu_encoder.c
--- dxr3interface_spu_encoder.c	30 Mar 2005 21:11:55 -0000	1.1.2.6
+++ dxr3interface_spu_encoder.c	3 Apr 2005 18:29:13 -0000
@@ -45,6 +45,7 @@ 
 #include <signal.h>
 #include <string>
 #include <vdr/plugin.h>
+#include "dxr3tools.h"
 
 namespace XineScaler
 {
@@ -310,6 +311,7 @@ 
 		break;
 
 	case OSD_SetPalette:
+	{
 		// Spu->Cmd(OSD_SetPalette, 0, NumColors - 1, 0, 0, 0, Colors);
 		// (firstcolor{color},lastcolor{x0},data)
 		// Set a number of entries in the palette
@@ -328,23 +330,18 @@ 
 
 		for (int x = color, i = 0; x <= x0; x++,i++) 
 		{
-			m_palManager.AddColor((int)*col & 0xFFFFFF);
-
-			idx = m_palManager.GetIndex((int)*col & 0xFFFFFF);
-			if (m_palManager.HasChanged()) 
-			{
-				cDxr3Interface::Instance().SetPalette(m_palManager.GetPalette());
-			}
-
+			idx = m_palManager.Index(Tools::Rgb2YCrCb(*col & 0x00FFFFFF));
 			opacity = ((*col & 0xFF000000) >> 24) * 0xF / 0xFF;
 			m_windows[m_lastwindow].colors[i] = (opacity << 4) | idx;
 			m_windows[m_lastwindow].opacity[i] = opacity;
 			col++;
 		}
+		int colors = 0;
+		cDxr3Interface::Instance().SetPalette((unsigned int*)m_palManager.Colors(colors));
 
 		return 0;
 		break;
-
+	}
 	case OSD_SetBlock:
 		// (x0,y0,x1,y1,increment{color},data)
 		// fills pixels x0,y0 through  x1,y1 with the content of data[]
@@ -395,12 +392,7 @@ 
 	#else
 		if ((col = (eDvbColor*)m_windows[m_lastwindow].colors) != NULL) 
 	#endif
-			{
-			for (size_t i = 0; i < m_windows[m_lastwindow].NumColors; ++i) 
-			{
-				m_palManager.RemoveColor((int)(col[i]) & 0xFFFFFF);
-			}
-		}
+			m_palManager.Reset();
 
 		// clear osd
 		for (size_t i = m_windows[m_lastwindow].y0; i <= m_windows[m_lastwindow].y1; ++i) 
@@ -449,7 +441,7 @@ 
 
 		// This should be done in cSPUEncoder::cSPUEncoder
 
-		m_palManager.Clear();
+		m_palManager.Reset();
 		return 0;
 		break;
 
Index: dxr3interface_spu_encoder.h
===================================================================
RCS file: /cvsroot/dxr3plugin/dxr3/Attic/dxr3interface_spu_encoder.h,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 dxr3interface_spu_encoder.h
--- dxr3interface_spu_encoder.h	14 Mar 2005 22:21:07 -0000	1.1.2.1
+++ dxr3interface_spu_encoder.h	3 Apr 2005 18:29:13 -0000
@@ -33,7 +33,6 @@ 
 #include <stdlib.h>
 #include <linux/dvb/osd.h>
 #include "dxr3vdrincludes.h"
-#include "dxr3palettemanager.h"
 #include "dxr3colormanager.h"
 #include "dxr3interface.h"
 #include "dxr3singleton.h"
@@ -138,7 +137,7 @@ 
 	void CalculateActiveOsdArea();
 
 	sOSD_Window			m_windows[8];
-	cDxr3PaletteManager m_palManager;
+	cPalette		m_palManager; // name for hysterical raisins ;)
 	cColorManager*		m_ColorManager;
 	encodedata			m_encodeddata;
     int					m_lastwindow;