X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fmainwindow.cpp;h=154537c7c4c05791c8532d8f35eb29536d3a46a2;hb=0403c737e76f127d046fcdf9eec7b2e3258833d8;hp=346c6f684446bb179c64ec784c089c019aab9040;hpb=c6fb9649d9f9c2e2cf3d1ac16c6c359630fe72bf;p=nageru diff --git a/futatabi/mainwindow.cpp b/futatabi/mainwindow.cpp index 346c6f6..154537c 100644 --- a/futatabi/mainwindow.cpp +++ b/futatabi/mainwindow.cpp @@ -431,6 +431,14 @@ void MainWindow::defer_timer_expired() void MainWindow::content_changed() { + // If we are playing, update the part of the playlist that's not playing yet. + vector clips; + for (unsigned row = 0; row < playlist_clips->size(); ++row) { + clips.emplace_back(*playlist_clips->clip_with_id(row)); + } + live_player->splice_play(clips); + + // Serialize the state. if (defer_timeout->isActive() && (!currently_deferring_model_changes || deferred_change_id != current_change_id)) { // There's some deferred event waiting, but this event is unrelated. @@ -493,6 +501,7 @@ void MainWindow::play_clicked() } live_player->play(clips); playlist_clips->set_progress({ { start_row, 0.0f } }); + ui->playlist->selectionModel()->clear(); playlist_selection_changed(); ui->stop_btn->setEnabled(true); @@ -505,30 +514,16 @@ void MainWindow::stop_clicked() fake_clip.pts_out = 0; playlist_clips->set_progress({}); live_player->play(fake_clip); + ui->stop_btn->setEnabled(false); } void MainWindow::live_player_done() { - set_output_status("paused"); + playlist_selection_changed(); playlist_clips->set_progress({}); ui->stop_btn->setEnabled(false); } -static string format_duration(double t) -{ - int t_ms = lrint(t * 1e3); - - int ms = t_ms % 1000; - t_ms /= 1000; - int s = t_ms % 60; - t_ms /= 60; - int m = t_ms; - - char buf[256]; - snprintf(buf, sizeof(buf), "%d:%02d.%03d", m, s, ms); - return buf; -} - void MainWindow::live_player_clip_progress(const map &progress, double time_remaining) { playlist_clips->set_progress(progress); @@ -1026,6 +1021,9 @@ void MainWindow::highlight_camera_input(int stream_idx) void MainWindow::set_output_status(const string &status) { ui->live_label->setText(QString::fromStdString("Current output (" + status + ")")); + if (live_player != nullptr) { + live_player->set_pause_status(status); + } lock_guard lock(queue_status_mu); queue_status = status;