From d399e440613e7f323af91fad0958ba213bb5450d Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Mon, 13 Feb 2023 17:05:05 +0100 Subject: [PATCH] bestsource: Always get exact duration Fixes arch1t3cht/Aegisub#27. --- src/video_provider_bestsource.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/video_provider_bestsource.cpp b/src/video_provider_bestsource.cpp index e3859680b..3853d2d73 100644 --- a/src/video_provider_bestsource.cpp +++ b/src/video_provider_bestsource.cpp @@ -84,7 +84,6 @@ public: std::string colormatrix_description(const AVFrame *frame) { // Assuming TV for unspecified std::string str = frame->color_range == AVCOL_RANGE_JPEG ? "PC" : "TV"; - LOG_D("bestsource") << frame->colorspace; switch (frame->colorspace) { case AVCOL_SPC_BT709: @@ -114,21 +113,16 @@ BSVideoProvider::BSVideoProvider(agi::fs::path const& filename, std::string cons has_audio = false; } + br->Run([&](agi::ProgressSink *ps) { + ps->SetTitle(from_wx(_("Exacting"))); + ps->SetMessage(from_wx(_("Creating cache... This can take a while!"))); + ps->SetIndeterminate(); + if (bs.GetExactDuration()) { + LOG_D("provider/video/bestsource") << "File cached and has exact samples."; + } + }); properties = bs.GetVideoProperties(); - if (properties.NumFrames == -1) { - LOG_D("bs") << "File not cached or varying samples, creating cache."; - br->Run([&](agi::ProgressSink *ps) { - ps->SetTitle(from_wx(_("Exacting"))); - ps->SetMessage(from_wx(_("Creating cache... This can take a while!"))); - ps->SetIndeterminate(); - if (bs.GetExactDuration()) { - LOG_D("bs") << "File cached and has exact samples."; - } - }); - properties = bs.GetVideoProperties(); - } - br->Run([&](agi::ProgressSink *ps) { ps->SetTitle(from_wx(_("Scanning"))); ps->SetMessage(from_wx(_("Finding Keyframes and Timecodes...")));