Commit 8b09b55d authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/access/dvdplay/access.c: activated button highlighting.

  * ./modules/codec/spudec/parse.c: implemented subtitle cropping and
    temporarily disabled subtitle cropping.
  * ./modules/codec/spudec/render.c: split RenderSPU into chroma-specific
    functions.
parent 2401b662
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* includes all common video types and constants. * includes all common video types and constants.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video.h,v 1.56 2002/07/23 00:39:16 sam Exp $ * $Id: video.h,v 1.57 2002/11/06 18:07:57 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -166,7 +166,6 @@ struct subpicture_t ...@@ -166,7 +166,6 @@ struct subpicture_t
/* Type and flags - should NOT be modified except by the vout thread */ /* Type and flags - should NOT be modified except by the vout thread */
int i_type; /* type */ int i_type; /* type */
int i_status; /* flags */ int i_status; /* flags */
int i_size; /* data size */
subpicture_t * p_next; /* next subtitle to be displayed */ subpicture_t * p_next; /* next subtitle to be displayed */
/* Date properties */ /* Date properties */
...@@ -199,13 +198,13 @@ struct subpicture_t ...@@ -199,13 +198,13 @@ struct subpicture_t
} type; } type;
#endif #endif
/* The subpicture rendering routine */ /* The subpicture rendering and destruction routines */
void ( *pf_render ) ( vout_thread_t *, picture_t *, const subpicture_t * ); void ( *pf_render ) ( vout_thread_t *, picture_t *, const subpicture_t * );
void ( *pf_destroy ) ( subpicture_t * );
/* Private data - the subtitle plugin might want to put stuff here to /* Private data - the subtitle plugin might want to put stuff here to
* keep track of the subpicture */ * keep track of the subpicture */
subpicture_sys_t *p_sys; /* subpicture data */ subpicture_sys_t *p_sys; /* subpicture data */
void *p_sys_orig; /* pointer before memalign */
}; };
/* Subpicture type */ /* Subpicture type */
...@@ -216,5 +215,4 @@ struct subpicture_t ...@@ -216,5 +215,4 @@ struct subpicture_t
#define FREE_SUBPICTURE 0 /* free and not allocated */ #define FREE_SUBPICTURE 0 /* free and not allocated */
#define RESERVED_SUBPICTURE 1 /* allocated and reserved */ #define RESERVED_SUBPICTURE 1 /* allocated and reserved */
#define READY_SUBPICTURE 2 /* ready for display */ #define READY_SUBPICTURE 2 /* ready for display */
#define DESTROYED_SUBPICTURE 3 /* allocated but not used anymore */
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously opened video output thread. * thread, and destroy a previously opened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video_output.h,v 1.84 2002/10/17 16:03:18 sam Exp $ * $Id: video_output.h,v 1.85 2002/11/06 18:07:57 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -158,7 +158,7 @@ VLC_EXPORT( void, vout_PlacePicture, ( vout_thread_t *, int, int, i ...@@ -158,7 +158,7 @@ VLC_EXPORT( void, vout_PlacePicture, ( vout_thread_t *, int, int, i
picture_t * vout_RenderPicture ( vout_thread_t *, picture_t *, picture_t * vout_RenderPicture ( vout_thread_t *, picture_t *,
subpicture_t * ); subpicture_t * );
VLC_EXPORT( subpicture_t *, vout_CreateSubPicture, ( vout_thread_t *, int, int ) ); VLC_EXPORT( subpicture_t *, vout_CreateSubPicture, ( vout_thread_t *, int ) );
VLC_EXPORT( void, vout_DestroySubPicture, ( vout_thread_t *, subpicture_t * ) ); VLC_EXPORT( void, vout_DestroySubPicture, ( vout_thread_t *, subpicture_t * ) );
VLC_EXPORT( void, vout_DisplaySubPicture, ( vout_thread_t *, subpicture_t * ) ); VLC_EXPORT( void, vout_DisplaySubPicture, ( vout_thread_t *, subpicture_t * ) );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* access.c: access capabilities for dvdplay plugin. * access.c: access capabilities for dvdplay plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: access.c,v 1.4 2002/10/26 15:24:19 gbazin Exp $ * $Id: access.c,v 1.5 2002/11/06 18:07:57 sam Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -87,7 +87,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) ...@@ -87,7 +87,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
p_dvd = malloc( sizeof(dvd_data_t) ); p_dvd = malloc( sizeof(dvd_data_t) );
if( p_dvd == NULL ) if( p_dvd == NULL )
{ {
msg_Err( p_input, "dvdplay error: out of memory" ); msg_Err( p_input, "out of memory" );
return -1; return -1;
} }
...@@ -114,7 +114,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) ...@@ -114,7 +114,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
if( p_dvd->vmg == NULL ) if( p_dvd->vmg == NULL )
{ {
msg_Err( p_input, "dvdplay error: can't open source" ); msg_Err( p_input, "cannot open %s", psz_source );
free( p_dvd ); free( p_dvd );
return -1; return -1;
} }
...@@ -184,6 +184,18 @@ int E_(OpenDVD) ( vlc_object_t *p_this ) ...@@ -184,6 +184,18 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
p_input->psz_demux = "dvdplay"; p_input->psz_demux = "dvdplay";
/* FIXME: we might lose variables here */
var_Create( p_input, "x-start", VLC_VAR_INTEGER );
var_Create( p_input, "y-start", VLC_VAR_INTEGER );
var_Create( p_input, "x-end", VLC_VAR_INTEGER );
var_Create( p_input, "y-end", VLC_VAR_INTEGER );
var_Create( p_input, "color", VLC_VAR_ADDRESS );
var_Create( p_input, "contrast", VLC_VAR_ADDRESS );
var_Create( p_input, "highlight", VLC_VAR_BOOL );
var_Create( p_input, "highlight-mutex", VLC_VAR_MUTEX );
return 0; return 0;
} }
...@@ -195,6 +207,17 @@ void E_(CloseDVD) ( vlc_object_t *p_this ) ...@@ -195,6 +207,17 @@ void E_(CloseDVD) ( vlc_object_t *p_this )
input_thread_t * p_input = (input_thread_t *)p_this; input_thread_t * p_input = (input_thread_t *)p_this;
dvd_data_t * p_dvd = (dvd_data_t *)p_input->p_access_data; dvd_data_t * p_dvd = (dvd_data_t *)p_input->p_access_data;
var_Destroy( p_input, "highlight-mutex" );
var_Destroy( p_input, "highlight" );
var_Destroy( p_input, "x-start" );
var_Destroy( p_input, "x-end" );
var_Destroy( p_input, "y-start" );
var_Destroy( p_input, "y-end" );
var_Destroy( p_input, "color" );
var_Destroy( p_input, "contrast" );
/* close libdvdplay */ /* close libdvdplay */
dvdplay_close( p_dvd->vmg ); dvdplay_close( p_dvd->vmg );
...@@ -350,6 +373,7 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event ) ...@@ -350,6 +373,7 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event )
{ {
input_thread_t * p_input; input_thread_t * p_input;
dvd_data_t * p_dvd; dvd_data_t * p_dvd;
vlc_value_t val;
int i; int i;
p_input = (input_thread_t*)p_args; p_input = (input_thread_t*)p_args;
...@@ -407,11 +431,38 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event ) ...@@ -407,11 +431,38 @@ static void pf_vmg_callback( void* p_args, dvdplay_event_t event )
case COMPLETE_VIDEO: case COMPLETE_VIDEO:
break; break;
case NEW_HIGHLIGHT: case NEW_HIGHLIGHT:
if( var_Get( p_input, "highlight-mutex", &val ) == VLC_SUCCESS )
{
vlc_mutex_t *p_mutex = val.p_address;
vlc_mutex_lock( p_mutex );
/* Retrieve the highlight from dvdplay */
dvdplay_highlight( p_dvd->vmg, &p_dvd->hli );
/* Fill our internal variables with this data */
val.i_int = p_dvd->hli.i_x_start;
var_Set( p_input, "x-start", val );
val.i_int = p_dvd->hli.i_y_start;
var_Set( p_input, "y-start", val );
val.i_int = p_dvd->hli.i_x_end;
var_Set( p_input, "x-end", val );
val.i_int = p_dvd->hli.i_y_end;
var_Set( p_input, "y-end", val );
val.p_address = (void *)p_dvd->hli.pi_color;
var_Set( p_input, "color", val );
val.p_address = (void *)p_dvd->hli.pi_contrast;
var_Set( p_input, "contrast", val );
/* Tell the SPU decoder that there's a new highlight */
val.b_bool = VLC_TRUE;
var_Set( p_input, "highlight", val );
vlc_mutex_unlock( p_mutex );
}
break; break;
default: default:
msg_Err( p_input, "unknown event from libdvdplay (%d)", msg_Err( p_input, "unknown event from libdvdplay (%d)", event );
event );
} }
return; return;
...@@ -494,3 +545,4 @@ static int dvdNewPGC( input_thread_t * p_input ) ...@@ -494,3 +545,4 @@ static int dvdNewPGC( input_thread_t * p_input )
return 0; return 0;
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd.h: structure of the dvdplay plugin * dvd.h: structure of the dvdplay plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd.h,v 1.1 2002/08/04 17:23:42 sam Exp $ * $Id: dvd.h,v 1.2 2002/11/06 18:07:57 sam Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -56,6 +56,7 @@ typedef struct ...@@ -56,6 +56,7 @@ typedef struct
dvdplay_event_t event; dvdplay_event_t event;
dvdplay_ctrl_t control; dvdplay_ctrl_t control;
dvdplay_highlight_t hli;
} dvd_data_t; } dvd_data_t;
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.c: interface for DVD video manager * intf.c: interface for DVD video manager
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: intf.c,v 1.2 2002/10/17 16:03:18 sam Exp $ * $Id: intf.c,v 1.3 2002/11/06 18:07:57 sam Exp $
* *
* Authors: Stphane Borel <stef@via.ecp.fr> * Authors: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "stream_control.h" #include "stream_control.h"
#include "input_ext-intf.h" #include "input_ext-intf.h"
#include "input_ext-dec.h"
#include "dvd.h" #include "dvd.h"
...@@ -190,10 +191,6 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -190,10 +191,6 @@ static void RunIntf( intf_thread_t *p_intf )
p_intf->p_sys->b_move = VLC_FALSE; p_intf->p_sys->b_move = VLC_FALSE;
} }
msg_Dbg( p_intf, "send button coordinates: %dx%d",
p_intf->p_sys->control.mouse.i_x,
p_intf->p_sys->control.mouse.i_y );
/* we can safely interact with libdvdplay /* we can safely interact with libdvdplay
* with the stream lock */ * with the stream lock */
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
...@@ -343,7 +340,6 @@ int dvdIntfStillTime( intf_thread_t *p_intf, int i_sec ) ...@@ -343,7 +340,6 @@ int dvdIntfStillTime( intf_thread_t *p_intf, int i_sec )
#endif #endif
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
return 0; return VLC_SUCCESS;
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* parse.c: SPU parser * parse.c: SPU parser
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: parse.c,v 1.3 2002/10/31 09:40:26 gbazin Exp $ * $Id: parse.c,v 1.4 2002/11/06 18:07:57 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -44,14 +44,20 @@ ...@@ -44,14 +44,20 @@
/***************************************************************************** /*****************************************************************************
* Local prototypes. * Local prototypes.
*****************************************************************************/ *****************************************************************************/
static int ParseControlSequences( spudec_thread_t *, subpicture_t * ); static int ParseControlSeq ( spudec_thread_t *, subpicture_t * );
static int ParseRLE ( spudec_thread_t *, subpicture_t *, u8 * ); static int ParseRLE ( spudec_thread_t *, subpicture_t *, uint8_t * );
static void DestroySPU ( subpicture_t * );
static void UpdateSPU ( subpicture_t *, vlc_object_t * );
static int CropCallback ( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
/***************************************************************************** /*****************************************************************************
* AddNibble: read a nibble from a source packet and add it to our integer. * AddNibble: read a nibble from a source packet and add it to our integer.
*****************************************************************************/ *****************************************************************************/
static inline unsigned int AddNibble( unsigned int i_code, static inline unsigned int AddNibble( unsigned int i_code,
u8 *p_src, int *pi_index ) uint8_t *p_src, int *pi_index )
{ {
if( *pi_index & 0x1 ) if( *pi_index & 0x1 )
{ {
...@@ -101,7 +107,7 @@ int E_(SyncPacket)( spudec_thread_t *p_spudec ) ...@@ -101,7 +107,7 @@ int E_(SyncPacket)( spudec_thread_t *p_spudec )
void E_(ParsePacket)( spudec_thread_t *p_spudec ) void E_(ParsePacket)( spudec_thread_t *p_spudec )
{ {
subpicture_t * p_spu; subpicture_t * p_spu;
u8 * p_src; uint8_t * p_src;
unsigned int i_offset; unsigned int i_offset;
mtime_t i_pts; mtime_t i_pts;
...@@ -117,22 +123,32 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec ) ...@@ -117,22 +123,32 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec )
} }
/* Allocate the subpicture internal data. */ /* Allocate the subpicture internal data. */
p_spu = vout_CreateSubPicture( p_spudec->p_vout, MEMORY_SUBPICTURE, p_spu = vout_CreateSubPicture( p_spudec->p_vout, MEMORY_SUBPICTURE );
sizeof( subpicture_sys_t )
+ p_spudec->i_rle_size * 4 ); if( p_spu == NULL )
{
return;
}
/* Rationale for the "p_spudec->i_rle_size * 4": we are going to /* 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 * 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 * on. This will speed things up a lot. Plus, we'll only need to do
* this stupid interlacing stuff once. */ * this stupid interlacing stuff once. */
p_spu->p_sys = malloc( sizeof( subpicture_sys_t )
+ p_spudec->i_rle_size * 4 );
if( p_spu == NULL ) if( p_spu->p_sys == NULL )
{ {
vout_DestroySubPicture( p_spudec->p_vout, p_spu );
return; return;
} }
/* Fill the p_spu structure */ /* Fill the p_spu structure */
vlc_mutex_init( p_spudec->p_fifo, &p_spu->p_sys->lock );
p_spu->pf_render = E_(RenderSPU); p_spu->pf_render = E_(RenderSPU);
p_spu->p_sys->p_data = (u8*)p_spu->p_sys + sizeof( subpicture_sys_t ); p_spu->pf_destroy = DestroySPU;
p_spu->p_sys->p_data = (uint8_t*)p_spu->p_sys + sizeof( subpicture_sys_t );
p_spu->p_sys->b_palette = VLC_FALSE; p_spu->p_sys->b_palette = VLC_FALSE;
p_spu->p_sys->pi_alpha[0] = 0x00; p_spu->p_sys->pi_alpha[0] = 0x00;
...@@ -140,9 +156,30 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec ) ...@@ -140,9 +156,30 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec )
p_spu->p_sys->pi_alpha[2] = 0x0f; p_spu->p_sys->pi_alpha[2] = 0x0f;
p_spu->p_sys->pi_alpha[3] = 0x0f; p_spu->p_sys->pi_alpha[3] = 0x0f;
p_spu->p_sys->b_crop = VLC_FALSE;
/* Get display time now. If we do it later, we may miss the PTS. */ /* Get display time now. If we do it later, we may miss the PTS. */
p_spu->p_sys->i_pts = i_pts; p_spu->p_sys->i_pts = i_pts;
/* Attach to our input thread */
p_spu->p_sys->p_input = vlc_object_find( p_spudec->p_fifo,
VLC_OBJECT_INPUT, FIND_PARENT );
if( p_spu->p_sys->p_input )
{
vlc_value_t val;
if( !var_Get( p_spu->p_sys->p_input, "highlight-mutex", &val ) )
{
vlc_mutex_t *p_mutex = val.p_address;
vlc_mutex_lock( p_mutex );
UpdateSPU( p_spu, VLC_OBJECT(p_spu->p_sys->p_input) );
var_AddCallback( p_spu->p_sys->p_input,
"highlight", CropCallback, p_spu );
vlc_mutex_unlock( p_mutex );
}
}
/* Allocate the temporary buffer we will parse */ /* Allocate the temporary buffer we will parse */
p_src = malloc( p_spudec->i_rle_size ); p_src = malloc( p_spudec->i_rle_size );
...@@ -176,7 +213,7 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec ) ...@@ -176,7 +213,7 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec )
#endif #endif
/* Getting the control part */ /* Getting the control part */
if( ParseControlSequences( p_spudec, p_spu ) ) if( ParseControlSeq( p_spudec, p_spu ) )
{ {
/* There was a parse error, delete the subpicture */ /* There was a parse error, delete the subpicture */
free( p_src ); free( p_src );
...@@ -203,18 +240,20 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec ) ...@@ -203,18 +240,20 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec )
/* SPU is finished - we can ask the video output to display it */ /* SPU is finished - we can ask the video output to display it */
vout_DisplaySubPicture( p_spudec->p_vout, p_spu ); vout_DisplaySubPicture( p_spudec->p_vout, p_spu );
/* TODO: do stuff! */
/* Clean up */ /* Clean up */
free( p_src ); free( p_src );
} }
/***************************************************************************** /*****************************************************************************
* ParseControlSequences: parse all SPU control sequences * ParseControlSeq: parse all SPU control sequences
***************************************************************************** *****************************************************************************
* This is the most important part in SPU decoding. We get dates, palette * This is the most important part in SPU decoding. We get dates, palette
* information, coordinates, and so on. For more information on the * information, coordinates, and so on. For more information on the
* subtitles format, see http://sam.zoy.org/doc/dvd/subtitles/index.html * subtitles format, see http://sam.zoy.org/doc/dvd/subtitles/index.html
*****************************************************************************/ *****************************************************************************/
static int ParseControlSequences( spudec_thread_t *p_spudec, static int ParseControlSeq( spudec_thread_t *p_spudec,
subpicture_t * p_spu ) subpicture_t * p_spu )
{ {
/* Our current index in the SPU packet */ /* Our current index in the SPU packet */
...@@ -224,7 +263,7 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -224,7 +263,7 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
int i_next_seq = 0, i_cur_seq = 0; int i_next_seq = 0, i_cur_seq = 0;
/* Command and date */ /* Command and date */
u8 i_command = SPU_CMD_END; uint8_t i_command = SPU_CMD_END;
mtime_t date = 0; mtime_t date = 0;
int i, pi_alpha[4]; int i, pi_alpha[4];
...@@ -275,12 +314,12 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -275,12 +314,12 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
if( p_spudec->p_fifo->p_demux_data if( p_spudec->p_fifo->p_demux_data
&& *(int*)p_spudec->p_fifo->p_demux_data == 0xBeeF ) && *(int*)p_spudec->p_fifo->p_demux_data == 0xBeeF )
{ {
u32 i_color; uint32_t i_color;
p_spu->p_sys->b_palette = VLC_TRUE; p_spu->p_sys->b_palette = VLC_TRUE;
for( i = 0; i < 4 ; i++ ) for( i = 0; i < 4 ; i++ )
{ {
i_color = ((u32*)((char*)p_spudec->p_fifo-> i_color = ((uint32_t*)((char*)p_spudec->p_fifo->
p_demux_data + sizeof(int)))[ p_demux_data + sizeof(int)))[
GetBits(&p_spudec->bit_stream, 4) ]; GetBits(&p_spudec->bit_stream, 4) ];
...@@ -431,7 +470,7 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -431,7 +470,7 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
* subtitles format, see http://sam.zoy.org/doc/dvd/subtitles/index.html * subtitles format, see http://sam.zoy.org/doc/dvd/subtitles/index.html
*****************************************************************************/ *****************************************************************************/
static int ParseRLE( spudec_thread_t *p_spudec, static int ParseRLE( spudec_thread_t *p_spudec,
subpicture_t * p_spu, u8 * p_src ) subpicture_t * p_spu, uint8_t * p_src )
{ {
unsigned int i_code; unsigned int i_code;
...@@ -439,17 +478,19 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -439,17 +478,19 @@ static int ParseRLE( spudec_thread_t *p_spudec,
unsigned int i_height = p_spu->i_height; unsigned int i_height = p_spu->i_height;
unsigned int i_x, i_y; unsigned int i_x, i_y;
u16 *p_dest = (u16 *)p_spu->p_sys->p_data; uint16_t *p_dest = (uint16_t *)p_spu->p_sys->p_data;
/* The subtitles are interlaced, we need two offsets */ /* The subtitles are interlaced, we need two offsets */
unsigned int i_id = 0; /* Start on the even SPU layer */ unsigned int i_id = 0; /* Start on the even SPU layer */
unsigned int pi_table[ 2 ]; unsigned int pi_table[ 2 ];
unsigned int *pi_offset; unsigned int *pi_offset;
#if 0 /* cropping */
vlc_bool_t b_empty_top = VLC_TRUE, vlc_bool_t b_empty_top = VLC_TRUE,
b_empty_bottom = VLC_FALSE; b_empty_bottom = VLC_FALSE;
unsigned int i_skipped_top = 0, unsigned int i_skipped_top = 0,
i_skipped_bottom = 0; i_skipped_bottom = 0;
#endif
/* Colormap statistics */ /* Colormap statistics */
int i_border = -1; int i_border = -1;
...@@ -513,6 +554,7 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -513,6 +554,7 @@ static int ParseRLE( spudec_thread_t *p_spudec,
stats[i_border] += i_code >> 2; stats[i_border] += i_code >> 2;
} }
#if 0 /* cropping */
if( (i_code >> 2) == i_width if( (i_code >> 2) == i_width
&& p_spu->p_sys->pi_alpha[ i_code & 0x3 ] == 0x00 ) && p_spu->p_sys->pi_alpha[ i_code & 0x3 ] == 0x00 )
{ {
...@@ -541,6 +583,9 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -541,6 +583,9 @@ static int ParseRLE( spudec_thread_t *p_spudec,
b_empty_bottom = VLC_FALSE; b_empty_bottom = VLC_FALSE;
i_skipped_bottom = 0; i_skipped_bottom = 0;
} }
#else
*p_dest++ = i_code;
#endif
} }
/* Check that we didn't go too far */ /* Check that we didn't go too far */
...@@ -581,6 +626,7 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -581,6 +626,7 @@ static int ParseRLE( spudec_thread_t *p_spudec,
msg_Dbg( p_spudec->p_fifo, "valid subtitle, size: %ix%i, position: %i,%i", msg_Dbg( p_spudec->p_fifo, "valid subtitle, size: %ix%i, position: %i,%i",
p_spu->i_width, p_spu->i_height, p_spu->i_x, p_spu->i_y ); p_spu->i_width, p_spu->i_height, p_spu->i_x, p_spu->i_y );