]> git.sesse.net Git - vlc/blobdiff - modules/codec/spudec/parse.c
A bit of headers cleanup
[vlc] / modules / codec / spudec / parse.c
index 7e0633791bd3983526eb7d48bc6f13d5f293f08c..f747c43818bebb3f0e2d59fc2e9b008184776a52 100644 (file)
@@ -27,8 +27,8 @@
  * Preamble
  *****************************************************************************/
 #include <vlc/vlc.h>
-#include <vlc/vout.h>
-#include <vlc/decoder.h>
+#include <vlc_vout.h>
+#include <vlc_codec.h>
 
 #include "spudec.h"
 
@@ -71,6 +71,8 @@ subpicture_t * E_(ParsePacket)( decoder_t *p_dec )
     p_spu = p_dec->pf_spu_buffer_new( p_dec );
     if( !p_spu ) return NULL;
 
+    p_spu->b_pausable = VLC_TRUE;
+
     /* Rationale for the "p_spudec->i_rle_size * 4": we are going to
      * expand the RLE stuff so that we won't need to read nibbles later
      * on. This will speed things up a lot. Plus, we'll only need to do
@@ -111,9 +113,11 @@ subpicture_t * E_(ParsePacket)( decoder_t *p_dec )
         return NULL;
     }
 
+#ifdef DEBUG_SPUDEC
     msg_Dbg( p_dec, "total size: 0x%x, RLE offsets: 0x%x 0x%x",
              p_sys->i_spu_size,
              p_spu_data->pi_offset[0], p_spu_data->pi_offset[1] );
+#endif
 
     Render( p_dec, p_spu, p_spu_data );
     free( p_spu_data );
@@ -143,8 +147,6 @@ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu,
     uint8_t i_command = SPU_CMD_END;
     mtime_t date = 0;
 
-    unsigned int i, pi_alpha[4];
-
     /* Initialize the structure */
     p_spu->i_start = p_spu->i_stop = 0;
     p_spu->b_ephemer = VLC_FALSE;
@@ -214,6 +216,7 @@ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu,
             if( p_dec->fmt_in.subs.spu.palette[0] == 0xBeeF )
             {
                 unsigned int idx[4];
+                int i;
 
                 p_spu_data->b_palette = VLC_TRUE;
 
@@ -243,24 +246,10 @@ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu,
                 return VLC_EGENERIC;
             }
 
-            pi_alpha[3] = (p_sys->buffer[i_index+1]>>4)&0x0f;
-            pi_alpha[2] = (p_sys->buffer[i_index+1])&0x0f;
-            pi_alpha[1] = (p_sys->buffer[i_index+2]>>4)&0x0f;
-            pi_alpha[0] = (p_sys->buffer[i_index+2])&0x0f;
-
-            /* Ignore blank alpha palette. Sometimes spurious blank
-             * alpha palettes are present - dunno why. */
-            if( pi_alpha[0] | pi_alpha[1] | pi_alpha[2] | pi_alpha[3] )
-            {
-                p_spu_data->pi_alpha[0] = pi_alpha[0];
-                p_spu_data->pi_alpha[1] = pi_alpha[1];
-                p_spu_data->pi_alpha[2] = pi_alpha[2];
-                p_spu_data->pi_alpha[3] = pi_alpha[3];
-            }
-            else
-            {
-                msg_Warn( p_dec, "ignoring blank alpha palette" );
-            }
+            p_spu_data->pi_alpha[3] = (p_sys->buffer[i_index+1]>>4)&0x0f;
+            p_spu_data->pi_alpha[2] = (p_sys->buffer[i_index+1])&0x0f;
+            p_spu_data->pi_alpha[1] = (p_sys->buffer[i_index+2]>>4)&0x0f;
+            p_spu_data->pi_alpha[0] = (p_sys->buffer[i_index+2])&0x0f;
 
             i_index += 3;
             break;
@@ -560,19 +549,24 @@ static int ParseRLE( decoder_t *p_dec, subpicture_t * p_spu,
         return VLC_EGENERIC;
     }
 
+#ifdef DEBUG_SPUDEC
     msg_Dbg( p_dec, "valid subtitle, size: %ix%i, position: %i,%i",
              p_spu->i_width, p_spu->i_height, p_spu->i_x, p_spu->i_y );
+#endif
 
     /* Crop if necessary */
     if( i_skipped_top || i_skipped_bottom )
     {
+#ifdef DEBUG_SPUDEC
         int i_y = p_spu->i_y + i_skipped_top;
         int i_height = p_spu->i_height - (i_skipped_top + i_skipped_bottom);
-
+#endif
         p_spu_data->i_y_top_offset = i_skipped_top;
         p_spu_data->i_y_bottom_offset = i_skipped_bottom;
+#ifdef DEBUG_SPUDEC
         msg_Dbg( p_dec, "cropped to: %ix%i, position: %i,%i",
                  p_spu->i_width, i_height, p_spu->i_x, i_y );
+#endif
     }
  
     /* Handle color if no palette was found */
@@ -627,8 +621,10 @@ static int ParseRLE( decoder_t *p_dec, subpicture_t * p_spu,
             p_spu_data->pi_yuv[i_shade][2] = 0x80;
         }
 
+#ifdef DEBUG_SPUDEC
         msg_Dbg( p_dec, "using custom palette (border %i, inner %i, shade %i)",
                  i_border, i_inner, i_shade );
+#endif
     }
 
     return VLC_SUCCESS;