]> git.sesse.net Git - vlc/commitdiff
playlist: add (proper) playlist_Pause() and playlist_Resume()
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 15 Dec 2014 17:07:24 +0000 (19:07 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 15 Dec 2014 17:14:29 +0000 (19:14 +0200)
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.

include/vlc_playlist.h
src/playlist/control.c

index f7bd863f1376b93e3cab3ae25a8dab185176bcb6..947b2c613bd2bb15d5283e6d5cb416d6f47ada49 100644 (file)
@@ -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 * );
index e3c3e3a4f18a3a2813d1798cf8ec49c762edc193..d1ac9d0931138d0454daf7eebe49a18beb17abe6 100644 (file)
@@ -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 );
 }