summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-06-06 22:10:40 +0100
committerCarl Hetherington <cth@carlh.net>2019-06-09 22:33:49 +0100
commite6f2a4b0085b35be378f2cdd687146857d61df80 (patch)
tree98bf0fe5057db49e1e58afc7769305264073b271 /src/lib/ffmpeg_content.cc
parent951d70db4f81b5ddd4093f11853637c8ecbe63c5 (diff)
swaroop: support validity periods in ecinema KDMs.
Diffstat (limited to 'src/lib/ffmpeg_content.cc')
-rw-r--r--src/lib/ffmpeg_content.cc21
1 files changed, 20 insertions, 1 deletions
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 <cth@carlh.net>
+ Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
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 <dcp/raw_convert.h>
#include <libcxml/cxml.h>
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