forked from mia/Aegisub
Update FFMSIndex to work with the new audio dump method.
Also update ffms2.lib (again). Originally committed to SVN as r2985.
This commit is contained in:
parent
9fe7b04830
commit
50069248e9
2 changed files with 23 additions and 4 deletions
|
@ -22,6 +22,10 @@ extern "C" {
|
||||||
#include <libavutil/log.h>
|
#include <libavutil/log.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <objbase.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -112,9 +116,7 @@ void ParseCMDLine (int argc, char *argv[]) {
|
||||||
CacheFile = InputFile;
|
CacheFile = InputFile;
|
||||||
CacheFile.append(".ffindex");
|
CacheFile.append(".ffindex");
|
||||||
}
|
}
|
||||||
if (AudioFile.empty()) {
|
AudioFile.append("%s.%d2.w64");
|
||||||
AudioFile = InputFile;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,6 +141,15 @@ static int FFMS_CC UpdateProgress(int64_t Current, int64_t Total, void *Private)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int FFMS_CC GenAudioFilename(const char *SourceFile, int Track, const TAudioProperties *AP, char *FileName, void *Private) {
|
||||||
|
const char * FormatString = AudioFile.c_str();
|
||||||
|
if (FileName == NULL)
|
||||||
|
return _snprintf(NULL, 0, FormatString, SourceFile, Track) + 1;
|
||||||
|
else
|
||||||
|
return _snprintf(FileName, 999999, FormatString, SourceFile, Track) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DoIndexing () {
|
void DoIndexing () {
|
||||||
char FFMSErrMsg[1024];
|
char FFMSErrMsg[1024];
|
||||||
int MsgSize = sizeof(FFMSErrMsg);
|
int MsgSize = sizeof(FFMSErrMsg);
|
||||||
|
@ -147,7 +158,7 @@ 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% \r" << std::flush;
|
std::cout << "Indexing, please wait... 0% \r" << std::flush;
|
||||||
Index = FFMS_MakeIndex(InputFile.c_str(), TrackMask, DumpMask, AudioFile.c_str(), IgnoreErrors, UpdateProgress, &Progress, FFMSErrMsg, MsgSize);
|
Index = FFMS_MakeIndex(InputFile.c_str(), TrackMask, DumpMask, &GenAudioFilename, NULL, IgnoreErrors, UpdateProgress, &Progress, FFMSErrMsg, MsgSize);
|
||||||
if (Index == NULL) {
|
if (Index == NULL) {
|
||||||
std::string Err = "\nIndexing error: ";
|
std::string Err = "\nIndexing error: ";
|
||||||
Err.append(FFMSErrMsg);
|
Err.append(FFMSErrMsg);
|
||||||
|
@ -186,6 +197,13 @@ int main(int argc, char *argv[]) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (!SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) {
|
||||||
|
std::cout << "COM initialization failure" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
FFMS_Init();
|
FFMS_Init();
|
||||||
|
|
||||||
if (Verbose)
|
if (Verbose)
|
||||||
|
@ -208,5 +226,6 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FFMS_DestroyFFIndex(Index);
|
FFMS_DestroyFFIndex(Index);
|
||||||
|
CoUninitialize();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue