[vlc-commits] qt: fix recent input item usage

Rémi Denis-Courmont git at videolan.org
Mon Mar 9 17:50:57 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar  9 18:46:00 2015 +0200| [7bd17ef11da115c95318bc0489f8acee8fc1354b] | committer: Rémi Denis-Courmont

qt: fix recent input item usage

 - Fix encoding (fixes #14123)
 - Fix data race on URI
 - Avoid useless variable retrievals
 - Avoid upcasting to double precision

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

 modules/gui/qt4/input_manager.cpp |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index c7f4de7..7338d59 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -132,7 +132,7 @@ void InputManager::setInput( input_thread_t *_p_input )
         /* Get Saved Time */
         if( p_item->i_type == ITEM_TYPE_FILE )
         {
-            int i_time = RecentsMRL::getInstance( p_intf )->time( p_item->psz_uri );
+            int i_time = RecentsMRL::getInstance( p_intf )->time( qfu(uri) );
             if( i_time > 0 && qfu( uri ) != lastURI &&
                     !var_GetFloat( p_input, "run-time" ) &&
                     !var_GetFloat( p_input, "start-time" ) &&
@@ -164,13 +164,18 @@ void InputManager::delInput()
     msg_Dbg( p_intf, "IM: Deleting the input" );
 
     /* Save time / position */
-    float f_pos = var_GetFloat( p_input , "position" );
-    int64_t i_time = var_GetTime( p_input, "time");
-    int i_length = var_GetTime( p_input , "length" ) / CLOCK_FREQ;
-    if( f_pos < 0.05 || f_pos > 0.95 || i_length < 60) {
-        i_time = -1;
+    char *uri = input_item_GetURI( p_item );
+    if( uri != NULL ) {
+        float f_pos = var_GetFloat( p_input , "position" );
+        int64_t i_time = -1;
+
+        if( f_pos >= 0.05f && f_pos <= 0.95f
+         && var_GetTime( p_input, "length" ) >= 60 * CLOCK_FREQ )
+            i_time = var_GetTime( p_input, "time");
+
+        RecentsMRL::getInstance( p_intf )->setTime( qfu(uri), i_time );
+        free(uri);
     }
-    RecentsMRL::getInstance( p_intf )->setTime( p_item->psz_uri, i_time );
 
     delCallbacks();
     i_old_playing_status = END_S;



More information about the vlc-commits mailing list