[vlc-commits] playlist: automatically resume from pause when uncorked

Rémi Denis-Courmont git at videolan.org
Sat May 16 10:55:45 CEST 2015


vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 15 19:24:25 2014 +0200| [5e840db932a0022e662b5042327dacf303304c79] | committer: Rémi Denis-Courmont

playlist: automatically resume from pause when uncorked

(derived from commit ab500430e6dfd02ae4e19ecb9a3d76f3f9486522)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=5e840db932a0022e662b5042327dacf303304c79
---

 src/playlist/engine.c |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index ebb46dc..af2637c 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -83,18 +83,20 @@ static int CorksCallback( vlc_object_t *obj, char const *var,
     if( !old.i_int == !cur.i_int )
         return VLC_SUCCESS; /* nothing to do */
 
-    if( cur.i_int )
-    {
-        if( var_InheritBool( obj, "playlist-cork" ) )
-        {
-            msg_Dbg( obj, "corked" );
-            playlist_Pause( pl );
-        }
-        else
-            msg_Dbg( obj, "not corked" );
-    }
-    else
-        msg_Dbg( obj, "uncorked" );
+    if( !var_InheritBool( obj, "playlist-cork" ) )
+        return VLC_SUCCESS;
+
+    input_thread_t *input = playlist_CurrentInput(pl);
+    if( input == NULL )
+        return VLC_SUCCESS;
+
+    bool playing = var_GetInteger(input, "state") == PLAYING_S;
+    vlc_object_release(input);
+    if( playing == !cur.i_int )
+        return VLC_SUCCESS;
+
+    msg_Dbg( obj, "%scorked", cur.i_int ? "" : "un" );
+    playlist_Pause( pl );
 
     (void) var; (void) dummy;
     return VLC_SUCCESS;



More information about the vlc-commits mailing list