Commit c63257e2 authored by Laurent Aimar's avatar Laurent Aimar

Privatized p_input->i_state.

parent 93acbebb
...@@ -411,7 +411,6 @@ struct input_thread_t ...@@ -411,7 +411,6 @@ struct input_thread_t
bool b_preparsing; bool b_preparsing;
bool b_dead; bool b_dead;
int i_state;
bool b_can_pace_control; bool b_can_pace_control;
/* All other data is input_thread is PRIVATE. You can't access it /* All other data is input_thread is PRIVATE. You can't access it
......
...@@ -173,7 +173,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, ...@@ -173,7 +173,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
p_input->p->i_title = 0; p_input->p->i_title = 0;
p_input->p->title = NULL; p_input->p->title = NULL;
p_input->p->i_title_offset = p_input->p->i_seekpoint_offset = 0; p_input->p->i_title_offset = p_input->p->i_seekpoint_offset = 0;
p_input->i_state = INIT_S; p_input->p->i_state = INIT_S;
p_input->p->i_rate = INPUT_RATE_DEFAULT; p_input->p->i_rate = INPUT_RATE_DEFAULT;
p_input->p->b_recording = false; p_input->p->b_recording = false;
memset( &p_input->p->bookmark, 0, sizeof(p_input->p->bookmark) ); memset( &p_input->p->bookmark, 0, sizeof(p_input->p->bookmark) );
...@@ -740,10 +740,10 @@ static void MainLoop( input_thread_t *p_input ) ...@@ -740,10 +740,10 @@ static void MainLoop( input_thread_t *p_input )
/* Demux data */ /* Demux data */
b_force_update = false; b_force_update = false;
i_wakeup = 0; i_wakeup = 0;
/* FIXME if p_input->i_state == PAUSE_S the access/access_demux /* FIXME if p_input->p->i_state == PAUSE_S the access/access_demux
* is paused -> this may cause problem with some of them * is paused -> this may cause problem with some of them
* The same problem can be seen when seeking while paused */ * The same problem can be seen when seeking while paused */
b_paused = p_input->i_state == PAUSE_S && b_paused = p_input->p->i_state == PAUSE_S &&
!es_out_GetBuffering( p_input->p->p_es_out ); !es_out_GetBuffering( p_input->p->p_es_out );
if( !b_paused ) if( !b_paused )
...@@ -1492,7 +1492,7 @@ static void ControlPause( input_thread_t *p_input, mtime_t i_control_date ) ...@@ -1492,7 +1492,7 @@ static void ControlPause( input_thread_t *p_input, mtime_t i_control_date )
if( i_ret ) if( i_ret )
{ {
msg_Warn( p_input, "cannot set pause state" ); msg_Warn( p_input, "cannot set pause state" );
i_state = p_input->i_state; i_state = p_input->p->i_state;
} }
} }
...@@ -1503,7 +1503,7 @@ static void ControlPause( input_thread_t *p_input, mtime_t i_control_date ) ...@@ -1503,7 +1503,7 @@ static void ControlPause( input_thread_t *p_input, mtime_t i_control_date )
if( i_ret ) if( i_ret )
{ {
msg_Warn( p_input, "cannot set pause state at es_out level" ); msg_Warn( p_input, "cannot set pause state at es_out level" );
i_state = p_input->i_state; i_state = p_input->p->i_state;
} }
} }
...@@ -1652,14 +1652,14 @@ static bool Control( input_thread_t *p_input, int i_type, ...@@ -1652,14 +1652,14 @@ static bool Control( input_thread_t *p_input, int i_type,
} }
case INPUT_CONTROL_SET_STATE: case INPUT_CONTROL_SET_STATE:
if( ( val.i_int == PLAYING_S && p_input->i_state == PAUSE_S ) || if( ( val.i_int == PLAYING_S && p_input->p->i_state == PAUSE_S ) ||
( val.i_int == PAUSE_S && p_input->i_state == PAUSE_S ) ) ( val.i_int == PAUSE_S && p_input->p->i_state == PAUSE_S ) )
{ {
ControlUnpause( p_input, i_control_date ); ControlUnpause( p_input, i_control_date );
b_force_update = true; b_force_update = true;
} }
else if( val.i_int == PAUSE_S && p_input->i_state == PLAYING_S /* && else if( val.i_int == PAUSE_S && p_input->p->i_state == PLAYING_S /* &&
p_input->p->b_can_pause */ ) p_input->p->b_can_pause */ )
{ {
ControlPause( p_input, i_control_date ); ControlPause( p_input, i_control_date );
...@@ -1671,7 +1671,7 @@ static bool Control( input_thread_t *p_input, int i_type, ...@@ -1671,7 +1671,7 @@ static bool Control( input_thread_t *p_input, int i_type,
b_force_update = true; b_force_update = true;
/* Correct "state" value */ /* Correct "state" value */
input_ChangeState( p_input, p_input->i_state ); input_ChangeState( p_input, p_input->p->i_state );
} }
else if( val.i_int != PLAYING_S && val.i_int != PAUSE_S ) else if( val.i_int != PLAYING_S && val.i_int != PAUSE_S )
{ {
...@@ -2057,11 +2057,11 @@ static bool Control( input_thread_t *p_input, int i_type, ...@@ -2057,11 +2057,11 @@ static bool Control( input_thread_t *p_input, int i_type,
break; break;
case INPUT_CONTROL_SET_FRAME_NEXT: case INPUT_CONTROL_SET_FRAME_NEXT:
if( p_input->i_state == PAUSE_S ) if( p_input->p->i_state == PAUSE_S )
{ {
es_out_SetFrameNext( p_input->p->p_es_out ); es_out_SetFrameNext( p_input->p->p_es_out );
} }
else if( p_input->i_state == PLAYING_S ) else if( p_input->p->i_state == PLAYING_S )
{ {
ControlPause( p_input, i_control_date ); ControlPause( p_input, i_control_date );
} }
...@@ -2956,9 +2956,9 @@ static void InputGetExtraFiles( input_thread_t *p_input, ...@@ -2956,9 +2956,9 @@ static void InputGetExtraFiles( input_thread_t *p_input,
/* */ /* */
static void input_ChangeState( input_thread_t *p_input, int i_state ) static void input_ChangeState( input_thread_t *p_input, int i_state )
{ {
const bool b_changed = p_input->i_state != i_state; const bool b_changed = p_input->p->i_state != i_state;
p_input->i_state = i_state; p_input->p->i_state = i_state;
if( i_state == ERROR_S ) if( i_state == ERROR_S )
p_input->b_error = true; p_input->b_error = true;
else if( i_state == END_S ) else if( i_state == END_S )
...@@ -3170,7 +3170,7 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for ...@@ -3170,7 +3170,7 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for
void input_UpdateStatistic( input_thread_t *p_input, void input_UpdateStatistic( input_thread_t *p_input,
input_statistic_t i_type, int i_delta ) input_statistic_t i_type, int i_delta )
{ {
assert( p_input->i_state != INIT_S ); assert( p_input->p->i_state != INIT_S );
vlc_mutex_lock( &p_input->p->counters.counters_lock); vlc_mutex_lock( &p_input->p->counters.counters_lock);
switch( i_type ) switch( i_type )
......
...@@ -79,6 +79,7 @@ struct input_thread_private_t ...@@ -79,6 +79,7 @@ struct input_thread_private_t
bool b_can_pause; bool b_can_pause;
bool b_can_rate_control; bool b_can_rate_control;
double f_fps; double f_fps;
int i_state;
/* Internal caching common to all sources */ /* Internal caching common to all sources */
mtime_t i_pts_delay; mtime_t i_pts_delay;
......
...@@ -132,7 +132,7 @@ void input_ControlVarInit ( input_thread_t *p_input ) ...@@ -132,7 +132,7 @@ void input_ControlVarInit ( input_thread_t *p_input )
/* State */ /* State */
var_Create( p_input, "state", VLC_VAR_INTEGER ); var_Create( p_input, "state", VLC_VAR_INTEGER );
val.i_int = p_input->i_state; val.i_int = p_input->p->i_state;
var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL ); var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
/* Rate */ /* Rate */
......
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