files in the program, then also delete it here.
*/
+
+/** @file src/verify.cc
+ * @brief dcp::verify() method and associated code
+ */
+
+
#include "verify.h"
#include "dcp.h"
#include "cpl.h"
#include <xercesc/dom/DOMErrorHandler.hpp>
#include <xercesc/framework/LocalFileInputSource.hpp>
#include <xercesc/framework/MemBufInputSource.hpp>
-#include <boost/noncopyable.hpp>
#include <boost/algorithm/string.hpp>
#include <map>
#include <vector>
#include <iostream>
+
using std::list;
using std::vector;
using std::string;
using boost::function;
using std::dynamic_pointer_cast;
+
using namespace dcp;
using namespace xercesc;
+
static
string
xml_ch_to_string (XMLCh const * a)
return o;
}
+
class XMLValidationError
{
public:
list<XMLValidationError> _errors;
};
-class StringToXMLCh : public boost::noncopyable
+
+class StringToXMLCh
{
public:
StringToXMLCh (string a)
_buffer = XMLString::transcode(a.c_str());
}
+ StringToXMLCh (StringToXMLCh const&) = delete;
+ StringToXMLCh& operator= (StringToXMLCh const&) = delete;
+
~StringToXMLCh ()
{
XMLString::release (&_buffer);
XMLCh* _buffer;
};
+
class LocalFileResolver : public EntityResolver
{
public:
static VerifyAssetResult
-verify_asset (shared_ptr<const DCP> dcp, shared_ptr<const ReelMXF> reel_mxf, function<void (float)> progress)
+verify_asset (shared_ptr<const DCP> dcp, shared_ptr<const ReelFileAsset> reel_file_asset, function<void (float)> progress)
{
- auto const actual_hash = reel_mxf->asset_ref()->hash(progress);
+ auto const actual_hash = reel_file_asset->asset_ref()->hash(progress);
auto pkls = dcp->pkls();
/* We've read this DCP in so it must have at least one PKL */
DCP_ASSERT (!pkls.empty());
- auto asset = reel_mxf->asset_ref().asset();
+ auto asset = reel_file_asset->asset_ref().asset();
optional<string> pkl_hash;
for (auto i: pkls) {
- pkl_hash = i->hash (reel_mxf->asset_ref()->id());
+ pkl_hash = i->hash (reel_file_asset->asset_ref()->id());
if (pkl_hash) {
break;
}
DCP_ASSERT (pkl_hash);
- auto cpl_hash = reel_mxf->hash();
+ auto cpl_hash = reel_file_asset->hash();
if (cpl_hash && *cpl_hash != *pkl_hash) {
return VerifyAssetResult::CPL_PKL_DIFFER;
}
template <class A, class R, class F>
optional<VerifyPictureAssetResult>
-verify_picture_asset_type (shared_ptr<const ReelMXF> reel_mxf, function<void (float)> progress)
+verify_picture_asset_type (shared_ptr<const ReelFileAsset> reel_file_asset, function<void (float)> progress)
{
- auto asset = dynamic_pointer_cast<A>(reel_mxf->asset_ref().asset());
+ auto asset = dynamic_pointer_cast<A>(reel_file_asset->asset_ref().asset());
if (!asset) {
return optional<VerifyPictureAssetResult>();
}
static VerifyPictureAssetResult
-verify_picture_asset (shared_ptr<const ReelMXF> reel_mxf, function<void (float)> progress)
+verify_picture_asset (shared_ptr<const ReelFileAsset> reel_file_asset, function<void (float)> progress)
{
- auto r = verify_picture_asset_type<MonoPictureAsset, MonoPictureAssetReader, MonoPictureFrame>(reel_mxf, progress);
+ auto r = verify_picture_asset_type<MonoPictureAsset, MonoPictureAssetReader, MonoPictureFrame>(reel_file_asset, progress);
if (!r) {
- r = verify_picture_asset_type<StereoPictureAsset, StereoPictureAssetReader, StereoPictureFrame>(reel_mxf, progress);
+ r = verify_picture_asset_type<StereoPictureAsset, StereoPictureAssetReader, StereoPictureFrame>(reel_file_asset, progress);
}
DCP_ASSERT (r);
{
vector<string> encrypted;
for (auto i: dcp->cpls()) {
- for (auto j: i->reel_mxfs()) {
+ 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 ReelMXF, so it's possible for
- * ReelMXFs to have assets which are not MXFs.
+ * 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()) {
if ((i->intrinsic_duration() * i->edit_rate().denominator / i->edit_rate().numerator) < 1) {
notes.push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_INTRINSIC_DURATION, i->id()});
}
- auto mxf = dynamic_pointer_cast<ReelMXF>(i);
- if (mxf && !mxf->hash()) {
+ auto file_asset = dynamic_pointer_cast<ReelFileAsset>(i);
+ if (file_asset && !file_asset->hash()) {
notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISSING_HASH, i->id()});
}
}
return notes;
}
+
string
dcp::note_to_string (VerificationNote note)
{
return a.type() == b.type() && a.code() == b.code() && a.note() == b.note() && a.file() == b.file() && a.line() == b.line();
}
+
std::ostream&
dcp::operator<< (std::ostream& s, dcp::VerificationNote const& note)
{