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
This diff is collapsed.
...@@ -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