[vlc-devel] commit: input: Attempt to fix variables deadlocks. (Pierre d'Herbemont )
git version control
git at videolan.org
Tue Jun 17 12:25:51 CEST 2008
vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Tue Jun 17 12:26:00 2008 +0200| [c7cd0ac4979a796904402309a4978de7416286ec]
input: Attempt to fix variables deadlocks.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c7cd0ac4979a796904402309a4978de7416286ec
---
src/input/input.c | 6 +++---
src/input/input_internal.h | 17 +++++++++++++++--
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/input/input.c b/src/input/input.c
index 2421834..b70115d 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1550,7 +1550,7 @@ static bool Control( input_thread_t *p_input, int i_type,
b_force_update = true;
/* Switch to play */
- input_ChangeState( p_input, PLAYING_S);
+ input_ChangeStateWithVarCallback( p_input, PLAYING_S, false );
/* */
if( !i_ret )
@@ -1580,7 +1580,7 @@ static bool Control( input_thread_t *p_input, int i_type,
}
/* Switch to new state */
- input_ChangeState( p_input, state);
+ input_ChangeStateWithVarCallback( p_input, state, false );
/* */
if( !i_ret )
@@ -1591,7 +1591,7 @@ static bool Control( input_thread_t *p_input, int i_type,
b_force_update = true;
/* Correct "state" value */
- input_ChangeState( p_input, p_input->i_state );
+ input_ChangeStateWithVarCallback( p_input, p_input->i_state, false );
}
else if( val.i_int != PLAYING_S && val.i_int != PAUSE_S )
{
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 90cb3e9..fb271ac 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -384,10 +384,17 @@ int subtitles_Filter( const char *);
void MRLSplit( char *, const char **, const char **, char ** );
-static inline void input_ChangeState( input_thread_t *p_input, int state )
+static inline void input_ChangeStateWithVarCallback( input_thread_t *p_input, int state, bool callback )
{
bool changed = (p_input->i_state != state);
- var_SetInteger( p_input, "state", p_input->i_state = state );
+ if( callback )
+ var_SetInteger( p_input, "state", p_input->i_state = state );
+ else
+ {
+ vlc_value_t val;
+ val.i_int = PLAYING_S;
+ var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
+ }
if( changed )
{
vlc_event_t event;
@@ -397,6 +404,12 @@ static inline void input_ChangeState( input_thread_t *p_input, int state )
}
}
+static inline void input_ChangeState( input_thread_t *p_input, int state )
+{
+ input_ChangeStateWithVarCallback( p_input, state, true );
+}
+
+
/* Access */
#define access_New( a, b, c, d ) __access_New(VLC_OBJECT(a), b, c, d )
More information about the vlc-devel
mailing list