[vlc-commits] qt4: Fix "resume where you left off"

Hugo Beauzée-Luyssen git at videolan.org
Thu Feb 18 18:19:12 CET 2016


vlc/vlc-2.2 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Feb 16 17:20:03 2016 +0100| [f44922c97b20d1978623766b15a73675777f5323] | committer: Hugo Beauzée-Luyssen

qt4: Fix "resume where you left off"

fix #16593

(cherry picked from commit 60399fdf58f7ad61c6e561e0f81cb736cb5413b0)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/gui/qt4/input_manager.cpp |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 707f114..6734bfd 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -127,11 +127,11 @@ void InputManager::setInput( input_thread_t *_p_input )
         p_item = input_GetItem( p_input );
         emit rateChanged( var_GetFloat( p_input, "rate" ) );
 
-        char *uri = input_item_GetURI( p_item );
-
         /* Get Saved Time */
         if( p_item->i_type == ITEM_TYPE_FILE )
         {
+            char *uri = input_item_GetURI( p_item );
+
             int i_time = RecentsMRL::getInstance( p_intf )->time( qfu(uri) );
             if( i_time > 0 && qfu( uri ) != lastURI &&
                     !var_GetFloat( p_input, "run-time" ) &&
@@ -140,20 +140,19 @@ void InputManager::setInput( input_thread_t *_p_input )
             {
                 emit resumePlayback( (int64_t)i_time * 1000 );
             }
+            playlist_Lock( THEPL );
+            // Add root items only
+            playlist_item_t* p_node = playlist_CurrentPlayingItem( THEPL );
+            if ( p_node != NULL && ( p_node->p_parent == NULL || p_node->i_children == -1 ) )
+            {
+                // Save the latest URI to avoid asking to restore the
+                // position on the same input file.
+                lastURI = qfu( uri );
+                RecentsMRL::getInstance( p_intf )->addRecent( lastURI );
+            }
+            playlist_Unlock( THEPL );
+            free( uri );
         }
-
-        playlist_Lock( THEPL );
-        // Add root items only
-        playlist_item_t* p_node = playlist_CurrentPlayingItem( THEPL );
-        if ( p_node != NULL && p_node->p_parent == NULL )
-        {
-            // Save the latest URI to avoid asking to restore the
-            // position on the same input file.
-            lastURI = qfu( uri );
-            RecentsMRL::getInstance( p_intf )->addRecent( lastURI );
-        }
-        playlist_Unlock( THEPL );
-        free( uri );
     }
     else
     {



More information about the vlc-commits mailing list