Commit 8fab2070 authored by Laurent Aimar's avatar Laurent Aimar

Cosmetics + clean up.

parent ebc680ce
...@@ -700,23 +700,15 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -700,23 +700,15 @@ static int InitThread( vout_thread_t *p_vout )
static void* RunThread( vlc_object_t *p_this ) static void* RunThread( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_thread_t *p_vout = (vout_thread_t *)p_this;
int i_index; /* index in heap */
int i_idle_loops = 0; /* loops without displaying a picture */ int i_idle_loops = 0; /* loops without displaying a picture */
mtime_t current_date; /* current date */
mtime_t display_date; /* display date */
picture_t * p_picture; /* picture pointer */
picture_t * p_last_picture = NULL; /* last picture */ picture_t * p_last_picture = NULL; /* last picture */
picture_t * p_directbuffer; /* direct buffer to display */
subpicture_t * p_subpic = NULL; /* subpicture pointer */ subpicture_t * p_subpic = NULL; /* subpicture pointer */
input_thread_t *p_input = NULL ; /* Parent input, if it exists */ bool b_drop_late;
vlc_value_t val; int i_displayed = 0, i_lost = 0;
bool b_drop_late;
int i_displayed = 0, i_lost = 0, i_loops = 0;
int canc = vlc_savecancel (); int canc = vlc_savecancel ();
/* /*
...@@ -725,9 +717,7 @@ static void* RunThread( vlc_object_t *p_this ) ...@@ -725,9 +717,7 @@ static void* RunThread( vlc_object_t *p_this )
vlc_mutex_lock( &p_vout->change_lock ); vlc_mutex_lock( &p_vout->change_lock );
p_vout->b_error = InitThread( p_vout ); p_vout->b_error = InitThread( p_vout );
var_Create( p_vout, "drop-late-frames", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); b_drop_late = var_CreateGetBool( p_vout, "drop-late-frames" );
var_Get( p_vout, "drop-late-frames", &val );
b_drop_late = val.b_bool;
/* signal the creation of the vout */ /* signal the creation of the vout */
vlc_thread_ready( p_vout ); vlc_thread_ready( p_vout );
...@@ -752,16 +742,24 @@ static void* RunThread( vlc_object_t *p_this ) ...@@ -752,16 +742,24 @@ static void* RunThread( vlc_object_t *p_this )
while( vlc_object_alive( p_vout ) && !p_vout->b_error ) while( vlc_object_alive( p_vout ) && !p_vout->b_error )
{ {
/* Initialize loop variables */ /* Initialize loop variables */
p_picture = NULL; const mtime_t current_date = mdate();
display_date = 0; picture_t *p_picture = NULL;
current_date = mdate(); mtime_t display_date = 0;
picture_t *p_directbuffer;
input_thread_t *p_input;
int i_index;
i_loops++; #if 0
if( !p_input ) p_vout->c_loops++;
if( !(p_vout->c_loops % VOUT_STATS_NB_LOOPS) )
{ {
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, msg_Dbg( p_vout, "picture heap: %d/%d",
FIND_PARENT ); I_RENDERPICTURES, p_vout->i_heap_size );
} }
#endif
/* Update statistics */
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input ) if( p_input )
{ {
vlc_mutex_lock( &p_input->p->counters.counters_lock ); vlc_mutex_lock( &p_input->p->counters.counters_lock );
...@@ -773,16 +771,7 @@ static void* RunThread( vlc_object_t *p_this ) ...@@ -773,16 +771,7 @@ static void* RunThread( vlc_object_t *p_this )
i_displayed = i_lost = 0; i_displayed = i_lost = 0;
vlc_mutex_unlock( &p_input->p->counters.counters_lock ); vlc_mutex_unlock( &p_input->p->counters.counters_lock );
vlc_object_release( p_input ); vlc_object_release( p_input );
p_input = NULL;
}
#if 0
p_vout->c_loops++;
if( !(p_vout->c_loops % VOUT_STATS_NB_LOOPS) )
{
msg_Dbg( p_vout, "picture heap: %d/%d",
I_RENDERPICTURES, p_vout->i_heap_size );
} }
#endif
/* /*
* Find the picture to display (the one with the earliest date). * Find the picture to display (the one with the earliest date).
...@@ -790,11 +779,12 @@ static void* RunThread( vlc_object_t *p_this ) ...@@ -790,11 +779,12 @@ static void* RunThread( vlc_object_t *p_this )
* are handled. */ * are handled. */
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) picture_t *p_pic = PP_RENDERPICTURE[i_index];
&& ( (p_picture == NULL) ||
(PP_RENDERPICTURE[i_index]->date < display_date) ) ) if( p_pic->i_status == READY_PICTURE &&
( p_picture == NULL || p_pic->date < display_date ) )
{ {
p_picture = PP_RENDERPICTURE[i_index]; p_picture = p_pic;
display_date = p_picture->date; display_date = p_picture->date;
} }
} }
...@@ -807,12 +797,13 @@ static void* RunThread( vlc_object_t *p_this ) ...@@ -807,12 +797,13 @@ static void* RunThread( vlc_object_t *p_this )
{ {
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) picture_t *p_pic = PP_RENDERPICTURE[i_index];
&& (PP_RENDERPICTURE[i_index] != p_last_picture)
&& ((p_picture == p_last_picture) || if( p_pic->i_status == READY_PICTURE &&
(PP_RENDERPICTURE[i_index]->date < display_date)) ) p_pic != p_last_picture &&
( p_picture == p_last_picture || p_pic->date < display_date ) )
{ {
p_picture = PP_RENDERPICTURE[i_index]; p_picture = p_pic;
display_date = p_picture->date; display_date = p_picture->date;
} }
} }
...@@ -904,16 +895,11 @@ static void* RunThread( vlc_object_t *p_this ) ...@@ -904,16 +895,11 @@ static void* RunThread( vlc_object_t *p_this )
*/ */
if( display_date > 0 ) if( display_date > 0 )
{ {
if( !p_input ) p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
{
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT,
FIND_PARENT );
}
p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date, p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date,
p_input ? var_GetBool( p_input, "state" ) == PAUSE_S : false ); p_input ? var_GetBool( p_input, "state" ) == PAUSE_S : false );
if( p_input ) if( p_input )
vlc_object_release( p_input ); vlc_object_release( p_input );
p_input = NULL;
} }
/* /*
...@@ -1105,12 +1091,6 @@ static void* RunThread( vlc_object_t *p_this ) ...@@ -1105,12 +1091,6 @@ static void* RunThread( vlc_object_t *p_this )
vlc_mutex_unlock( &p_vout->vfilter_lock ); vlc_mutex_unlock( &p_vout->vfilter_lock );
} }
if( p_input )
{
vlc_object_release( p_input );
}
/* /*
* Error loop - wait until the thread destruction is requested * Error loop - wait until the thread destruction is requested
*/ */
......
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