Skip to content

Commit

Permalink
Merge pull request #50 from random-patch-method/fix-audio-progress
Browse files Browse the repository at this point in the history
Fix audio indexing progress message shown as VideoSource
  • Loading branch information
myrsloik authored Apr 25, 2024
2 parents 4d0d83f + 926ec77 commit 11cdf8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vapoursynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,11 @@ static void VS_CC CreateBestAudioSource(const VSMap *In, VSMap *Out, void *, VSC
[vsapi, Core, &NextUpdate, &LastValue](int Track, int64_t Cur, int64_t Total) {
if (NextUpdate < std::chrono::high_resolution_clock::now()) {
if (Total == INT64_MAX && Cur == Total) {
vsapi->logMessage(mtInformation, ("VideoSource track #" + std::to_string(Track) + " indexing complete").c_str(), Core);
vsapi->logMessage(mtInformation, ("AudioSource track #" + std::to_string(Track) + " indexing complete").c_str(), Core);
} else {
int PValue = (Total > 0) ? static_cast<int>((static_cast<double>(Cur) / static_cast<double>(Total)) * 100) : static_cast<int>(Cur / (1024 * 1024));
if (PValue != LastValue) {
vsapi->logMessage(mtInformation, ("VideoSource track #" + std::to_string(Track) + " index progress " + std::to_string(PValue) + ((Total > 0) ? "%" : "MB")).c_str(), Core);
vsapi->logMessage(mtInformation, ("AudioSource track #" + std::to_string(Track) + " index progress " + std::to_string(PValue) + ((Total > 0) ? "%" : "MB")).c_str(), Core);
LastValue = PValue;
NextUpdate = std::chrono::high_resolution_clock::now() + std::chrono::seconds(1);
}
Expand Down

0 comments on commit 11cdf8c

Please sign in to comment.