]> git.sesse.net Git - nageru/commitdiff
When previewing the playlist time, use compute_time_left().
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 16 Dec 2018 21:44:49 +0000 (22:44 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 16 Dec 2018 21:44:58 +0000 (22:44 +0100)
Less code duplication, and also fixes an issue where the fade time
would not be counted correctly.

futatabi/mainwindow.cpp

index 8d52c06d022bfdf78349ebc29b056b609b001f13..68b29e4be57127b97b3bd058f335ebbfecdf9d11 100644 (file)
@@ -793,11 +793,11 @@ void MainWindow::playlist_selection_changed()
        if (!any_selected) {
                set_output_status("paused");
        } else {
-               double remaining = 0.0;
-               for (int row = selected->selectedRows().front().row(); row < int(playlist_clips->size()); ++row) {
-                       const Clip clip = *playlist_clips->clip(row);
-                       remaining += double(clip.pts_out - clip.pts_in) / TIMEBASE / 0.5;  // FIXME: stop hardcoding speed.
+               vector<Clip> clips;
+               for (size_t row = 0; row < playlist_clips->size(); ++row) {
+                       clips.push_back(*playlist_clips->clip(row));
                }
+               double remaining = compute_time_left(clips, {{selected->selectedRows().front().row(), 0.0}});
                set_output_status(format_duration(remaining) + " ready");
        }
 }