diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-19 00:32:53 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-19 00:32:53 +0100 |
| commit | 1f284533185a798c0ed36669bd6c9729adf6ec5a (patch) | |
| tree | 94dd3de07e0670f1bf1eed0de94ada1033ceb7f6 /src | |
| parent | 37631b4d5e07eddbf052c1cff315d6a98b3bcb73 (diff) | |
Rename encrypted() to any_encrypted() and add all_encrypted().
Diffstat (limited to 'src')
| -rw-r--r-- | src/cpl.cc | 19 | ||||
| -rw-r--r-- | src/cpl.h | 3 | ||||
| -rw-r--r-- | src/dcp.cc | 19 | ||||
| -rw-r--r-- | src/dcp.h | 3 | ||||
| -rw-r--r-- | src/reel.cc | 30 | ||||
| -rw-r--r-- | src/reel.h | 3 | ||||
| -rw-r--r-- | src/verify.cc | 2 |
7 files changed, 66 insertions, 13 deletions
@@ -584,10 +584,10 @@ CPL::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler not /** @return true if we have any encrypted content */ bool -CPL::encrypted () const +CPL::any_encrypted () const { for (auto i: _reels) { - if (i->encrypted ()) { + if (i->any_encrypted()) { return true; } } @@ -595,6 +595,21 @@ CPL::encrypted () const return false; } + +/** @return true if we have all our encryptable content is encrypted */ +bool +CPL::all_encrypted () const +{ + for (auto i: _reels) { + if (!i->all_encrypted()) { + return false; + } + } + + return true; +} + + /** Add a KDM to this CPL. If the KDM is for any of this CPLs assets it will be used * to decrypt those assets. * @param kdm KDM. @@ -93,7 +93,8 @@ public: std::vector<std::shared_ptr<const ReelMXF>> reel_mxfs () const; std::vector<std::shared_ptr<ReelMXF>> reel_mxfs (); - bool encrypted () const; + bool any_encrypted () const; + bool all_encrypted () const; void write_xml ( boost::filesystem::path file, @@ -316,11 +316,12 @@ DCP::add (std::shared_ptr<CPL> cpl) _cpls.push_back (cpl); } + bool -DCP::encrypted () const +DCP::any_encrypted () const { for (auto i: cpls()) { - if (i->encrypted()) { + if (i->any_encrypted()) { return true; } } @@ -328,6 +329,20 @@ DCP::encrypted () const return false; } + +bool +DCP::all_encrypted () const +{ + for (auto i: cpls()) { + if (!i->all_encrypted()) { + return false; + } + } + + return true; +} + + /** Add a KDM to decrypt this DCP. This method must be called after DCP::read() * or the KDM you specify will be ignored. * @param kdm KDM to use. @@ -106,7 +106,8 @@ public: std::vector<std::shared_ptr<CPL>> cpls () const; std::vector<std::shared_ptr<Asset>> assets (bool ignore_unresolved = false) const; - bool encrypted () const; + bool any_encrypted () const; + bool all_encrypted () const; void add (DecryptedKDM const &); diff --git a/src/reel.cc b/src/reel.cc index 89056cff..a05a7b36 100644 --- a/src/reel.cc +++ b/src/reel.cc @@ -223,7 +223,7 @@ Reel::equals (std::shared_ptr<const Reel> other, EqualityOptions opt, NoteHandle } bool -Reel::encrypted () const +Reel::any_encrypted () const { auto ecc = false; for (auto i: _closed_captions) { @@ -233,14 +233,34 @@ Reel::encrypted () const } return ( - (_main_picture && _main_picture->encrypted ()) || - (_main_sound && _main_sound->encrypted ()) || - (_main_subtitle && _main_subtitle->encrypted ()) || + (_main_picture && _main_picture->encrypted()) || + (_main_sound && _main_sound->encrypted()) || + (_main_subtitle && _main_subtitle->encrypted()) || ecc || - (_atmos && _atmos->encrypted ()) + (_atmos && _atmos->encrypted()) ); } + +bool +Reel::all_encrypted () const +{ + auto ecc = true; + for (auto i: _closed_captions) { + if (!i->encrypted()) { + ecc = false; + } + } + + return ( + (!_main_picture || _main_picture->encrypted()) && + (!_main_sound || _main_sound->encrypted()) && + (!_main_subtitle || _main_subtitle->encrypted()) && + ecc && + (!_atmos || _atmos->encrypted()) + ); +} + void Reel::add (DecryptedKDM const & kdm) { @@ -114,7 +114,8 @@ public: xmlpp::Element* write_to_cpl (xmlpp::Element* node, Standard standard) const; - bool encrypted () const; + bool any_encrypted () const; + bool all_encrypted () const; bool equals (std::shared_ptr<const Reel> other, EqualityOptions opt, NoteHandler notes) const; diff --git a/src/verify.cc b/src/verify.cc index 26173a5b..3b0fb7c9 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -1352,7 +1352,7 @@ dcp::verify ( check_extension_metadata (cpl, notes); - if (cpl->encrypted()) { + if (cpl->any_encrypted()) { cxml::Document doc ("CompositionPlaylist"); DCP_ASSERT (cpl->file()); doc.read_file (cpl->file().get()); |
