summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-09 23:49:42 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-09 23:49:42 +0200
commitc59e6c0e64f95afc7c33168e7c7562502411bd01 (patch)
tree044a8ebb292801f5b44b6589017e98fbae6054ce /src
parent4bf244a0823e7ae59071f1566495b4210166d4a5 (diff)
Add check for Bv2.1 10.4.3 - container duration vs reel duration in timed text.
Diffstat (limited to 'src')
-rw-r--r--src/verify.cc28
-rw-r--r--src/verify.h5
2 files changed, 29 insertions, 4 deletions
diff --git a/src/verify.cc b/src/verify.cc
index e5743995..ce79bc2e 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -637,6 +637,7 @@ struct State
void
verify_smpte_timed_text_asset (
shared_ptr<const SMPTESubtitleAsset> asset,
+ optional<int64_t> reel_asset_duration,
vector<VerificationNote>& notes
)
{
@@ -670,6 +671,16 @@ verify_smpte_timed_text_asset (
} else if (asset->start_time() != Time()) {
notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_SUBTITLE_START_TIME, asset->file().get() });
}
+
+ if (reel_asset_duration && *reel_asset_duration != asset->intrinsic_duration()) {
+ notes.push_back (
+ {
+ VerificationNote::Type::BV21_ERROR,
+ VerificationNote::Code::MISMATCHED_TIMED_TEXT_DURATION,
+ String::compose("%1 %2", *reel_asset_duration, asset->intrinsic_duration()),
+ asset->file().get()
+ });
+ }
}
@@ -704,6 +715,7 @@ verify_smpte_subtitle_asset (
static void
verify_subtitle_asset (
shared_ptr<const SubtitleAsset> asset,
+ optional<int64_t> reel_asset_duration,
function<void (string, optional<boost::filesystem::path>)> stage,
boost::filesystem::path xsd_dtd_directory,
vector<VerificationNote>& notes,
@@ -718,7 +730,7 @@ verify_subtitle_asset (
auto smpte = dynamic_pointer_cast<const SMPTESubtitleAsset>(asset);
if (smpte) {
- verify_smpte_timed_text_asset (smpte, notes);
+ verify_smpte_timed_text_asset (smpte, reel_asset_duration, notes);
verify_smpte_subtitle_asset (smpte, notes, state);
}
}
@@ -728,6 +740,7 @@ verify_subtitle_asset (
static void
verify_closed_caption_asset (
shared_ptr<const SubtitleAsset> asset,
+ optional<int64_t> reel_asset_duration,
function<void (string, optional<boost::filesystem::path>)> stage,
boost::filesystem::path xsd_dtd_directory,
vector<VerificationNote>& notes
@@ -741,7 +754,7 @@ verify_closed_caption_asset (
auto smpte = dynamic_pointer_cast<const SMPTESubtitleAsset>(asset);
if (smpte) {
- verify_smpte_timed_text_asset (smpte, notes);
+ verify_smpte_timed_text_asset (smpte, reel_asset_duration, notes);
}
if (asset->raw_xml().size() > 256 * 1024) {
@@ -1268,7 +1281,7 @@ dcp::verify (
if (reel->main_subtitle()) {
verify_main_subtitle_reel (reel->main_subtitle(), notes);
if (reel->main_subtitle()->asset_ref().resolved()) {
- verify_subtitle_asset (reel->main_subtitle()->asset(), stage, *xsd_dtd_directory, notes, state);
+ verify_subtitle_asset (reel->main_subtitle()->asset(), reel->main_subtitle()->duration(), stage, *xsd_dtd_directory, notes, state);
}
have_main_subtitle = true;
} else {
@@ -1278,7 +1291,7 @@ dcp::verify (
for (auto i: reel->closed_captions()) {
verify_closed_caption_reel (i, notes);
if (i->asset_ref().resolved()) {
- verify_closed_caption_asset (i->asset(), stage, *xsd_dtd_directory, notes);
+ verify_closed_caption_asset (i->asset(), i->duration(), stage, *xsd_dtd_directory, notes);
}
}
@@ -1580,6 +1593,13 @@ dcp::note_to_string (VerificationNote note)
return "The Resource ID in a timed text MXF did not match the ID of the contained XML.";
case VerificationNote::Code::INCORRECT_TIMED_TEXT_ASSET_ID:
return "The Asset ID in a timed text MXF is the same as the Resource ID or that of the contained XML.";
+ case VerificationNote::Code::MISMATCHED_TIMED_TEXT_DURATION:
+ {
+ vector<string> parts;
+ boost::split (parts, note.note().get(), boost::is_any_of(" "));
+ DCP_ASSERT (parts.size() == 2);
+ return String::compose("The reel duration of some timed text (%1) is not the same as the ContainerDuration of its MXF (%2).", parts[0], parts[1]);
+ }
}
return "";
diff --git a/src/verify.h b/src/verify.h
index 0a422801..169845b7 100644
--- a/src/verify.h
+++ b/src/verify.h
@@ -370,6 +370,11 @@ public:
MISMATCHED_TIMED_TEXT_RESOURCE_ID,
/** The AssetID of a timed text MXF is the same as its ResourceID or that of the contained XML essence [Bv2.1_10.4.2] */
INCORRECT_TIMED_TEXT_ASSET_ID,
+ /** The ContainerDuration of a timed text MXF is not the same as the Duration in its reel [Bv2.1_10_4_3]
+ * note contains the reel duration, followed by a space, followed by the MXF duration
+ * file contains the asset filename
+ */
+ MISMATCHED_TIMED_TEXT_DURATION,
};
VerificationNote (Type type, Code code)