[vlc-commits] vout: drop or patch invalid dvd menu palette

Francois Cartegnie git at videolan.org
Wed Aug 23 12:52:43 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Aug  2 16:07:40 2017 +0200| [50b86e5bfea521ce75592bc68e66c7865eebc286] | committer: Francois Cartegnie

vout: drop or patch invalid dvd menu palette

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=50b86e5bfea521ce75592bc68e66c7865eebc286
---

 src/video_output/vout_subpictures.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 5a72a3a06b..64a660ff34 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -745,6 +745,7 @@ static void SpuRenderRegion(spu_t *spu,
         video_palette_t *old_palette = region->fmt.p_palette;
         video_palette_t new_palette;
         bool b_opaque = false;
+        bool b_old_opaque = false;
 
         /* We suppose DVD palette here */
         new_palette.i_entries = 4;
@@ -757,14 +758,29 @@ static void SpuRenderRegion(spu_t *spu,
 
         if (old_palette->i_entries == new_palette.i_entries) {
             for (int i = 0; i < old_palette->i_entries; i++)
+            {
                 for (int j = 0; j < 4; j++)
                     changed_palette |= old_palette->palette[i][j] != new_palette.palette[i][j];
+                b_old_opaque |= (old_palette->palette[i][3] > 0x00);
+            }
         } else {
             changed_palette = true;
+            b_old_opaque = true;
         }
 
-        /* Reject fully transparent broken palette for cropping */
-        changed_palette &= b_opaque;
+        /* Reject or patch fully transparent broken palette used for dvd menus */
+        if( !b_opaque )
+        {
+            if( !b_old_opaque )
+            {
+                /* replace with new one and fixed alpha */
+                old_palette->palette[1][3] = 0x80;
+                old_palette->palette[2][3] = 0x80;
+                old_palette->palette[3][3] = 0x80;
+            }
+            /* keep old visible palette */
+            else changed_palette = false;
+        }
 
         if( changed_palette )
             *old_palette = new_palette;



More information about the vlc-commits mailing list