summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-06-26 01:45:17 +0200
committerCarl Hetherington <cth@carlh.net>2023-06-27 00:09:54 +0200
commitc72e832423ceb81f30e8ca19bfeb87fca26298c1 (patch)
tree7981151787cad7ea2365cc302aec587079dd7ffe /src
parent54617cea2d186bd62eb44b07292b8722fe59ed4e (diff)
Add verifier check for the actual asset file's ID not being the same as the one in the asset map.
Diffstat (limited to 'src')
-rw-r--r--src/dcp.cc6
-rw-r--r--src/verify.cc3
-rw-r--r--src/verify.h17
3 files changed, 24 insertions, 2 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index 7fa84798..0d0dc690 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -253,7 +253,11 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m
) {
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});
}
diff --git a/src/verify.cc b/src/verify.cc
index b3fe83a2..394326fe 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -1449,6 +1449,7 @@ verify_reel(
}
}
}
+
}
if (reel->main_sound() && reel->main_sound()->asset_ref().resolved()) {
@@ -2082,6 +2083,8 @@ dcp::note_to_string (VerificationNote note)
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 "";
diff --git a/src/verify.h b/src/verify.h
index 0474dca2..04c5d869 100644
--- a/src/verify.h
+++ b/src/verify.h
@@ -456,7 +456,12 @@ public:
/** 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)
@@ -512,6 +517,7 @@ private:
COMPONENT,
SIZE,
ID,
+ OTHER_ID,
};
template <class T>
@@ -573,6 +579,15 @@ public:
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;