MCPcopy Create free account
hub / github.com/FFMS/ffms2 / ParseCMDLine

Function ParseCMDLine

src/index/ffmsindex.cpp:138–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138void ParseCMDLine(int argc, const char *argv[]) {
139 for (int i = 1; i < argc; ++i) {
140 const char *Option = argv[i];
141#define OPTION_ARG(dst, flag, parse) try { dst = parse(i + 1 < argc ? argv[i+1] : throw Error("Error: missing argument for -" flag)); i++; } catch (std::logic_error &) { throw Error("Error: invalid argument specified for -" flag); }
142
143 if (!strcmp(Option, "-f")) {
144 Overwrite = true;
145 } else if (!strcmp(Option, "-v")) {
146 Verbose++;
147 } else if (!strcmp(Option, "-p")) {
148 PrintProgress = false;
149 } else if (!strcmp(Option, "-c")) {
150 WriteTC = true;
151 } else if (!strcmp(Option, "-k")) {
152 WriteKF = true;
153 } else if (!strcmp(Option, "-t")) {
154 OPTION_ARG(IndexMask, "t", std::stoll);
155 } else if (!strcmp(Option, "-s")) {
156 OPTION_ARG(IgnoreErrors, "s", std::stoi);
157 } else if (!strcmp(Option, "-u")) {
158 OPTION_ARG(ProgressInterval, "u", parseSecondsToMicroseconds);
159 } else if (!strcmp(Option, "-o")) {
160 OPTION_ARG(LAVFOpts, "o", parseDemuxerOpts);
161 } else if (!strcmp(Option, "--enable_drefs")) {
162 parseDemuxerOpts("enable_drefs=1");
163 } else if (!strcmp(Option, "--use_absolute_path")) {
164 parseDemuxerOpts("use_absolute_path=1");
165 } else if (InputFile.empty()) {
166 InputFile = Option;
167 } else if (CacheFile.empty()) {
168 CacheFile = Option;
169 } else {
170 std::cout << "Warning: ignoring unknown option " << Option << std::endl;
171 }
172 }
173
174 if (IgnoreErrors < 0 || IgnoreErrors > 3)
175 throw Error("Error: invalid error handling mode");
176 if (InputFile.empty())
177 throw Error("Error: no input file specified");
178
179 if (CacheFile.empty()) {
180 CacheFile = InputFile;
181 CacheFile.append(".ffindex");
182 }
183}
184
185int FFMS_CC UpdateProgress(int64_t Current, int64_t Total, void *Private) {
186 if (!PrintProgress)

Callers 1

mainFunction · 0.85

Calls 3

parseDemuxerOptsFunction · 0.85
ErrorClass · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected