Changeset 8b09b55dd76c038d1363ff4827f49f131bd42429
- Timestamp:
- 11/06/02 19:07:57 (6 years ago)
- git-parent:
- Files:
-
- include/video.h (modified) (4 diffs)
- include/video_output.h (modified) (2 diffs)
- modules/access/dvdplay/access.c (modified) (8 diffs)
- modules/access/dvdplay/dvd.h (modified) (2 diffs)
- modules/access/dvdplay/intf.c (modified) (4 diffs)
- modules/codec/spudec/parse.c (modified) (20 diffs)
- modules/codec/spudec/render.c (modified) (21 diffs)
- modules/codec/spudec/spudec.c (modified) (5 diffs)
- modules/codec/spudec/spudec.h (modified) (5 diffs)
- src/video_output/vout_subpictures.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/video.h
r64d33dc r8b09b55 5 5 ***************************************************************************** 6 6 * Copyright (C) 1999, 2000 VideoLAN 7 * $Id: video.h,v 1.5 6 2002/07/23 00:39:16sam Exp $7 * $Id: video.h,v 1.57 2002/11/06 18:07:57 sam Exp $ 8 8 * 9 9 * Authors: Vincent Seguin <seguin@via.ecp.fr> … … 167 167 int i_type; /* type */ 168 168 int i_status; /* flags */ 169 int i_size; /* data size */170 169 subpicture_t * p_next; /* next subtitle to be displayed */ 171 170 … … 200 199 #endif 201 200 202 /* The subpicture rendering routine */ 203 void ( *pf_render ) ( vout_thread_t *, picture_t *, const subpicture_t * ); 201 /* The subpicture rendering and destruction routines */ 202 void ( *pf_render ) ( vout_thread_t *, picture_t *, const subpicture_t * ); 203 void ( *pf_destroy ) ( subpicture_t * ); 204 204 205 205 /* Private data - the subtitle plugin might want to put stuff here to 206 206 * keep track of the subpicture */ 207 207 subpicture_sys_t *p_sys; /* subpicture data */ 208 void *p_sys_orig; /* pointer before memalign */209 208 }; 210 209 … … 217 216 #define RESERVED_SUBPICTURE 1 /* allocated and reserved */ 218 217 #define READY_SUBPICTURE 2 /* ready for display */ 219 #define DESTROYED_SUBPICTURE 3 /* allocated but not used anymore */ 220 218 include/video_output.h
r0a47ec0 r8b09b55 6 6 ***************************************************************************** 7 7 * Copyright (C) 1999, 2000 VideoLAN 8 * $Id: video_output.h,v 1.8 4 2002/10/17 16:03:18sam Exp $8 * $Id: video_output.h,v 1.85 2002/11/06 18:07:57 sam Exp $ 9 9 * 10 10 * Authors: Vincent Seguin <seguin@via.ecp.fr> … … 159 159 subpicture_t * ); 160 160 161 VLC_EXPORT( subpicture_t *, vout_CreateSubPicture, ( vout_thread_t *, int , int) );161 VLC_EXPORT( subpicture_t *, vout_CreateSubPicture, ( vout_thread_t *, int ) ); 162 162 VLC_EXPORT( void, vout_DestroySubPicture, ( vout_thread_t *, subpicture_t * ) ); 163 163 VLC_EXPORT( void, vout_DisplaySubPicture, ( vout_thread_t *, subpicture_t * ) ); modules/access/dvdplay/access.c
r09cbae7 r8b09b55 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: access.c,v 1. 4 2002/10/26 15:24:19 gbazinExp $5 * $Id: access.c,v 1.5 2002/11/06 18:07:57 sam Exp $ 6 6 * 7 7 * Author: St�ane Borel <stef@via.ecp.fr> … … 88 88 if( p_dvd == NULL ) 89 89 { 90 msg_Err( p_input, " dvdplay error:out of memory" );90 msg_Err( p_input, "out of memory" ); 91 91 return -1; 92 92 } … … 115 115 if( p_dvd->vmg == NULL ) 116 116 { 117 msg_Err( p_input, " dvdplay error: can't open source");117 msg_Err( p_input, "cannot open %s", psz_source ); 118 118 free( p_dvd ); 119 119 return -1; … … 185 185 p_input->psz_demux = "dvdplay"; 186 186 187 /* FIXME: we might lose variables here */ 188 var_Create( p_input, "x-start", VLC_VAR_INTEGER ); 189 var_Create( p_input, "y-start", VLC_VAR_INTEGER ); 190 var_Create( p_input, "x-end", VLC_VAR_INTEGER ); 191 var_Create( p_input, "y-end", VLC_VAR_INTEGER ); 192 193 var_Create( p_input, "color", VLC_VAR_ADDRESS ); 194 var_Create( p_input, "contrast", VLC_VAR_ADDRESS ); 195 196 var_Create( p_input, "highlight", VLC_VAR_BOOL ); 197 var_Create( p_input, "highlight-mutex", VLC_VAR_MUTEX ); 198 187 199 return 0; 188 200 } … … 195 207 input_thread_t * p_input = (input_thread_t *)p_this; 196 208 dvd_data_t * p_dvd = (dvd_data_t *)p_input->p_access_data; 209 210 var_Destroy( p_input, "highlight-mutex" ); 211 var_Destroy( p_input, "highlight" ); 212 213 var_Destroy( p_input, "x-start" ); 214 var_Destroy( p_input, "x-end" ); 215 var_Destroy( p_input, "y-start" ); 216 var_Destroy( p_input, "y-end" ); 217 218 var_Destroy( p_input, "color" ); 219 var_Destroy( p_input, "contrast" ); 197 220 198 221 /* close libdvdplay */ … … 351 374 input_thread_t * p_input; 352 375 dvd_data_t * p_dvd; 376 vlc_value_t val; 353 377 int i; 354 378 … … 408 432 break; 409 433 case NEW_HIGHLIGHT: 410 434 if( var_Get( p_input, "highlight-mutex", &val ) == VLC_SUCCESS ) 435 { 436 vlc_mutex_t *p_mutex = val.p_address; 437 vlc_mutex_lock( p_mutex ); 438 439 /* Retrieve the highlight from dvdplay */ 440 dvdplay_highlight( p_dvd->vmg, &p_dvd->hli ); 441 442 /* Fill our internal variables with this data */ 443 val.i_int = p_dvd->hli.i_x_start; 444 var_Set( p_input, "x-start", val ); 445 val.i_int = p_dvd->hli.i_y_start; 446 var_Set( p_input, "y-start", val ); 447 val.i_int = p_dvd->hli.i_x_end; 448 var_Set( p_input, "x-end", val ); 449 val.i_int = p_dvd->hli.i_y_end; 450 var_Set( p_input, "y-end", val ); 451 452 val.p_address = (void *)p_dvd->hli.pi_color; 453 var_Set( p_input, "color", val ); 454 val.p_address = (void *)p_dvd->hli.pi_contrast; 455 var_Set( p_input, "contrast", val ); 456 457 /* Tell the SPU decoder that there's a new highlight */ 458 val.b_bool = VLC_TRUE; 459 var_Set( p_input, "highlight", val ); 460 461 vlc_mutex_unlock( p_mutex ); 462 } 411 463 break; 412 464 default: 413 msg_Err( p_input, "unknown event from libdvdplay (%d)", 414 event ); 465 msg_Err( p_input, "unknown event from libdvdplay (%d)", event ); 415 466 } 416 467 … … 495 546 return 0; 496 547 } 548 modules/access/dvdplay/dvd.h
r19ea8fe r8b09b55 3 3 ***************************************************************************** 4 4 * Copyright (C) 1999-2001 VideoLAN 5 * $Id: dvd.h,v 1. 1 2002/08/04 17:23:42sam Exp $5 * $Id: dvd.h,v 1.2 2002/11/06 18:07:57 sam Exp $ 6 6 * 7 7 * Author: St�ane Borel <stef@via.ecp.fr> … … 57 57 dvdplay_event_t event; 58 58 dvdplay_ctrl_t control; 59 dvdplay_highlight_t hli; 59 60 60 61 } dvd_data_t; modules/access/dvdplay/intf.c
r0a47ec0 r8b09b55 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002 VideoLAN 5 * $Id: intf.c,v 1. 2 2002/10/17 16:03:18sam Exp $5 * $Id: intf.c,v 1.3 2002/11/06 18:07:57 sam Exp $ 6 6 * 7 7 * Authors: St�ane Borel <stef@via.ecp.fr> … … 34 34 #include "stream_control.h" 35 35 #include "input_ext-intf.h" 36 #include "input_ext-dec.h" 36 37 37 38 #include "dvd.h" … … 191 192 } 192 193 193 msg_Dbg( p_intf, "send button coordinates: %dx%d",194 p_intf->p_sys->control.mouse.i_x,195 p_intf->p_sys->control.mouse.i_y );196 197 194 /* we can safely interact with libdvdplay 198 195 * with the stream lock */ … … 344 341 vlc_mutex_unlock( &p_intf->change_lock ); 345 342 346 return 0; 347 } 348 349 343 return VLC_SUCCESS; 344 } 345 modules/codec/spudec/parse.c
rcae5489 r8b09b55 3 3 ***************************************************************************** 4 4 * Copyright (C) 2000-2001 VideoLAN 5 * $Id: parse.c,v 1. 3 2002/10/31 09:40:26 gbazinExp $5 * $Id: parse.c,v 1.4 2002/11/06 18:07:57 sam Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 45 45 * Local prototypes. 46 46 *****************************************************************************/ 47 static int ParseControlSequences( spudec_thread_t *, subpicture_t * ); 48 static int ParseRLE ( spudec_thread_t *, subpicture_t *, u8 * ); 47 static int ParseControlSeq ( spudec_thread_t *, subpicture_t * ); 48 static int ParseRLE ( spudec_thread_t *, subpicture_t *, uint8_t * ); 49 50 static void DestroySPU ( subpicture_t * ); 51 52 static void UpdateSPU ( subpicture_t *, vlc_object_t * ); 53 static int CropCallback ( vlc_object_t *, char const *, 54 vlc_value_t, vlc_value_t, void * ); 49 55 50 56 /***************************************************************************** … … 52 58 *****************************************************************************/ 53 59 static inline unsigned int AddNibble( unsigned int i_code, 54 u 8*p_src, int *pi_index )60 uint8_t *p_src, int *pi_index ) 55 61 { 56 62 if( *pi_index & 0x1 ) … … 102 108 { 103 109 subpicture_t * p_spu; 104 u 8* p_src;110 uint8_t * p_src; 105 111 unsigned int i_offset; 106 112 mtime_t i_pts; … … 118 124 119 125 /* Allocate the subpicture internal data. */ 120 p_spu = vout_CreateSubPicture( p_spudec->p_vout, MEMORY_SUBPICTURE, 121 sizeof( subpicture_sys_t ) 122 + p_spudec->i_rle_size * 4 ); 126 p_spu = vout_CreateSubPicture( p_spudec->p_vout, MEMORY_SUBPICTURE ); 127 128 if( p_spu == NULL ) 129 { 130 return; 131 } 132 123 133 /* Rationale for the "p_spudec->i_rle_size * 4": we are going to 124 134 * expand the RLE stuff so that we won't need to read nibbles later 125 135 * on. This will speed things up a lot. Plus, we'll only need to do 126 136 * this stupid interlacing stuff once. */ 127 128 if( p_spu == NULL ) 129 { 137 p_spu->p_sys = malloc( sizeof( subpicture_sys_t ) 138 + p_spudec->i_rle_size * 4 ); 139 140 if( p_spu->p_sys == NULL ) 141 { 142 vout_DestroySubPicture( p_spudec->p_vout, p_spu ); 130 143 return; 131 144 } 132 145 133 146 /* Fill the p_spu structure */ 147 vlc_mutex_init( p_spudec->p_fifo, &p_spu->p_sys->lock ); 148 134 149 p_spu->pf_render = E_(RenderSPU); 135 p_spu->p_sys->p_data = (u8*)p_spu->p_sys + sizeof( subpicture_sys_t ); 150 p_spu->pf_destroy = DestroySPU; 151 p_spu->p_sys->p_data = (uint8_t*)p_spu->p_sys + sizeof( subpicture_sys_t ); 136 152 p_spu->p_sys->b_palette = VLC_FALSE; 137 153 … … 141 157 p_spu->p_sys->pi_alpha[3] = 0x0f; 142 158 159 p_spu->p_sys->b_crop = VLC_FALSE; 160 143 161 /* Get display time now. If we do it later, we may miss the PTS. */ 144 162 p_spu->p_sys->i_pts = i_pts; 163 164 /* Attach to our input thread */ 165 p_spu->p_sys->p_input = vlc_object_find( p_spudec->p_fifo, 166 VLC_OBJECT_INPUT, FIND_PARENT ); 167 if( p_spu->p_sys->p_input ) 168 { 169 vlc_value_t val; 170 171 if( !var_Get( p_spu->p_sys->p_input, "highlight-mutex", &val ) ) 172 { 173 vlc_mutex_t *p_mutex = val.p_address; 174 175 vlc_mutex_lock( p_mutex ); 176 UpdateSPU( p_spu, VLC_OBJECT(p_spu->p_sys->p_input) ); 177 var_AddCallback( p_spu->p_sys->p_input, 178 "highlight", CropCallback, p_spu ); 179 vlc_mutex_unlock( p_mutex ); 180 } 181 } 145 182 146 183 /* Allocate the temporary buffer we will parse */ … … 177 214 178 215 /* Getting the control part */ 179 if( ParseControlSeq uences( p_spudec, p_spu ) )216 if( ParseControlSeq( p_spudec, p_spu ) ) 180 217 { 181 218 /* There was a parse error, delete the subpicture */ … … 204 241 vout_DisplaySubPicture( p_spudec->p_vout, p_spu ); 205 242 243 /* TODO: do stuff! */ 244 206 245 /* Clean up */ 207 246 free( p_src ); … … 209 248 210 249 /***************************************************************************** 211 * ParseControlSeq uences: parse all SPU control sequences250 * ParseControlSeq: parse all SPU control sequences 212 251 ***************************************************************************** 213 252 * This is the most important part in SPU decoding. We get dates, palette … … 215 254 * subtitles format, see http://sam.zoy.org/doc/dvd/subtitles/index.html 216 255 *****************************************************************************/ 217 static int ParseControlSeq uences( spudec_thread_t *p_spudec,256 static int ParseControlSeq( spudec_thread_t *p_spudec, 218 257 subpicture_t * p_spu ) 219 258 { … … 225 264 226 265 /* Command and date */ 227 u 8i_command = SPU_CMD_END;266 uint8_t i_command = SPU_CMD_END; 228 267 mtime_t date = 0; 229 268 … … 276 315 && *(int*)p_spudec->p_fifo->p_demux_data == 0xBeeF ) 277 316 { 278 u 32i_color;317 uint32_t i_color; 279 318 280 319 p_spu->p_sys->b_palette = VLC_TRUE; 281 320 for( i = 0; i < 4 ; i++ ) 282 321 { 283 i_color = ((u 32*)((char*)p_spudec->p_fifo->322 i_color = ((uint32_t*)((char*)p_spudec->p_fifo-> 284 323 p_demux_data + sizeof(int)))[ 285 324 GetBits(&p_spudec->bit_stream, 4) ]; … … 432 471 *****************************************************************************/ 433 472 static int ParseRLE( spudec_thread_t *p_spudec, 434 subpicture_t * p_spu, u 8* p_src )473 subpicture_t * p_spu, uint8_t * p_src ) 435 474 { 436 475 unsigned int i_code; … … 440 479 unsigned int i_x, i_y; 441 480 442 u 16 *p_dest = (u16*)p_spu->p_sys->p_data;481 uint16_t *p_dest = (uint16_t *)p_spu->p_sys->p_data; 443 482 444 483 /* The subtitles are interlaced, we need two offsets */ … … 447 486 unsigned int *pi_offset; 448 487 488 #if 0 /* cropping */ 449 489 vlc_bool_t b_empty_top = VLC_TRUE, 450 490 b_empty_bottom = VLC_FALSE; 451 491 unsigned int i_skipped_top = 0, 452 492 i_skipped_bottom = 0; 493 #endif 453 494 454 495 /* Colormap statistics */ … … 514 555 } 515 556 557 #if 0 /* cropping */ 516 558 if( (i_code >> 2) == i_width 517 559 && p_spu->p_sys->pi_alpha[ i_code & 0x3 ] == 0x00 ) … … 542 584 i_skipped_bottom = 0; 543 585 } 586 #else 587 *p_dest++ = i_code; 588 #endif 544 589 } 545 590 … … 582 627 p_spu->i_width, p_spu->i_height, p_spu->i_x, p_spu->i_y ); 583 628 629 #if 0 /* cropping */ 584 630 /* Crop if necessary */ 585 631 if( i_skipped_top || i_skipped_bottom ) … … 591 637 p_spu->i_width, p_spu->i_height, p_spu->i_x, p_spu->i_y ); 592 638 } 639 #endif 593 640 594 641 /* Handle color if no palette was found */ … … 652 699 } 653 700 701 /***************************************************************************** 702 * DestroySPU: subpicture destructor 703 *****************************************************************************/ 704 static void DestroySPU( subpicture_t *p_spu ) 705 { 706 if( p_spu->p_sys->p_input ) 707 { 708 /* Detach from our input thread */ 709 var_DelCallback( p_spu->p_sys->p_input, "highlight", 710 CropCallback, p_spu ); 711 vlc_object_release( p_spu->p_sys->p_input ); 712 } 713 714 vlc_mutex_destroy( &p_spu->p_sys->lock ); 715 free( p_spu->p_sys ); 716 } 717 718 /***************************************************************************** 719 * UpdateSPU: update subpicture settings 720 ***************************************************************************** 721 * This function is called from CropCallback and at initialization time, to 722 * retrieve crop information from the input. 723 *****************************************************************************/ 724 static void UpdateSPU( subpicture_t *p_spu, vlc_object_t *p_object ) 725 { 726 vlc_value_t val; 727 728 if( var_Get( p_object, "highlight", &val ) ) 729 { 730 return; 731 } 732 733 p_spu->p_sys->b_crop = val.b_bool; 734 if( !p_spu->p_sys->b_crop ) 735 { 736 return; 737 } 738 739 var_Get( p_object, "x-start", &val ); 740 p_spu->p_sys->i_x_start = val.i_int; 741 var_Get( p_object, "y-start", &val ); 742 p_spu->p_sys->i_y_start = val.i_int; 743 var_Get( p_object, "x-end", &val ); 744 p_spu->p_sys->i_x_end = val.i_int; 745 var_Get( p_object, "y-end", &val ); 746 p_spu->p_sys->i_y_end = val.i_int; 747 748 #if 0 749 if( var_Get( p_object, "color", &val ) == VLC_SUCCESS ) 750 { 751 p_spu->p_sys->pi_color[0] = ((uint8_t *)val.p_address)[0]; 752 p_spu->p_sys->pi_color[1] = ((uint8_t *)val.p_address)[1]; 753 p_spu->p_sys->pi_color[2] = ((uint8_t *)val.p_address)[2]; 754 p_spu->p_sys->pi_color[3] = ((uint8_t *)val.p_address)[3]; 755 } 756 #endif 757 758 if( var_Get( p_object, "contrast", &val ) == VLC_SUCCESS ) 759 { 760 p_spu->p_sys->pi_alpha[0] = ((uint8_t *)val.p_address)[0]; 761 p_spu->p_sys->pi_alpha[1] = ((uint8_t *)val.p_address)[1]; 762 p_spu->p_sys->pi_alpha[2] = ((uint8_t *)val.p_address)[2]; 763 p_spu->p_sys->pi_alpha[3] = ((uint8_t *)val.p_address)[3]; 764 } 765 } 766 767 /***************************************************************************** 768 * CropCallback: called when the highlight properties are changed 769 ***************************************************************************** 770 * This callback is called from the input thread when we need cropping 771 *****************************************************************************/ 772 static int CropCallback( vlc_object_t *p_object, char const *psz_var, 773 vlc_value_t oldval, vlc_value_t newval, void *p_data ) 774 { 775 UpdateSPU( (subpicture_t *)p_data, p_object ); 776 777 return VLC_SUCCESS; 778 } 779 modules/codec/spudec/render.c
rbf2f5b0 r8b09b55 3 3 ***************************************************************************** 4 4 * Copyright (C) 2000-2001 VideoLAN 5 * $Id: render.c,v 1. 2 2002/09/30 18:30:26 titerExp $5 * $Id: render.c,v 1.3 2002/11/06 18:07:57 sam Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 45 45 46 46 /***************************************************************************** 47 * Local prototypes 48 *****************************************************************************/ 49 static void RenderI420( vout_thread_t *, picture_t *, const subpicture_t *, 50 vlc_bool_t ); 51 static void RenderRV16( vout_thread_t *, picture_t *, const subpicture_t *, 52 vlc_bool_t ); 53 static void RenderRV32( vout_thread_t *, picture_t *, const subpicture_t *, 54 vlc_bool_t ); 55 static void RenderYUY2( vout_thread_t *, picture_t *, const subpicture_t *, 56 vlc_bool_t ); 57 58 /***************************************************************************** 47 59 * RenderSPU: draw an SPU on a picture 48 60 ***************************************************************************** … … 55 67 const subpicture_t *p_spu ) 56 68 { 69 switch( p_vout->output.i_chroma ) 70 { 71 /* I420 target, no scaling */ 72 case VLC_FOURCC('I','4','2','0'): 73 case VLC_FOURCC('I','Y','U','V'): 74 case VLC_FOURCC('Y','V','1','2'): 75 RenderI420( p_vout, p_pic, p_spu, p_spu->p_sys->b_crop ); 76 break; 77 78 /* RV16 target, scaling */ 79 case VLC_FOURCC('R','V','1','6'): 80 RenderRV16( p_vout, p_pic, p_spu, p_spu->p_sys->b_crop ); 81 break; 82 83 /* RV32 target, scaling */ 84 case VLC_FOURCC('R','V','2','4'): 85 case VLC_FOURCC('R','V','3','2'): 86 RenderRV32( p_vout, p_pic, p_spu, p_spu->p_sys->b_crop ); 87 break; 88 89 /* NVidia overlay, no scaling */ 90 case VLC_FOURCC('Y','U','Y','2'): 91 RenderYUY2( p_vout, p_pic, p_spu, p_spu->p_sys->b_crop ); 92 break; 93 94 default: 95 msg_Err( p_vout, "unknown chroma, can't render SPU" ); 96 break; 97 } 98 } 99 100 /* Following functions are local */ 101 102 static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic, 103 const subpicture_t *p_spu, vlc_bool_t b_crop ) 104 { 57 105 /* Common variables */ 58 u16 p_clut16[4];59 u32 p_clut32[4];60 106 u8 *p_dest; 61 107 u8 *p_destptr; … … 65 111 int i_len, i_color; 66 112 u16 i_colprecomp, i_destalpha; 67 u8 i_cnt; 68 69 /* RGB-specific */ 70 int i_xscale, i_yscale, i_width, i_height, i_ytmp, i_yreal, i_ynext; 71 72 switch( p_vout->output.i_chroma ) 73 { 74 /* I420 target, no scaling */ 75 case VLC_FOURCC('I','4','2','0'): 76 case VLC_FOURCC('I','Y','U','V'): 77 case VLC_FOURCC('Y','V','1','2'): 113 114 /* Crop-specific */ 115 int i_x_start, i_y_start, i_x_end, i_y_end; 78 116 79 117 p_dest = p_pic->Y_PIXELS + p_spu->i_x + p_spu->i_width 80 118 + p_pic->Y_PITCH * ( p_spu->i_y + p_spu->i_height ); 119 120 i_x_start = p_spu->i_width - p_spu->p_sys->i_x_end; 121 i_y_start = p_pic->Y_PITCH * (p_spu->i_height - p_spu->p_sys->i_y_end ); 122 i_x_end = p_spu->i_width - p_spu->p_sys->i_x_start; 123 i_y_end = p_pic->Y_PITCH * (p_spu->i_height - p_spu->p_sys->i_y_start ); 81 124 82 125 /* Draw until we reach the bottom of the subtitle */ … … 86 129 { 87 130 /* Draw until we reach the end of the line */ 88 for( i_x = p_spu->i_width ; i_x ; )131 for( i_x = p_spu->i_width ; i_x ; i_x -= i_len ) 89 132 { 90 133 /* Get the RLE part, then draw the line */ 91 134 i_color = *p_source & 0x3; 92 135 i_len = *p_source++ >> 2; 136 137 if( b_crop 138 && ( i_x < i_x_start || i_x > i_x_end 139 || i_y < i_y_start || i_y > i_y_end ) ) 140 { 141 continue; 142 } 93 143 94 144 switch( p_spu->p_sys->pi_alpha[i_color] ) … … 118 168 } 119 169 break; 120 121 } 122 i_x -= i_len; 170 } 123 171 } 124 172 } 125 126 break; 127 128 /* RV16 target, scaling */ 129 case VLC_FOURCC('R','V','1','6'): 173 } 174 175 static void RenderRV16( vout_thread_t *p_vout, picture_t *p_pic, 176 const subpicture_t *p_spu, vlc_bool_t b_crop ) 177 { 178 /* Common variables */ 179 u16 p_clut16[4]; 180 u8 *p_dest; 181 u16 *p_source = (u16 *)p_spu->p_sys->p_data; 182 183 int i_x, i_y; 184 int i_len, i_color; 185 186 /* RGB-specific */ 187 int i_xscale, i_yscale, i_width, i_height, i_ytmp, i_yreal, i_ynext; 188 189 /* Crop-specific */ 190 int i_x_start, i_y_start, i_x_end, i_y_end; 130 191 131 192 /* XXX: this is a COMPLETE HACK, memcpy is unable to do u16s anyway */ … … 147 208 + ( (p_spu->i_x * i_xscale) >> 6 ) * 2 148 209 + ( (p_spu->i_y * i_yscale) >> 6 ) * p_pic->p->i_pitch; 210 211 i_x_start = i_width - i_xscale * p_spu->p_sys->i_x_end; 212 i_y_start = i_yscale * p_spu->p_sys->i_y_start; 213 i_x_end = i_width - i_xscale * p_spu->p_sys->i_x_start; 214 i_y_end = i_yscale * p_spu->p_sys->i_y_end; 149 215 150 216 /* Draw until we reach the bottom of the subtitle */ … … 161 227 162 228 /* Draw until we reach the end of the line */ 163 for( i_x = i_width ; i_x ; )229 for( i_x = i_width ; i_x ; i_x -= i_len ) 164 230 { 165 231 /* Get the RLE part, then draw the line */ 166 232 i_color = *p_source & 0x3; 233 i_len = i_xscale * ( *p_source++ >> 2 ); 234 235 if( b_crop 236 && ( i_x < i_x_start || i_x > i_x_end 237 || i_y < i_y_start || i_y > i_y_end ) ) 238 { 239 continue; 240 } 167 241 168 242 switch( p_spu->p_sys->pi_alpha[ i_color ] ) 169 243 { 170 244 case 0x00: 171 i_x -= i_xscale * ( *p_source++ >> 2 );172 245 break; 173 246 174 247 case 0x0f: 175 i_len = i_xscale * ( *p_source++ >> 2 );176 248 memset( p_dest - 2 * ( i_x >> 6 ) + i_yreal, 177 249 p_clut16[ i_color ], 178 250 2 * ( ( i_len >> 6 ) + 1 ) ); 179 i_x -= i_len;180 251 break; 181 252 182 253 default: 183 254 /* FIXME: we should do transparency */ 184 i_len = i_xscale * ( *p_source++ >> 2 );185 255 memset( p_dest - 2 * ( i_x >> 6 ) + i_yreal, 186 256 p_clut16[ i_color ], 187 257 2 * ( ( i_len >> 6 ) + 1 ) ); 188 i_x -= i_len; 189 break; 190 } 191 258 break; 259 } 192 260 } 193 261 } … … 198 266 199 267 /* Draw until we reach the end of the line */ 200 for( i_x = i_width ; i_x ; )268 for( i_x = i_width ; i_x ; i_x -= i_len ) 201 269 { 202 270 /* Get the RLE part, then draw as many lines as needed */ 203 271 i_color = *p_source & 0x3; 272 i_len = i_xscale * ( *p_source++ >> 2 ); 273 274 if( b_crop 275 && ( i_x < i_x_start || i_x > i_x_end 276 || i_y < i_y_start || i_y > i_y_end ) ) 277 { 278 continue; 279 } 204 280 205 281 switch( p_spu->p_sys->pi_alpha[ i_color ] ) 206 282 { 207 283 case 0x00: 208 i_x -= i_xscale * ( *p_source++ >> 2 );209 284 break; 210 285 211 286 case 0x0f: 212 i_len = i_xscale * ( *p_source++ >> 2 );213 287 for( i_ytmp = i_yreal ; i_ytmp < i_ynext ; 214 288 i_ytmp += p_pic->p->i_pitch ) … … 218 292 2 * ( ( i_len >> 6 ) + 1 ) ); 219 293 } 220 i_x -= i_len;221 294 break; 222 295 223 296 default: 224 297 /* FIXME: we should do transparency */ 225 i_len = i_xscale * ( *p_source++ >> 2 );226 298 for( i_ytmp = i_yreal ; i_ytmp < i_ynext ; 227 299 i_ytmp += p_pic->p->i_pitch ) … … 231 303 2 * ( ( i_len >> 6 ) + 1 ) ); 232 304 } 233 i_x -= i_len;234 305 break; 235 306 } … … 237 308 } 238 309 } 239 240 break; 241 242 /* RV32 target, scaling */ 243 case VLC_FOURCC('R','V','2','4'): 244 case VLC_FOURCC('R','V','3','2'): 310 } 311 312 static void RenderRV32( vout_thread_t *p_vout, picture_t *p_pic, 313 const subpicture_t *p_spu, vlc_bool_t b_crop ) 314 { 315 /* Common variables */ 316 u32 p_clut32[4]; 317 u8 *p_dest; 318 u16 *p_source = (u16 *)p_spu->p_sys->p_data; 319 320 int i_x, i_y; 321 int i_len, i_color; 322 323 /* RGB-specific */ 324 int i_xscale, i_yscale, i_width, i_height, i_ytmp, i_yreal, i_ynext; 325 326 /* Crop-specific */ 327 int i_x_start, i_y_start, i_x_end, i_y_end; 245 328 246 329 /* XXX: this is a COMPLETE HACK, memcpy is unable to do u32s anyway */ … … 257 340 i_width = p_spu->i_width * i_xscale; 258 341 i_height = p_spu->i_height * i_yscale; 342 343 i_x_start = i_width - i_xscale * p_spu->p_sys->i_x_end; 344 i_y_start = i_yscale * p_spu->p_sys->i_y_start; 345 i_x_end = i_width - i_xscale * p_spu->p_sys->i_x_start; 346 i_y_end = i_yscale * p_spu->p_sys->i_y_end; 259 347 260 348 p_dest = p_pic->p->p_pixels + ( i_width >> 6 ) * 4 … … 276 364 277 365 /* Draw until we reach the end of the line */ 278 for( i_x = i_width ; i_x ; )366 for( i_x = i_width ; i_x ; i_x -= i_len ) 279 367 { 280 368 /* Get the RLE part, then draw the line */ 281 369 i_color = *p_source & 0x3; 370 i_len = i_xscale * ( *p_source++ >> 2 ); 371 372 if( b_crop 373 && ( i_x < i_x_start || i_x > i_x_end 374 || i_y < i_y_start || i_y > i_y_end ) ) 375 { 376 continue; 377 } 282 378 283 379 switch( p_spu->p_sys->pi_alpha[ i_color ] ) 284 380 { 285 381 case 0x00: 286 i_x -= i_xscale * ( *p_source++ >> 2 );287 382 break; 288 383 289 384 case 0x0f: 290 i_len = i_xscale * ( *p_source++ >> 2 );291 385 memset( p_dest - 4 * ( i_x >> 6 ) + i_yreal, 292 386 p_clut32[ i_color ], 4 * ( ( i_len >> 6 ) + 1 ) ); 293 i_x -= i_len;294 387 break; 295 388 296 389 default: 297 390 /* FIXME: we should do transparency */ 298 i_len = i_xscale * ( *p_source++ >> 2 );299 391 memset( p_dest - 4 * ( i_x >> 6 ) + i_yreal, 300 392 p_clut32[ i_color ], 4 * ( ( i_len >> 6 ) + 1 ) ); 301 i_x -= i_len; 302 break; 303 } 304 393 break; 394 } 305 395 } 306 396 } … … 311 401 312 402 /* Draw until we reach the end of the line */ 313 for( i_x = i_width ; i_x ; )403 for( i_x = i_width ; i_x ; i_x -= i_len ) 314 404 { 315 405 /* Get the RLE part, then draw as many lines as needed */ 316 406 i_color = *p_source & 0x3; 407 i_len = i_xscale * ( *p_source++ >> 2 ); 408 409 if( b_crop 410 && ( i_x < i_x_start || i_x > i_x_end 411 || i_y < i_y_start || i_y > i_y_end ) ) 412 { 413 continue; 414 } 317 415 318 416 switch( p_spu->p_sys->pi_alpha[ i_color ] ) 319 417 { 320 418 case 0x00: 321 i_x -= i_xscale * ( *p_source++ >> 2 );322 419 break; 323 420 324 421 case 0x0f: 325 i_len = i_xscale * ( *p_source++ >> 2 );326 422 for( i_ytmp = i_yreal ; i_ytmp < i_ynext ; 327 423 i_ytmp += p_pic->p->i_pitch ) … … 331 427 4 * ( ( i_len >> 6 ) + 1 ) ); 332 428 } 333 i_x -= i_len;334 429 break; 335 430 336 431 default: 337 432 /* FIXME: we should do transparency */ 338 i_len = i_xscale * ( *p_source++ >> 2 );339 433 for( i_ytmp = i_yreal ; i_ytmp < i_ynext ; 340 434 i_ytmp += p_pic->p->i_pitch ) … … 344 438 4 * ( ( i_len >> 6 ) + 1 ) ); 345 439 } 346 i_x -= i_len;347 440 break; 348 441 } … … 350 443 } 351 444 } 352 353 break; 354 355 /* NVidia overlay, no scaling */ 356 case VLC_FOURCC(
