]> git.sesse.net Git - vlc/blobdiff - modules/codec/spudec/parse.c
Use var_InheritString for --decklink-video-connection.
[vlc] / modules / codec / spudec / parse.c
index c61674ae83fc6f506ce1e1830c562b73b1a1d12a..99a8c4702da49bf03729cdd0f816849a52be61c3 100644 (file)
@@ -101,7 +101,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec )
     spu_properties_t spu_properties;
 
     /* Allocate the subpicture internal data. */
-    p_spu = decoder_NewSubpicture( p_dec );
+    p_spu = decoder_NewSubpicture( p_dec, NULL );
     if( !p_spu ) return NULL;
 
     p_spu->i_original_picture_width =
@@ -161,7 +161,7 @@ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu,
     decoder_sys_t *p_sys = p_dec->p_sys;
 
     /* Our current index in the SPU packet */
-    unsigned int i_index = p_sys->i_rle_size + 4;
+    unsigned int i_index;
 
     /* The next start-of-control-sequence index and the previous one */
     unsigned int i_next_seq = 0, i_cur_seq = 0;
@@ -293,11 +293,14 @@ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu,
                 return VLC_EGENERIC;
             }
 
-            b_cmd_alpha = true;
-            spu_data_cmd.pi_alpha[3] = (p_sys->buffer[i_index+1]>>4)&0x0f;
-            spu_data_cmd.pi_alpha[2] = (p_sys->buffer[i_index+1])&0x0f;
-            spu_data_cmd.pi_alpha[1] = (p_sys->buffer[i_index+2]>>4)&0x0f;
-            spu_data_cmd.pi_alpha[0] = (p_sys->buffer[i_index+2])&0x0f;
+            if(!p_sys->b_disabletrans)
+            { /* If we want to use original transparency values */
+                b_cmd_alpha = true;
+                spu_data_cmd.pi_alpha[3] = (p_sys->buffer[i_index+1]>>4)&0x0f;
+                spu_data_cmd.pi_alpha[2] = (p_sys->buffer[i_index+1])&0x0f;
+                spu_data_cmd.pi_alpha[1] = (p_sys->buffer[i_index+2]>>4)&0x0f;
+                spu_data_cmd.pi_alpha[0] = (p_sys->buffer[i_index+2])&0x0f;
+            }
 
             i_index += 3;
             break;
@@ -464,7 +467,7 @@ static int ParseRLE( decoder_t *p_dec,
     bool b_empty_top = true;
     unsigned int i_skipped_top = 0, i_skipped_bottom = 0;
     unsigned int i_transparent_code = 0;
+
     /* Colormap statistics */
     int i_border = -1;
     int stats[4]; stats[0] = stats[1] = stats[2] = stats[3] = 0;
@@ -613,7 +616,7 @@ static int ParseRLE( decoder_t *p_dec,
                  p_spu->i_width, i_height, p_spu->i_x, i_y );
 #endif
     }
+
     /* Handle color if no palette was found */
     if( !p_spu_data->b_palette )
     {
@@ -688,7 +691,8 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
     fmt.i_chroma = VLC_CODEC_YUVP;
-    fmt.i_aspect = 0; /* 0 means use aspect ratio of background video */
+    fmt.i_sar_num = 0; /* 0 means use aspect ratio of background video */
+    fmt.i_sar_den = 1;
     fmt.i_width = fmt.i_visible_width = p_spu_properties->i_width;
     fmt.i_height = fmt.i_visible_height = p_spu_properties->i_height -
         p_spu_data->i_y_top_offset - p_spu_data->i_y_bottom_offset;
@@ -700,9 +704,7 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
         fmt.p_palette->palette[i_x][0] = p_spu_data->pi_yuv[i_x][0];
         fmt.p_palette->palette[i_x][1] = p_spu_data->pi_yuv[i_x][1];
         fmt.p_palette->palette[i_x][2] = p_spu_data->pi_yuv[i_x][2];
-        fmt.p_palette->palette[i_x][3] =
-            p_spu_data->pi_alpha[i_x] == 0xf ? 0xff :
-            p_spu_data->pi_alpha[i_x] << 4;
+        fmt.p_palette->palette[i_x][3] = p_spu_data->pi_alpha[i_x] * 0x11;
     }
 
     p_spu->p_region = subpicture_region_New( &fmt );