X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fexport.cpp;h=d513cf0dacf5a6f6f74ff9cbe14ffde737cee615;hb=9966c32542c522588e3aee2e8089f42ec485e06f;hp=1aea044c224162398debf7fd6ae67aa4480871ff;hpb=4d7015171fbd6c36c480d1d7992b76bbb45410c5;p=nageru diff --git a/futatabi/export.cpp b/futatabi/export.cpp index 1aea044..d513cf0 100644 --- a/futatabi/export.cpp +++ b/futatabi/export.cpp @@ -223,27 +223,24 @@ void export_interpolated_clip(const string &filename, const vector &clips) progress.setMaximum(100000); progress.setValue(0); - vector clips_with_row; + vector clips_with_id; for (const Clip &clip : clips) { - clips_with_row.emplace_back(Player::ClipWithRow{ clip, 0 }); + clips_with_id.emplace_back(ClipWithID{ clip, 0 }); } - double total_length = compute_total_time(clips_with_row); + double total_length = compute_total_time(clips_with_id); promise done_promise; future done = done_promise.get_future(); std::atomic current_value{ 0.0 }; - size_t clip_idx = 0; Player player(/*destination=*/nullptr, Player::FILE_STREAM_OUTPUT, closer.release()); - player.set_done_callback([&done_promise, &clip_idx, &clips] { - if (clip_idx >= clips.size()) { - done_promise.set_value(); - } + player.set_done_callback([&done_promise] { + done_promise.set_value(); }); - player.set_progress_callback([¤t_value, &clips, total_length](const std::map &player_progress, double time_remaining) { + player.set_progress_callback([¤t_value, total_length](const std::map &player_progress, double time_remaining) { current_value = 1.0 - time_remaining / total_length; }); - player.play(clips_with_row); + player.play(clips_with_id); while (done.wait_for(std::chrono::milliseconds(100)) != future_status::ready && !progress.wasCanceled()) { progress.setValue(lrint(100000.0 * current_value)); }