From 50069248e907de4ee63183439de31ab88bbe6e32 Mon Sep 17 00:00:00 2001 From: Karl Blomster Date: Mon, 25 May 2009 15:50:31 +0000 Subject: [PATCH] Update FFMSIndex to work with the new audio dump method. Also update ffms2.lib (again). Originally committed to SVN as r2985. --- aegisub/FFmpegSource2/ffmsindex.cpp | 27 +++++++++++++++++++++++---- aegisub/lib/ffms2.lib | Bin 10608 -> 10414 bytes 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/aegisub/FFmpegSource2/ffmsindex.cpp b/aegisub/FFmpegSource2/ffmsindex.cpp index 779ae9f9a..e8f1268b8 100644 --- a/aegisub/FFmpegSource2/ffmsindex.cpp +++ b/aegisub/FFmpegSource2/ffmsindex.cpp @@ -22,6 +22,10 @@ extern "C" { #include } +#ifdef _WIN32 +#include +#endif + #include #include #include @@ -112,9 +116,7 @@ void ParseCMDLine (int argc, char *argv[]) { CacheFile = InputFile; CacheFile.append(".ffindex"); } - if (AudioFile.empty()) { - AudioFile = InputFile; - } + AudioFile.append("%s.%d2.w64"); } @@ -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 () { char FFMSErrMsg[1024]; int MsgSize = sizeof(FFMSErrMsg); @@ -147,7 +158,7 @@ void DoIndexing () { Index = FFMS_ReadIndex(CacheFile.c_str(), FFMSErrMsg, MsgSize); if (Overwrite || Index == NULL) { 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) { std::string Err = "\nIndexing error: "; Err.append(FFMSErrMsg); @@ -186,6 +197,13 @@ int main(int argc, char *argv[]) { return 1; } +#ifdef _WIN32 + if (!SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) { + std::cout << "COM initialization failure" << std::endl; + return 1; + } +#endif /* _WIN32 */ + FFMS_Init(); if (Verbose) @@ -208,5 +226,6 @@ int main(int argc, char *argv[]) { } FFMS_DestroyFFIndex(Index); + CoUninitialize(); return 0; } diff --git a/aegisub/lib/ffms2.lib b/aegisub/lib/ffms2.lib index 1337520dbde176b00af999a38120bfc5f063eb93..74f06afb510d968e9339046fb0e9547440a755fa 100644 GIT binary patch delta 1796 zcmZuxO=w(Y6g`t4Gnq-6F*EPI`Fr!;{7*(~(n&f*jWP;WkTka1MJd!ol!7INfFPxt zl&*>kwO$uevMH5NXc5dHb=5`+(v4YlDX}ihq6X|j0^J19_r7^EFVeutoB8fN=iYn1 zJMZcHKb-v99&9#_962hjq`BIdo}F>MzoiI(_kegEFy;aCGGJ|KJ*{Ck0fo|nMsb_@M1EGo zeaJk*Uf0N#0EP6vM&%+KC8}pMvZnwAC#7pkL(}d1p$9{v6{ zdh}bVXUz6qbfaHR^jqymV-NZ}BTv~$>!{u;cPTO->c`DH>34@htS@=1*$yRs4)xrT zM@DQ=CEOL;awKg26^MncSl`V%?X;EeG3q>#<>Z^)H1A+LaA3)6skq8Ik$U@J)~~4^ zt(!HQ?q!+Mmq`q(cIY_<#mTg~3LarZ#b^&+pgVFhoROb0Za1YKRbgHOhA<$pk)%|! zy{ISPi7SDytY+WnFrOAQlXrt*GJokaWW;tl(J8y`v3P5U$jA0fx1OiyxmT7&+mOfh z%YoQSg}B$QOWufT*BvzF!<;Y67l3@1OL#3GX38iFKN~E|?|#NNPTkY4%8xli{)mk+ z6p^!z`JBGSVlK;n)R&OSYS4eq=Ix#`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