Commit 385b4ac8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Code factorization

parent 1665845f
...@@ -179,7 +179,6 @@ void Close ( vlc_object_t *p_this ) ...@@ -179,7 +179,6 @@ void Close ( vlc_object_t *p_this )
static void RunIntf( intf_thread_t *p_intf ) static void RunIntf( intf_thread_t *p_intf )
{ {
intf_sys_t *p_sys = p_intf->p_sys; intf_sys_t *p_sys = p_intf->p_sys;
playlist_t * p_playlist = NULL;
int canc = vlc_savecancel(); int canc = vlc_savecancel();
input_thread_t *p_input; input_thread_t *p_input;
...@@ -199,13 +198,12 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -199,13 +198,12 @@ static void RunIntf( intf_thread_t *p_intf )
/* If you modify this, please try to follow this convention: /* If you modify this, please try to follow this convention:
Start with LEFT, RIGHT for playback related commands Start with LEFT, RIGHT for playback related commands
and UP, DOWN, for other commands */ and UP, DOWN, for other commands */
playlist_t * p_playlist = pl_Hold( p_intf );
switch( p_sys->i_pattern ) switch( p_sys->i_pattern )
{ {
case LEFT: case LEFT:
msg_Dbg( p_intf, "Go backward in the movie!" ); msg_Dbg( p_intf, "Go backward in the movie!" );
p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf );
if( p_input ) if( p_input )
{ {
i_interval = config_GetInt( p_intf , "short-jump-size" ); i_interval = config_GetInt( p_intf , "short-jump-size" );
...@@ -220,10 +218,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -220,10 +218,7 @@ static void RunIntf( intf_thread_t *p_intf )
case RIGHT: case RIGHT:
msg_Dbg( p_intf, "Go forward in the movie!" ); msg_Dbg( p_intf, "Go forward in the movie!" );
p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf );
if( p_input ) if( p_input )
{ {
i_interval = config_GetInt( p_intf , "short-jump-size" ); i_interval = config_GetInt( p_intf , "short-jump-size" );
...@@ -238,9 +233,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -238,9 +233,7 @@ static void RunIntf( intf_thread_t *p_intf )
case GESTURE(LEFT,UP,NONE,NONE): case GESTURE(LEFT,UP,NONE,NONE):
msg_Dbg( p_intf, "Going slower." ); msg_Dbg( p_intf, "Going slower." );
p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf );
if( p_input ) if( p_input )
{ {
var_SetVoid( p_input, "rate-slower" ); var_SetVoid( p_input, "rate-slower" );
...@@ -250,9 +243,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -250,9 +243,7 @@ static void RunIntf( intf_thread_t *p_intf )
case GESTURE(RIGHT,UP,NONE,NONE): case GESTURE(RIGHT,UP,NONE,NONE):
msg_Dbg( p_intf, "Going faster." ); msg_Dbg( p_intf, "Going faster." );
p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf );
if( p_input ) if( p_input )
{ {
var_SetVoid( p_input, "rate-faster" ); var_SetVoid( p_input, "rate-faster" );
...@@ -263,9 +254,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -263,9 +254,7 @@ static void RunIntf( intf_thread_t *p_intf )
case GESTURE(LEFT,RIGHT,NONE,NONE): case GESTURE(LEFT,RIGHT,NONE,NONE):
case GESTURE(RIGHT,LEFT,NONE,NONE): case GESTURE(RIGHT,LEFT,NONE,NONE):
msg_Dbg( p_intf, "Play/Pause" ); msg_Dbg( p_intf, "Play/Pause" );
p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf );
if( p_input ) if( p_input )
{ {
...@@ -277,15 +266,11 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -277,15 +266,11 @@ static void RunIntf( intf_thread_t *p_intf )
break; break;
case GESTURE(LEFT,DOWN,NONE,NONE): case GESTURE(LEFT,DOWN,NONE,NONE):
p_playlist = pl_Hold( p_intf );
playlist_Prev( p_playlist ); playlist_Prev( p_playlist );
pl_Release( p_intf );
break; break;
case GESTURE(RIGHT,DOWN,NONE,NONE): case GESTURE(RIGHT,DOWN,NONE,NONE):
p_playlist = pl_Hold( p_intf );
playlist_Next( p_playlist ); playlist_Next( p_playlist );
pl_Release( p_intf );
break; break;
case UP: case UP:
...@@ -309,10 +294,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -309,10 +294,7 @@ static void RunIntf( intf_thread_t *p_intf )
vlc_value_t val, list, list2; vlc_value_t val, list, list2;
int i_count, i; int i_count, i;
p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf );
if( !p_input ) if( !p_input )
break; break;
...@@ -352,10 +334,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -352,10 +334,7 @@ static void RunIntf( intf_thread_t *p_intf )
vlc_value_t val, list, list2; vlc_value_t val, list, list2;
int i_count, i; int i_count, i;
p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf );
if( !p_input ) if( !p_input )
break; break;
...@@ -417,6 +396,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -417,6 +396,7 @@ static void RunIntf( intf_thread_t *p_intf )
p_sys->i_num_gestures = 0; p_sys->i_num_gestures = 0;
p_sys->i_pattern = 0; p_sys->i_pattern = 0;
p_sys->b_got_gesture = false; p_sys->b_got_gesture = false;
pl_Release( p_intf );
} }
/* /*
...@@ -434,7 +414,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -434,7 +414,7 @@ static void RunIntf( intf_thread_t *p_intf )
if( p_sys->p_vout == NULL ) if( p_sys->p_vout == NULL )
{ {
p_playlist = pl_Hold( p_intf ); playlist_t *p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist ); p_input = playlist_CurrentInput( p_playlist );
pl_Release( p_intf ); pl_Release( p_intf );
if( p_input ) if( p_input )
......
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