[vlc-commits] playlist: add (proper) playlist_Pause() and playlist_Resume()
Rémi Denis-Courmont
git at videolan.org
Mon Dec 15 18:25:18 CET 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 15 19:07:24 2014 +0200| [612bcfc8841f716673c5009ebe14e7463fdc4464] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=612bcfc8841f716673c5009ebe14e7463fdc4464
---
include/vlc_playlist.h | 6 ++++++
src/playlist/control.c | 12 ++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index f7bd863..947b2c6 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -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 * );
diff --git a/src/playlist/control.c b/src/playlist/control.c
index e3c3e3a..d1ac9d0 100644
--- a/src/playlist/control.c
+++ b/src/playlist/control.c
@@ -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 );
}
More information about the vlc-commits
mailing list