mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
Allow empty track names.
This commit is contained in:
parent
2032366652
commit
bb0c2c6ba7
@ -847,15 +847,22 @@ parse_language(const string &s,
|
|||||||
language_t &lang,
|
language_t &lang,
|
||||||
const string &opt,
|
const string &opt,
|
||||||
const char *topic,
|
const char *topic,
|
||||||
bool check) {
|
bool check,
|
||||||
|
bool empty_ok = false) {
|
||||||
vector<string> parts;
|
vector<string> parts;
|
||||||
|
|
||||||
// Extract the track number.
|
// Extract the track number.
|
||||||
parts = split(s, ":", 2);
|
parts = split(s, ":", 2);
|
||||||
strip(parts);
|
strip(parts);
|
||||||
if (parts.size() != 2)
|
if (0 == parts.size())
|
||||||
mxerror(_("No track ID specified in '--%s' %s'.\n"), opt.c_str(),
|
mxerror(_("No track ID specified in '--%s %s'.\n"), opt.c_str(),
|
||||||
s.c_str());
|
s.c_str());
|
||||||
|
if (1 == parts.size()) {
|
||||||
|
if (!empty_ok)
|
||||||
|
mxerror("No %s specified in '--%s %s'.\n", topic, opt.c_str(),
|
||||||
|
s.c_str());
|
||||||
|
parts.push_back("");
|
||||||
|
}
|
||||||
|
|
||||||
if (!parse_int(parts[0], lang.id))
|
if (!parse_int(parts[0], lang.id))
|
||||||
mxerror(_("Invalid track ID specified in '--%s %s'.\n"), opt.c_str(),
|
mxerror(_("Invalid track ID specified in '--%s %s'.\n"), opt.c_str(),
|
||||||
@ -1808,7 +1815,7 @@ parse_args(vector<string> args) {
|
|||||||
if (no_next_arg)
|
if (no_next_arg)
|
||||||
mxerror(_("'--track-name' lacks its argument.\n"));
|
mxerror(_("'--track-name' lacks its argument.\n"));
|
||||||
|
|
||||||
parse_language(next_arg, lang, "track-name", "track name", false);
|
parse_language(next_arg, lang, "track-name", "track name", false, true);
|
||||||
ti->track_names.push_back(track_name_t(lang.language, lang.id));
|
ti->track_names.push_back(track_name_t(lang.language, lang.id));
|
||||||
sit++;
|
sit++;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user