mirror of https://github.com/odrling/Aegisub
update ffmsindex with new API functionality
Originally committed to SVN as r2390.
This commit is contained in:
parent
770e581ca7
commit
a1e144cbfe
|
@ -25,7 +25,9 @@
|
||||||
#include "ffms.h"
|
#include "ffms.h"
|
||||||
|
|
||||||
int TrackMask;
|
int TrackMask;
|
||||||
|
int DumpMask;
|
||||||
bool Overwrite;
|
bool Overwrite;
|
||||||
|
bool IgnoreErrors;
|
||||||
std::string InputFile;
|
std::string InputFile;
|
||||||
std::string CacheFile;
|
std::string CacheFile;
|
||||||
std::string AudioFile;
|
std::string AudioFile;
|
||||||
|
@ -39,11 +41,14 @@ void PrintUsage () {
|
||||||
<< "Usage: ffmsindex [options] inputfile [outputfile]" << endl
|
<< "Usage: ffmsindex [options] inputfile [outputfile]" << endl
|
||||||
<< "If no output filename is specified, inputfile.ffindex will be used." << endl << endl
|
<< "If no output filename is specified, inputfile.ffindex will be used." << endl << endl
|
||||||
<< "Options:" << endl
|
<< "Options:" << endl
|
||||||
<< "-f Overwrite existing index file if it exists (default: no)" << endl
|
<< "-f Force overwriting of existing index file, if any (default: no)" << endl
|
||||||
<< "-t N Set the audio trackmask to N (-1 means decode all tracks, 0 means decode none; default: 0)" << endl
|
<< "-s Silently skip indexing of audio tracks that cannot be read (default: no)" << endl
|
||||||
|
<< "-t N Set the audio indexing mask to N (-1 means index all tracks, 0 means index none, default: 0)" << endl
|
||||||
|
<< "-d N Set the audio decoding mask to N (mask syntax same as -t, default: 0)" << endl
|
||||||
<< "-a NAME Set the audio output base filename to NAME (default: input filename)";
|
<< "-a NAME Set the audio output base filename to NAME (default: input filename)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ParseCMDLine (int argc, char *argv[]) {
|
void ParseCMDLine (int argc, char *argv[]) {
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
PrintUsage();
|
PrintUsage();
|
||||||
|
@ -55,7 +60,9 @@ void ParseCMDLine (int argc, char *argv[]) {
|
||||||
CacheFile = "";
|
CacheFile = "";
|
||||||
AudioFile = "";
|
AudioFile = "";
|
||||||
TrackMask = 0;
|
TrackMask = 0;
|
||||||
|
DumpMask = 0;
|
||||||
Overwrite = false;
|
Overwrite = false;
|
||||||
|
IgnoreErrors = false;
|
||||||
|
|
||||||
// argv[0] = name of program
|
// argv[0] = name of program
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
@ -68,9 +75,14 @@ void ParseCMDLine (int argc, char *argv[]) {
|
||||||
|
|
||||||
if (!Option.compare("-f")) {
|
if (!Option.compare("-f")) {
|
||||||
Overwrite = true;
|
Overwrite = true;
|
||||||
|
} else if (!Option.compare("-s")) {
|
||||||
|
IgnoreErrors = true;
|
||||||
} else if (!Option.compare("-t")) {
|
} else if (!Option.compare("-t")) {
|
||||||
TrackMask = atoi(OptionArg.c_str());
|
TrackMask = atoi(OptionArg.c_str());
|
||||||
i++;
|
i++;
|
||||||
|
} else if (!Option.compare("-d")) {
|
||||||
|
DumpMask = atoi(OptionArg.c_str());
|
||||||
|
i++;
|
||||||
} else if (!Option.compare("-a")) {
|
} else if (!Option.compare("-a")) {
|
||||||
AudioFile = OptionArg;
|
AudioFile = OptionArg;
|
||||||
i++;
|
i++;
|
||||||
|
@ -127,7 +139,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%";
|
std::cout << "Indexing, please wait... 0%";
|
||||||
Index = FFMS_MakeIndex(InputFile.c_str(), TrackMask, AudioFile.c_str(), 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 = "Indexing error: ";
|
||||||
Err.append(FFMSErrMsg);
|
Err.append(FFMSErrMsg);
|
||||||
|
@ -174,6 +186,10 @@ int main(int argc, char *argv[]) {
|
||||||
std::cout << Error << std::endl;
|
std::cout << Error << std::endl;
|
||||||
FFMS_DestroyFrameIndex(Index);
|
FFMS_DestroyFrameIndex(Index);
|
||||||
return 1;
|
return 1;
|
||||||
|
} catch (std::string Error) {
|
||||||
|
std::cout << std::endl << Error << std::endl;
|
||||||
|
FFMS_DestroyFrameIndex(Index);
|
||||||
|
return 1;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
std::cout << std::endl << "Unknown error" << std::endl;
|
std::cout << std::endl << "Unknown error" << std::endl;
|
||||||
FFMS_DestroyFrameIndex(Index);
|
FFMS_DestroyFrameIndex(Index);
|
||||||
|
|
Loading…
Reference in New Issue