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

* ./plugins/dvd/dvd_es.c: error in selecting SPU stream.

  * ./plugins/spudec/spu_decoder.c: endianness fix for subtitles colour.
  * ./plugins/spudec/spu_decoder.c: little hack for preventing blank alpha
    palette.
  * ./plugins/spudec/spu_decoder.c: subtitle transparency support.

   All patches courtesy of Roine Gustafsson.
parent f1e0682c
...@@ -176,6 +176,10 @@ E: alexis.guillard@bt.com ...@@ -176,6 +176,10 @@ E: alexis.guillard@bt.com
D: IPv6 D: IPv6
S: United Kingdom S: United Kingdom
N: Roine Gustafsson
E: roine@popstar.com
D: spudec bug fixes
N: Shane Harper N: Shane Harper
E: shanegh@optusnet.com.au E: shanegh@optusnet.com.au
D: SDL plugin fixes and enhancements D: SDL plugin fixes and enhancements
......
...@@ -9,6 +9,11 @@ HEAD ...@@ -9,6 +9,11 @@ HEAD
0.4.2 0.4.2
Mon, 20 Jun 2002 00:41:26 +0200 Mon, 20 Jun 2002 00:41:26 +0200
* ./plugins/dvd/dvd_es.c: error in selecting SPU stream.
* ./plugins/spudec/spu_decoder.c: endianness fix for subtitles colour.
* ./plugins/spudec/spu_decoder.c: little hack for preventing blank alpha
palette.
* ./plugins/spudec/spu_decoder.c: subtitle transparency support.
* ./plugins/macosx: new controls for audio output, and deinterlacing * ./plugins/macosx: new controls for audio output, and deinterlacing
support. support.
* ./plugins/macosx: fixed a bug with language and subtitle menus. * ./plugins/macosx: fixed a bug with language and subtitle menus.
......
/* dvd_es.c: functions to find and select ES /* dvd_es.c: functions to find and select ES
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_es.c,v 1.11 2002/05/18 14:03:13 gbazin Exp $ * $Id: dvd_es.c,v 1.11.2.1 2002/06/27 19:44:54 sam Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -310,8 +310,15 @@ void DVDLaunchDecoders( input_thread_t * p_input ) ...@@ -310,8 +310,15 @@ void DVDLaunchDecoders( input_thread_t * p_input )
} }
if( i_spu > 0 ) if( i_spu > 0 )
{ {
i_spu += p_dvd->p_ifo->vts.manager_inf.i_audio_nb; int i=0,j=0;
input_SelectES( p_input, p_input->stream.pp_es[i_spu] ); for (i=0; i < p_input->stream.i_es_number; i++ ) {
if ( p_input->stream.pp_es[i]->i_type == DVD_SPU_ES ) {
j++;
if ( i_spu == j ) break;
}
}
if (i_spu == j )
input_SelectES( p_input, p_input->stream.pp_es[i] );
} }
} }
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* spu_decoder.c : spu decoder thread * spu_decoder.c : spu decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: spu_decoder.c,v 1.24.2.1 2002/06/02 13:41:55 sam Exp $ * $Id: spu_decoder.c,v 1.24.2.2 2002/06/27 19:44:54 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Rudolf Cornelissen <rag.cornelissen@inter.nl.net> * Rudolf Cornelissen <rag.cornelissen@inter.nl.net>
...@@ -157,12 +157,18 @@ static int decoder_Run( decoder_config_t * p_config ) ...@@ -157,12 +157,18 @@ static int decoder_Run( decoder_config_t * p_config )
boolean_t b_error = p_spudec->p_fifo->b_error; boolean_t b_error = p_spudec->p_fifo->b_error;
/* End of thread */ /* End of thread */
EndThread( p_spudec );
/*
* EndThread will free the 'b_error' variable, so
* we'll test it before
*/
if( b_error ) if( b_error )
{ {
EndThread( p_spudec );
return( -1 ); return( -1 );
} }
EndThread( p_spudec );
} }
return( 0 ); return( 0 );
...@@ -393,7 +399,7 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -393,7 +399,7 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
u8 i_command; u8 i_command;
int i_date; int i_date;
int i; int i, i_alpha0, i_alpha1, i_alpha2, i_alpha3;
/* XXX: temporary variables */ /* XXX: temporary variables */
boolean_t b_force_display = 0; boolean_t b_force_display = 0;
...@@ -459,9 +465,15 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -459,9 +465,15 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
p_demux_data + sizeof(int)))[ p_demux_data + sizeof(int)))[
GetBits(&p_spudec->bit_stream, 4) ]; GetBits(&p_spudec->bit_stream, 4) ];
#ifndef WORDS_BIGENDIAN
p_spu->p_sys->pi_yuv[3-i][0] = (i_color>>16) & 0xff; p_spu->p_sys->pi_yuv[3-i][0] = (i_color>>16) & 0xff;
p_spu->p_sys->pi_yuv[3-i][1] = (i_color>>0) & 0xff; p_spu->p_sys->pi_yuv[3-i][1] = (i_color>>0) & 0xff;
p_spu->p_sys->pi_yuv[3-i][2] = (i_color>>8) & 0xff; p_spu->p_sys->pi_yuv[3-i][2] = (i_color>>8) & 0xff;
#else
p_spu->p_sys->pi_yuv[3-i][0] = (i_color>>8) & 0xff;
p_spu->p_sys->pi_yuv[3-i][1] = (i_color>>24) & 0xff;
p_spu->p_sys->pi_yuv[3-i][2] = (i_color>>16) & 0xff;
#endif
} }
} }
else else
...@@ -475,11 +487,21 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -475,11 +487,21 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
case SPU_CMD_SET_ALPHACHANNEL: case SPU_CMD_SET_ALPHACHANNEL:
/* 04xxxx (alpha channel) */ /* 04xxxx (alpha channel) */
for( i = 0; i < 4 ; i++ ) i_alpha3 = GetBits( &p_spudec->bit_stream, 4 );
{ i_alpha2 = GetBits( &p_spudec->bit_stream, 4 );
p_spu->p_sys->pi_alpha[3-i] i_alpha1 = GetBits( &p_spudec->bit_stream, 4 );
= GetBits( &p_spudec->bit_stream, 4 ); i_alpha0 = GetBits( &p_spudec->bit_stream, 4 );
}
// Ignore blank alpha palette. Sometimes spurious blank alphapalettes
// are present - dunno why.
if ( i_alpha0 + i_alpha1 + i_alpha2 + i_alpha3 ) {
p_spu->p_sys->pi_alpha[0] = i_alpha0;
p_spu->p_sys->pi_alpha[1] = i_alpha1;
p_spu->p_sys->pi_alpha[2] = i_alpha2;
p_spu->p_sys->pi_alpha[3] = i_alpha3;
} else
intf_WarnMsg( 2, "spudec warning: ignoring blank alpha palette" );
i_index += 2; i_index += 2;
break; break;
...@@ -841,10 +863,12 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic, ...@@ -841,10 +863,12 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic,
u16 p_clut16[4]; u16 p_clut16[4];
u32 p_clut32[4]; u32 p_clut32[4];
u8 *p_dest; u8 *p_dest;
u8 *p_destptr = (u8 *)p_dest;
u16 *p_source = (u16 *)p_spu->p_sys->p_data; u16 *p_source = (u16 *)p_spu->p_sys->p_data;
int i_x, i_y; int i_x, i_y;
int i_len, i_color; int i_len, i_color, i_colprecomp, i_destalpha;
int i;
u8 i_cnt; u8 i_cnt;
/* RGB-specific */ /* RGB-specific */
...@@ -870,28 +894,30 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic, ...@@ -870,28 +894,30 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic,
{ {
/* Get the RLE part, then draw the line */ /* Get the RLE part, then draw the line */
i_color = *p_source & 0x3; i_color = *p_source & 0x3;
i_len = *p_source++ >> 2;
switch( p_spu->p_sys->pi_alpha[ i_color ] ) switch( p_spu->p_sys->pi_alpha[ i_color ] )
{ {
case 0x00: case 0x00:
i_x -= *p_source++ >> 2;
break; break;
case 0x0f: case 0x0f:
i_len = *p_source++ >> 2;
memset( p_dest - i_x - i_y, memset( p_dest - i_x - i_y,
p_spu->p_sys->pi_yuv[i_color][0], i_len ); p_spu->p_sys->pi_yuv[i_color][0], i_len );
i_x -= i_len;
break; break;
default: default:
/* FIXME: we should do transparency */ // To be able to divide by 16 (>>4) we add 1 to the alpha. This means Alpha 0 won't
i_len = *p_source++ >> 2; // be completely transparent, but that's handled in a special case above anyway.
memset( p_dest - i_x - i_y, i_colprecomp = p_spu->p_sys->pi_yuv[i_color][0] * (p_spu->p_sys->pi_alpha[ i_color ]+1);
p_spu->p_sys->pi_yuv[i_color][0], i_len ); i_destalpha = 15 - p_spu->p_sys->pi_alpha[ i_color ];
i_x -= i_len;
for ( p_destptr = p_dest - i_x - i_y; p_destptr < p_dest - i_x - i_y +i_len; p_destptr++ )
*p_destptr = ( i_colprecomp + *p_destptr * i_destalpha ) >> 4;
break; break;
} }
i_x -= i_len;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment