mkvpropedit: verify given track language to be a ISO 639-2 code

Fixes #1550.
This commit is contained in:
Moritz Bunkus 2015-12-30 17:53:16 +01:00
parent 72527c3998
commit 4ef49467e0
2 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2015-12-30 Moritz Bunkus <moritz@bunkus.org> 2015-12-30 Moritz Bunkus <moritz@bunkus.org>
* mkvpropedit: bug fix: when changing the track language it is now
verified to be a valid ISO 639-2 language code before writing it
to the file. Fixes #1550.
* mkvmerge: enhancement: the MP4 reader will keep the display * mkvmerge: enhancement: the MP4 reader will keep the display
dimensions from the track header atom ("tkhd") and use them as the dimensions from the track header atom ("tkhd") and use them as the
display width & height. See also #1547. display width & height. See also #1547.

View File

@ -20,6 +20,8 @@
#include "common/common_pch.h" #include "common/common_pch.h"
#include "common/ebml.h" #include "common/ebml.h"
#include "common/iso639.h"
#include "common/list_utils.h"
#include "common/output.h" #include "common/output.h"
#include "common/strings/editing.h" #include "common/strings/editing.h"
#include "common/strings/parsing.h" #include "common/strings/parsing.h"
@ -276,5 +278,10 @@ change_c::parse_spec(change_c::change_type_e type,
if (name.empty()) if (name.empty())
throw std::runtime_error(Y("missing property name")); throw std::runtime_error(Y("missing property name"));
if ( mtx::included_in(type, ct_add, ct_set)
&& (name == "language")
&& !is_valid_iso639_2_code(value))
throw std::runtime_error{(boost::format(("invalid ISO 639-2 language code '%1%'")) % value).str()};
return std::make_shared<change_c>(type, name, value); return std::make_shared<change_c>(type, name, value);
} }