L-SMASH-Works
L-SMASH-Works copied to clipboard
feature request: write progress to stdout while indexing
It would be a valuable feature if L-SMASH-Works would print progress to stdout.
I've asked DG how he does it in DGIndexNV, his answer:
void OutputProgress(int progr)
{
static int lastprogress = -1;
if (progr != lastprogress)
{
char percent[20];
DWORD written;
sprintf(percent, "%d\r", progr);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), percent, (DWORD) strlen(percent), &written, NULL);
lastprogress = progr;
}
}
This is important too for an implementer:
"Every 30 frames, this function is called to write to stdout"
and
progr is an int 0-100 indicating the percent completed. The caller determines the percent complete from the ratio of the current file position and the size of the file. That way you don't need to know the number of frames in the file.