Commit 07341fa8 authored by Ludovic Fauvet's avatar Ludovic Fauvet Committed by 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: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 15513a7e
...@@ -127,11 +127,13 @@ void InputManager::setInput( input_thread_t *_p_input ) ...@@ -127,11 +127,13 @@ void InputManager::setInput( input_thread_t *_p_input )
p_item = input_GetItem( p_input ); p_item = input_GetItem( p_input );
emit rateChanged( var_GetFloat( p_input, "rate" ) ); emit rateChanged( var_GetFloat( p_input, "rate" ) );
char *uri = input_item_GetURI( p_item );
/* Get Saved Time */ /* Get Saved Time */
if( p_item->i_type == ITEM_TYPE_FILE ) 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( 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, "run-time" ) &&
!var_GetFloat( p_input, "start-time" ) && !var_GetFloat( p_input, "start-time" ) &&
!var_GetFloat( p_input, "stop-time" ) ) !var_GetFloat( p_input, "stop-time" ) )
...@@ -139,6 +141,11 @@ void InputManager::setInput( input_thread_t *_p_input ) ...@@ -139,6 +141,11 @@ void InputManager::setInput( input_thread_t *_p_input )
emit resumePlayback( (int64_t)i_time * 1000 ); 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 else
{ {
...@@ -1097,6 +1104,7 @@ void MainInputManager::customEvent( QEvent *event ) ...@@ -1097,6 +1104,7 @@ void MainInputManager::customEvent( QEvent *event )
void MainInputManager::stop() void MainInputManager::stop()
{ {
playlist_Stop( THEPL ); playlist_Stop( THEPL );
getIM()->lastURI.clear();
} }
void MainInputManager::next() void MainInputManager::next()
......
...@@ -154,6 +154,7 @@ private: ...@@ -154,6 +154,7 @@ private:
input_item_t *p_item; input_item_t *p_item;
int i_old_playing_status; int i_old_playing_status;
QString oldName; QString oldName;
QString lastURI;
QString artUrl; QString artUrl;
float f_rate; float f_rate;
float f_cache; float f_cache;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment