From 93a706be8996dadfd6d307a942f304d4948d6020 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 15 Apr 2020 01:56:31 +0200 Subject: [PATCH] Provide better information on what will happen to JPEG2000 content in inputs (part of #1471). --- src/lib/content.cc | 15 +++++++++++++++ src/lib/content.h | 3 +++ src/lib/dcp_content.cc | 28 ++++++++++++++++++++++++++++ src/lib/dcp_content.h | 2 ++ src/lib/player_video.cc | 2 ++ src/wx/video_panel.cc | 5 ++++- 6 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/lib/content.cc b/src/lib/content.cc index 4242477d4..79f50d985 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -511,3 +511,18 @@ Content::add_path (boost::filesystem::path p) _paths.push_back (p); _last_write_times.push_back (boost::filesystem::last_write_time(p)); } + + +string +Content::video_processing_description (boost::shared_ptr film) const +{ + return video ? video->processing_description(film) : ""; +} + + +string +Content::audio_processing_description (boost::shared_ptr film) const +{ + return audio ? audio->processing_description(film) : ""; +} + diff --git a/src/lib/content.h b/src/lib/content.h index a2d78aa68..543e3cba0 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -98,6 +98,9 @@ public: */ virtual std::list reel_split_points (boost::shared_ptr) const; + virtual std::string video_processing_description (boost::shared_ptr film) const; + virtual std::string audio_processing_description (boost::shared_ptr film) const; + boost::shared_ptr clone () const; void set_paths (std::vector paths); diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index ca210b558..07bd946b0 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -760,3 +760,31 @@ DCPContent::resolution () const return RESOLUTION_2K; } +string +DCPContent::video_processing_description (shared_ptr film) const +{ + /* This and PlayerVideo::has_j2k() need to be kept in sync */ + + if (!video) { + return ""; + } + + string s = video->processing_description (film); + + /* XXX: overlapping burnt subs... */ + + if (video->crop() != Crop()) { + s += _("JPEG2000 video will be re-compressed because the image is cropped."); + } else if (film->frame_size() != video->size()) { + s += _("JPEG2000 video will be re-compressed because the project's container is different to the DCP's."); + } else if (video->fade_in() || video->fade_out()) { + s += _("JPEG2000 video will be re-compressed because fades have been set up."); + } else if (video->colour_conversion()) { + s += _("JPEG2000 video will be re-compressed because the colour conversion is not set to 'None'"); + } else { + s += _("JPEG2000 video will be passed through without any change."); + } + + return s; +} + diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 6d707670f..16c546e96 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -74,6 +74,8 @@ public: void set_default_colour_conversion (); std::list reel_split_points (boost::shared_ptr film) const; + std::string video_processing_description (boost::shared_ptr film) const; + std::vector directories () const; bool encrypted () const { diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc index 10e798ed5..1dd64540a 100644 --- a/src/lib/player_video.cc +++ b/src/lib/player_video.cc @@ -224,6 +224,8 @@ PlayerVideo::has_j2k () const { /* XXX: maybe other things */ + /* This and DCPContent::processing_description() need to be kept in sync */ + shared_ptr j2k = dynamic_pointer_cast (_in); if (!j2k) { return false; diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 4be9a741f..56d995e9c 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -398,6 +398,7 @@ VideoPanel::film_content_changed (int property) } else { checked_set (_colour_conversion, 0); } + setup_description (); } else if (check.size() > 1) { /* Add a "many" entry and select it as an indication that multiple different * colour conversions are present in the selection. @@ -436,6 +437,7 @@ VideoPanel::film_content_changed (int property) } else { _fade_in->clear (); } + setup_description (); } else if (property == VideoContentProperty::FADE_OUT) { set check; BOOST_FOREACH (shared_ptr i, vc) { @@ -450,6 +452,7 @@ VideoPanel::film_content_changed (int property) } else { _fade_out->clear (); } + setup_description (); } else if (property == DCPContentProperty::REFERENCE_VIDEO) { if (vc.size() == 1) { shared_ptr dcp = dynamic_pointer_cast (vc.front ()); @@ -511,7 +514,7 @@ VideoPanel::setup_description () return; } - string d = vc.front()->video->processing_description (_parent->film()); + string d = vc.front()->video_processing_description (_parent->film()); size_t lines = count (d.begin(), d.end(), '\n'); for (int i = lines; i < 6; ++i) { -- 2.30.2