X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Ffilm.cc;h=4d6b3d7e3b4fa132bf54b9e75fa568246f1e3615;hp=0000dca10485c63a09ffb9c41de1dce8d426c109;hb=254b3044d72de6b033d7c584f5abd2b9aa70aad5;hpb=609dd231fcbd8e44d4a857f0974ffc2a2a45bfca diff --git a/src/lib/film.cc b/src/lib/film.cc index 0000dca10..4d6b3d7e3 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -157,6 +157,7 @@ Film::Film (optional 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,11 +399,19 @@ Film::metadata (bool with_content_paths) const root->add_child("ReelType")->add_child_text (raw_convert (static_cast (_reel_type))); root->add_child("ReelLength")->add_child_text (raw_convert (_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; } +void +Film::write_metadata (boost::filesystem::path path) const +{ + shared_ptr doc = metadata (); + doc->write_to_file_formatted (path.string()); +} + /** Write state to our `metadata' file */ void Film::write_metadata () const @@ -505,6 +514,7 @@ Film::read_metadata (optional path) _reel_type = static_cast (f.optional_number_child("ReelType").get_value_or (static_cast(REELTYPE_SINGLE))); _reel_length = f.optional_number_child("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 notes; /* This method is the only one that can return notes (so far) */ @@ -936,6 +946,13 @@ Film::set_upload_after_make_dcp (bool u) _upload_after_make_dcp = u; } +void +Film::set_reencode_j2k (bool r) +{ + ChangeSignaller ch (this, REENCODE_J2K); + _reencode_j2k = r; +} + void Film::signal_change (ChangeType type, int p) { @@ -957,9 +974,8 @@ Film::signal_change (ChangeType type, Property p) if (p == Film::VIDEO_FRAME_RATE || p == Film::SEQUENCE) { /* We want to call Playlist::maybe_sequence but this must happen after the main signal emission (since the butler will see that emission and un-suspend itself). - Doing it this way ensures that the Change signal above is emitted first. */ - signal_manager->when_idle (boost::bind(&Playlist::maybe_sequence, _playlist.get())); + emit (boost::bind(&Playlist::maybe_sequence, _playlist.get(), shared_from_this())); } } else { Change (type, p); @@ -1100,7 +1116,7 @@ Film::maybe_add_content (weak_ptr j, weak_ptr c, bool disable_audi if (Config::instance()->automatic_audio_analysis() && content->audio && !disable_audio_analysis) { shared_ptr playlist (new Playlist); - playlist->add (content); + playlist->add (shared_from_this(), content); boost::signals2::connection c; JobManager::instance()->analyse_audio ( shared_from_this(), playlist, false, c, bind (&Film::audio_analysis_finished, this) @@ -1114,9 +1130,9 @@ Film::add_content (shared_ptr c) { /* Add {video,subtitle} content after any existing {video,subtitle} content */ if (c->video) { - c->set_position (_playlist->video_end()); + c->set_position (shared_from_this(), _playlist->video_end(shared_from_this())); } else if (!c->text.empty()) { - c->set_position (_playlist->text_end()); + c->set_position (shared_from_this(), _playlist->text_end(shared_from_this())); } if (_template_film) { @@ -1126,7 +1142,7 @@ Film::add_content (shared_ptr c) } } - _playlist->add (c); + _playlist->add (shared_from_this(), c); } void @@ -1138,20 +1154,20 @@ Film::remove_content (shared_ptr c) void Film::move_content_earlier (shared_ptr c) { - _playlist->move_earlier (c); + _playlist->move_earlier (shared_from_this(), c); } void Film::move_content_later (shared_ptr c) { - _playlist->move_later (c); + _playlist->move_later (shared_from_this(), c); } /** @return length of the film from time 0 to the last thing on the playlist */ DCPTime Film::length () const { - return _playlist->length().ceil(video_frame_rate()); + return _playlist->length(shared_from_this()).ceil(video_frame_rate()); } int @@ -1243,7 +1259,7 @@ Film::frame_size () const } /** @param recipient KDM recipient certificate. - * @param trusted_devices Certificates of other trusted devices (can be empty). + * @param trusted_devices Certificate thumbprints of other trusted devices (can be empty). * @param cpl_file CPL filename. * @param from KDM from time expressed as a local time with an offset from UTC. * @param until KDM to time expressed as a local time with an offset from UTC. @@ -1255,7 +1271,7 @@ Film::frame_size () const dcp::EncryptedKDM Film::make_kdm ( dcp::Certificate recipient, - vector trusted_devices, + vector trusted_devices, boost::filesystem::path cpl_file, dcp::LocalTime from, dcp::LocalTime until, @@ -1341,7 +1357,7 @@ Film::make_kdms ( if (i->recipient) { dcp::EncryptedKDM const kdm = make_kdm ( i->recipient.get(), - i->trusted_devices, + i->trusted_device_thumbprints(), cpl_file, dcp::LocalTime (from, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()), dcp::LocalTime (until, i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()), @@ -1363,7 +1379,7 @@ Film::make_kdms ( uint64_t Film::required_disk_space () const { - return _playlist->required_disk_space (j2k_bandwidth(), audio_channels(), audio_frame_rate()); + return _playlist->required_disk_space (shared_from_this(), j2k_bandwidth(), audio_channels(), audio_frame_rate()); } /** This method checks the disk that the Film is on and tries to decide whether or not @@ -1497,7 +1513,7 @@ Film::audio_output_names () const void Film::repeat_content (ContentList c, int n) { - _playlist->repeat (c, n); + _playlist->repeat (shared_from_this(), c, n); } void @@ -1538,7 +1554,7 @@ Film::reels () const } } - DCPTime video_end = last_video ? last_video->end() : DCPTime(0); + DCPTime video_end = last_video ? last_video->end(shared_from_this()) : DCPTime(0); if (last_split) { /* Definitely go from the last split to the end of the video content */ p.push_back (DCPTimePeriod (last_split.get(), video_end)); @@ -1573,7 +1589,7 @@ Film::reels () const string Film::content_summary (DCPTimePeriod period) const { - return _playlist->content_summary (period); + return _playlist->content_summary (shared_from_this(), period); } void