summaryrefslogtreecommitdiff
path: root/src/verify.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-12-09 16:27:26 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-17 20:13:22 +0100
commitf5bd0937a730e9dbb58f955c11df41abc56e89b5 (patch)
tree408ce49aee9a923300994f0ffc12c57e23ef8f0e /src/verify.cc
parent02e0e7febed98d2b9375c7638b61a25003603c9a (diff)
Bv2.1 6.2.1: Check that closed caption reel and XML <Language> conform to RFC 5646.
Diffstat (limited to 'src/verify.cc')
-rw-r--r--src/verify.cc27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/verify.cc b/src/verify.cc
index 1b245331..e5deb789 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -35,6 +35,7 @@
#include "dcp.h"
#include "cpl.h"
#include "reel.h"
+#include "reel_closed_caption_asset.h"
#include "reel_picture_asset.h"
#include "reel_sound_asset.h"
#include "reel_subtitle_asset.h"
@@ -571,21 +572,30 @@ verify_main_subtitle_reel (shared_ptr<const ReelSubtitleAsset> reel_asset, list<
static void
-verify_main_subtitle_asset (
- shared_ptr<const ReelSubtitleAsset> reel_asset,
+verify_closed_caption_reel (shared_ptr<const ReelClosedCaptionAsset> reel_asset, list<VerificationNote>& notes)
+{
+ /* XXX: is Language compulsory? */
+ if (reel_asset->language()) {
+ verify_language_tag (*reel_asset->language(), notes);
+ }
+}
+
+
+static void
+verify_subtitle_asset (
+ shared_ptr<const SubtitleAsset> asset,
function<void (string, optional<boost::filesystem::path>)> stage,
boost::filesystem::path xsd_dtd_directory,
list<VerificationNote>& notes
)
{
- shared_ptr<SubtitleAsset> asset = reel_asset->asset();
stage ("Checking subtitle XML", asset->file());
/* Note: we must not use SubtitleAsset::xml_as_string() here as that will mean the data on disk
* gets passed through libdcp which may clean up and therefore hide errors.
*/
validate_xml (asset->raw_xml(), xsd_dtd_directory, notes);
- shared_ptr<SMPTESubtitleAsset> smpte = dynamic_pointer_cast<SMPTESubtitleAsset>(asset);
+ shared_ptr<const SMPTESubtitleAsset> smpte = dynamic_pointer_cast<const SMPTESubtitleAsset>(asset);
if (smpte) {
if (smpte->language()) {
verify_language_tag (*smpte->language(), notes);
@@ -679,7 +689,14 @@ dcp::verify (
if (reel->main_subtitle()) {
verify_main_subtitle_reel (reel->main_subtitle(), notes);
if (reel->main_subtitle()->asset_ref().resolved()) {
- verify_main_subtitle_asset (reel->main_subtitle(), stage, xsd_dtd_directory, notes);
+ verify_subtitle_asset (reel->main_subtitle()->asset(), stage, xsd_dtd_directory, notes);
+ }
+ }
+
+ BOOST_FOREACH (shared_ptr<dcp::ReelClosedCaptionAsset> i, reel->closed_captions()) {
+ verify_closed_caption_reel (i, notes);
+ if (i->asset_ref().resolved()) {
+ verify_subtitle_asset (i->asset(), stage, xsd_dtd_directory, notes);
}
}
}