mirror of https://github.com/odrling/Aegisub
Update indexing progress less often
wxTheApp->QueueEvent is sufficiently slow that updating the progress could sometimes take longer than the actual indexing.
This commit is contained in:
parent
a28aafcdab
commit
382708132c
|
@ -103,13 +103,19 @@ FFMS_Index *FFmpegSourceProvider::DoIndexing(FFMS_Indexer *Indexer, agi::fs::pat
|
|||
// index all audio tracks
|
||||
FFMS_Index *Index;
|
||||
Progress.Run([&](agi::ProgressSink *ps) {
|
||||
struct progress {
|
||||
agi::ProgressSink *ps;
|
||||
int calls;
|
||||
};
|
||||
progress state = { ps, 0 };
|
||||
Index = FFMS_DoIndexing(Indexer, Trackmask, FFMS_TRACKMASK_NONE, nullptr, nullptr, IndexEH,
|
||||
static_cast<TIndexCallback>([](int64_t Current, int64_t Total, void *Private) -> int {
|
||||
agi::ProgressSink *ps = static_cast<agi::ProgressSink*>(Private);
|
||||
ps->SetProgress(Current, Total);
|
||||
return ps->IsCancelled();
|
||||
auto state = static_cast<progress *>(Private);
|
||||
if (++state->calls % 10 == 0)
|
||||
state->ps->SetProgress(Current, Total);
|
||||
return state->ps->IsCancelled();
|
||||
}),
|
||||
ps, &ErrInfo);
|
||||
&state, &ErrInfo);
|
||||
});
|
||||
|
||||
if (Index == nullptr) {
|
||||
|
|
Loading…
Reference in New Issue