summaryrefslogtreecommitdiff
path: root/src
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
parent02e0e7febed98d2b9375c7638b61a25003603c9a (diff)
Bv2.1 6.2.1: Check that closed caption reel and XML <Language> conform to RFC 5646.
Diffstat (limited to 'src')
-rw-r--r--src/reel_closed_caption_asset.h6
-rw-r--r--src/smpte_subtitle_asset.h2
-rw-r--r--src/verify.cc27
3 files changed, 30 insertions, 5 deletions
diff --git a/src/reel_closed_caption_asset.h b/src/reel_closed_caption_asset.h
index 47645a8f..25f1f569 100644
--- a/src/reel_closed_caption_asset.h
+++ b/src/reel_closed_caption_asset.h
@@ -43,6 +43,10 @@
#include "reel_asset.h"
#include "reel_mxf.h"
+
+struct verify_invalid_closed_caption_languages;
+
+
namespace dcp {
class SubtitleAsset;
@@ -76,6 +80,8 @@ public:
}
private:
+ friend struct ::verify_invalid_closed_caption_languages;
+
std::string key_type () const;
std::string cpl_node_name (Standard standard) const;
std::pair<std::string, std::string> cpl_node_namespace (Standard standard) const;
diff --git a/src/smpte_subtitle_asset.h b/src/smpte_subtitle_asset.h
index 28aecefa..6d7019a5 100644
--- a/src/smpte_subtitle_asset.h
+++ b/src/smpte_subtitle_asset.h
@@ -48,6 +48,7 @@ namespace ASDCP {
}
}
+struct verify_invalid_closed_caption_languages;
struct verify_test26;
namespace dcp {
@@ -174,6 +175,7 @@ protected:
private:
friend struct ::write_smpte_subtitle_test;
friend struct ::write_smpte_subtitle_test2;
+ friend struct ::verify_invalid_closed_caption_languages;
friend struct ::verify_test26;
void read_fonts (std::shared_ptr<ASDCP::TimedText::MXFReader>);
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);
}
}
}