]> git.sesse.net Git - vlc/commitdiff
. les sous-titres sont centr�s
authorSam Hocevar <sam@videolan.org>
Wed, 22 Mar 2000 00:57:10 +0000 (00:57 +0000)
committerSam Hocevar <sam@videolan.org>
Wed, 22 Mar 2000 00:57:10 +0000 (00:57 +0000)
 . la palette des sous-titres par d�faut est moins affreuse.

Bugs que j'avais oubli�s:
 . ne marchent qu'en 16 bits (devrait se fixer vite)
 . parfois quelques glitches graphiques que je ne comprends pas.

include/video.h
src/spu_decoder/spu_decoder.c
src/video_output/video_output.c
src/video_output/video_spu.c
src/video_output/video_spu.h

index 941b1ee3585b482b420b8715eda4dd4e244d1ee5..c9f865b45685e5b0a0b4d5b09144a5ba9791cba0 100644 (file)
@@ -151,6 +151,8 @@ typedef struct subpicture_s
         struct
         {
             int                 i_offset[2];         /* byte offsets to data */
+            int                 i_x1, i_x2;                 /* X coordinates */
+            int                 i_y1, i_y2;                 /* Y coordinates */
         } spu;
     } type;
 
index c99aa4ecdddb9ec290c20b246c6c769e60c6a272..9c9d130e350a5be32b603ea952ecf9cfac44aa6f 100644 (file)
@@ -298,9 +298,15 @@ static void RunThread( spudec_thread_t *p_spudec )
                                 break;
                             case 0x05:
                                 /* 05xxxyyyxxxyyy (coordinates) */
-                                GetWord( i_word );
-                                GetWord( i_word );
-                                GetWord( i_word );
+                                i_word = GetByte( &p_spudec->bit_stream );
+                                p_spu->type.spu.i_x1 = (i_word << 4) | GetBits( &p_spudec->bit_stream, 4 );
+                                i_word = GetBits( &p_spudec->bit_stream, 4 );
+                                p_spu->type.spu.i_x2 = (i_word << 8) | GetByte( &p_spudec->bit_stream );
+                                i_word = GetByte( &p_spudec->bit_stream );
+                                p_spu->type.spu.i_y1 = (i_word << 4) | GetBits( &p_spudec->bit_stream, 4 );
+                                i_word = GetBits( &p_spudec->bit_stream, 4 );
+                                p_spu->type.spu.i_y2 = (i_word << 8) | GetByte( &p_spudec->bit_stream );
+                               i_index += 6;
                                 break;
                             case 0x06:
                                 /* 06xxxxyyyy (byte offsets) */
index 7de077c823a9eb26bf295160210ae5eefa6f57d8..b2b9c6add7599e218fe5fe584b89a211fe73d44c 100644 (file)
@@ -1009,9 +1009,10 @@ last_display_date = display_date;
 #endif
                 if( display_date > current_date + VOUT_DISPLAY_DELAY )
             {
-                /* A picture is ready to be rendered, but its rendering date is
-                 * far from the current one so the thread will perform an empty loop
-                 * as if no picture were found. The picture state is unchanged */
+                /* A picture is ready to be rendered, but its rendering date
+                 * is far from the current one so the thread will perform an
+                 * empty loop as if no picture were found. The picture state
+                 * is unchanged */
                 p_pic =         NULL;
                 display_date =  0;
             }
@@ -1092,6 +1093,7 @@ last_display_date = display_date;
             }
 
         }
+#if 0
         else if( p_subpic )                              /* subpicture alone */
         {
             b_display = p_vout->b_active;
@@ -1119,6 +1121,7 @@ last_display_date = display_date;
             p_subpic->i_status = DESTROYED_SUBPICTURE;
             vlc_mutex_unlock( &p_vout->subpicture_lock );*/
         }
