changeset 14561:a226d301eec1

Handle missing palettes in the info part of VobSubs in Matroska files correctly by giving mplayer a NULL pointer. This way it will use a default palette instead of black only. Patch by Csillag Kristof (fenwick () freemail ! hu)
author mosu
date Fri, 21 Jan 2005 18:25:44 +0000
parents 1481e9c76eb5
children ee95cfdc1433
files libmpdemux/demux_mkv.c libmpdemux/matroska.h mplayer.c
diffstat 3 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Fri Jan 21 17:12:56 2005 +0000
+++ b/libmpdemux/demux_mkv.c	Fri Jan 21 18:25:44 2005 +0000
@@ -373,6 +373,7 @@
              t->sh_sub.palette[11], t->sh_sub.palette[12],
              t->sh_sub.palette[13], t->sh_sub.palette[14],
              t->sh_sub.palette[15]);
+      t->sh_sub.has_palette = 1;
       return 2;
     }
   return 0;
@@ -480,6 +481,7 @@
   memcpy(buf, t->private_data, t->private_size);
   buf[t->private_size] = 0;
   t->sh_sub.type = 'v';
+  t->sh_sub.has_palette = 0;
 
   pos = buf;
   start = buf;
--- a/libmpdemux/matroska.h	Fri Jan 21 17:12:56 2005 +0000
+++ b/libmpdemux/matroska.h	Fri Jan 21 18:25:44 2005 +0000
@@ -59,6 +59,7 @@
 
 typedef struct {
   char type;                    // t = text, v = VobSub
+  int has_palette;              // If we have a valid palette
   unsigned int palette[16];     // for VobSubs
   int width, height;            // for VobSubs
   int custom_colors;
--- a/mplayer.c	Fri Jan 21 17:12:56 2005 +0000
+++ b/mplayer.c	Fri Jan 21 18:25:44 2005 +0000
@@ -3417,7 +3417,7 @@
         if (vo_spudec != NULL)
           spudec_free(vo_spudec);
         vo_spudec =
-          spudec_new_scaled_vobsub(mkv_sh_sub->palette, mkv_sh_sub->colors,
+          spudec_new_scaled_vobsub(mkv_sh_sub->has_palette ? mkv_sh_sub->palette : NULL, mkv_sh_sub->colors,
                                    mkv_sh_sub->custom_colors,
                                    mkv_sh_sub->width,
                                    mkv_sh_sub->height);