use slightly different method for updating progress display in ffmsindex.exe, might make some GUI makers happy

Originally committed to SVN as r2467.
This commit is contained in:
Karl Blomster 2008-11-20 19:31:22 +00:00
parent 671a788abc
commit 95bccb4e1e

View file

@ -120,12 +120,12 @@ static int FFMS_CC UpdateProgress(int State, int64_t Current, int64_t Total, voi
*LastPercentage = Percentage; *LastPercentage = Percentage;
if (Percentage < 10) /*if (Percentage < 10)
cout << "\b\b"; cout << "\b\b";
else else
cout << "\b\b\b"; cout << "\b\b\b"; */
cout << Percentage << "%"; cout << "Indexing, please wait... " << Percentage << "% \r";
return 0; return 0;
} }
@ -138,16 +138,16 @@ void DoIndexing () {
Index = FFMS_ReadIndex(CacheFile.c_str(), FFMSErrMsg, MsgSize); Index = FFMS_ReadIndex(CacheFile.c_str(), FFMSErrMsg, MsgSize);
if (Overwrite || Index == NULL) { if (Overwrite || Index == NULL) {
std::cout << "Indexing, please wait... 0%"; std::cout << "Indexing, please wait... 0% \r";
Index = FFMS_MakeIndex(InputFile.c_str(), TrackMask, DumpMask, AudioFile.c_str(), IgnoreErrors, UpdateProgress, &Progress, FFMSErrMsg, MsgSize); Index = FFMS_MakeIndex(InputFile.c_str(), TrackMask, DumpMask, AudioFile.c_str(), IgnoreErrors, UpdateProgress, &Progress, FFMSErrMsg, MsgSize);
if (Index == NULL) { if (Index == NULL) {
std::string Err = "Indexing error: "; std::string Err = "\nIndexing error: ";
Err.append(FFMSErrMsg); Err.append(FFMSErrMsg);
throw Err; throw Err;
} }
if (Progress != 100) if (Progress != 100)
std::cout << "\b\b\b100%"; std::cout << "Indexing, please wait... 100% \r";
std::cout << std::endl << "Writing index... "; std::cout << std::endl << "Writing index... ";