diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-11-07 23:26:51 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-11-07 23:26:51 +0000 |
| commit | 75538d19688ad8c29c5949de9bff9f044c713936 (patch) | |
| tree | f16509ab4ceb02be3e4b5cc07042cfa043003709 /src/lib | |
| parent | a3ec24ce1952a3bfd556d30b50cee79cc57436cb (diff) | |
Add button to force re-encode of J2K content.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 10 | ||||
| -rw-r--r-- | src/lib/film.h | 9 | ||||
| -rw-r--r-- | src/lib/j2k_encoder.cc | 2 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 807aeaf2f..2ff02d799 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -157,6 +157,7 @@ Film::Film (optional<boost::filesystem::path> dir) , _reel_type (REELTYPE_SINGLE) , _reel_length (2000000000) , _upload_after_make_dcp (Config::instance()->default_upload_after_make_dcp()) + , _reencode_j2k (false) , _state_version (current_state_version) , _dirty (false) { @@ -398,6 +399,7 @@ Film::metadata (bool with_content_paths) const root->add_child("ReelType")->add_child_text (raw_convert<string> (static_cast<int> (_reel_type))); root->add_child("ReelLength")->add_child_text (raw_convert<string> (_reel_length)); root->add_child("UploadAfterMakeDCP")->add_child_text (_upload_after_make_dcp ? "1" : "0"); + root->add_child("ReencodeJ2K")->add_child_text (_reencode_j2k ? "1" : "0"); _playlist->as_xml (root->add_child ("Playlist"), with_content_paths); return doc; @@ -512,6 +514,7 @@ Film::read_metadata (optional<boost::filesystem::path> path) _reel_type = static_cast<ReelType> (f.optional_number_child<int>("ReelType").get_value_or (static_cast<int>(REELTYPE_SINGLE))); _reel_length = f.optional_number_child<int64_t>("ReelLength").get_value_or (2000000000); _upload_after_make_dcp = f.optional_bool_child("UploadAfterMakeDCP").get_value_or (false); + _reencode_j2k = f.optional_bool_child("ReencodeJ2K").get_value_or(false); list<string> notes; /* This method is the only one that can return notes (so far) */ @@ -944,6 +947,13 @@ Film::set_upload_after_make_dcp (bool u) } void +Film::set_reencode_j2k (bool r) +{ + ChangeSignaller<Film> ch (this, REENCODE_J2K); + _reencode_j2k = r; +} + +void Film::signal_change (ChangeType type, int p) { signal_change (type, static_cast<Property>(p)); diff --git a/src/lib/film.h b/src/lib/film.h index 273077f8f..d251c7fcc 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -204,7 +204,8 @@ public: AUDIO_PROCESSOR, REEL_TYPE, REEL_LENGTH, - UPLOAD_AFTER_MAKE_DCP + UPLOAD_AFTER_MAKE_DCP, + REENCODE_J2K }; @@ -296,6 +297,10 @@ public: return _context_id; } + bool reencode_j2k () const { + return _reencode_j2k; + } + /* SET */ @@ -326,6 +331,7 @@ public: void set_reel_type (ReelType); void set_reel_length (int64_t); void set_upload_after_make_dcp (bool); + void set_reencode_j2k (bool); /** Emitted when some property has of the Film is about to change or has changed */ mutable boost::signals2::signal<void (ChangeType, Property)> Change; @@ -399,6 +405,7 @@ private: /** Desired reel length in bytes, if _reel_type == REELTYPE_BY_LENGTH */ int64_t _reel_length; bool _upload_after_make_dcp; + bool _reencode_j2k; int _state_version; diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc index e62e708cc..f92f23168 100644 --- a/src/lib/j2k_encoder.cc +++ b/src/lib/j2k_encoder.cc @@ -216,7 +216,7 @@ J2KEncoder::encode (shared_ptr<PlayerVideo> pv, DCPTime time) LOG_DEBUG_ENCODE("Frame @ %1 FAKE", to_string(time)); _writer->fake_write (position, pv->eyes ()); frame_done (); - } else if (pv->has_j2k ()) { + } else if (pv->has_j2k() && !_film->reencode_j2k()) { LOG_DEBUG_ENCODE("Frame @ %1 J2K", to_string(time)); /* This frame already has J2K data, so just write it */ _writer->write (pv->j2k(), position, pv->eyes ()); |
