X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fexport.cpp;h=5b8da136370a7dd8b649bce379e436daa7e8b176;hb=33b86069c755119da2a35af63fbd580ca9abfa7c;hp=50fc950bbd2fa8ead59a365c28375b9be66ac278;hpb=c6fb9649d9f9c2e2cf3d1ac16c6c359630fe72bf;p=nageru diff --git a/futatabi/export.cpp b/futatabi/export.cpp index 50fc950..5b8da13 100644 --- a/futatabi/export.cpp +++ b/futatabi/export.cpp @@ -104,7 +104,7 @@ void export_multitrack_clip(const string &filename, const Clip &clip) AVStream *avstream_video = avformat_new_stream(avctx, nullptr); if (avstream_video == nullptr) { fprintf(stderr, "avformat_new_stream() failed\n"); - exit(1); + abort(); } avstream_video->time_base = AVRational{ 1, TIMEBASE }; avstream_video->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; @@ -227,7 +227,7 @@ void export_interpolated_clip(const string &filename, const vector &clips) for (const Clip &clip : clips) { clips_with_id.emplace_back(ClipWithID{ clip, 0 }); } - double total_length = compute_total_time(clips_with_id); + TimeRemaining total_length = compute_total_time(clips_with_id); promise done_promise; future done = done_promise.get_future(); @@ -237,8 +237,8 @@ void export_interpolated_clip(const string &filename, const vector &clips) 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) { - current_value = 1.0 - time_remaining / total_length; + player.set_progress_callback([¤t_value, total_length](const std::map &player_progress, TimeRemaining time_remaining) { + current_value = 1.0 - time_remaining.t / total_length.t; // Nothing to do about the infinite clips. }); player.play(clips_with_id); while (done.wait_for(std::chrono::milliseconds(100)) != future_status::ready && !progress.wasCanceled()) {