Commit 612bcfc8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: add (proper) playlist_Pause() and playlist_Resume()

Those two functions have no effects if the playlist is stopped.
Otherwise they force the playlist to playing ("running") or paused
state respectively.

As a reminder, the existing playlist_Play() forces the playlist into
running state (unless it is empty), and playlist_Stop() forces the
playlist into stopped state (unless the input thread refuses to die).
There are no functions to force the playlist to paused state.
parent 3decf123
......@@ -261,6 +261,8 @@ enum {
PLAYLIST_TOGGLE_PAUSE, /**< No arg res=can fail */
PLAYLIST_STOP, /**< No arg res=can fail*/
PLAYLIST_SKIP, /**< arg1=int, res=can fail*/
PLAYLIST_PAUSE, /**< No arg */
PLAYLIST_RESUME, /**< No arg */
};
#define playlist_Play(p) playlist_Control(p,PLAYLIST_PLAY, pl_Unlocked )
......@@ -270,6 +272,10 @@ enum {
#define playlist_Next(p) playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, 1)
#define playlist_Prev(p) playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, -1)
#define playlist_Skip(p,i) playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, (i) )
#define playlist_Pause(p) \
playlist_Control(p, PLAYLIST_PAUSE, pl_Unlocked)
#define playlist_Resume(p) \
playlist_Control(p, PLAYLIST_RESUME, pl_Unlocked)
VLC_API void playlist_Lock( playlist_t * );
VLC_API void playlist_Unlock( playlist_t * );
......
......@@ -119,6 +119,18 @@ static void playlist_vaControl( playlist_t *p_playlist, int i_query, va_list arg
pl_priv(p_playlist)->request.i_skip = (int) va_arg( args, int );
pl_priv(p_playlist)->request.b_request = true;
break;
case PLAYLIST_PAUSE:
if( pl_priv(p_playlist)->p_input == NULL )
return;
var_SetInteger( pl_priv(p_playlist)->p_input, "state", PAUSE_S );
break;
case PLAYLIST_RESUME:
if( pl_priv(p_playlist)->p_input == NULL )
return;
var_SetInteger( pl_priv(p_playlist)->p_input, "state", PLAYING_S );
break;
}
vlc_cond_signal( &pl_priv(p_playlist)->signal );
}
......
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