X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Freel.cc;h=c8ea54ebca5be8a915857877d6328a00541c3243;hb=6f4d2af753813849c5cf0e9e568edad667b8b77a;hp=481b153b93176b6ace07f099d7b203dc367d5ad6;hpb=59617eb2230e47b59882c4f9ca6092ce05f53cf1;p=libdcp.git diff --git a/src/reel.cc b/src/reel.cc index 481b153b..c8ea54eb 100644 --- a/src/reel.cc +++ b/src/reel.cc @@ -17,13 +17,18 @@ */ +#include #include "reel.h" #include "util.h" #include "picture_asset.h" #include "sound_asset.h" #include "subtitle_asset.h" +#include "kdm.h" -using namespace std; +using std::string; +using std::list; +using std::cout; +using boost::shared_ptr; using namespace libdcp; void @@ -79,3 +84,23 @@ Reel::equals (boost::shared_ptr other, EqualityOptions opt, boost::f return true; } +bool +Reel::encrypted () const +{ + return ((_main_picture && _main_picture->encrypted ()) || (_main_sound && _main_sound->encrypted ())); +} + +void +Reel::add_kdm (KDM const & kdm) +{ + list ciphers = kdm.ciphers (); + + for (list::iterator i = ciphers.begin(); i != ciphers.end(); ++i) { + if (i->key_id() == _main_picture->key_id()) { + _main_picture->set_kdm_cipher (*i); + } + if (i->key_id() == _main_sound->key_id()) { + _main_sound->set_kdm_cipher (*i); + } + } +}