Patch: dxr3plugin OSD don't turn pink

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

 



Hi ML, Hi dxr3plugin lovers,

Attached to this posting is a patch which fixes the odd problem making 
the osd
turn pink after returning from mplayer or after hardware-reset of the 
dxr3-card.
I posted this fix in a german-vdr-forum a couple of months ago and it
works for other users there, too. I haven't found the time to post it 
here (other users hadn't either:) )...  so,
here it is.

Now what this patch does is it changes some behavior of cDxr3PaletteManager.
It seems, that after returning from pmExtern_THIS_SHOULD_BE_AVOIDED,
palette-data in cDxr3PaletteManager is somehow broken after 
resuscitation (whatever happens there, the code is
a total mess).
I avoid this by *not* converting the whole data allover again in 
cDxr3PaletteManager::GetPalette() through Tools::Rgb2YCrCb() and copy it 
to m_pal (only when palette-data has changed, indicated by member 
m_changed, should speed up the whole process a bit additionally).

This patch may be applied to current CVS (HEAD or MAIN, also vdr-dxr3-0-2).
Give it a shot !
Bye,
-- 
---
Martin Cap



-------------- next part --------------
diff -Nur dxr3/dxr3palettemanager.c dxr3_orig/dxr3palettemanager.c
--- dxr3/dxr3palettemanager.c	2005-03-30 13:39:03.494069720 +0200
+++ dxr3_orig/dxr3palettemanager.c	2005-03-30 13:41:07.113276744 +0200
@@ -17,12 +17,12 @@
 
 // ================================== 
 //! constructor
-cDxr3PaletteManager::cDxr3PaletteManager() : 
-    m_changed(false)
+cDxr3PaletteManager::cDxr3PaletteManager() 
 {
     memset(m_colors, 0, sizeof(int) * MAX_COLORS);
     memset(m_users, 0, sizeof(int) * MAX_COLORS);
-    memset(m_pal, 0, sizeof(uint32_t) * MAX_COLORS);
+    memset(m_pal, 0, sizeof(int) * MAX_COLORS);
+    m_changed = false;
 };
 
 // ==================================
@@ -31,8 +31,6 @@
     int freeIndex = MAX_COLORS;
     bool found = false;
 
-	m_changed = false;
-
     for (int i = 0; i < MAX_COLORS && !found; ++i) 
 	{
         if (color == m_colors[i]) 
@@ -58,17 +56,12 @@
 void cDxr3PaletteManager::RemoveColor(int color) 
 {
     bool found = false;
-    
-  	m_changed = false;
-    
     for (int i = 0; i < MAX_COLORS && !found; ++i) 
 	{
         if (color == m_colors[i]) 
 		{
             if (m_users[i] > 0) --m_users[i];
-            m_changed = found = true;
-            
-            
+            found = true;
         }
     }
 }
@@ -78,15 +71,12 @@
 {
     bool found = false;
     int index = 0;
-
-	 m_changed = false;
-	
     for (int i = 0; i < MAX_COLORS && !found; ++i) 
 	{
         if (color == m_colors[i]) 
 		{
             index = i;
-            m_changed = found = true;
+            found = true;
         }
     }
     return index; 
@@ -102,29 +92,24 @@
 int cDxr3PaletteManager::operator[](int index) 
 {
     assert(index < MAX_COLORS && index > 0);
-    
     return m_colors[index];
 }
 
 // ==================================
 bool cDxr3PaletteManager::HasChanged() 
 {
-//    bool retval = m_changed;
-//    m_changed = false;
-    return m_changed;
+    bool retval = m_changed;
+    m_changed = false;
+    return retval;
 }
 
 // ==================================
 uint32_t* cDxr3PaletteManager::GetPalette() 
 {   
-	if(m_changed)
-	{	
-   	 for (int i = 0; i < MAX_COLORS; ++i) 
-		{
-	        m_pal[i] = Tools::Rgb2YCrCb(m_colors[i]);
-	    }
-	}
-	
+    for (int i = 0; i < MAX_COLORS; ++i) 
+	{
+        m_pal[i] = Tools::Rgb2YCrCb(m_colors[i]);
+    }
+    
     return m_pal;
 } 
-


[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux