From f5bd0937a730e9dbb58f955c11df41abc56e89b5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 9 Dec 2020 16:27:26 +0100 Subject: Bv2.1 6.2.1: Check that closed caption reel and XML conform to RFC 5646. --- src/verify.cc | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/verify.cc') 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 reel_asset, list< static void -verify_main_subtitle_asset ( - shared_ptr reel_asset, +verify_closed_caption_reel (shared_ptr reel_asset, list& notes) +{ + /* XXX: is Language compulsory? */ + if (reel_asset->language()) { + verify_language_tag (*reel_asset->language(), notes); + } +} + + +static void +verify_subtitle_asset ( + shared_ptr asset, function)> stage, boost::filesystem::path xsd_dtd_directory, list& notes ) { - shared_ptr 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 smpte = dynamic_pointer_cast(asset); + shared_ptr smpte = dynamic_pointer_cast(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 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); } } } -- cgit v1.2.3