X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_content.cc;h=f3c0d01cbafc792eb9356ae6b484a6e4e420a1ea;hb=8f8730cadb3dae36e8aa7b7c732a7c162eac0fb6;hp=29ff7e80baeb3f5550f28b674122121f230d381a;hpb=125ef6e49a0a20ab6ee7c95f80c710ec9efc3c00;p=dcpomatic.git diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 29ff7e80b..f3c0d01cb 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2016 Carl Hetherington + Copyright (C) 2013-2019 Carl Hetherington This file is part of DCP-o-matic. @@ -30,9 +30,11 @@ #include "filter.h" #include "film.h" #include "log.h" +#include "config.h" #include "exceptions.h" #include "frame_rate_change.h" #include "text_content.h" +#include "decrypted_ecinema_kdm.h" #include #include extern "C" { @@ -710,4 +712,21 @@ FFmpegContent::add_kdm (EncryptedECinemaKDM kdm) _kdm = kdm; } + +bool +FFmpegContent::kdm_timing_window_valid () const +{ + if (!_kdm) { + return true; + } + + DCPOMATIC_ASSERT (Config::instance()->decryption_chain()->key()); + + DecryptedECinemaKDM decrypted (*_kdm, *Config::instance()->decryption_chain()->key()); + + dcp::LocalTime now; + return (!decrypted.not_valid_before() || *decrypted.not_valid_before() < now) && + (!decrypted.not_valid_after() || now < *decrypted.not_valid_after()); +} + #endif