[vlc-commits] Qt: don't try to resume playback on the same input file

Ludovic Fauvet git at videolan.org
Mon Jan 26 19:50:28 CET 2015


vlc/vlc-2.2 | branch: master | Ludovic Fauvet <etix at videolan.org> | Mon Jan 26 19:42:59 2015 +0100| [07341fa8b64d17463c87bb5868a2b3d4edb1e3e8] | committer: Jean-Baptiste Kempf

Qt: don't try to resume playback on the same input file

Close #11704

(cherry picked from commit 1d81d4854e3ad7e78852fd0fb953923bc780c895)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt4/input_manager.cpp |   10 +++++++++-
 modules/gui/qt4/input_manager.hpp |    1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index dbc317a..d260fe0 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -127,11 +127,13 @@ 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 )
         {
             int i_time = RecentsMRL::getInstance( p_intf )->time( p_item->psz_uri );
-            if( i_time > 0 &&
+            if( i_time > 0 && qfu( uri ) != lastURI &&
                     !var_GetFloat( p_input, "run-time" ) &&
                     !var_GetFloat( p_input, "start-time" ) &&
                     !var_GetFloat( p_input, "stop-time" ) )
@@ -139,6 +141,11 @@ void InputManager::setInput( input_thread_t *_p_input )
                 emit resumePlayback( (int64_t)i_time * 1000 );
             }
         }
+
+        // Save the latest URI to avoid asking to restore the
+        // position on the same input file.
+        lastURI = qfu( uri );
+        free( uri );
     }
     else
     {
@@ -1097,6 +1104,7 @@ void MainInputManager::customEvent( QEvent *event )
 void MainInputManager::stop()
 {
    playlist_Stop( THEPL );
+   getIM()->lastURI.clear();
 }
 
 void MainInputManager::next()
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index e6cc0ed..b69b6f9 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -154,6 +154,7 @@ private:
     input_item_t   *p_item;
     int             i_old_playing_status;
     QString         oldName;
+    QString         lastURI;
     QString         artUrl;
     float           f_rate;
     float           f_cache;



More information about the vlc-commits mailing list