#include "raw_convert.h"
#include "reel.h"
#include "reel_closed_caption_asset.h"
+#include "reel_interop_subtitle_asset.h"
#include "reel_markers_asset.h"
#include "reel_picture_asset.h"
#include "reel_sound_asset.h"
+#include "reel_smpte_subtitle_asset.h"
#include "reel_subtitle_asset.h"
#include "smpte_subtitle_asset.h"
#include "stereo_picture_asset.h"
class DCPErrorHandler : public ErrorHandler
{
public:
- void warning(const SAXParseException& e)
+ void warning(const SAXParseException& e) override
{
maybe_add (XMLValidationError(e));
}
- void error(const SAXParseException& e)
+ void error(const SAXParseException& e) override
{
maybe_add (XMLValidationError(e));
}
- void fatalError(const SAXParseException& e)
+ void fatalError(const SAXParseException& e) override
{
maybe_add (XMLValidationError(e));
}
- void resetErrors() {
+ void resetErrors() override {
_errors.clear ();
}
add("http://www.smpte-ra.org/schemas/429-10/2008/Main-Stereo-Picture-CPL", "SMPTE-429-10-2008.xsd");
}
- InputSource* resolveEntity(XMLCh const *, XMLCh const * system_id)
+ InputSource* resolveEntity(XMLCh const *, XMLCh const * system_id) override
{
if (!system_id) {
return 0;
void
verify_smpte_timed_text_asset (
shared_ptr<const SMPTESubtitleAsset> asset,
+ optional<int64_t> reel_asset_duration,
vector<VerificationNote>& notes
)
{
} else if (asset->start_time() != Time()) {
notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_SUBTITLE_START_TIME, asset->file().get() });
}
+
+ if (reel_asset_duration && *reel_asset_duration != asset->intrinsic_duration()) {
+ notes.push_back (
+ {
+ VerificationNote::Type::BV21_ERROR,
+ VerificationNote::Code::MISMATCHED_TIMED_TEXT_DURATION,
+ String::compose("%1 %2", *reel_asset_duration, asset->intrinsic_duration()),
+ asset->file().get()
+ });
+ }
}
static void
verify_subtitle_asset (
shared_ptr<const SubtitleAsset> asset,
+ optional<int64_t> reel_asset_duration,
function<void (string, optional<boost::filesystem::path>)> stage,
boost::filesystem::path xsd_dtd_directory,
vector<VerificationNote>& notes,
auto smpte = dynamic_pointer_cast<const SMPTESubtitleAsset>(asset);
if (smpte) {
- verify_smpte_timed_text_asset (smpte, notes);
+ verify_smpte_timed_text_asset (smpte, reel_asset_duration, notes);
verify_smpte_subtitle_asset (smpte, notes, state);
}
}
static void
verify_closed_caption_asset (
shared_ptr<const SubtitleAsset> asset,
+ optional<int64_t> reel_asset_duration,
function<void (string, optional<boost::filesystem::path>)> stage,
boost::filesystem::path xsd_dtd_directory,
vector<VerificationNote>& notes
auto smpte = dynamic_pointer_cast<const SMPTESubtitleAsset>(asset);
if (smpte) {
- verify_smpte_timed_text_asset (smpte, notes);
+ verify_smpte_timed_text_asset (smpte, reel_asset_duration, notes);
}
if (asset->raw_xml().size() > 256 * 1024) {
return static_cast<bool>(reel->main_subtitle());
},
[](shared_ptr<Reel> reel) {
- return reel->main_subtitle()->asset()->raw_xml();
+ auto interop = dynamic_pointer_cast<ReelInteropSubtitleAsset>(reel->main_subtitle());
+ if (interop) {
+ return interop->asset()->raw_xml();
+ }
+ auto smpte = dynamic_pointer_cast<ReelSMPTESubtitleAsset>(reel->main_subtitle());
+ DCP_ASSERT (smpte);
+ return smpte->asset()->raw_xml();
},
[](shared_ptr<Reel> reel) {
return reel->main_subtitle()->actual_duration();
for (auto i: dcp->cpls()) {
for (auto j: i->reel_file_assets()) {
if (j->asset_ref().resolved()) {
- /* It's a bit surprising / broken but Interop subtitle assets are represented
- * in reels by ReelSubtitleAsset which inherits ReelFileAsset, so it's possible for
- * ReelFileAssets to have assets which are not MXFs.
- */
- if (auto asset = dynamic_pointer_cast<MXF>(j->asset_ref().asset())) {
- if (asset->encrypted()) {
- encrypted.push_back(j->asset_ref().id());
- }
+ auto mxf = dynamic_pointer_cast<MXF>(j->asset_ref().asset());
+ if (mxf && mxf->encrypted()) {
+ encrypted.push_back(j->asset_ref().id());
}
}
}
stage ("Checking DCP", dcp->directory());
bool carry_on = true;
try {
- dcp->read (¬es);
+ dcp->read (¬es, true);
} catch (MissingAssetmapError& e) {
notes.push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::FAILED_READ, string(e.what())});
carry_on = false;
notes.push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_INTRINSIC_DURATION, i->id()});
}
auto file_asset = dynamic_pointer_cast<ReelFileAsset>(i);
- if (file_asset && !file_asset->hash()) {
+ if (i->encryptable() && !file_asset->hash()) {
notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISSING_HASH, i->id()});
}
}
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(), reel->main_subtitle()->duration(), stage, *xsd_dtd_directory, notes, state);
}
have_main_subtitle = true;
} else {
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);
+ verify_closed_caption_asset (i->asset(), i->duration(), stage, *xsd_dtd_directory, notes);
}
}
return String::compose("The instantaneous bit rate of the picture asset %1 is close to the limit of 250Mbit/s in at least one place.", note.file()->filename());
case VerificationNote::Code::EXTERNAL_ASSET:
return String::compose("The asset %1 that this DCP refers to is not included in the DCP. It may be a VF.", note.note().get());
+ case VerificationNote::Code::THREED_ASSET_MARKED_AS_TWOD:
+ return String::compose("The asset %1 is 3D but its MXF is marked as 2D.", note.file()->filename());
case VerificationNote::Code::INVALID_STANDARD:
return "This DCP does not use the SMPTE standard.";
case VerificationNote::Code::INVALID_LANGUAGE:
return "The Resource ID in a timed text MXF did not match the ID of the contained XML.";
case VerificationNote::Code::INCORRECT_TIMED_TEXT_ASSET_ID:
return "The Asset ID in a timed text MXF is the same as the Resource ID or that of the contained XML.";
+ case VerificationNote::Code::MISMATCHED_TIMED_TEXT_DURATION:
+ {
+ vector<string> parts;
+ boost::split (parts, note.note().get(), boost::is_any_of(" "));
+ DCP_ASSERT (parts.size() == 2);
+ return String::compose("The reel duration of some timed text (%1) is not the same as the ContainerDuration of its MXF (%2).", parts[0], parts[1]);
+ }
}
return "";
}
+bool
+dcp::operator< (dcp::VerificationNote const& a, dcp::VerificationNote const& b)
+{
+ if (a.type() != b.type()) {
+ return a.type() < b.type();
+ }
+
+ if (a.code() != b.code()) {
+ return a.code() < b.code();
+ }
+
+ if (a.note() != b.note()) {
+ return a.note().get_value_or("") < b.note().get_value_or("");
+ }
+
+ if (a.file() != b.file()) {
+ return a.file().get_value_or("") < b.file().get_value_or("");
+ }
+
+ return a.line().get_value_or(0) < b.line().get_value_or(0);
+}
+
+
std::ostream&
dcp::operator<< (std::ostream& s, dcp::VerificationNote const& note)
{