+#endif
         else if( p_vout->b_active )        /* idle or interface screen alone */
         {
             if( p_vout->b_interface && 0 /* && XXX?? intf_change */ )
@@ -1829,6 +1832,7 @@ static void RenderSubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
     {
     case DVD_SUBPICTURE:                              /* DVD subpicture unit */
         vout_RenderSPU( p_subpic->p_data, p_subpic->type.spu.i_offset,
+                        p_subpic->type.spu.i_x1, p_subpic->type.spu.i_y1,
                         p_vout->p_buffer[ p_vout->i_buffer_index ].p_data,
                         p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line );
         break;
index 5a4b9b79af152b9de32431127af176797bd3b5c8..1d82875ecf6bb6e4d74ccd7a631368e8d3049721 100644 (file)
@@ -53,9 +53,9 @@ static int PutPixel ( spu_t *p_spu, int len, u8 color );
 #define GET_NIBBLE( i ) \
     if( b_aligned ) \
     { \
-        i_next = *p_dest[i_id]; \
+        i_next = *p_from[i_id]; \
         /*printf("%.1x", i_next >> 4);*/ \
-        p_dest[ i_id ]++; \
+        p_from[ i_id ]++; \
         b_aligned = 0; \
         i = i_next >> 4; \
     } \
@@ -70,9 +70,9 @@ static int PutPixel ( spu_t *p_spu, int len, u8 color );
 #define ADD_NIBBLE( i, j ) \
     if( b_aligned ) \
     { \
-        i_next = *p_dest[i_id]; \
+        i_next = *p_from[i_id]; \
         /*printf("%.1x", i_next >> 4);*/ \
-        p_dest[ i_id ]++; \
+        p_from[ i_id ]++; \
         b_aligned = 0; \
         i = (j) + (i_next >> 4); \
     } \
@@ -88,26 +88,27 @@ static int PutPixel ( spu_t *p_spu, int len, u8 color );
  *****************************************************************************
  * 
  *****************************************************************************/
-void vout_RenderSPU( byte_t *p_data, int p_offset[2], byte_t *p_pic,
+void vout_RenderSPU( byte_t *p_data, int p_offset[2],
+                     int i_x, int i_y, byte_t *p_pic,
                      int i_bytes_per_pixel, int i_bytes_per_line )
 {
     int i_code = 0x00;
     int i_next = 0;
     int i_id = 0;
     boolean_t b_aligned = 1;
-    byte_t *p_dest[2];
+    byte_t *p_from[2];
     spu_t spu;
 
-    p_dest[0] = p_data + p_offset[0];
-    p_dest[1] = p_data + p_offset[1];
+    p_from[1] = p_data + p_offset[1];
+    p_from[0] = p_data + p_offset[0];
 
     spu.x = 0;
     spu.y = 0;
     spu.width = 720;
     spu.height = 576;
-    spu.p_data = p_pic;
+    spu.p_data = p_pic + i_x * i_bytes_per_pixel + i_y * i_bytes_per_line;
 
-    while( p_dest[0] < p_data + p_offset[1] + 2 )
+    while( p_from[0] < p_data + p_offset[1] + 2 )
     {
         GET_NIBBLE( i_code );
 
@@ -149,7 +150,7 @@ void vout_RenderSPU( byte_t *p_data, int p_offset[2], byte_t *p_pic,
         {
             intf_DbgMsg( "video_spu: unknown code 0x%x "
                          "(dest %x side %x, x=%d, y=%d)\n",
-                         i_code, p_dest[i_id], i_id, spu.x, spu.y );
+                         i_code, p_from[i_id], i_id, spu.x, spu.y );
             if( NewLine( &spu, &i_id ) < 0 )
                 return;
             continue;
@@ -175,7 +176,7 @@ static int NewLine( spu_t *p_spu, int *i_id )
 static int PutPixel ( spu_t *p_spu, int i_len, u8 i_color )
 {
     //static int p_palette[4] = { 0x0000, 0xfef8, 0x7777, 0xffff };
-    static int p_palette[4] = { 0x0000, 0xffff, 0x0000, 0xffff };
+    static int p_palette[4] = { 0x0000, 0xffff, 0x5555, 0x0000 };
 
     if( (i_len + p_spu->x + p_spu->y * p_spu->width)
             > p_spu->height * p_spu->width )
index 93e46362e5bdb6d12145d210036b686375708955..d434ab2f4fcb08605ad677143bc7f6dc72b8f92e 100644 (file)
@@ -24,5 +24,6 @@
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
-void   vout_RenderSPU ( byte_t *p_data, int p_offset[2], byte_t *p_pic,
+void   vout_RenderSPU ( byte_t *p_data, int p_offset[2],
+                        int i_x, int i_y, byte_t *p_pic,
                         int i_bytes_per_pixel, int i_bytes_per_line );