summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-09 01:39:08 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-17 20:13:22 +0100
commit3034388f30732db8d748da96ee66fcdde0626c52 (patch)
treefc8de1e5e82832a08958b78e9d656fc3aa79f9b2 /src
parent9dcee1cb0ab00ed75c0f56bc9708a01aa358b62b (diff)
Bv2.1 7.2.4: first subtitle should be at least 4s into the DCP.
Diffstat (limited to 'src')
-rw-r--r--src/verify.cc31
-rw-r--r--src/verify.h2
2 files changed, 28 insertions, 5 deletions
diff --git a/src/verify.cc b/src/verify.cc
index 8f04f799..6a9967e6 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -651,7 +651,8 @@ verify_subtitle_asset (
function<void (string, optional<boost::filesystem::path>)> stage,
boost::filesystem::path xsd_dtd_directory,
list<VerificationNote>& notes,
- State& state
+ State& state,
+ bool first_reel
)
{
stage ("Checking subtitle XML", asset->file());
@@ -715,6 +716,20 @@ verify_subtitle_asset (
VerificationNote::VERIFY_BV21_ERROR, VerificationNote::SUBTITLE_START_TIME_NON_ZERO, *asset->file())
);
}
+
+ if (first_reel) {
+ auto subs = smpte->subtitles();
+ subs.sort ([](shared_ptr<Subtitle> a, shared_ptr<Subtitle> b) {
+ return a->in() < b->in();
+ });
+ if (!subs.empty() && subs.front()->in() < dcp::Time(0, 0, 4, 0, 24)) {
+ notes.push_back(
+ VerificationNote(
+ VerificationNote::VERIFY_WARNING, VerificationNote::FIRST_TEXT_TOO_EARLY
+ )
+ );
+ }
+ }
}
}
@@ -725,10 +740,11 @@ verify_closed_caption_asset (
function<void (string, optional<boost::filesystem::path>)> stage,
boost::filesystem::path xsd_dtd_directory,
list<VerificationNote>& notes,
- State& state
+ State& state,
+ bool first_reel
)
{
- verify_subtitle_asset (asset, stage, xsd_dtd_directory, notes, state);
+ verify_subtitle_asset (asset, stage, xsd_dtd_directory, notes, state, first_reel);
if (asset->raw_xml().size() > 256 * 1024) {
notes.push_back (
@@ -796,6 +812,7 @@ dcp::verify (
}
}
+ bool first_reel = true;
for (auto reel: cpl->reels()) {
stage ("Checking reel", optional<boost::filesystem::path>());
@@ -834,16 +851,18 @@ 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(), stage, xsd_dtd_directory, notes, state, first_reel);
}
}
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, state);
+ verify_closed_caption_asset (i->asset(), stage, xsd_dtd_directory, notes, state, first_reel);
}
}
+
+ first_reel = false;
}
}
@@ -927,6 +946,8 @@ dcp::note_to_string (dcp::VerificationNote note)
return String::compose("The XML for a SMPTE subtitle asset has no <StartTime> tag, which is required by Bv2.1", note.file()->filename());
case dcp::VerificationNote::SUBTITLE_START_TIME_NON_ZERO:
return String::compose("The XML for a SMPTE subtitle asset has a non-zero <StartTime> tag, which is disallowed by Bv2.1", note.file()->filename());
+ case dcp::VerificationNote::FIRST_TEXT_TOO_EARLY:
+ return "The first subtitle or closed caption is less than 4 seconds from the start of the DCP.";
}
return "";
diff --git a/src/verify.h b/src/verify.h
index 2957654f..f692e867 100644
--- a/src/verify.h
+++ b/src/verify.h
@@ -116,6 +116,8 @@ public:
MISSING_SUBTITLE_START_TIME,
/** Some SMPTE subtitle XML has a non-zero <StartTime> tag [Bv2.1_7.2.3] */
SUBTITLE_START_TIME_NON_ZERO,
+ /** The first subtitle or closed caption happens before 4s into the first reel [Bv2.1_7.2.4] */
+ FIRST_TEXT_TOO_EARLY,
};
VerificationNote (Type type, Code code)