diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-09-25 02:10:44 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-09-25 02:10:44 +0200 |
| commit | c0418f2a763407424d986c82ed147fbeaa2d9416 (patch) | |
| tree | d59c1e80a82b5d25d1f48bbfe4790126ba865077 | |
| parent | 540b9948e4a2fd4e52a2b29ed2089a0dc61d4cc6 (diff) | |
| parent | 152266f6e65451a03521eb04b6a406b6e309e17a (diff) | |
Merge remote-tracking branch 'origin/main' into v1.9.xv1.9.22
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | src/dcp.cc | 2 | ||||
| -rw-r--r-- | src/dcp.h | 1 | ||||
| -rw-r--r-- | src/filesystem.cc | 18 | ||||
| -rw-r--r-- | src/filesystem.h | 9 | ||||
| -rw-r--r-- | src/mono_j2k_picture_asset.cc | 1 | ||||
| -rw-r--r-- | src/mxf.h | 1 | ||||
| -rw-r--r-- | src/pkl.cc | 18 | ||||
| -rw-r--r-- | src/pkl.h | 5 | ||||
| -rw-r--r-- | src/verify.cc | 2 | ||||
| -rw-r--r-- | src/verify.h | 7 | ||||
| -rw-r--r-- | test/dcp_test.cc | 1 | ||||
| -rw-r--r-- | tools/dcpdiff.cc | 1 | ||||
| -rw-r--r-- | wscript | 21 |
14 files changed, 73 insertions, 16 deletions
@@ -24,7 +24,7 @@ Bugfixes were received from Philip Tschiemer. # Dependencies - pkg-config (for build system) -- boost (1.45 or above): filesystem, signals2, datetime and unit testing libraries +- boost (1.45 or above): filesystem, datetime and unit testing libraries - openssl - libxml++ - xmlsec @@ -159,7 +159,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m } for (auto i: pkl_paths) { - _pkls.push_back(make_shared<PKL>(i)); + _pkls.push_back(make_shared<PKL>(i, notes)); } /* Now we have: @@ -49,7 +49,6 @@ #include "util.h" #include "verify.h" #include "version.h" -#include <boost/signals2.hpp> #include <memory> #include <string> #include <vector> diff --git a/src/filesystem.cc b/src/filesystem.cc index 428bb029..4cbbc3d4 100644 --- a/src/filesystem.cc +++ b/src/filesystem.cc @@ -107,9 +107,15 @@ dcp::filesystem::copy_file(boost::filesystem::path const& from, boost::filesyste void -dcp::filesystem::copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, boost::filesystem::copy_option option) +dcp::filesystem::copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, CopyOptions option) { - boost::filesystem::copy_file(dcp::filesystem::fix_long_path(from), dcp::filesystem::fix_long_path(to), option); +#ifdef LIBDCP_HAVE_COPY_OPTIONS + auto const options = option == CopyOptions::OVERWRITE_EXISTING ? boost::filesystem::copy_options::overwrite_existing : boost::filesystem::copy_options::none; +#else + auto const options = option == CopyOptions::OVERWRITE_EXISTING ? boost::filesystem::copy_option::overwrite_if_exists : boost::filesystem::copy_option::none; +#endif + + boost::filesystem::copy_file(dcp::filesystem::fix_long_path(from), dcp::filesystem::fix_long_path(to), options); } @@ -247,7 +253,7 @@ dcp::filesystem::create_symlink(boost::filesystem::path const& from, boost::file std::string dcp::filesystem::extension(boost::filesystem::path const& path) { - return boost::filesystem::extension(dcp::filesystem::fix_long_path(path)); + return dcp::filesystem::fix_long_path(path).extension().string(); } @@ -297,7 +303,13 @@ dcp::filesystem::rename(boost::filesystem::path const& old_path, boost::filesyst boost::filesystem::path dcp::filesystem::change_extension(boost::filesystem::path const& path, std::string const& new_extension) { +#ifdef LIBDCP_HAVE_REPLACE_EXTENSION + auto copy = path; + copy.replace_extension(new_extension); + return copy; +#else return boost::filesystem::change_extension(path, new_extension); +#endif } diff --git a/src/filesystem.h b/src/filesystem.h index 53ec209d..a06dc69e 100644 --- a/src/filesystem.h +++ b/src/filesystem.h @@ -51,7 +51,14 @@ boost::filesystem::path change_extension(boost::filesystem::path const& from, st void copy(boost::filesystem::path const& from, boost::filesystem::path const& to); void copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to); void copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, boost::system::error_code& ec); -void copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, boost::filesystem::copy_option ec); + +enum class CopyOptions +{ + NONE, + OVERWRITE_EXISTING +}; + +void copy_file(boost::filesystem::path const& from, boost::filesystem::path const& to, CopyOptions options); bool create_directory(boost::filesystem::path const& path); bool create_directory(boost::filesystem::path const& path, boost::system::error_code& ec); bool create_directories(boost::filesystem::path const& path); diff --git a/src/mono_j2k_picture_asset.cc b/src/mono_j2k_picture_asset.cc index f718525d..b1f311d6 100644 --- a/src/mono_j2k_picture_asset.cc +++ b/src/mono_j2k_picture_asset.cc @@ -48,6 +48,7 @@ #include "mono_j2k_picture_frame.h" #include <asdcp/AS_DCP.h> #include <asdcp/KM_fileio.h> +#include <boost/bind/bind.hpp> using std::dynamic_pointer_cast; @@ -45,7 +45,6 @@ #include "key.h" #include "metadata.h" #include "dcp_assert.h" -#include <boost/signals2.hpp> namespace ASDCP { @@ -44,6 +44,7 @@ #include "raw_convert.h" #include "util.h" #include "warnings.h" +#include "verify.h" LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> LIBDCP_ENABLE_WARNINGS @@ -53,15 +54,18 @@ LIBDCP_ENABLE_WARNINGS using std::string; using std::shared_ptr; using std::make_shared; +using std::vector; using boost::optional; using namespace dcp; static string const pkl_interop_ns = "http://www.digicine.com/PROTO-ASDCP-PKL-20040311#"; static string const pkl_smpte_ns = "http://www.smpte-ra.org/schemas/429-8/2007/PKL"; +/* I don't know why Resolve are using this namespace but apparently they are */ +static string const pkl_resolve_smpte_ns = "http://www.smpte-ra.org/schemas/2067-2/2016/PKL"; -PKL::PKL (boost::filesystem::path file) +PKL::PKL(boost::filesystem::path file, vector<dcp::VerificationNote>* notes) : _file (file) { cxml::Document pkl ("PackingList"); @@ -71,6 +75,18 @@ PKL::PKL (boost::filesystem::path file) _standard = Standard::INTEROP; } else if (pkl.namespace_uri() == pkl_smpte_ns) { _standard = Standard::SMPTE; + } else if (pkl.namespace_uri() == pkl_resolve_smpte_ns) { + _standard = Standard::SMPTE; + if (notes) { + notes->push_back( + dcp::VerificationNote( + dcp::VerificationNote::Type::ERROR, + dcp::VerificationNote::Code::INVALID_PKL_NAMESPACE, + pkl.namespace_uri(), + file + ) + ); + } } else { boost::throw_exception(XMLError("Unrecognised packing list namespace " + pkl.namespace_uri())); } @@ -52,6 +52,9 @@ namespace dcp { +class VerificationNote; + + class PKL : public Object, public AssetList { public: @@ -59,7 +62,7 @@ public: : AssetList(standard, annotation_text, issue_date, issuer, creator) {} - explicit PKL (boost::filesystem::path file); + explicit PKL(boost::filesystem::path file, std::vector<dcp::VerificationNote>* notes = nullptr); boost::optional<std::string> hash (std::string id) const; boost::optional<std::string> type (std::string id) const; diff --git a/src/verify.cc b/src/verify.cc index 9abda0ff..a0b8284f 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -2212,6 +2212,8 @@ dcp::note_to_string(VerificationNote note, function<string (string)> process_str return compose("The namespace %1 in CPL %2 is invalid", note.note().get(), note.cpl_id().get()); case VerificationNote::Code::MISSING_CPL_CONTENT_VERSION: return compose("The CPL %1 has no <ContentVersion> tag", note.cpl_id().get()); + case VerificationNote::Code::INVALID_PKL_NAMESPACE: + return compose("The namespace %1 in PKL %2 is invalid", note.note().get(), note.file()->filename()); } return ""; diff --git a/src/verify.h b/src/verify.h index 01ea0efe..16323261 100644 --- a/src/verify.h +++ b/src/verify.h @@ -506,7 +506,12 @@ public: /** A SMPTE CPL does not contain a _<ContentVersion>_ tag * file contains the CPL filename */ - MISSING_CPL_CONTENT_VERSION + MISSING_CPL_CONTENT_VERSION, + /** The PKL namespace is not valid. + * note contains the invalid namespace + * file contains the PKL filename + */ + INVALID_PKL_NAMESPACE }; VerificationNote (Type type, Code code) diff --git a/test/dcp_test.cc b/test/dcp_test.cc index f0a2e4f5..b59386f3 100644 --- a/test/dcp_test.cc +++ b/test/dcp_test.cc @@ -53,6 +53,7 @@ #include "test.h" #include <asdcp/KM_util.h> #include <sndfile.h> +#include <boost/bind.hpp> #include <boost/test/unit_test.hpp> diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc index 6c101ab0..e4dee74a 100644 --- a/tools/dcpdiff.cc +++ b/tools/dcpdiff.cc @@ -39,6 +39,7 @@ #include "filesystem.h" #include "mxf.h" #include <getopt.h> +#include <boost/bind.hpp> #include <boost/optional.hpp> #include <memory> #include <boost/filesystem.hpp> @@ -237,11 +237,22 @@ def configure(conf): define_name='LIBDCP_HAVE_WEAKLY_CANONICAL') conf.check_cxx(fragment=""" - #include <boost/signals2.hpp>\n - int main() { boost::signals2::signal<void (int)> x; }\n - """, - msg='Checking for boost signals2 library', - uselib_store='BOOST_SIGNALS2') + #include <boost/filesystem.hpp>\n + int main() { auto x = boost::filesystem::copy_options(); }\n + """, + mandatory=False, + msg='Checking for boost::filesystem::copy_options', + uselib='BOOST_FILESYSTEM', + define_name='LIBDCP_HAVE_COPY_OPTIONS') + + conf.check_cxx(fragment=""" + #include <boost/filesystem.hpp>\n + int main() { boost::filesystem::path y = "foo"; y.replace_extension("bar"); }\n + """, + mandatory=False, + msg='Checking for boost::filesystem::replace_extension', + uselib='BOOST_FILESYSTEM', + define_name='LIBDCP_HAVE_REPLACE_EXTENSION') conf.check_cxx(fragment=""" #include <boost/date_time.hpp>\n |
