From 561eed2dc9978e890a020b6435ceb0333bb69a61 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 21 Apr 2020 23:07:07 +0200 Subject: [PATCH] Add DCPContent::resolution(). --- src/lib/dcp_content.cc | 21 ++++++++++++++------- src/lib/dcp_content.h | 2 ++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 94d5c010b..6c2db91d3 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -606,13 +606,8 @@ DCPContent::can_reference_video (shared_ptr film, string& why_not) c return false; } - Resolution video_res = RESOLUTION_2K; - if (video->size().width > 2048 || video->size().height > 1080) { - video_res = RESOLUTION_4K; - } - - if (film->resolution() != video_res) { - if (video_res == RESOLUTION_4K) { + if (film->resolution() != resolution()) { + if (resolution() == RESOLUTION_4K) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " why_not = _("it is 4K and the film is 2K."); } else { @@ -738,3 +733,15 @@ DCPContent::kdm_timing_window_valid () const dcp::LocalTime now; return _kdm->not_valid_before() < now && now < _kdm->not_valid_after(); } + + +Resolution +DCPContent::resolution () const +{ + if (video->size().width > 2048 || video->size().height > 1080) { + return RESOLUTION_4K; + } + + return RESOLUTION_2K; +} + diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index b9c4d9ee5..8658ac5ed 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -156,6 +156,8 @@ public: bool kdm_timing_window_valid () const; + Resolution resolution () const; + private: friend class reels_test5; -- 2.30.2