]> git.sesse.net Git - vlc/commitdiff
qt: fix recent input item usage
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 9 Mar 2015 16:46:00 +0000 (18:46 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 9 Mar 2015 16:47:17 +0000 (18:47 +0200)
 - Fix encoding (fixes #14123)
 - Fix data race on URI
 - Avoid useless variable retrievals
 - Avoid upcasting to double precision

modules/gui/qt4/input_manager.cpp

index c7f4de70f6ee75691668570f693792ddd8c49e73..7338d59e00ff2d5a053a4f830338afb67c2cfae6 100644 (file)
@@ -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;