summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-12-09 10:21:57 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-17 20:13:22 +0100
commit0d7a7b85095a5accf5f3666bc1d0a037a5455d0b (patch)
treeb9083e6d14520830168c074d076bd91641406f90 /src
parent3187bc1ffbc7bd2716abc99e064b1e6e471b8172 (diff)
Bv2.1 6.2.1: Check that subtitle XML <Language> conforms to RFC 5646.
Diffstat (limited to 'src')
-rw-r--r--src/smpte_subtitle_asset.h3
-rw-r--r--src/verify.cc14
2 files changed, 14 insertions, 3 deletions
diff --git a/src/smpte_subtitle_asset.h b/src/smpte_subtitle_asset.h
index b66b1ea6..28aecefa 100644
--- a/src/smpte_subtitle_asset.h
+++ b/src/smpte_subtitle_asset.h
@@ -48,6 +48,8 @@ namespace ASDCP {
}
}
+struct verify_test26;
+
namespace dcp {
class SMPTELoadFontNode;
@@ -172,6 +174,7 @@ protected:
private:
friend struct ::write_smpte_subtitle_test;
friend struct ::write_smpte_subtitle_test2;
+ friend struct ::verify_test26;
void read_fonts (std::shared_ptr<ASDCP::TimedText::MXFReader>);
void parse_xml (std::shared_ptr<cxml::Document> xml);
diff --git a/src/verify.cc b/src/verify.cc
index b4408946..89d84eef 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -46,6 +46,7 @@
#include "exceptions.h"
#include "compose.hpp"
#include "raw_convert.h"
+#include "smpte_subtitle_asset.h"
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/parsers/AbstractDOMParser.hpp>
@@ -572,12 +573,19 @@ verify_main_subtitle_asset (
list<VerificationNote>& notes
)
{
- shared_ptr<ReelSubtitleAsset> reel_asset = reel->main_subtitle ();
- stage ("Checking subtitle XML", reel->main_subtitle()->asset()->file());
+ shared_ptr<SubtitleAsset> asset = reel->main_subtitle()->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 (reel->main_subtitle()->asset()->raw_xml(), xsd_dtd_directory, notes);
+ validate_xml (asset->raw_xml(), xsd_dtd_directory, notes);
+
+ shared_ptr<SMPTESubtitleAsset> smpte = dynamic_pointer_cast<SMPTESubtitleAsset>(asset);
+ if (smpte) {
+ if (smpte->language()) {
+ verify_language_tag (*smpte->language(), notes);
+ }
+ }
}