diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-10-27 21:00:41 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-10-31 11:34:16 +0000 |
| commit | 83efe84020dc0ba2801c4b305448790720fe133f (patch) | |
| tree | cbe46d9cbcad21e9495f2624e2c8c8f61e1ca0e3 /src/lib | |
| parent | 5b04f870694373ad9c6086aed5ab38b0c6b41ccc (diff) | |
Use the same ContextID whenever encrypting the picture asset for a project;
this ensures that resumption of encodes works. Before this, a random ContextID
would be created for each run (#980).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 3 | ||||
| -rw-r--r-- | src/lib/film.h | 9 | ||||
| -rw-r--r-- | src/lib/reel_writer.cc | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 1a1957d33..d331516dd 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -132,6 +132,7 @@ Film::Film (optional<boost::filesystem::path> dir) , _resolution (RESOLUTION_2K) , _signed (true) , _encrypted (false) + , _context_id (dcp::make_uuid ()) , _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ()) , _isdcf_metadata (Config::instance()->default_isdcf_metadata ()) , _video_frame_rate (24) @@ -361,6 +362,7 @@ Film::metadata (bool with_content_paths) const root->add_child("Signed")->add_child_text (_signed ? "1" : "0"); root->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0"); root->add_child("Key")->add_child_text (_key.hex ()); + root->add_child("ContextID")->add_child_text (_context_id); if (_audio_processor) { root->add_child("AudioProcessor")->add_child_text (_audio_processor->id ()); } @@ -463,6 +465,7 @@ Film::read_metadata (optional<boost::filesystem::path> path) _three_d = f.bool_child ("ThreeD"); _interop = f.bool_child ("Interop"); _key = dcp::Key (f.string_child ("Key")); + _context_id = f.optional_string_child("ContextID").get_value_or (dcp::make_uuid ()); if (f.optional_string_child ("AudioProcessor")) { _audio_processor = AudioProcessor::from_id (f.string_child ("AudioProcessor")); diff --git a/src/lib/film.h b/src/lib/film.h index ad94852a2..2b700b007 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -284,6 +284,11 @@ public: return _upload_after_make_dcp; } + std::string context_id () const { + return _context_id; + } + + /* SET */ void set_directory (boost::filesystem::path); @@ -357,6 +362,10 @@ private: bool _signed; bool _encrypted; dcp::Key _key; + /** context ID used when encrypting picture assets; we keep it so that we can + * re-start picture MXF encodes. + */ + std::string _context_id; /** bandwidth for J2K files in bits per second */ int _j2k_bandwidth; /** ISDCF naming stuff */ diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 398c9c66d..bf232579f 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -88,6 +88,7 @@ ReelWriter::ReelWriter ( if (_film->encrypted ()) { _picture_asset->set_key (_film->key ()); + _picture_asset->set_context_id (_film->context_id ()); } _picture_asset->set_file ( |
