) {
bool found_threed_marked_as_twod = false;
- other_assets.push_back (asset_factory(path, ignore_incorrect_picture_mxf_type, &found_threed_marked_as_twod));
+ auto asset = asset_factory(path, ignore_incorrect_picture_mxf_type, &found_threed_marked_as_twod);
+ if (asset->id() != id) {
+ notes->push_back(VerificationNote(VerificationNote::Type::ERROR, VerificationNote::Code::MISMATCHED_ASSET_MAP_ID).set_id(id).set_other_id(asset->id()));
+ }
+ other_assets.push_back(asset);
if (found_threed_marked_as_twod && notes) {
notes->push_back ({VerificationNote::Type::WARNING, VerificationNote::Code::THREED_ASSET_MARKED_AS_TWOD, path});
}
}
}
}
+
}
if (reel->main_sound() && reel->main_sound()->asset_ref().resolved()) {
return String::compose("A subtitle or closed caption refers to a font with ID %1 that does not have a corresponding <LoadFont> node", note.id().get());
case VerificationNote::Code::MISSING_LOAD_FONT:
return String::compose("The SMPTE subtitle asset %1 has <Text> nodes but no <LoadFont> node", note.id().get());
+ case VerificationNote::Code::MISMATCHED_ASSET_MAP_ID:
+ return String::compose("The asset with ID %1 in the asset map actually has an id of %2", note.id().get(), note.other_id().get());
}
return "";
/** A SMPTE subtitle asset has at least one <Text> element but no <LoadFont>
* id contains the ID of the subtitle asset.
*/
- MISSING_LOAD_FONT
+ MISSING_LOAD_FONT,
+ /** An ID in an asset map does not match the ID obtained from reading the actual file.
+ * id contains the ID from the asset map.
+ * other_id contains the ID from the file.
+ */
+ MISMATCHED_ASSET_MAP_ID,
};
VerificationNote (Type type, Code code)
COMPONENT,
SIZE,
ID,
+ OTHER_ID,
};
template <class T>
return data<std::string>(Data::ID);
}
+ VerificationNote& set_other_id(std::string other_id) {
+ _data[Data::OTHER_ID] = other_id;
+ return *this;
+ }
+
+ boost::optional<std::string> other_id() const {
+ return data<std::string>(Data::OTHER_ID);
+ }
+
private:
Type _type;
Code _code;
});
}
+
+BOOST_AUTO_TEST_CASE(verify_spots_wrong_asset)
+{
+ boost::filesystem::path const dir = "build/test/verify_spots_wrong_asset";
+ boost::filesystem::remove_all(dir);
+
+ auto dcp1 = make_simple(dir / "1");
+ dcp1->write_xml();
+
+ auto const asset_1 = dcp::MonoPictureAsset(dir / "1" / "video.mxf").id();
+
+ auto dcp2 = make_simple(dir / "2");
+ dcp2->write_xml();
+ auto const asset_2 = dcp::MonoPictureAsset(dir / "2" / "video.mxf").id();
+
+ boost::filesystem::remove(dir / "1" / "video.mxf");
+ boost::filesystem::copy_file(dir / "2" / "video.mxf", dir / "1" / "video.mxf");
+
+ check_verify_result(
+ {dir / "1"},
+ {
+ dcp::VerificationNote(dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_ASSET_MAP_ID).set_id(asset_1).set_other_id(asset_2)
+ });
+}