[vlc-devel] [PATCH 05/10] vlc_es: use a common define for the initialized SPU palette

Steve Lhomme robux4 at videolabs.io
Fri Jul 7 12:56:13 CEST 2017


---
 include/vlc_es.h                             | 2 ++
 modules/access/dvdnav.c                      | 2 +-
 modules/access/dvdread.c                     | 2 +-
 modules/codec/spudec/parse.c                 | 2 +-
 modules/demux/avformat/demux.c               | 2 +-
 modules/demux/mkv/matroska_segment_parse.cpp | 2 +-
 modules/demux/mp4/essetup.c                  | 2 +-
 modules/demux/vobsub.c                       | 2 +-
 8 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/vlc_es.h b/include/vlc_es.h
index d469c376f7..52d4d0cdcd 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -534,6 +534,8 @@ struct subs_format_t
     text_style_t *p_style; /* Default styles to use */
 };
 
+#define SPU_PALETTE_DEFINED  0xbeefbeef
+
 /**
  * ES language definition
  */
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 28be76d89f..e163b48542 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -1502,7 +1502,7 @@ static void ESNew( demux_t *p_demux, int i_id )
         }
 
         /* Palette */
-        tk->fmt.subs.spu.palette[0] = 0xBeef;
+        tk->fmt.subs.spu.palette[0] = SPU_PALETTE_DEFINED;
         memcpy( &tk->fmt.subs.spu.palette[1], p_sys->clut,
                 16 * sizeof( uint32_t ) );
 
diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c
index b479b9eeee..747e511475 100644
--- a/modules/access/dvdread.c
+++ b/modules/access/dvdread.c
@@ -706,7 +706,7 @@ static void ESNew( demux_t *p_demux, int i_id, int i_lang )
     else if( tk->fmt.i_cat == SPU_ES )
     {
         /* Palette */
-        tk->fmt.subs.spu.palette[0] = 0xBeef;
+        tk->fmt.subs.spu.palette[0] = SPU_PALETTE_DEFINED;
         memcpy( &tk->fmt.subs.spu.palette[1], p_sys->clut,
                 16 * sizeof( uint32_t ) );
 
diff --git a/modules/codec/spudec/parse.c b/modules/codec/spudec/parse.c
index 9ea200ff49..771c41dd64 100644
--- a/modules/codec/spudec/parse.c
+++ b/modules/codec/spudec/parse.c
@@ -260,7 +260,7 @@ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu,
                 return VLC_EGENERIC;
             }
 
-            if( p_dec->fmt_in.subs.spu.palette[0] == 0xBeeF )
+            if( p_dec->fmt_in.subs.spu.palette[0] == SPU_PALETTE_DEFINED )
             {
                 unsigned int idx[4];
                 int i;
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index e5275c30ec..c2489c6eed 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -486,7 +486,7 @@ int OpenDemux( vlc_object_t *p_this )
                     if( psz_start &&
                         vobsub_palette_parse( psz_start, &es_fmt.subs.spu.palette[1] ) == VLC_SUCCESS )
                     {
-                        es_fmt.subs.spu.palette[0] =  0xBeef;
+                        es_fmt.subs.spu.palette[0] = SPU_PALETTE_DEFINED;
                         msg_Dbg( p_demux, "vobsub palette read" );
                     }
                     else
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 7ba0bc2f7c..a7be7901e7 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -1880,7 +1880,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
                     if( psz_start &&
                         vobsub_palette_parse( psz_start, &p_tk->fmt.subs.spu.palette[1] ) == VLC_SUCCESS )
                     {
-                        p_tk->fmt.subs.spu.palette[0] =  0xBeef;
+                        p_tk->fmt.subs.spu.palette[0] = SPU_PALETTE_DEFINED;
                         msg_Dbg( vars.p_demuxer, "vobsub palette read" );
                     }
                     else
diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index cc53143881..bf3232486b 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -167,7 +167,7 @@ static void SetupESDS( demux_t *p_demux, mp4_track_t *p_track, const MP4_descrip
             p_track->fmt.subs.spu.palette[1 + i] =
                     GetDWBE((char*)p_track->fmt.p_extra + i * 4);
         }
-        p_track->fmt.subs.spu.palette[0] = 0xBeef;
+        p_track->fmt.subs.spu.palette[0] = SPU_PALETTE_DEFINED;
     }
 }
 
diff --git a/modules/demux/vobsub.c b/modules/demux/vobsub.c
index a04b854551..d46775b5b5 100644
--- a/modules/demux/vobsub.c
+++ b/modules/demux/vobsub.c
@@ -558,7 +558,7 @@ static int ParseVobSubIDX( demux_t *p_demux )
             fmt.psz_language = language;
             if( p_sys->b_palette )
             {
-                fmt.subs.spu.palette[0] = 0xBeef;
+                fmt.subs.spu.palette[0] = SPU_PALETTE_DEFINED;
                 memcpy( &fmt.subs.spu.palette[1], p_sys->palette, 16 * sizeof( uint32_t ) );
             }
 
-- 
2.12.1



More information about the vlc-devel mailing list