Commit cea09ed8 authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/codec/spudec/parse.c: fixed bad initialization of the alpha

    palette, implemented the "force display" command as forever-living
    subtitles, and reworked some code.
  * ./src/video_output/video_output.c: we increment the image date even if
    we are repeating the previous image, so that subtitles have a chance to
    get displayed.
  * ./src/video_output/vout_subpictures.c: ephemer subpictures don't timeout.
parent 649051a1
...@@ -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.1 2002/08/16 03:07:56 sam Exp $ * $Id: parse.c,v 1.2 2002/10/17 08:24:12 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -84,12 +84,12 @@ int E_(SyncPacket)( spudec_thread_t *p_spudec ) ...@@ -84,12 +84,12 @@ int E_(SyncPacket)( spudec_thread_t *p_spudec )
if( !p_spudec->i_spu_size if( !p_spudec->i_spu_size
|| ( p_spudec->i_rle_size >= p_spudec->i_spu_size ) ) || ( p_spudec->i_rle_size >= p_spudec->i_spu_size ) )
{ {
return( 1 ); return VLC_EGENERIC;
} }
RemoveBits( &p_spudec->bit_stream, 16 ); RemoveBits( &p_spudec->bit_stream, 16 );
return( 0 ); return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -131,7 +131,12 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec ) ...@@ -131,7 +131,12 @@ void E_(ParsePacket)( spudec_thread_t *p_spudec )
/* Fill the p_spu structure */ /* Fill the p_spu structure */
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->p_sys->p_data = (u8*)p_spu->p_sys + sizeof( subpicture_sys_t );
p_spu->p_sys->b_palette = 0; p_spu->p_sys->b_palette = VLC_FALSE;
p_spu->p_sys->pi_alpha[0] = 0x00;
p_spu->p_sys->pi_alpha[1] = 0x0f;
p_spu->p_sys->pi_alpha[2] = 0x0f;
p_spu->p_sys->pi_alpha[3] = 0x0f;
/* 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 = p_spudec->p_fifo->p_first->i_pts; p_spu->p_sys->i_pts = p_spudec->p_fifo->p_first->i_pts;
...@@ -214,25 +219,26 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -214,25 +219,26 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
int i_index = p_spudec->i_rle_size + 4; int i_index = p_spudec->i_rle_size + 4;
/* The next start-of-control-sequence index and the previous one */ /* The next start-of-control-sequence index and the previous one */
int i_next_seq, i_cur_seq; int i_next_seq = 0, i_cur_seq = 0;
/* Command time and date */ /* Command and date */
u8 i_command; u8 i_command = SPU_CMD_END;
int i_date; mtime_t date = 0;
int i, pi_alpha[4]; int i, pi_alpha[4];
/* XXX: temporary variables */
vlc_bool_t b_force_display = 0;
/* Initialize the structure */ /* Initialize the structure */
p_spu->i_start = p_spu->i_stop = 0; p_spu->i_start = p_spu->i_stop = 0;
p_spu->b_ephemer = 0; p_spu->b_ephemer = VLC_FALSE;
do do
{
/* If we just read a command sequence, read the next one;
* otherwise, go on with the commands of the current sequence. */
if( i_command == SPU_CMD_END )
{ {
/* Get the control sequence date */ /* Get the control sequence date */
i_date = GetBits( &p_spudec->bit_stream, 16 ); date = GetBits( &p_spudec->bit_stream, 16 );
/* Next offset */ /* Next offset */
i_cur_seq = i_index; i_cur_seq = i_index;
...@@ -240,46 +246,36 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -240,46 +246,36 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
/* Skip what we just read */ /* Skip what we just read */
i_index += 4; i_index += 4;
}
do
{
i_command = GetBits( &p_spudec->bit_stream, 8 ); i_command = GetBits( &p_spudec->bit_stream, 8 );
i_index++; i_index++;
switch( i_command ) switch( i_command )
{ {
case SPU_CMD_FORCE_DISPLAY: case SPU_CMD_FORCE_DISPLAY: /* 00 (force displaying) */
p_spu->i_start = p_spu->p_sys->i_pts + ( date * 11000 );
/* 00 (force displaying) */ p_spu->b_ephemer = VLC_TRUE;
p_spu->i_start = p_spu->p_sys->i_pts + ( i_date * 11000 );
b_force_display = 1;
break; break;
/* Convert the dates in seconds to PTS values */ /* Convert the dates in seconds to PTS values */
case SPU_CMD_START_DISPLAY: case SPU_CMD_START_DISPLAY: /* 01 (start displaying) */
p_spu->i_start = p_spu->p_sys->i_pts + ( date * 11000 );
/* 01 (start displaying) */
p_spu->i_start = p_spu->p_sys->i_pts + ( i_date * 11000 );
break; break;
case SPU_CMD_STOP_DISPLAY: case SPU_CMD_STOP_DISPLAY: /* 02 (stop displaying) */
p_spu->i_stop = p_spu->p_sys->i_pts + ( date * 11000 );
/* 02 (stop displaying) */
p_spu->i_stop = p_spu->p_sys->i_pts + ( i_date * 11000 );
break; break;
case SPU_CMD_SET_PALETTE: case SPU_CMD_SET_PALETTE:
/* 03xxxx (palette) */ /* 03xxxx (palette) */
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; u32 i_color;
p_spu->p_sys->b_palette = 1; 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 = ((u32*)((char*)p_spudec->p_fifo->
...@@ -306,9 +302,7 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -306,9 +302,7 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
break; break;
case SPU_CMD_SET_ALPHACHANNEL: case SPU_CMD_SET_ALPHACHANNEL: /* 04xxxx (alpha channel) */
/* 04xxxx (alpha channel) */
pi_alpha[3] = GetBits( &p_spudec->bit_stream, 4 ); pi_alpha[3] = GetBits( &p_spudec->bit_stream, 4 );
pi_alpha[2] = GetBits( &p_spudec->bit_stream, 4 ); pi_alpha[2] = GetBits( &p_spudec->bit_stream, 4 );
pi_alpha[1] = GetBits( &p_spudec->bit_stream, 4 ); pi_alpha[1] = GetBits( &p_spudec->bit_stream, 4 );
...@@ -325,17 +319,13 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -325,17 +319,13 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
} }
else else
{ {
msg_Warn( p_spudec->p_fifo, msg_Warn( p_spudec->p_fifo, "ignoring blank alpha palette" );
"ignoring blank alpha palette" );
} }
i_index += 2; i_index += 2;
break; break;
case SPU_CMD_SET_COORDINATES: case SPU_CMD_SET_COORDINATES: /* 05xxxyyyxxxyyy (coordinates) */
/* 05xxxyyyxxxyyy (coordinates) */
p_spu->i_x = GetBits( &p_spudec->bit_stream, 12 ); p_spu->i_x = GetBits( &p_spudec->bit_stream, 12 );
p_spu->i_width = GetBits( &p_spudec->bit_stream, 12 ) p_spu->i_width = GetBits( &p_spudec->bit_stream, 12 )
- p_spu->i_x + 1; - p_spu->i_x + 1;
...@@ -345,12 +335,9 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -345,12 +335,9 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
- p_spu->i_y + 1; - p_spu->i_y + 1;
i_index += 6; i_index += 6;
break; break;
case SPU_CMD_SET_OFFSETS: case SPU_CMD_SET_OFFSETS: /* 06xxxxyyyy (byte offsets) */
/* 06xxxxyyyy (byte offsets) */
p_spu->p_sys->pi_offset[0] = p_spu->p_sys->pi_offset[0] =
GetBits( &p_spudec->bit_stream, 16 ) - 4; GetBits( &p_spudec->bit_stream, 16 ) - 4;
...@@ -358,45 +345,38 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -358,45 +345,38 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
GetBits( &p_spudec->bit_stream, 16 ) - 4; GetBits( &p_spudec->bit_stream, 16 ) - 4;
i_index += 4; i_index += 4;
break; break;
case SPU_CMD_END: case SPU_CMD_END: /* ff (end) */
/* ff (end) */
break; break;
default: default: /* xx (unknown command) */
/* xx (unknown command) */
msg_Err( p_spudec->p_fifo, "unknown command 0x%.2x", msg_Err( p_spudec->p_fifo, "unknown command 0x%.2x",
i_command ); i_command );
return( 1 ); return VLC_EGENERIC;
} }
/* We need to check for quit commands here */ /* We need to check for quit commands here */
if( p_spudec->p_fifo->b_die ) if( p_spudec->p_fifo->b_die )
{ {
return( 1 ); return VLC_EGENERIC;
} }
} while( i_command != SPU_CMD_END ); } while( i_command != SPU_CMD_END || i_index == i_next_seq );
} while( i_index == i_next_seq );
/* Check that the next sequence index matches the current one */ /* Check that the next sequence index matches the current one */
if( i_next_seq != i_cur_seq ) if( i_next_seq != i_cur_seq )
{ {
msg_Err( p_spudec->p_fifo, "index mismatch (0x%.4x != 0x%.4x)", msg_Err( p_spudec->p_fifo, "index mismatch (0x%.4x != 0x%.4x)",
i_next_seq, i_cur_seq ); i_next_seq, i_cur_seq );
return( 1 ); return VLC_EGENERIC;
} }
if( i_index > p_spudec->i_spu_size ) if( i_index > p_spudec->i_spu_size )
{ {
msg_Err( p_spudec->p_fifo, "uh-oh, we went too far (0x%.4x > 0x%.4x)", msg_Err( p_spudec->p_fifo, "uh-oh, we went too far (0x%.4x > 0x%.4x)",
i_index, p_spudec->i_spu_size ); i_index, p_spudec->i_spu_size );
return( 1 ); return VLC_EGENERIC;
} }
if( !p_spu->i_start ) if( !p_spu->i_start )
...@@ -404,11 +384,11 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -404,11 +384,11 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
msg_Err( p_spudec->p_fifo, "no `start display' command" ); msg_Err( p_spudec->p_fifo, "no `start display' command" );
} }
if( !p_spu->i_stop ) if( !p_spu->i_stop && !p_spu->b_ephemer )
{ {
/* This subtitle will live for 5 seconds or until the next subtitle */ /* This subtitle will live for 5 seconds or until the next subtitle */
p_spu->i_stop = p_spu->i_start + 500 * 11000; p_spu->i_stop = p_spu->i_start + 500 * 11000;
p_spu->b_ephemer = 1; p_spu->b_ephemer = VLC_TRUE;
} }
/* Get rid of padding bytes */ /* Get rid of padding bytes */
...@@ -437,15 +417,8 @@ static int ParseControlSequences( spudec_thread_t *p_spudec, ...@@ -437,15 +417,8 @@ static int ParseControlSequences( spudec_thread_t *p_spudec,
break; break;
} }
if( b_force_display )
{
msg_Err( p_spudec->p_fifo, "\"force display\" command" );
msg_Err( p_spudec->p_fifo, "send mail to <sam@zoy.org> if you "
"want to help debugging this" );
}
/* Successfully parsed ! */ /* Successfully parsed ! */
return( 0 ); return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -471,8 +444,8 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -471,8 +444,8 @@ static int ParseRLE( spudec_thread_t *p_spudec,
unsigned int pi_table[ 2 ]; unsigned int pi_table[ 2 ];
unsigned int *pi_offset; unsigned int *pi_offset;
vlc_bool_t b_empty_top = 1, vlc_bool_t b_empty_top = VLC_TRUE,
b_empty_bottom = 0; 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;
...@@ -516,7 +489,7 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -516,7 +489,7 @@ static int ParseRLE( spudec_thread_t *p_spudec,
/* We have a boo boo ! */ /* We have a boo boo ! */
msg_Err( p_spudec->p_fifo, "unknown RLE code " msg_Err( p_spudec->p_fifo, "unknown RLE code "
"0x%.4x", i_code ); "0x%.4x", i_code );
return( 1 ); return VLC_EGENERIC;
} }
} }
} }
...@@ -528,7 +501,7 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -528,7 +501,7 @@ static int ParseRLE( spudec_thread_t *p_spudec,
msg_Err( p_spudec->p_fifo, msg_Err( p_spudec->p_fifo,
"out of bounds, %i at (%i,%i) is out of %ix%i", "out of bounds, %i at (%i,%i) is out of %ix%i",
i_code >> 2, i_x, i_y, i_width, i_height ); i_code >> 2, i_x, i_y, i_width, i_height );
return( 1 ); return VLC_EGENERIC;
} }
/* Try to find the border color */ /* Try to find the border color */
...@@ -552,7 +525,7 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -552,7 +525,7 @@ static int ParseRLE( spudec_thread_t *p_spudec,
* so we store the code just in case. */ * so we store the code just in case. */
*p_dest++ = i_code; *p_dest++ = i_code;
b_empty_bottom = 1; b_empty_bottom = VLC_TRUE;
i_skipped_bottom++; i_skipped_bottom++;
} }
} }
...@@ -562,8 +535,8 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -562,8 +535,8 @@ static int ParseRLE( spudec_thread_t *p_spudec,
*p_dest++ = i_code; *p_dest++ = i_code;
/* Valid code means no blank line */ /* Valid code means no blank line */
b_empty_top = 0; b_empty_top = VLC_FALSE;
b_empty_bottom = 0; b_empty_bottom = VLC_FALSE;
i_skipped_bottom = 0; i_skipped_bottom = 0;
} }
} }
...@@ -573,7 +546,7 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -573,7 +546,7 @@ static int ParseRLE( spudec_thread_t *p_spudec,
{ {
msg_Err( p_spudec->p_fifo, "i_x overflowed, %i > %i", msg_Err( p_spudec->p_fifo, "i_x overflowed, %i > %i",
i_x, i_width ); i_x, i_width );
return( 1 ); return VLC_EGENERIC;
} }
/* Byte-align the stream */ /* Byte-align the stream */
...@@ -600,7 +573,7 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -600,7 +573,7 @@ static int ParseRLE( spudec_thread_t *p_spudec,
i_y++; i_y++;
} }
return( 1 ); return VLC_EGENERIC;
} }
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",
...@@ -673,6 +646,6 @@ static int ParseRLE( spudec_thread_t *p_spudec, ...@@ -673,6 +646,6 @@ static int ParseRLE( spudec_thread_t *p_spudec,
i_border, i_inner, i_shade ); i_border, i_inner, i_shade );
} }
return( 0 ); return VLC_SUCCESS;
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread. * thread, and destroy a previously oppened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.191 2002/08/29 23:53:22 massiot Exp $ * $Id: video_output.c,v 1.192 2002/10/17 08:24:12 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
*****************************************************************************/ *****************************************************************************/
#include <errno.h> /* ENOMEM */ #include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */ #include <stdlib.h> /* free() */
#include <stdio.h> /* sprintf() */
#include <string.h> /* strerror() */
#include <vlc/vlc.h> #include <vlc/vlc.h>
...@@ -78,7 +76,7 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent, ...@@ -78,7 +76,7 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent,
if( p_vout == NULL ) if( p_vout == NULL )
{ {
msg_Err( p_parent, "out of memory" ); msg_Err( p_parent, "out of memory" );
return( NULL ); return NULL;
} }
/* If the parent is not a VOUT object, that means we are at the start of /* If the parent is not a VOUT object, that means we are at the start of
...@@ -192,7 +190,7 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent, ...@@ -192,7 +190,7 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent,
{ {
msg_Err( p_vout, "no suitable vout module" ); msg_Err( p_vout, "no suitable vout module" );
vlc_object_destroy( p_vout ); vlc_object_destroy( p_vout );
return( NULL ); return NULL;
} }
/* Create thread and set locks */ /* Create thread and set locks */
...@@ -205,7 +203,7 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent, ...@@ -205,7 +203,7 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent,
if( vlc_thread_create( p_vout, "video output", RunThread, if( vlc_thread_create( p_vout, "video output", RunThread,
VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE ) ) VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE ) )
{ {
msg_Err( p_vout, "%s", strerror(ENOMEM) ); msg_Err( p_vout, "out of memory" );
module_Unneed( p_vout, p_vout->p_module ); module_Unneed( p_vout, p_vout->p_module );
vlc_object_destroy( p_vout ); vlc_object_destroy( p_vout );
return NULL; return NULL;
...@@ -253,7 +251,7 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -253,7 +251,7 @@ static int InitThread( vout_thread_t *p_vout )
if( p_vout->pf_init( p_vout ) ) if( p_vout->pf_init( p_vout ) )
{ {
vlc_mutex_unlock( &p_vout->change_lock ); vlc_mutex_unlock( &p_vout->change_lock );
return( 1 ); return VLC_EGENERIC;
} }
if( !I_OUTPUTPICTURES ) if( !I_OUTPUTPICTURES )
...@@ -262,7 +260,7 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -262,7 +260,7 @@ static int InitThread( vout_thread_t *p_vout )
"one direct buffer" ); "one direct buffer" );
p_vout->pf_end( p_vout ); p_vout->pf_end( p_vout );
vlc_mutex_unlock( &p_vout->change_lock ); vlc_mutex_unlock( &p_vout->change_lock );
return( 1 ); return VLC_EGENERIC;
} }
msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES ); msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES );
...@@ -328,7 +326,7 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -328,7 +326,7 @@ static int InitThread( vout_thread_t *p_vout )
&p_vout->render.i_chroma, &p_vout->output.i_chroma ); &p_vout->render.i_chroma, &p_vout->output.i_chroma );
p_vout->pf_end( p_vout ); p_vout->pf_end( p_vout );
vlc_mutex_unlock( &p_vout->change_lock ); vlc_mutex_unlock( &p_vout->change_lock );
return( 1 ); return VLC_EGENERIC;
} }
if( I_OUTPUTPICTURES < 2 * VOUT_MAX_PICTURES ) if( I_OUTPUTPICTURES < 2 * VOUT_MAX_PICTURES )
...@@ -366,7 +364,7 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -366,7 +364,7 @@ static int InitThread( vout_thread_t *p_vout )
} }
/* XXX XXX mark thread ready */ /* XXX XXX mark thread ready */
return( 0 ); return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -407,6 +405,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -407,6 +405,7 @@ static void RunThread( vout_thread_t *p_vout)
while( (!p_vout->b_die) && (!p_vout->b_error) ) while( (!p_vout->b_die) && (!p_vout->b_error) )
{ {
/* Initialize loop variables */ /* Initialize loop variables */
p_picture = NULL;
display_date = 0; display_date = 0;
current_date = mdate(); current_date = mdate();
...@@ -420,11 +419,9 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -420,11 +419,9 @@ static void RunThread( vout_thread_t *p_vout)
#endif #endif
/* /*
* Find the picture to display - this operation does not need lock, * Find the picture to display (the one with the earliest date).
* since only READY_PICTUREs are handled * This operation does not need lock, since only READY_PICTUREs
*/ * are handled. */
p_picture = NULL;
for( i_index = 0; i_index < I_RENDERPICTURES; i_index++ ) for( i_index = 0; i_index < I_RENDERPICTURES; i_index++ )
{ {
if( (PP_RENDERPICTURE[i_index]->i_status == READY_PICTURE) if( (PP_RENDERPICTURE[i_index]->i_status == READY_PICTURE)
...@@ -436,7 +433,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -436,7 +433,7 @@ static void RunThread( vout_thread_t *p_vout)
} }
} }
if( p_picture != NULL ) if( p_picture )
{ {
/* If we met the last picture, parse again to see whether there is /* If we met the last picture, parse again to see whether there is
* a more appropriate one. */ * a more appropriate one. */
...@@ -546,7 +543,9 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -546,7 +543,9 @@ static void RunThread( vout_thread_t *p_vout)
} }
else else
{ {
/*intf_WarnMsg( 6, "vout info: duplicating picture" );*/ /* We set the display date to something high, otherwise
* we'll have lots of problems with late pictures */
display_date = current_date + p_vout->render_time;
} }
} }
} }
...@@ -580,7 +579,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -580,7 +579,7 @@ static void RunThread( vout_thread_t *p_vout)
*/ */
if( display_date != 0 ) if( display_date != 0 )
{ {
/* Store render time using Bresenham algorithm */ /* Store render time using a sliding mean */
p_vout->render_time += mdate() - current_date; p_vout->render_time += mdate() - current_date;
p_vout->render_time >>= 1; p_vout->render_time >>= 1;
} }
...@@ -659,7 +658,6 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -659,7 +658,6 @@ static void RunThread( vout_thread_t *p_vout)
p_vout->chroma.p_module->pf_deactivate( VLC_OBJECT(p_vout) ); p_vout->chroma.p_module->pf_deactivate( VLC_OBJECT(p_vout) );
p_vout->chroma.p_module->pf_activate( VLC_OBJECT(p_vout) ); p_vout->chroma.p_module->pf_activate( VLC_OBJECT(p_vout) );
} }
} }
/* /*
...@@ -816,7 +814,7 @@ static int BinaryLog(u32 i) ...@@ -816,7 +814,7 @@ static int BinaryLog(u32 i)
if( i & 0xcccccccc ) i_log += 2; if( i & 0xcccccccc ) i_log += 2;
if( i & 0xaaaaaaaa ) i_log += 1; if( i & 0xaaaaaaaa ) i_log += 1;
return( i_log ); return i_log;
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_subpictures.c : subpicture management functions * vout_subpictures.c : subpicture management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* $Id: vout_subpictures.c,v 1.14 2002/06/01 12:32:02 sam Exp $ * $Id: vout_subpictures.c,v 1.15 2002/10/17 08:24:12 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -104,7 +104,7 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type, ...@@ -104,7 +104,7 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
* to be done */ * to be done */
p_vout->p_subpicture[i_subpic].i_status = RESERVED_SUBPICTURE; p_vout->p_subpicture[i_subpic].i_status = RESERVED_SUBPICTURE;
vlc_mutex_unlock( &p_vout->subpicture_lock ); vlc_mutex_unlock( &p_vout->subpicture_lock );
return( &p_vout->p_subpicture[i_subpic] ); return &p_vout->p_subpicture[i_subpic];
} }
else if( p_destroyed_subpic == NULL ) else if( p_destroyed_subpic == NULL )
{ {
...@@ -135,7 +135,7 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type, ...@@ -135,7 +135,7 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
{ {
msg_Err( p_vout, "subpicture heap is full" ); msg_Err( p_vout, "subpicture heap is full" );
vlc_mutex_unlock( &p_vout->subpicture_lock ); vlc_mutex_unlock( &p_vout->subpicture_lock );
return( NULL ); return NULL;
} }
p_free_subpic->p_sys = p_free_subpic->p_sys =
...@@ -163,7 +163,7 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type, ...@@ -163,7 +163,7 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
vlc_mutex_unlock( &p_vout->subpicture_lock ); vlc_mutex_unlock( &p_vout->subpicture_lock );
return( p_free_subpic ); return p_free_subpic;
} }
/***************************************************************************** /*****************************************************************************
...@@ -230,7 +230,8 @@ subpicture_t *vout_SortSubPictures( vout_thread_t *p_vout, ...@@ -230,7 +230,8 @@ subpicture_t *vout_SortSubPictures( vout_thread_t *p_vout,
/* If it is a DVD subpicture, check its date */ /* If it is a DVD subpicture, check its date */
if( p_vout->p_subpicture[i_index].i_type == MEMORY_SUBPICTURE ) if( p_vout->p_subpicture[i_index].i_type == MEMORY_SUBPICTURE )
{ {
if( display_date > p_vout->p_subpicture[i_index].i_stop ) if( !p_vout->p_subpicture[i_index].b_ephemer
&& display_date > p_vout->p_subpicture[i_index].i_stop )
{ {
/* Too late, destroy the subpic */ /* Too late, destroy the subpic */
vout_DestroySubPicture( p_vout, vout_DestroySubPicture( p_vout,
...@@ -238,7 +239,8 @@ subpicture_t *vout_SortSubPictures( vout_thread_t *p_vout, ...@@ -238,7 +239,8 @@ subpicture_t *vout_SortSubPictures( vout_thread_t *p_vout,
continue; continue;
} }
if( display_date < p_vout->p_subpicture[i_index].i_start ) if( display_date
&& display_date < p_vout->p_subpicture[i_index].i_start )
{ {
/* Too early, come back next monday */ /* Too early, come back next monday */
continue; continue;
......
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