mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
Better error message.
This commit is contained in:
parent
f9bc92f86b
commit
09551a3f94
@ -370,13 +370,17 @@ identify(const string &filename) {
|
||||
int64_t
|
||||
parse_number_with_unit(const string &s,
|
||||
const string &subject,
|
||||
const string &argument) {
|
||||
const string &argument,
|
||||
string display_s = "") {
|
||||
string unit;
|
||||
int64_t value, multiplier, unit_length;
|
||||
|
||||
if (display_s == "")
|
||||
display_s = s;
|
||||
|
||||
if (s.length() < 3)
|
||||
mxerror(_("'%s' is not a valid %s in '%s %s'.\n"),
|
||||
s.c_str(), subject.c_str(), argument.c_str(), s.c_str());
|
||||
s.c_str(), subject.c_str(), argument.c_str(), display_s.c_str());
|
||||
|
||||
unit = s.substr(s.length() - 2, 2);
|
||||
|
||||
@ -392,11 +396,12 @@ parse_number_with_unit(const string &s,
|
||||
unit_length = 1;
|
||||
else
|
||||
mxerror(_("'%s' does not contain a valid unit ('s', 'ms', 'us' or 'ns') "
|
||||
"in '%s %s'.\n"), s.c_str(), argument.c_str(), s.c_str());
|
||||
"in '%s %s'.\n"), s.c_str(), argument.c_str(),
|
||||
display_s.c_str());
|
||||
|
||||
if (!parse_int(s.substr(0, s.length() - unit_length), value))
|
||||
mxerror(_("'%s' does not contain a valid number in front of the unit in "
|
||||
"'%s %s'.\n"), s.c_str(), argument.c_str(), s.c_str());
|
||||
"'%s %s'.\n"), s.c_str(), argument.c_str(), display_s.c_str());
|
||||
value *= multiplier;
|
||||
|
||||
return value;
|
||||
@ -814,7 +819,7 @@ parse_delay(const string &s,
|
||||
if (!parse_int(parts[0], delay.id))
|
||||
mxerror(_("Invalid track ID specified in '--delay %s'.\n"), s.c_str());
|
||||
|
||||
delay.delay = parse_number_with_unit(parts[1], "delay", "--delay");
|
||||
delay.delay = parse_number_with_unit(parts[1], "delay", "--delay", s);
|
||||
|
||||
ti.packet_delays.push_back(delay);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user