6.1 must be smpte [/]
immersive audio DCPs must comply with 429-18, 429-19 [*] don't have these standards
6.2 Language and Territory must comply with RFC 5646
- - subtitle reel <Language>
+ - subtitle reel <Language> /
- subtitle XML <Language>
- sound reel <Language>
- ccap reel <Language>
#include "reel_mxf.h"
#include "subtitle_asset.h"
+struct verify_test26;
+
namespace dcp {
class SubtitleAsset;
}
private:
+ friend struct ::verify_test26;
+
std::string key_type () const;
std::string cpl_node_name (Standard standard) const;
}
+void
+verify_language_tag (string tag, list<VerificationNote>& notes)
+{
+ try {
+ dcp::LanguageTag test (tag);
+ } catch (dcp::LanguageTagError &) {
+ notes.push_back (VerificationNote(VerificationNote::VERIFY_BV21_ERROR, VerificationNote::BAD_LANGUAGE, tag));
+ }
+}
+
+
enum VerifyPictureAssetResult
{
VERIFY_PICTURE_ASSET_RESULT_GOOD,
}
+static void
+verify_main_subtitle_reel (shared_ptr<const ReelSubtitleAsset> reel_asset, list<VerificationNote>& notes)
+{
+ /* XXX: is Language compulsory? */
+ if (reel_asset->language()) {
+ verify_language_tag (*reel_asset->language(), notes);
+ }
+}
+
+
static void
verify_main_subtitle_asset (
shared_ptr<const Reel> reel,
verify_main_sound_asset (dcp, reel, stage, progress, notes);
}
- if (reel->main_subtitle() && reel->main_subtitle()->asset_ref().resolved()) {
- verify_main_subtitle_asset (reel, stage, xsd_dtd_directory, notes);
+ if (reel->main_subtitle()) {
+ verify_main_subtitle_reel (reel->main_subtitle(), notes);
+ if (reel->main_subtitle()->asset_ref().resolved()) {
+ verify_main_subtitle_asset (reel, stage, xsd_dtd_directory, notes);
+ }
}
}
}
return String::compose("An asset that this DCP refers to is not included in the DCP. It may be a VF. Missing asset is %1.", note.note().get());
case dcp::VerificationNote::NOT_SMPTE:
return "This DCP does not use the SMPTE standard, which is required for Bv2.1 compliance.";
+ case dcp::VerificationNote::BAD_LANGUAGE:
+ return String::compose("The DCP specifies a language '%1' which does not conform to the RFC 5646 standard.", note.note().get());
}
return "";
EXTERNAL_ASSET,
/** DCP is Interop, not SMPTE [Bv2.1_6.1] */
NOT_SMPTE,
+ /** A language or territory does not conform to RFC 5646 [Bv2.1_6.2.1] */
+ BAD_LANGUAGE,
};
VerificationNote (Type type, Code code)
list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test);
}
+
+/* SMPTE DCP with invalid <Language> in the MainSubtitle */
+BOOST_AUTO_TEST_CASE (verify_test26)
+{
+ boost::filesystem::path const dir("build/test/verify_test26");
+ boost::filesystem::remove_all (dir);
+ boost::filesystem::create_directories (dir);
+ boost::filesystem::copy_file ("test/data/subs.mxf", dir / "subs.mxf");
+ shared_ptr<dcp::SMPTESubtitleAsset> asset(new dcp::SMPTESubtitleAsset(dir / "subs.mxf"));
+ shared_ptr<dcp::ReelSubtitleAsset> reel_asset(new dcp::ReelSubtitleAsset(asset, dcp::Fraction(24, 1), 16 * 24, 0));
+ reel_asset->_language = "badlang";
+ shared_ptr<dcp::Reel> reel(new dcp::Reel());
+ reel->add (reel_asset);
+ shared_ptr<dcp::CPL> cpl(new dcp::CPL("hello", dcp::FEATURE));
+ cpl->add (reel);
+ shared_ptr<dcp::DCP> dcp(new dcp::DCP(dir));
+ dcp->add (cpl);
+ dcp->write_xml (dcp::SMPTE);
+
+ vector<boost::filesystem::path> dirs;
+ dirs.push_back (dir);
+ list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test);
+ BOOST_REQUIRE_EQUAL (notes.size(), 1U);
+ list<dcp::VerificationNote>::const_iterator i = notes.begin ();
+ BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::BAD_LANGUAGE);
+
+}
+