From a332bd6be323f03dad5b180fb237afe54f1bf81e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 23 Nov 2020 13:58:33 +0100 Subject: [PATCH] Remove swaroop variant. --- cscript | 3 - platform/linux/wscript | 58 +-- platform/windows/wscript | 6 +- src/lib/checker.cc | 86 ---- src/lib/checker.h | 65 --- src/lib/config.cc | 95 ---- src/lib/config.h | 97 ---- src/lib/decrypted_ecinema_kdm.cc | 101 ---- src/lib/decrypted_ecinema_kdm.h | 65 --- src/lib/dkdm_recipient.cc | 2 +- src/lib/dkdm_wrapper.cc | 18 - src/lib/dkdm_wrapper.h | 23 - src/lib/encrypted_ecinema_kdm.cc | 113 ----- src/lib/encrypted_ecinema_kdm.h | 67 --- src/lib/ffmpeg.cc | 8 - src/lib/ffmpeg_content.cc | 50 -- src/lib/ffmpeg_content.h | 29 -- src/lib/ffmpeg_decoder.cc | 6 - src/lib/ffmpeg_encoder.cc | 30 +- src/lib/ffmpeg_encoder.h | 8 - src/lib/ffmpeg_examiner.cc | 7 - src/lib/ffmpeg_examiner.h | 10 - src/lib/ffmpeg_file_encoder.cc | 23 - src/lib/ffmpeg_file_encoder.h | 4 - src/lib/kdm_with_metadata.h | 42 +- src/lib/lock_file_checker.cc | 54 --- src/lib/lock_file_checker.h | 36 -- src/lib/monitor_checker.cc | 52 -- src/lib/monitor_checker.h | 36 -- src/lib/player_video.h | 4 +- src/lib/screen.cc | 2 +- src/lib/swaroop_spl.cc | 71 --- src/lib/swaroop_spl.h | 112 ----- src/lib/swaroop_spl_entry.cc | 72 --- src/lib/swaroop_spl_entry.h | 63 --- src/lib/util.cc | 105 ---- src/lib/util.h | 8 - src/lib/wscript | 8 - src/tools/dcpomatic.cc | 6 +- src/tools/dcpomatic_kdm.cc | 84 +--- src/tools/dcpomatic_kdm_cli.cc | 2 +- src/tools/dcpomatic_player.cc | 84 ---- src/tools/swaroop_dcpomatic_ecinema.cc | 312 ------------ src/tools/swaroop_dcpomatic_playlist.cc | 482 ------------------- src/tools/swaroop_dcpomatic_uuid.cc | 40 -- src/tools/wscript | 27 +- src/wx/config_dialog.cc | 32 -- src/wx/config_dialog.h | 7 - src/wx/film_viewer.cc | 10 - src/wx/film_viewer.h | 15 - src/wx/player_config_dialog.cc | 205 -------- src/wx/simple_video_view.cc | 34 -- src/wx/swaroop_controls.cc | 610 ------------------------ src/wx/swaroop_controls.h | 90 ---- src/wx/video_view.cc | 3 - src/wx/video_view.h | 6 - src/wx/wscript | 5 +- test/ecinema_kdm_test.cc | 95 ---- test/ffmpeg_encoder_test.cc | 72 +-- test/util_test.cc | 21 - test/wscript | 1 - wscript | 6 - 62 files changed, 71 insertions(+), 3817 deletions(-) delete mode 100644 src/lib/checker.cc delete mode 100644 src/lib/checker.h delete mode 100644 src/lib/decrypted_ecinema_kdm.cc delete mode 100644 src/lib/decrypted_ecinema_kdm.h delete mode 100644 src/lib/encrypted_ecinema_kdm.cc delete mode 100644 src/lib/encrypted_ecinema_kdm.h delete mode 100644 src/lib/lock_file_checker.cc delete mode 100644 src/lib/lock_file_checker.h delete mode 100644 src/lib/monitor_checker.cc delete mode 100644 src/lib/monitor_checker.h delete mode 100644 src/lib/swaroop_spl.cc delete mode 100644 src/lib/swaroop_spl.h delete mode 100644 src/lib/swaroop_spl_entry.cc delete mode 100644 src/lib/swaroop_spl_entry.h delete mode 100644 src/tools/swaroop_dcpomatic_ecinema.cc delete mode 100644 src/tools/swaroop_dcpomatic_playlist.cc delete mode 100644 src/tools/swaroop_dcpomatic_uuid.cc delete mode 100644 src/wx/swaroop_controls.cc delete mode 100644 src/wx/swaroop_controls.h delete mode 100644 test/ecinema_kdm_test.cc diff --git a/cscript b/cscript index 6c70828f7..990ad52f3 100644 --- a/cscript +++ b/cscript @@ -285,9 +285,6 @@ def make_spec(filename, version, target, options, requires=None): print('%{_bindir}/dcpomatic2_playlist', file=f) print('%{_bindir}/dcpomatic2_openssl', file=f) print('%{_bindir}/dcpomatic2_combiner', file=f) - if options['variant'] == 'swaroop-studio': - print('%{_bindir}/dcpomatic2_ecinema', file=f) - print('%{_bindir}/dcpomatic2_uuid', file=f) if os.path.exists(os.path.join(tools, "dcpomatic2_disk")): print('%{_bindir}/dcpomatic2_disk', file=f) print('%{_bindir}/dcpomatic2_disk_writer', file=f) diff --git a/platform/linux/wscript b/platform/linux/wscript index dad5778a6..4b6f7f7aa 100644 --- a/platform/linux/wscript +++ b/platform/linux/wscript @@ -1,42 +1,42 @@ def build(bld): desktops = [] - if bld.env.VARIANT != 'swaroop-theater': - obj = bld(features='subst') - obj.source = 'dcpomatic.desktop.in' - obj.target = 'dcpomatic2.desktop' - obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX - obj.VERSION = bld.env.VERSION - desktops.append(obj.target) - obj = bld(features='subst') - obj.source = 'dcpomatic_batch.desktop.in' - obj.target = 'dcpomatic2_batch.desktop' - obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX - obj.VERSION = bld.env.VERSION - desktops.append(obj.target) + obj = bld(features='subst') + obj.source = 'dcpomatic.desktop.in' + obj.target = 'dcpomatic2.desktop' + obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX + obj.VERSION = bld.env.VERSION + desktops.append(obj.target) - obj = bld(features='subst') - obj.source = 'dcpomatic_server.desktop.in' - obj.target = 'dcpomatic2_server.desktop' - obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX - obj.VERSION = bld.env.VERSION - desktops.append(obj.target) + obj = bld(features='subst') + obj.source = 'dcpomatic_batch.desktop.in' + obj.target = 'dcpomatic2_batch.desktop' + obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX + obj.VERSION = bld.env.VERSION + desktops.append(obj.target) + obj = bld(features='subst') + obj.source = 'dcpomatic_server.desktop.in' + obj.target = 'dcpomatic2_server.desktop' + obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX + obj.VERSION = bld.env.VERSION + desktops.append(obj.target) + + obj = bld(features='subst') + obj.source = 'dcpomatic_kdm.desktop.in' + obj.target = 'dcpomatic2_kdm.desktop' + obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX + obj.VERSION = bld.env.VERSION + desktops.append(obj.target) + + if bld.env.ENABLE_DISK: obj = bld(features='subst') - obj.source = 'dcpomatic_kdm.desktop.in' - obj.target = 'dcpomatic2_kdm.desktop' + obj.source = 'dcpomatic_disk.desktop.in' + obj.target = 'dcpomatic2_disk.desktop' obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX obj.VERSION = bld.env.VERSION desktops.append(obj.target) - if bld.env.ENABLE_DISK: - obj = bld(features='subst') - obj.source = 'dcpomatic_disk.desktop.in' - obj.target = 'dcpomatic2_disk.desktop' - obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX - obj.VERSION = bld.env.VERSION - desktops.append(obj.target) - obj = bld(features='subst') obj.source = 'dcpomatic_player.desktop.in' obj.target = 'dcpomatic2_player.desktop' diff --git a/platform/windows/wscript b/platform/windows/wscript index 2d0c464ec..47044c8dd 100644 --- a/platform/windows/wscript +++ b/platform/windows/wscript @@ -1,7 +1,7 @@ from __future__ import print_function import os -def write_installer(bits, dcpomatic_version, debug, variant, disk): +def write_installer(bits, dcpomatic_version, debug, disk): tools = [ ('batch', 'Batch Converter'), @@ -471,5 +471,5 @@ DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\U def build(bld): - write_installer(32, bld.env.VERSION, bld.env.DEBUG, bld.env.VARIANT, bld.env.ENABLE_DISK) - write_installer(64, bld.env.VERSION, bld.env.DEBUG, bld.env.VARIANT, bld.env.ENABLE_DISK) + write_installer(32, bld.env.VERSION, bld.env.DEBUG, bld.env.ENABLE_DISK) + write_installer(64, bld.env.VERSION, bld.env.DEBUG, bld.env.ENABLE_DISK) diff --git a/src/lib/checker.cc b/src/lib/checker.cc deleted file mode 100644 index b96b965aa..000000000 --- a/src/lib/checker.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#ifdef DCPOMATIC_VARIANT_SWAROOP - -#include "checker.h" -#include "config.h" -#include "cross.h" - -using boost::bind; -using boost::ref; - -Checker::Checker (int period) - : _terminate (false) - , _ok (true) - , _period (period) -{ - -} - -void -Checker::run () -{ - _thread = boost::thread (boost::bind(&Checker::thread, this)); -} - -Checker::~Checker () -{ - boost::this_thread::disable_interruption dis; - - { - boost::mutex::scoped_lock lm (_mutex); - _terminate = true; - } - - _thread.interrupt (); - try { - _thread.join (); - } catch (...) {} -} - -void -Checker::thread () -{ - while (true) { - boost::mutex::scoped_lock lm (_mutex); - if (_terminate) { - break; - } - - bool const was_ok = _ok; - _ok = check(); - if (was_ok != _ok) { - emit (bind(boost::ref(StateChanged))); - } - - lm.unlock (); - dcpomatic_sleep_seconds (_period); - } -} - -bool -Checker::ok () const -{ - boost::mutex::scoped_lock lm (_mutex); - return _ok; -} - -#endif diff --git a/src/lib/checker.h b/src/lib/checker.h deleted file mode 100644 index 8b80d8527..000000000 --- a/src/lib/checker.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -/** @file src/lib/checker.h - * @brief Checker class. - */ - -#ifndef DCPOMATIC_CHECKER_H -#define DCPOMATIC_CHECKER_H - -#include "signaller.h" -#include - -/** Parent for classes which check some condition every so often and signal - * when the state of the condition changes. - */ -class Checker : public Signaller, public boost::noncopyable -{ -public: - virtual ~Checker (); - - void run (); - - bool ok () const; - - /** Emitted when the state of our condition changes */ - boost::signals2::signal StateChanged; - -protected: - - Checker (int period); - - /** @return true if the condition is `ok', otherwise false */ - virtual bool check () const = 0; - -private: - - void thread (); - - boost::thread _thread; - mutable boost::mutex _mutex; - bool _terminate; - bool _ok; - /** check period in seconds */ - int _period; -}; - -#endif diff --git a/src/lib/config.cc b/src/lib/config.cc index 8b849dcc1..7c126ff19 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -175,16 +175,6 @@ Config::set_defaults () _player_playlist_directory = boost::none; _player_kdm_directory = boost::none; _audio_mapping = boost::none; -#ifdef DCPOMATIC_VARIANT_SWAROOP - _player_background_image = boost::none; - _kdm_server_url = "http://localhost:8000/{CPL}"; - _player_watermark_theatre = ""; - _player_watermark_period = 1; - _player_watermark_duration = 50; - _player_lock_file = boost::none; - _signer_chain_path = "signer"; - _decryption_chain_path = "decryption"; -#endif _allowed_dcp_frame_rates.clear (); _allowed_dcp_frame_rates.push_back (24); @@ -241,14 +231,6 @@ void Config::read () try { -#if defined(DCPOMATIC_VARIANT_SWAROOP) && defined(DCPOMATIC_LINUX) - if (geteuid() == 0) { - /* Take ownership of the config file if we're root */ - chown (config_file().string().c_str(), 0, 0); - chmod (config_file().string().c_str(), 0644); - } -#endif - cxml::Document f ("Config"); f.read_file (config_file ()); @@ -411,21 +393,6 @@ try } cxml::NodePtr signer = f.optional_node_child ("Signer"); -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (signer && signer->node_children().size() == 1) { - /* The content of is a path to a file; if it's relative it's in the same - directory as .config. */ - _signer_chain_path = signer->content(); - if (_signer_chain_path.is_relative()) { - _signer_chain = read_swaroop_chain (path(_signer_chain_path.string())); - } else { - _signer_chain = read_swaroop_chain (_signer_chain_path); - } - } else { - /* is not present or has children: ignore it and remake. */ - _signer_chain = create_certificate_chain (); - } -#else if (signer) { shared_ptr c (new dcp::CertificateChain ()); /* Read the signing certificates and private key in from the config file */ @@ -438,24 +405,8 @@ try /* Make a new set of signing certificates and key */ _signer_chain = create_certificate_chain (); } -#endif cxml::NodePtr decryption = f.optional_node_child ("Decryption"); -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (decryption && decryption->node_children().size() == 1) { - /* The content of is a path to a file; if it's relative, it's in the same - directory as .config. */ - _decryption_chain_path = decryption->content(); - if (_decryption_chain_path.is_relative()) { - _decryption_chain = read_swaroop_chain (path(_decryption_chain_path.string())); - } else { - _decryption_chain = read_swaroop_chain (_decryption_chain_path); - } - } else { - /* is not present or has more children: ignore it and remake. */ - _decryption_chain = create_certificate_chain (); - } -#else if (decryption) { shared_ptr c (new dcp::CertificateChain ()); BOOST_FOREACH (cxml::NodePtr i, decryption->node_children ("Certificate")) { @@ -466,7 +417,6 @@ try } else { _decryption_chain = create_certificate_chain (); } -#endif /* These must be done before we call Bad as that might set one of the nags. @@ -601,18 +551,6 @@ try _audio_mapping = AudioMapping (f.node_child("AudioMapping"), Film::current_state_version); } -#ifdef DCPOMATIC_VARIANT_SWAROOP - _player_background_image = f.optional_string_child("PlayerBackgroundImage"); - _kdm_server_url = f.optional_string_child("KDMServerURL").get_value_or("http://localhost:8000/{CPL}"); - _player_watermark_theatre = f.optional_string_child("PlayerWatermarkTheatre").get_value_or(""); - _player_watermark_period = f.optional_number_child("PlayerWatermarkPeriod").get_value_or(1); - _player_watermark_duration = f.optional_number_child("PlayerWatermarkDuration").get_value_or(150); - BOOST_FOREACH (cxml::ConstNodePtr i, f.node_children("RequiredMonitor")) { - _required_monitors.push_back(Monitor(i)); - } - _player_lock_file = f.optional_string_child("PlayerLockFile"); -#endif - if (boost::filesystem::exists (_cinemas_file)) { cxml::Document f ("Cinemas"); f.read_file (_cinemas_file); @@ -838,14 +776,6 @@ Config::write_config () const root->add_child("Win32Console")->add_child_text (_win32_console ? "1" : "0"); #endif -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (_signer_chain_path.is_relative()) { - write_swaroop_chain (_signer_chain, path(_signer_chain_path.string())); - } else { - write_swaroop_chain (_signer_chain, _signer_chain_path); - } - root->add_child("Signer")->add_child_text(_signer_chain_path.string()); -#else /* [XML] Signer Certificate chain and private key to use when signing DCPs and KDMs. Should contain <Certificate> tags in order and a <PrivateKey> tag all containing PEM-encoded certificates or private keys as appropriate. */ @@ -855,16 +785,7 @@ Config::write_config () const signer->add_child("Certificate")->add_child_text (i.certificate (true)); } signer->add_child("PrivateKey")->add_child_text (_signer_chain->key().get ()); -#endif -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (_decryption_chain_path.is_relative()) { - write_swaroop_chain (_decryption_chain, path(_decryption_chain_path.string())); - } else { - write_swaroop_chain (_decryption_chain, _decryption_chain_path); - } - root->add_child("Decryption")->add_child_text(_decryption_chain_path.string()); -#else /* [XML] Decryption Certificate chain and private key to use when decrypting KDMs */ xmlpp::Element* decryption = root->add_child ("Decryption"); DCPOMATIC_ASSERT (_decryption_chain); @@ -872,7 +793,6 @@ Config::write_config () const decryption->add_child("Certificate")->add_child_text (i.certificate (true)); } decryption->add_child("PrivateKey")->add_child_text (_decryption_chain->key().get ()); -#endif /* [XML] History Filename of DCP to present in the File menu of the GUI; there can be more than one of these tags. @@ -1053,21 +973,6 @@ Config::write_config () const if (_audio_mapping) { _audio_mapping->as_xml (root->add_child("AudioMapping")); } -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (_player_background_image) { - root->add_child("PlayerBackgroundImage")->add_child_text(_player_background_image->string()); - } - root->add_child("KDMServerURL")->add_child_text(_kdm_server_url); - root->add_child("PlayerWatermarkTheatre")->add_child_text(_player_watermark_theatre); - root->add_child("PlayerWatermarkPeriod")->add_child_text(raw_convert(_player_watermark_period)); - root->add_child("PlayerWatermarkDuration")->add_child_text(raw_convert(_player_watermark_duration)); - BOOST_FOREACH (Monitor i, _required_monitors) { - i.as_xml(root->add_child("RequiredMonitor")); - } - if (_player_lock_file) { - root->add_child("PlayerLockFile")->add_child_text(_player_lock_file->string()); - } -#endif try { string const s = doc.write_to_string_formatted (); diff --git a/src/lib/config.h b/src/lib/config.h index 11ca36b85..87afcbba8 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -86,9 +86,6 @@ public: HISTORY, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS, AUDIO_MAPPING, -#ifdef DCPOMATIC_VARIANT_SWAROOP - PLAYER_BACKGROUND_IMAGE, -#endif OTHER }; @@ -540,36 +537,6 @@ public: AudioMapping audio_mapping (int output_channels); -#ifdef DCPOMATIC_VARIANT_SWAROOP - boost::optional player_background_image () const { - return _player_background_image; - } - - std::string kdm_server_url () const { - return _kdm_server_url; - } - - std::string player_watermark_theatre () const { - return _player_watermark_theatre; - } - - int player_watermark_period () const { - return _player_watermark_period; - } - - int player_watermark_duration () const { - return _player_watermark_duration; - } - - std::vector required_monitors () const { - return _required_monitors; - } - - boost::optional player_lock_file () const { - return _player_lock_file; - } -#endif - /* SET (mostly) */ void set_master_encoding_threads (int n) { @@ -1081,52 +1048,6 @@ public: void set_audio_mapping (AudioMapping m); void set_audio_mapping_to_default (); -#ifdef DCPOMATIC_VARIANT_SWAROOP - void set_player_background_image (boost::filesystem::path p) { - maybe_set (_player_background_image, p, PLAYER_BACKGROUND_IMAGE); - } - - void unset_player_background_image () { - if (!_player_background_image) { - return; - } - _player_background_image = boost::none; - changed (PLAYER_BACKGROUND_IMAGE); - } - - void set_kdm_server_url (std::string s) { - maybe_set (_kdm_server_url, s); - } - - void set_player_watermark_theatre (std::string p) { - maybe_set (_player_watermark_theatre, p); - } - - void set_player_watermark_period (int minutes) { - maybe_set (_player_watermark_period, minutes); - } - - void set_player_watermark_duration (int milliseconds) { - maybe_set (_player_watermark_duration, milliseconds); - } - - void set_required_monitors (std::vector monitors) { - maybe_set (_required_monitors, monitors); - } - - void set_player_lock_file (boost::filesystem::path p) { - maybe_set (_player_lock_file, p); - } - - void unset_player_lock_file () { - if (!_player_lock_file) { - return; - } - _player_lock_file = boost::none; - changed (); - } -#endif - void changed (Property p = OTHER); boost::signals2::signal Changed; /** Emitted if read() failed on an existing Config file. There is nothing @@ -1276,16 +1197,10 @@ private: std::string _notification_bcc; std::string _notification_email; boost::shared_ptr _signer_chain; -#ifdef DCPOMATIC_VARIANT_SWAROOP - boost::filesystem::path _signer_chain_path; -#endif /** Chain used to decrypt KDMs; the leaf of this chain is the target * certificate for making KDMs given to DCP-o-matic. */ boost::shared_ptr _decryption_chain; -#ifdef DCPOMATIC_VARIANT_SWAROOP - boost::filesystem::path _decryption_chain_path; -#endif /** true to check for updates on startup */ bool _check_for_updates; bool _check_for_test_updates; @@ -1346,18 +1261,6 @@ private: boost::optional _player_playlist_directory; boost::optional _player_kdm_directory; boost::optional _audio_mapping; -#ifdef DCPOMATIC_VARIANT_SWAROOP - boost::optional _player_background_image; - std::string _kdm_server_url; - std::string _player_watermark_theatre; - /** watermark period in minutes */ - int _player_watermark_period; - /** watermark duration in milliseconds */ - int _player_watermark_duration; - std::vector _required_monitors; - /** a file which, if specified, must be present for the player to work */ - boost::optional _player_lock_file; -#endif static int const _current_version; diff --git a/src/lib/decrypted_ecinema_kdm.cc b/src/lib/decrypted_ecinema_kdm.cc deleted file mode 100644 index f76161c8b..000000000 --- a/src/lib/decrypted_ecinema_kdm.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (C) 2019 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#ifdef DCPOMATIC_VARIANT_SWAROOP - -#include "encrypted_ecinema_kdm.h" -#include "decrypted_ecinema_kdm.h" -#include "ecinema_kdm_data.h" -#include "exceptions.h" -#include "compose.hpp" -#include -#include -#include -#include -#include -#include - -using std::string; -using std::runtime_error; -using dcp::Certificate; -using boost::optional; - -DecryptedECinemaKDM::DecryptedECinemaKDM (string id, string name, dcp::Key content_key, optional not_valid_before, optional not_valid_after) - : _id (id) - , _name (name) - , _content_key (content_key) - , _not_valid_before (not_valid_before) - , _not_valid_after (not_valid_after) -{ - -} - -DecryptedECinemaKDM::DecryptedECinemaKDM (EncryptedECinemaKDM kdm, string private_key) - : _id (kdm.id()) - , _name (kdm.name()) -{ - /* Read the private key */ - - BIO* bio = BIO_new_mem_buf (const_cast (private_key.c_str()), -1); - if (!bio) { - throw runtime_error ("could not create memory BIO"); - } - - RSA* rsa = PEM_read_bio_RSAPrivateKey (bio, 0, 0, 0); - if (!rsa) { - throw FileError ("could not read RSA private key file", private_key); - } - - uint8_t value[RSA_size(rsa)]; - int const len = RSA_private_decrypt (kdm.data().size(), kdm.data().data().get(), value, rsa, RSA_PKCS1_OAEP_PADDING); - if (len == -1) { - throw KDMError (ERR_error_string(ERR_get_error(), 0), ""); - } - - if (len != ECINEMA_KDM_KEY_LENGTH && len != (ECINEMA_KDM_KEY_LENGTH + ECINEMA_KDM_NOT_VALID_BEFORE_LENGTH + ECINEMA_KDM_NOT_VALID_AFTER_LENGTH)) { - throw KDMError ( - "Unexpected data block size in ECinema KDM.", - String::compose("Size was %1; expected %2 or %3", ECINEMA_KDM_KEY_LENGTH, ECINEMA_KDM_KEY_LENGTH + ECINEMA_KDM_NOT_VALID_BEFORE_LENGTH + ECINEMA_KDM_NOT_VALID_AFTER_LENGTH) - ); - } - - _content_key = dcp::Key (value + ECINEMA_KDM_KEY, ECINEMA_KDM_KEY_LENGTH); - if (len > ECINEMA_KDM_KEY_LENGTH) { - uint8_t* p = value + ECINEMA_KDM_NOT_VALID_BEFORE; - string b; - for (int i = 0; i < ECINEMA_KDM_NOT_VALID_BEFORE_LENGTH; ++i) { - b += *p++; - } - _not_valid_before = dcp::LocalTime (b); - string a; - for (int i = 0; i < ECINEMA_KDM_NOT_VALID_AFTER_LENGTH; ++i) { - a += *p++; - } - _not_valid_after = dcp::LocalTime (a); - } -} - -EncryptedECinemaKDM -DecryptedECinemaKDM::encrypt (Certificate recipient) -{ - return EncryptedECinemaKDM (_id, _name, _content_key, _not_valid_before, _not_valid_after, recipient); -} - -#endif diff --git a/src/lib/decrypted_ecinema_kdm.h b/src/lib/decrypted_ecinema_kdm.h deleted file mode 100644 index 7a66b63e0..000000000 --- a/src/lib/decrypted_ecinema_kdm.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2019 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#ifdef DCPOMATIC_VARIANT_SWAROOP - -#include "encrypted_ecinema_kdm.h" -#include -#include -#include - -class DecryptedECinemaKDM -{ -public: - DecryptedECinemaKDM (std::string id, std::string name, dcp::Key content_key, boost::optional not_valid_before, boost::optional not_valid_after); - DecryptedECinemaKDM (EncryptedECinemaKDM kdm, std::string private_key); - - EncryptedECinemaKDM encrypt (dcp::Certificate recipient); - - std::string id () const { - return _id; - } - - std::string name () const { - return _name; - } - - dcp::Key key () const { - return _content_key; - } - - boost::optional not_valid_before () const { - return _not_valid_before; - } - - boost::optional not_valid_after () const { - return _not_valid_after; - } - -private: - std::string _id; - std::string _name; - /** unenecrypted content key */ - dcp::Key _content_key; - boost::optional _not_valid_before; - boost::optional _not_valid_after; -}; - -#endif diff --git a/src/lib/dkdm_recipient.cc b/src/lib/dkdm_recipient.cc index f03a1597b..b9db06152 100644 --- a/src/lib/dkdm_recipient.cc +++ b/src/lib/dkdm_recipient.cc @@ -90,6 +90,6 @@ kdm_for_dkdm_recipient ( name_values['e'] = end.date() + " " + end.time_of_day(true, false); name_values['i'] = kdm.cpl_id(); - return KDMWithMetadataPtr(new DCPKDMWithMetadata(name_values, 0, recipient->emails, kdm)); + return KDMWithMetadataPtr(new KDMWithMetadata(name_values, 0, recipient->emails, kdm)); } diff --git a/src/lib/dkdm_wrapper.cc b/src/lib/dkdm_wrapper.cc index 6638bc315..23539bd94 100644 --- a/src/lib/dkdm_wrapper.cc +++ b/src/lib/dkdm_wrapper.cc @@ -37,10 +37,6 @@ DKDMBase::read (cxml::ConstNodePtr node) { if (node->name() == "DKDM") { return shared_ptr (new DKDM (dcp::EncryptedKDM (node->content ()))); -#ifdef DCPOMATIC_VARIANT_SWAROOP - } else if (node->name() == "ECinemaDKDM") { - return shared_ptr (new ECinemaDKDM(EncryptedECinemaKDM(node->content()))); -#endif } else if (node->name() == "DKDMGroup") { shared_ptr group (new DKDMGroup (node->string_attribute ("Name"))); BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children()) { @@ -67,20 +63,6 @@ DKDM::as_xml (xmlpp::Element* node) const node->add_child("DKDM")->add_child_text (_dkdm.as_xml ()); } -#ifdef DCPOMATIC_VARIANT_SWAROOP -string -ECinemaDKDM::name () const -{ - return String::compose ("%1 (%2)", _dkdm.name(), _dkdm.id()); -} - -void -ECinemaDKDM::as_xml (xmlpp::Element* node) const -{ - node->add_child("ECinemaDKDM")->add_child_text (_dkdm.as_xml()); -} -#endif - void DKDMGroup::as_xml (xmlpp::Element* node) const { diff --git a/src/lib/dkdm_wrapper.h b/src/lib/dkdm_wrapper.h index d828ffac2..09e9d25c4 100644 --- a/src/lib/dkdm_wrapper.h +++ b/src/lib/dkdm_wrapper.h @@ -18,9 +18,6 @@ */ -#ifdef DCPOMATIC_VARIANT_SWAROOP -#include "encrypted_ecinema_kdm.h" -#endif #include #include #include @@ -70,26 +67,6 @@ private: dcp::EncryptedKDM _dkdm; }; -#ifdef DCPOMATIC_VARIANT_SWAROOP -class ECinemaDKDM : public DKDMBase -{ -public: - explicit ECinemaDKDM (EncryptedECinemaKDM k) - : _dkdm (k) - {} - - std::string name () const; - void as_xml (xmlpp::Element *) const; - - EncryptedECinemaKDM dkdm () const { - return _dkdm; - } - -private: - EncryptedECinemaKDM _dkdm; -}; -#endif - class DKDMGroup : public DKDMBase { public: diff --git a/src/lib/encrypted_ecinema_kdm.cc b/src/lib/encrypted_ecinema_kdm.cc deleted file mode 100644 index faea03424..000000000 --- a/src/lib/encrypted_ecinema_kdm.cc +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright (C) 2019 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#ifdef DCPOMATIC_VARIANT_SWAROOP - -#include "encrypted_ecinema_kdm.h" -#include "ecinema_kdm_data.h" -#include "exceptions.h" -#include "cross.h" -#include -#include -#include -#include -#include -#include -#include -#include - -using std::cout; -using std::string; -using boost::shared_ptr; -using boost::optional; -using dcp::Certificate; - -EncryptedECinemaKDM::EncryptedECinemaKDM (string id, string name, dcp::Key content_key, optional not_valid_before, optional not_valid_after, Certificate recipient) - : _id (id) - , _name (name) -{ - RSA* rsa = recipient.public_key (); - _data = dcp::Data (RSA_size(rsa)); - - int input_size = ECINEMA_KDM_KEY_LENGTH; - if (not_valid_before && not_valid_after) { - input_size += ECINEMA_KDM_NOT_VALID_BEFORE_LENGTH + ECINEMA_KDM_NOT_VALID_AFTER_LENGTH; - } - - dcp::Data input (input_size); - memcpy (input.data().get(), content_key.value(), ECINEMA_KDM_KEY_LENGTH); - if (not_valid_before && not_valid_after) { - memcpy (input.data().get() + ECINEMA_KDM_NOT_VALID_BEFORE, not_valid_before->as_string().c_str(), ECINEMA_KDM_NOT_VALID_BEFORE_LENGTH); - memcpy (input.data().get() + ECINEMA_KDM_NOT_VALID_AFTER, not_valid_after->as_string().c_str(), ECINEMA_KDM_NOT_VALID_AFTER_LENGTH); - } - - int const N = RSA_public_encrypt (input_size, input.data().get(), _data.data().get(), rsa, RSA_PKCS1_OAEP_PADDING); - if (N == -1) { - throw KDMError ("Could not encrypt ECinema KDM", ERR_error_string(ERR_get_error(), 0)); - } - -} - -EncryptedECinemaKDM::EncryptedECinemaKDM (string xml) -{ - cxml::Document doc ("ECinemaSecurityMessage"); - doc.read_string (xml); - _id = doc.string_child ("Id"); - _name = doc.string_child ("Name"); - _data = dcp::Data (256); - int const len = dcp::base64_decode (doc.string_child("Data"), _data.data().get(), _data.size()); - _data.set_size (len); -} - -string -EncryptedECinemaKDM::as_xml () const -{ - string key; - - /* Lazy overallocation */ - char out[_data.size() * 2]; - Kumu::base64encode (_data.data().get(), _data.size(), out, _data.size() * 2); - int const N = strlen (out); - string lines; - for (int i = 0; i < N; ++i) { - if (i > 0 && (i % 64) == 0) { - lines += "\n"; - } - lines += out[i]; - } - - xmlpp::Document document; - xmlpp::Element* root = document.create_root_node ("ECinemaSecurityMessage"); - root->add_child("Id")->add_child_text(_id); - root->add_child("Name")->add_child_text(_name); - root->add_child("Data")->add_child_text(lines); - return document.write_to_string ("UTF-8"); -} - -void -EncryptedECinemaKDM::as_xml (boost::filesystem::path path) const -{ - FILE* f = fopen_boost (path, "w"); - string const x = as_xml (); - fwrite (x.c_str(), 1, x.length(), f); - fclose (f); -} - -#endif diff --git a/src/lib/encrypted_ecinema_kdm.h b/src/lib/encrypted_ecinema_kdm.h deleted file mode 100644 index 90e13422a..000000000 --- a/src/lib/encrypted_ecinema_kdm.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2019 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#ifdef DCPOMATIC_VARIANT_SWAROOP - -#ifndef DCPOMATIC_ENCRYPTED_ECINEMA_KDM_H -#define DCPOMATIC_ENCRYPTED_ECINEMA_KDM_H - -#include -#include -#include -#include -#include - -class DecryptedECinemaKDM; - -class EncryptedECinemaKDM -{ -public: - explicit EncryptedECinemaKDM (std::string xml); - - std::string as_xml () const; - void as_xml (boost::filesystem::path out) const; - - std::string id () const { - return _id; - } - - std::string name () const { - return _name; - } - - dcp::Data data () const { - return _data; - } - -private: - friend class DecryptedECinemaKDM; - - EncryptedECinemaKDM (std::string id, std::string name, dcp::Key key, boost::optional not_valid_before, boost::optional not_valid_after, dcp::Certificate recipient); - - std::string _id; - std::string _name; - /** encrypted data */ - dcp::Data _data; -}; - -#endif - -#endif diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index 0802fa159..f9c1ef063 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -27,7 +27,6 @@ #include "dcpomatic_log.h" #include "ffmpeg_subtitle_stream.h" #include "ffmpeg_audio_stream.h" -#include "decrypted_ecinema_kdm.h" #include "digester.h" #include "compose.hpp" #include "config.h" @@ -128,13 +127,6 @@ FFmpeg::setup_general () _format_context->pb = _avio_context; AVDictionary* options = 0; -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (_ffmpeg_content->kdm()) { - DecryptedECinemaKDM kdm (_ffmpeg_content->kdm().get(), Config::instance()->decryption_chain()->key().get()); - av_dict_set (&options, "decryption_key", kdm.key().hex().c_str(), 0); - } -#endif - int e = avformat_open_input (&_format_context, 0, 0, &options); if (e < 0) { throw OpenFileError (_ffmpeg_content->path(0).string(), e, OpenFileError::READ); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 03763fc28..ac62ac7f4 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -34,7 +34,6 @@ #include "exceptions.h" #include "frame_rate_change.h" #include "text_content.h" -#include "decrypted_ecinema_kdm.h" #include #include extern "C" { @@ -67,9 +66,6 @@ int const FFmpegContentProperty::KDM = 103; FFmpegContent::FFmpegContent (boost::filesystem::path p) : Content (p) -#ifdef DCPOMATIC_VARIANT_SWAROOP - , _encrypted (false) -#endif { } @@ -130,9 +126,6 @@ FFmpegContent::FFmpegContent (cxml::ConstNodePtr node, int version, list _color_trc = get_optional_enum(node, "ColorTransferCharacteristic"); _colorspace = get_optional_enum(node, "Colorspace"); _bits_per_pixel = node->optional_number_child ("BitsPerPixel"); -#ifdef DCPOMATIC_VARIANT_SWAROOP - _encrypted = node->optional_bool_child("Encrypted").get_value_or(false); -#endif } FFmpegContent::FFmpegContent (vector > c) @@ -194,9 +187,6 @@ FFmpegContent::FFmpegContent (vector > c) _color_trc = ref->_color_trc; _colorspace = ref->_colorspace; _bits_per_pixel = ref->_bits_per_pixel; -#ifdef DCPOMATIC_VARIANT_SWAROOP - _encrypted = ref->_encrypted; -#endif } void @@ -256,11 +246,6 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const if (_bits_per_pixel) { node->add_child("BitsPerPixel")->add_child_text (raw_convert (*_bits_per_pixel)); } -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (_encrypted) { - node->add_child("Encypted")->add_child_text ("1"); - } -#endif } void @@ -327,10 +312,6 @@ FFmpegContent::examine (shared_ptr film, shared_ptr job) text.push_back (shared_ptr (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_UNKNOWN))); _subtitle_stream = _subtitle_streams.front (); } - -#ifdef DCPOMATIC_VARIANT_SWAROOP - _encrypted = first_path.extension() == ".ecinema"; -#endif } if (examiner->has_video ()) { @@ -344,10 +325,6 @@ FFmpegContent::examine (shared_ptr film, shared_ptr job) set_video_frame_rate (24000.0 / 1001); video->set_length (video->length() * 24.0 / 30); } - -#ifdef DCPOMATIC_VARIANT_SWAROOP - _id = examiner->id (); -#endif } string @@ -713,30 +690,3 @@ FFmpegContent::take_settings_from (shared_ptr c) _filters = fc->_filters; } -#ifdef DCPOMATIC_VARIANT_SWAROOP -void -FFmpegContent::add_kdm (EncryptedECinemaKDM kdm) -{ - ChangeSignaller cc (this, FFmpegContentProperty::KDM); - boost::mutex::scoped_lock lm (_mutex); - _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 diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index cf1849971..f933e4195 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -21,9 +21,6 @@ #ifndef DCPOMATIC_FFMPEG_CONTENT_H #define DCPOMATIC_FFMPEG_CONTENT_H -#ifdef DCPOMATIC_VARIANT_SWAROOP -#include "encrypted_ecinema_kdm.h" -#endif #include "content.h" #include "audio_stream.h" @@ -102,27 +99,6 @@ public: void signal_subtitle_stream_changed (); -#ifdef DCPOMATIC_VARIANT_SWAROOP - - bool encrypted () const { - boost::mutex::scoped_lock lm (_mutex); - return _encrypted; - } - - void add_kdm (EncryptedECinemaKDM kdm); - - boost::optional kdm () const { - return _kdm; - } - - boost::optional id () const { - return _id; - } - - bool kdm_timing_window_valid () const; - -#endif - private: void add_properties (boost::shared_ptr film, std::list &) const; @@ -140,11 +116,6 @@ private: boost::optional _color_trc; boost::optional _colorspace; boost::optional _bits_per_pixel; -#ifdef DCPOMATIC_VARIANT_SWAROOP - bool _encrypted; - boost::optional _kdm; - boost::optional _id; -#endif }; #endif diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 3c0f48804..41b93dad7 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -159,12 +159,6 @@ FFmpegDecoder::flush () bool FFmpegDecoder::pass () { -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (_ffmpeg_content->encrypted() && !_ffmpeg_content->kdm()) { - return true; - } -#endif - int r = av_read_frame (_format_context, &_packet); /* AVERROR_INVALIDDATA can apparently be returned sometimes even when av_read_frame diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc index 2c76a38c3..1d8feffa8 100644 --- a/src/lib/ffmpeg_encoder.cc +++ b/src/lib/ffmpeg_encoder.cc @@ -57,10 +57,6 @@ FFmpegEncoder::FFmpegEncoder ( bool split_reels, bool audio_stream_per_channel, int x264_crf -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional key - , optional id -#endif ) : Encoder (film, job) , _history (200) @@ -154,10 +150,6 @@ FFmpegEncoder::go () _film->three_d(), filename, extension -#ifdef DCPOMATIC_VARIANT_SWAROOP - , key - , id -#endif ) ); } @@ -249,10 +241,6 @@ FFmpegEncoder::FileEncoderSet::FileEncoderSet ( bool three_d, boost::filesystem::path output, string extension -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional key - , optional id -#endif ) { if (three_d) { @@ -260,31 +248,19 @@ FFmpegEncoder::FileEncoderSet::FileEncoderSet ( _encoders[EYES_LEFT] = shared_ptr( new FFmpegFileEncoder( video_frame_size, video_frame_rate, audio_frame_rate, channels, format, - audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("L"), extension) -#ifdef DCPOMATIC_VARIANT_SWAROOP - , key, id -#endif - ) + audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("L"), extension)) ); /// TRANSLATORS: R here is an abbreviation for "right", to indicate the right-eye part of a 3D export _encoders[EYES_RIGHT] = shared_ptr( new FFmpegFileEncoder( video_frame_size, video_frame_rate, audio_frame_rate, channels, format, - audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("R"), extension) -#ifdef DCPOMATIC_VARIANT_SWAROOP - , key, id -#endif - ) + audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("R"), extension)) ); } else { _encoders[EYES_BOTH] = shared_ptr( new FFmpegFileEncoder( video_frame_size, video_frame_rate, audio_frame_rate, channels, format, - audio_stream_per_channel, x264_crf, String::compose("%1%2", output.string(), extension) -#ifdef DCPOMATIC_VARIANT_SWAROOP - , key, id -#endif - ) + audio_stream_per_channel, x264_crf, String::compose("%1%2", output.string(), extension)) ); } } diff --git a/src/lib/ffmpeg_encoder.h b/src/lib/ffmpeg_encoder.h index 3b0bdd170..c71f8fa63 100644 --- a/src/lib/ffmpeg_encoder.h +++ b/src/lib/ffmpeg_encoder.h @@ -40,10 +40,6 @@ public: bool split_reels, bool audio_stream_per_channel, int x264_crf -#ifdef DCPOMATIC_VARIANT_SWAROOP - , boost::optional key - , boost::optional id -#endif ); void go (); @@ -70,10 +66,6 @@ private: bool three_d, boost::filesystem::path output, std::string extension -#ifdef DCPOMATIC_VARIANT_SWAROOP - , boost::optional key - , boost::optional id -#endif ); boost::shared_ptr get (Eyes eyes) const; diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 8a26f5626..bfd7e7722 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -192,13 +192,6 @@ DCPOMATIC_ENABLE_WARNINGS _pulldown = true; LOG_GENERAL_NC("Suggest that this may be 2:3 pull-down (soft telecine)"); } - -#ifdef DCPOMATIC_VARIANT_SWAROOP - AVDictionaryEntry* e = av_dict_get (_format_context->metadata, SWAROOP_ID_TAG, 0, 0); - if (e) { - _id = e->value; - } -#endif } diff --git a/src/lib/ffmpeg_examiner.h b/src/lib/ffmpeg_examiner.h index 4f5110ca0..3852f51a5 100644 --- a/src/lib/ffmpeg_examiner.h +++ b/src/lib/ffmpeg_examiner.h @@ -81,12 +81,6 @@ public: return _pulldown; } -#ifdef DCPOMATIC_VARIANT_SWAROOP - boost::optional id () const { - return _id; - } -#endif - private: void video_packet (AVCodecContext *, std::string& temporal_reference); void audio_packet (AVCodecContext *, boost::shared_ptr); @@ -107,10 +101,6 @@ private: boost::optional _rotation; bool _pulldown; -#ifdef DCPOMATIC_VARIANT_SWAROOP - boost::optional _id; -#endif - struct SubtitleStart { SubtitleStart (std::string id_, bool image_, dcpomatic::ContentTime time_) diff --git a/src/lib/ffmpeg_file_encoder.cc b/src/lib/ffmpeg_file_encoder.cc index 9a3c434d4..e527b1820 100644 --- a/src/lib/ffmpeg_file_encoder.cc +++ b/src/lib/ffmpeg_file_encoder.cc @@ -218,10 +218,6 @@ FFmpegFileEncoder::FFmpegFileEncoder ( bool audio_stream_per_channel, int x264_crf, boost::filesystem::path output -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional key - , optional id -#endif ) : _audio_stream_per_channel (audio_stream_per_channel) , _video_options (0) @@ -258,11 +254,7 @@ FFmpegFileEncoder::FFmpegFileEncoder ( DCPOMATIC_ASSERT (false); } -#ifdef DCPOMATIC_VARIANT_SWAROOP - int r = avformat_alloc_output_context2 (&_format_context, av_guess_format("mov", 0, 0), 0, 0); -#else int r = avformat_alloc_output_context2 (&_format_context, 0, 0, _output.string().c_str()); -#endif if (!_format_context) { throw runtime_error (String::compose("could not allocate FFmpeg format context (%1)", r)); } @@ -277,21 +269,6 @@ FFmpegFileEncoder::FFmpegFileEncoder ( AVDictionary* options = 0; -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (key) { - av_dict_set (&options, "encryption_key", key->hex().c_str(), 0); - /* XXX: is this OK? */ - av_dict_set (&options, "encryption_kid", "00000000000000000000000000000000", 0); - av_dict_set (&options, "encryption_scheme", "cenc-aes-ctr", 0); - } - - if (id) { - if (av_dict_set(&_format_context->metadata, SWAROOP_ID_TAG, id->c_str(), 0) < 0) { - throw runtime_error ("Could not write ID to output"); - } - } -#endif - if (avformat_write_header (_format_context, &options) < 0) { throw runtime_error ("could not write header to FFmpeg output file"); } diff --git a/src/lib/ffmpeg_file_encoder.h b/src/lib/ffmpeg_file_encoder.h index 19674d249..08fc4778b 100644 --- a/src/lib/ffmpeg_file_encoder.h +++ b/src/lib/ffmpeg_file_encoder.h @@ -47,10 +47,6 @@ public: bool audio_stream_per_channel, int x264_crf, boost::filesystem::path output -#ifdef DCPOMATIC_VARIANT_SWAROOP - , boost::optional key - , boost::optional id -#endif ); ~FFmpegFileEncoder (); diff --git a/src/lib/kdm_with_metadata.h b/src/lib/kdm_with_metadata.h index b6bec1c4c..2e07334de 100644 --- a/src/lib/kdm_with_metadata.h +++ b/src/lib/kdm_with_metadata.h @@ -21,9 +21,6 @@ #ifndef DCPOMATIC_KDM_WITH_METADATA_H #define DCPOMATIC_KDM_WITH_METADATA_H -#ifdef DCPOMATIC_VARIANT_SWAROOP -#include "encrypted_ecinema_kdm.h" -#endif #include #include #include @@ -33,16 +30,20 @@ class Cinema; class KDMWithMetadata { public: - KDMWithMetadata (dcp::NameFormat::Map const& name_values, void const* group, std::list emails) + KDMWithMetadata (dcp::NameFormat::Map const& name_values, void const* group, std::list emails, dcp::EncryptedKDM kdm) : _name_values (name_values) , _group (group) , _emails (emails) + , _kdm (kdm) {} - virtual ~KDMWithMetadata () {} + std::string kdm_as_xml () const { + return _kdm.as_xml (); + } - virtual std::string kdm_as_xml () const = 0; - virtual void kdm_as_xml (boost::filesystem::path out) const = 0; + void kdm_as_xml (boost::filesystem::path out) const { + return _kdm.as_xml (out); + } dcp::NameFormat::Map const& name_values () const { return _name_values; @@ -62,6 +63,7 @@ private: dcp::NameFormat::Map _name_values; void const* _group; std::list _emails; + dcp::EncryptedKDM _kdm; }; @@ -105,31 +107,5 @@ void email ( std::string cpl_name ); - -template -class SpecialKDMWithMetadata : public KDMWithMetadata -{ -public: - SpecialKDMWithMetadata (dcp::NameFormat::Map const& name_values, void const* group, std::list emails, T k) - : KDMWithMetadata (name_values, group, emails) - , kdm (k) - {} - - std::string kdm_as_xml () const { - return kdm.as_xml (); - } - - void kdm_as_xml (boost::filesystem::path out) const { - return kdm.as_xml (out); - } - - T kdm; -}; - -typedef SpecialKDMWithMetadata DCPKDMWithMetadata; -#ifdef DCPOMATIC_VARIANT_SWAROOP -typedef SpecialKDMWithMetadata ECinemaKDMWithMetadata; -#endif - #endif diff --git a/src/lib/lock_file_checker.cc b/src/lib/lock_file_checker.cc deleted file mode 100644 index 9543c2c9f..000000000 --- a/src/lib/lock_file_checker.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#ifdef DCPOMATIC_VARIANT_SWAROOP - -#include "lock_file_checker.h" -#include "config.h" -#include "cross.h" - -using boost::bind; -using boost::ref; - -LockFileChecker* LockFileChecker::_instance = 0; - -LockFileChecker::LockFileChecker () - : Checker (10) -{ - -} - -bool -LockFileChecker::check () const -{ - return !Config::instance()->player_lock_file() || boost::filesystem::is_regular_file(Config::instance()->player_lock_file().get()); -} - -LockFileChecker * -LockFileChecker::instance () -{ - if (!_instance) { - _instance = new LockFileChecker (); - } - - return _instance; -} - -#endif diff --git a/src/lib/lock_file_checker.h b/src/lib/lock_file_checker.h deleted file mode 100644 index 76c00717d..000000000 --- a/src/lib/lock_file_checker.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#include "checker.h" -#include - -class LockFileChecker : public Checker -{ -public: - LockFileChecker (); - - static LockFileChecker* instance (); - -protected: - bool check () const; - -private: - static LockFileChecker* _instance; -}; diff --git a/src/lib/monitor_checker.cc b/src/lib/monitor_checker.cc deleted file mode 100644 index d15dee63f..000000000 --- a/src/lib/monitor_checker.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#ifdef DCPOMATIC_VARIANT_SWAROOP - -#include "monitor_checker.h" -#include "config.h" -#include "cross.h" - -MonitorChecker* MonitorChecker::_instance = 0; - -MonitorChecker::MonitorChecker () - : Checker (60) -{ - -} - -bool -MonitorChecker::check () const -{ - return Config::instance()->required_monitors().empty() || get_monitors() == Config::instance()->required_monitors(); -} - - -MonitorChecker * -MonitorChecker::instance () -{ - if (!_instance) { - _instance = new MonitorChecker (); - } - - return _instance; -} - -#endif diff --git a/src/lib/monitor_checker.h b/src/lib/monitor_checker.h deleted file mode 100644 index f99ab4b2a..000000000 --- a/src/lib/monitor_checker.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#include "checker.h" -#include - -class MonitorChecker : public Checker -{ -public: - MonitorChecker (); - - static MonitorChecker* instance (); - -protected: - bool check () const; - -private: - static MonitorChecker* _instance; -}; diff --git a/src/lib/player_video.h b/src/lib/player_video.h index 0456457db..56cfbd100 100644 --- a/src/lib/player_video.h +++ b/src/lib/player_video.h @@ -126,9 +126,7 @@ private: boost::optional _colour_conversion; VideoRange _video_range; boost::optional _text; - /** Content that we came from. This is so that reset_metadata() can work, and also - * for variant:swaroop's non-skippable ads. - */ + /** Content that we came from. This is so that reset_metadata() can work. */ boost::weak_ptr _content; /** Video frame that we came from. Again, this is for reset_metadata() */ boost::optional _video_frame; diff --git a/src/lib/screen.cc b/src/lib/screen.cc index 61a27f2bc..544bce9ef 100644 --- a/src/lib/screen.cc +++ b/src/lib/screen.cc @@ -107,6 +107,6 @@ kdm_for_screen ( name_values['e'] = end.date() + " " + end.time_of_day(true, false); name_values['i'] = kdm.cpl_id(); - return KDMWithMetadataPtr(new DCPKDMWithMetadata(name_values, cinema.get(), cinema ? cinema->emails : list(), kdm)); + return KDMWithMetadataPtr(new KDMWithMetadata(name_values, cinema.get(), cinema ? cinema->emails : list(), kdm)); } diff --git a/src/lib/swaroop_spl.cc b/src/lib/swaroop_spl.cc deleted file mode 100644 index 02ed966a4..000000000 --- a/src/lib/swaroop_spl.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2018-2019 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#include "swaroop_spl.h" -#include "content_store.h" -#include -#include -#include -#include -#include - -using std::cout; -using std::string; -using boost::shared_ptr; -using dcp::raw_convert; - -void -SPL::read (boost::filesystem::path path, ContentStore* store) -{ - _path = path; - - _spl.clear (); - _missing = false; - cxml::Document doc ("SPL"); - doc.read_file (path); - _id = doc.string_child("Id"); - BOOST_FOREACH (cxml::ConstNodePtr i, doc.node_children("Entry")) { - shared_ptr c = store->get(i->string_child("Digest")); - if (c) { - add (SPLEntry(c, i)); - } else { - _missing = true; - } - } - - _allowed_shows = doc.optional_number_child("AllowedShows"); -} - -void -SPL::write (boost::filesystem::path path) const -{ - _path = path; - - xmlpp::Document doc; - xmlpp::Element* root = doc.create_root_node ("SPL"); - root->add_child("Id")->add_child_text (_id); - BOOST_FOREACH (SPLEntry i, _spl) { - i.as_xml (root->add_child("Entry")); - } - if (_allowed_shows) { - root->add_child("AllowedShows")->add_child_text(raw_convert(*_allowed_shows)); - } - doc.write_to_file_formatted (path.string()); -} diff --git a/src/lib/swaroop_spl.h b/src/lib/swaroop_spl.h deleted file mode 100644 index 308f5286d..000000000 --- a/src/lib/swaroop_spl.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#ifndef DCPOMATIC_SPL_H -#define DCPOMATIC_SPL_H - -#include "swaroop_spl_entry.h" -#include - -class ContentStore; - -class SPL -{ -public: - SPL () - : _id (dcp::make_uuid()) - , _missing (false) - {} - - void add (SPLEntry e) { - _spl.push_back (e); - } - - void remove (std::size_t index) { - _spl.erase (_spl.begin() + index); - } - - std::vector const & get () const { - return _spl; - } - - SPLEntry & operator[] (std::size_t index) { - return _spl[index]; - } - - SPLEntry const & operator[] (std::size_t index) const { - return _spl[index]; - } - - void read (boost::filesystem::path path, ContentStore* store); - void write (boost::filesystem::path path) const; - - std::string id () const { - return _id; - } - - boost::optional path () const { - return _path; - } - - std::string name () const { - if (!_path) { - return ""; - } - return _path->filename().string(); - } - - bool missing () const { - return _missing; - } - - boost::optional allowed_shows () const { - return _allowed_shows; - } - - bool have_allowed_shows () const { - return !_allowed_shows || *_allowed_shows > 0; - } - - void set_allowed_shows (int s) { - _allowed_shows = s; - } - - void unset_allowed_shows () { - _allowed_shows = boost::optional(); - } - - void decrement_allowed_shows () { - if (_allowed_shows) { - (*_allowed_shows)--; - } - - } - -private: - std::string _id; - mutable boost::optional _path; - std::vector _spl; - /** true if any content was missing when read() was last called on this SPL */ - bool _missing; - /** number of times left that the player will allow this playlist to be played (unset means infinite shows) */ - boost::optional _allowed_shows; -}; - -#endif diff --git a/src/lib/swaroop_spl_entry.cc b/src/lib/swaroop_spl_entry.cc deleted file mode 100644 index ed5a469ac..000000000 --- a/src/lib/swaroop_spl_entry.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#include "swaroop_spl_entry.h" -#include "dcp_content.h" -#include "dcpomatic_assert.h" -#include - -using boost::shared_ptr; -using boost::dynamic_pointer_cast; - -SPLEntry::SPLEntry (shared_ptr content) - : skippable (false) - , disable_timeline (false) - , stop_after_play (false) -{ - construct (content); -} - -SPLEntry::SPLEntry (shared_ptr content, cxml::ConstNodePtr node) - : skippable (node->bool_child("Skippable")) - , disable_timeline (node->bool_child("DisableTimeline")) - , stop_after_play (node->bool_child("StopAfterPlay")) -{ - construct (content); -} - -void -SPLEntry::construct (shared_ptr c) -{ - content = c; - shared_ptr dcp = dynamic_pointer_cast (content); - digest = content->digest (); - if (dcp) { - name = dcp->name (); - DCPOMATIC_ASSERT (dcp->cpl()); - id = *dcp->cpl(); - kind = dcp->content_kind().get_value_or(dcp::FEATURE); - type = DCP; - encrypted = dcp->encrypted (); - } else { - name = content->path(0).filename().string(); - type = ECINEMA; - kind = dcp::FEATURE; - } -} - -void -SPLEntry::as_xml (xmlpp::Element* e) -{ - e->add_child("Digest")->add_child_text(digest); - e->add_child("Skippable")->add_child_text(skippable ? "1" : "0"); - e->add_child("DisableTimeline")->add_child_text(disable_timeline ? "1" : "0"); - e->add_child("StopAfterPlay")->add_child_text(stop_after_play ? "1" : "0"); -} diff --git a/src/lib/swaroop_spl_entry.h b/src/lib/swaroop_spl_entry.h deleted file mode 100644 index 75e0b5223..000000000 --- a/src/lib/swaroop_spl_entry.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#ifndef DCPOMATIC_SWAROOP_SPL_ENTRY_H -#define DCPOMATIC_SWAROOP_SPL_ENTRY_H - -#include -#include -#include - -namespace xmlpp { - class Element; -} - -class Content; - -class SPLEntry -{ -public: - SPLEntry (boost::shared_ptr content); - SPLEntry (boost::shared_ptr content, cxml::ConstNodePtr node); - - void as_xml (xmlpp::Element* e); - - boost::shared_ptr content; - std::string name; - /** Digest of this content */ - std::string digest; - /** CPL ID or something else for MP4 (?) */ - std::string id; - dcp::ContentKind kind; - enum Type { - DCP, - ECINEMA - }; - Type type; - bool encrypted; - bool skippable; - bool disable_timeline; - bool stop_after_play; - -private: - void construct (boost::shared_ptr content); -}; - -#endif diff --git a/src/lib/util.cc b/src/lib/util.cc index 90d78b32e..5310e55c9 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -1094,111 +1094,6 @@ copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, boost::f free (buffer); } -#ifdef DCPOMATIC_VARIANT_SWAROOP - -/* Make up a key from the machine UUID */ -dcp::Data -key_from_uuid () -{ - dcp::Data key (dcpomatic::crypto_key_length()); - memset (key.data().get(), 0, key.size()); - string const magic = command_and_read ("dcpomatic2_uuid"); - strncpy ((char *) key.data().get(), magic.c_str(), dcpomatic::crypto_key_length()); - return key; -} - -/* swaroop chain file format: - * - * 0 [int16_t] IV length - * 2 [int16_t] cert #1 length, or 0 for none - * 4 [int16_t] cert #2 length, or 0 for none - * 6 [int16_t] cert #3 length, or 0 for none - * 8 [int16_t] cert #4 length, or 0 for none - * 10 [int16_t] cert #5 length, or 0 for none - * 12 [int16_t] cert #6 length, or 0 for none - * 14 [int16_t] cert #7 length, or 0 for none - * 16 [int16_t] cert #8 length, or 0 for none - * 16 [int16_t] private key length - * 20 IV - * cert #1 - * cert #2 - * cert #3 - * cert #4 - * cert #5 - * cert #6 - * cert #7 - * cert #8 - * private key - */ - -struct __attribute__ ((packed)) Header_ { - int16_t iv_length; - int16_t cert_length[8]; - int16_t private_key_length; -}; - -typedef struct Header_ Header; - -shared_ptr -read_swaroop_chain (boost::filesystem::path path) -{ - dcp::Data data (path); - Header* header = (Header *) data.data().get(); - uint8_t* p = data.data().get() + sizeof(Header); - - dcp::Data iv (p, header->iv_length); - p += iv.size(); - - shared_ptr cc (new dcp::CertificateChain()); - for (int i = 0; i < 8; ++i) { - if (header->cert_length[i] == 0) { - break; - } - dcp::Data c(p, header->cert_length[i]); - p += c.size(); - cc->add (dcp::Certificate(dcpomatic::decrypt(c, key_from_uuid(), iv))); - } - - dcp::Data k (p, header->private_key_length); - cc->set_key (dcpomatic::decrypt(k, key_from_uuid(), iv)); - return cc; -} - -void -write_swaroop_chain (shared_ptr chain, boost::filesystem::path output) -{ - scoped_array buffer (new uint8_t[65536]); - Header* header = (Header *) buffer.get(); - memset (header, 0, sizeof(Header)); - uint8_t* p = buffer.get() + sizeof(Header); - - dcp::Data iv = dcpomatic::random_iv (); - header->iv_length = iv.size (); - memcpy (p, iv.data().get(), iv.size()); - p += iv.size(); - - int N = 0; - BOOST_FOREACH (dcp::Certificate i, chain->root_to_leaf()) { - dcp::Data e = dcpomatic::encrypt (i.certificate(true), key_from_uuid(), iv); - memcpy (p, e.data().get(), e.size()); - p += e.size(); - DCPOMATIC_ASSERT (N < 8); - header->cert_length[N] = e.size (); - ++N; - } - - dcp::Data k = dcpomatic::encrypt (chain->key().get(), key_from_uuid(), iv); - memcpy (p, k.data().get(), k.size()); - p += k.size(); - header->private_key_length = k.size (); - - FILE* f = fopen_boost (output, "wb"); - checked_fwrite (buffer.get(), p - buffer.get(), f, output); - fclose (f); -} - -#endif - double db_to_linear (double db) { diff --git a/src/lib/util.h b/src/lib/util.h index b4378040a..28a6fd660 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -65,10 +65,6 @@ namespace dcp { #define CLOSED_CAPTION_LINES 3 /** Maximum line length of closed caption viewers */ #define CLOSED_CAPTION_LENGTH 30 -/* We are mis-using genre here, as only some metadata tags are written/read. - I tried the use_metadata_tags option but it didn't seem to make any difference. -*/ -#define SWAROOP_ID_TAG "genre" extern std::string program_name; extern bool is_batch_converter; @@ -115,10 +111,6 @@ extern std::string day_of_week_to_string (boost::gregorian::greg_weekday d); extern void emit_subtitle_image (dcpomatic::ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, boost::shared_ptr decoder); extern bool show_jobs_on_console (bool progress); extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, boost::function); -#ifdef DCPOMATIC_VARIANT_SWAROOP -extern boost::shared_ptr read_swaroop_chain (boost::filesystem::path path); -extern void write_swaroop_chain (boost::shared_ptr chain, boost::filesystem::path output); -#endif extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container); extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm); extern boost::filesystem::path default_font_file (); diff --git a/src/lib/wscript b/src/lib/wscript index 04044a8c3..7b7b3cf20 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -47,7 +47,6 @@ sources = """ text_content.cc text_decoder.cc case_insensitive_sorter.cc - checker.cc check_content_change_job.cc cinema.cc cinema_sound_processor.cc @@ -79,7 +78,6 @@ sources = """ decoder.cc decoder_factory.cc decoder_part.cc - decrypted_ecinema_kdm.cc digester.cc dkdm_recipient.cc dkdm_wrapper.cc @@ -91,7 +89,6 @@ sources = """ encode_server.cc encode_server_finder.cc encoded_log_entry.cc - encrypted_ecinema_kdm.cc environment_info.cc event_history.cc examine_content_job.cc @@ -131,11 +128,9 @@ sources = """ json_server.cc kdm_with_metadata.cc kdm_recipient.cc - lock_file_checker.cc log.cc log_entry.cc mid_side_decoder.cc - monitor_checker.cc overlaps.cc player.cc player_text.cc @@ -211,9 +206,6 @@ def build(bld): obj.source = sources + ' version.cc' - if bld.env.VARIANT == 'swaroop-theater' or bld.env.VARIANT == 'swaroop-studio': - obj.source += ' swaroop_spl.cc swaroop_spl_entry.cc' - if bld.env.ENABLE_DISK: obj.source += ' copy_to_drive_job.cc nanomsg.cc' obj.uselib += ' LWEXT4 NANOMSG' diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 3ddf2256e..d66993388 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -985,11 +985,7 @@ private: shared_ptr job (new TranscodeJob (_film)); job->set_encoder ( shared_ptr ( - new FFmpegEncoder (_film, job, d->path(), d->format(), d->mixdown_to_stereo(), d->split_reels(), d->split_streams(), d->x264_crf() -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ) + new FFmpegEncoder (_film, job, d->path(), d->format(), d->mixdown_to_stereo(), d->split_reels(), d->split_streams(), d->x264_crf()) ) ); JobManager::instance()->add (job); diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index cc070b454..aa7cf8340 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -45,9 +45,6 @@ #include "lib/cinema.h" #include "lib/dkdm_wrapper.h" #include "lib/cross.h" -#ifdef DCPOMATIC_VARIANT_SWAROOP -#include "lib/decrypted_ecinema_kdm.h" -#endif #include #include #include @@ -311,47 +308,6 @@ private: list kdms; string title; -#ifdef DCPOMATIC_VARIANT_SWAROOP - shared_ptr ecinema_dkdm = boost::dynamic_pointer_cast (dkdm_base); - if (ecinema_dkdm) { - DecryptedECinemaKDM decrypted (ecinema_dkdm->dkdm(), Config::instance()->decryption_chain()->key().get()); - title = decrypted.name (); - - BOOST_FOREACH (shared_ptr i, _screens->screens()) { - - if (!i->recipient) { - continue; - } - - dcp::LocalTime begin(_timing->from(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()); - dcp::LocalTime end(_timing->until(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()); - - DecryptedECinemaKDM kdm ( - decrypted.id(), - decrypted.name(), - decrypted.key(), - begin, - end - ); - - dcp::NameFormat::Map name_values; - name_values['c'] = i->cinema->name; - name_values['s'] = i->name; - name_values['f'] = title; - name_values['b'] = begin.date() + " " + begin.time_of_day(true, false); - name_values['e'] = end.date() + " " + end.time_of_day(true, false); - name_values['i'] = kdm.id(); - - /* Encrypt */ - kdms.push_back ( - KDMWithMetadataPtr( - new ECinemaKDMWithMetadata(name_values, i->cinema, kdm.encrypt(i->recipient.get())) - ) - ); - } - } -#endif - shared_ptr dkdm = boost::dynamic_pointer_cast (dkdm_base); if (dkdm) { @@ -404,7 +360,7 @@ private: /* Encrypt */ kdms.push_back ( KDMWithMetadataPtr( - new DCPKDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, encrypted) + new KDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, encrypted) ) ); } @@ -494,44 +450,6 @@ private: shared_ptr chain = Config::instance()->decryption_chain(); DCPOMATIC_ASSERT (chain->key()); -#ifdef DCPOMATIC_VARIANT_SWAROOP - try { - cxml::Document test_doc; - string const xml_string = dcp::file_to_string (wx_to_std(d->GetPath()), MAX_KDM_SIZE); - test_doc.read_string (xml_string); - if (test_doc.root_name() == "ECinemaSecurityMessage") { - EncryptedECinemaKDM ekdm(xml_string); - /* Decrypt the DKDM to make sure that we can */ - DecryptedECinemaKDM dkdm(ekdm, chain->key().get()); - - shared_ptr new_dkdm(new ECinemaDKDM(ekdm)); - shared_ptr group = dynamic_pointer_cast (selected_dkdm()); - if (!group) { - group = Config::instance()->dkdms(); - } - add_dkdm_model (new_dkdm, group); - add_dkdm_view (new_dkdm); - d->Destroy (); - return; - } - } catch (KDMError& e) { - error_dialog ( - this, "Could not read file as a KDM. Perhaps it is badly formatted, created with the wrong certificate, or not a KDM at all.", - std_to_wx(e.what()) - ); - d->Destroy (); - return; - } catch (dcp::MiscError& e) { - error_dialog ( - this, - _("Could not read file as a KDM. It is much too large. Make sure you are loading a DKDM (XML) file."), - std_to_wx(e.what()) - ); - d->Destroy (); - return; - } -#endif - try { dcp::EncryptedKDM ekdm(dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE)); /* Decrypt the DKDM to make sure that we can */ diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc index b9f73d357..4da0393b0 100644 --- a/src/tools/dcpomatic_kdm_cli.cc +++ b/src/tools/dcpomatic_kdm_cli.cc @@ -354,7 +354,7 @@ from_dkdm ( name_values['e'] = end.date() + " " + end.time_of_day(true, false); name_values['i'] = kdm.cpl_id(); - kdms.push_back (KDMWithMetadataPtr(new DCPKDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, kdm))); + kdms.push_back (KDMWithMetadataPtr(new KDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, kdm))); } write_files (kdms, zip, output, container_name_format, filename_format, verbose); } catch (FileError& e) { diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index a82e67b88..9fab8b588 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -29,9 +29,6 @@ #include "wx/verify_dcp_dialog.h" #include "wx/standard_controls.h" #include "wx/playlist_controls.h" -#ifdef DCPOMATIC_VARIANT_SWAROOP -#include "wx/swaroop_controls.h" -#endif #include "wx/timer_display.h" #include "wx/system_information_dialog.h" #include "wx/player_stress_tester.h" @@ -55,8 +52,6 @@ #include "lib/server.h" #include "lib/dcpomatic_socket.h" #include "lib/scoped_temporary.h" -#include "lib/monitor_checker.h" -#include "lib/lock_file_checker.h" #include "lib/ffmpeg_content.h" #include "lib/dcpomatic_log.h" #include "lib/file_log.h" @@ -201,11 +196,6 @@ public: _overall_panel = new wxPanel (this, wxID_ANY); _viewer.reset (new FilmViewer (_overall_panel)); -#ifdef DCPOMATIC_VARIANT_SWAROOP - SwaroopControls* sc = new SwaroopControls (_overall_panel, _viewer); - _controls = sc; - sc->ResetFilm.connect (bind(&DOMFrame::reset_film_weak, this, _1)); -#else if (Config::instance()->player_mode() == Config::PLAYER_MODE_DUAL) { PlaylistControls* pc = new PlaylistControls (_overall_panel, _viewer); _controls = pc; @@ -213,7 +203,6 @@ public: } else { _controls = new StandardControls (_overall_panel, _viewer, false); } -#endif _viewer->set_dcp_decode_reduction (Config::instance()->decode_reduction ()); _viewer->PlaybackPermitted.connect (bind(&DOMFrame::playback_permitted, this)); _viewer->Started.connect (bind(&DOMFrame::playback_started, this, _1)); @@ -262,39 +251,11 @@ public: reset_film (); UpdateChecker::instance()->StateChanged.connect (boost::bind (&DOMFrame::update_checker_state_changed, this)); -#ifdef DCPOMATIC_VARIANT_SWAROOP - MonitorChecker::instance()->StateChanged.connect(boost::bind(&DOMFrame::monitor_checker_state_changed, this)); - MonitorChecker::instance()->run (); - LockFileChecker::instance()->StateChanged.connect(boost::bind(&DOMFrame::lock_checker_state_changed, this)); - LockFileChecker::instance()->run (); -#endif setup_screen (); _stress.LoadDCP.connect (boost::bind(&DOMFrame::load_dcp, this, _1)); - -#ifdef DCPOMATIC_VARIANT_SWAROOP - sc->check_restart (); -#endif - } - -#ifdef DCPOMATIC_VARIANT_SWAROOP - void monitor_checker_state_changed () - { - if (!MonitorChecker::instance()->ok()) { - _viewer->stop (); - error_dialog (this, _("The required display devices are not connected correctly.")); - } } - void lock_checker_state_changed () - { - if (!LockFileChecker::instance()->ok()) { - _viewer->stop (); - error_dialog (this, _("The lock file is not present.")); - } - } -#endif - void setup_main_sizer (Config::PlayerMode mode) { _main_sizer->Detach (_viewer->panel()); @@ -311,16 +272,6 @@ public: bool playback_permitted () { -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (!MonitorChecker::instance()->ok()) { - error_dialog (this, _("The required display devices are not connected correctly.")); - return false; - } - if (!LockFileChecker::instance()->ok()) { - error_dialog (this, _("The lock file is not present.")); - return false; - } -#endif if (!_film || !Config::instance()->respect_kdm_validity_periods()) { return true; } @@ -333,15 +284,6 @@ public: } } -#ifdef DCPOMATIC_VARIANT_SWAROOP - BOOST_FOREACH (shared_ptr i, _film->content()) { - shared_ptr c = dynamic_pointer_cast(i); - if (c && !c->kdm_timing_window_valid()) { - ok = false; - } - } -#endif - if (!ok) { error_dialog (this, _("The KDM does not allow playback of this content at this time.")); } @@ -391,14 +333,6 @@ public: void playback_stopped (DCPTime time) { -#ifdef DCPOMATIC_VARIANT_SWAROOP - try { - boost::filesystem::remove (Config::path("position")); - } catch (...) { - /* Never mind */ - } -#endif - _controls->log (wxString::Format("playback-stopped %s", time.timecode(_film->video_frame_rate()).c_str())); } @@ -424,9 +358,7 @@ public: if (!ok || !report_errors_from_last_job(this)) { return; } -#ifndef DCPOMATIC_VARIANT_SWAROOP Config::instance()->add_to_player_history (dir); -#endif } catch (dcp::ReadError& e) { error_dialog (this, wxString::Format(_("Could not load a DCP from %s"), std_to_wx(dir.string())), std_to_wx(e.what())); } catch (DCPError& e) { @@ -587,10 +519,8 @@ private: optional c = Config::instance()->decode_reduction(); _view_cpl = view->Append(ID_view_cpl, _("CPL"), _cpl_menu); view->AppendSeparator(); -#ifndef DCPOMATIC_VARIANT_SWAROOP _view_full_screen = view->AppendCheckItem(ID_view_full_screen, _("Full screen\tF11")); _view_dual_screen = view->AppendCheckItem(ID_view_dual_screen, _("Dual screen\tShift+F11")); -#endif setup_menu (); view->AppendSeparator(); view->Append(ID_view_closed_captions, _("Closed captions...")); @@ -702,22 +632,8 @@ private: if (d->ShowModal() == wxID_OK) { DCPOMATIC_ASSERT (_film); -#ifdef DCPOMATIC_VARIANT_SWAROOP - shared_ptr ffmpeg = boost::dynamic_pointer_cast(_film->content().front()); - if (ffmpeg) { - try { - ffmpeg->add_kdm (EncryptedECinemaKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE))); - } catch (exception& e) { - error_dialog (this, wxString::Format(_("Could not load KDM.")), std_to_wx(e.what())); - d->Destroy(); - return; - } - } -#endif shared_ptr dcp = boost::dynamic_pointer_cast(_film->content().front()); -#ifndef DCPOMATIC_VARIANT_SWAROOP DCPOMATIC_ASSERT (dcp); -#endif try { if (dcp) { dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE))); diff --git a/src/tools/swaroop_dcpomatic_ecinema.cc b/src/tools/swaroop_dcpomatic_ecinema.cc deleted file mode 100644 index 152194c48..000000000 --- a/src/tools/swaroop_dcpomatic_ecinema.cc +++ /dev/null @@ -1,312 +0,0 @@ -/* - Copyright (C) 2018-2019 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#include "lib/version.h" -#include "lib/decrypted_ecinema_kdm.h" -#include "lib/config.h" -#include "lib/util.h" -#include "lib/film.h" -#include "lib/dcp_content.h" -#include "lib/job_manager.h" -#include "lib/cross.h" -#include "lib/transcode_job.h" -#include "lib/ffmpeg_encoder.h" -#include "lib/signal_manager.h" -#include "lib/video_content.h" -#include "lib/ratio.h" -#include -extern "C" { -#include -#include -} -#include -#include -#include -#include -#include -#include -#include -#include - -using std::string; -using std::cerr; -using std::cout; -using std::ofstream; -using boost::optional; -using boost::shared_ptr; - -static void convert_dcp ( - boost::filesystem::path input, - boost::filesystem::path output_file, - boost::optional kdm, - int crf - ); -static void convert_ffmpeg (boost::filesystem::path input, boost::filesystem::path output_file, string format); -static void write_kdm (string id, boost::filesystem::path name, dcp::Key key); - -static void -help (string n) -{ - cerr << "Syntax: " << n << " [OPTION] |\n" - << " -v, --version show DCP-o-matic version\n" - << " -h, --help show this help\n" - << " -o, --output output directory\n" - << " -f, --format output format (mov or mp4; defaults to mov)\n" - << " -k, --kdm DCP KDM filename (if required)\n" - << " -c, --crf quality (CRF) when transcoding from DCP (0 is best, 51 is worst, defaults to 23)\n" - << "\n" - << " is an unencrypted .mp4 file; is a DCP directory.\n"; -} - -int -main (int argc, char* argv[]) -{ - optional output; - optional format; - optional kdm; - int crf = 23; - - int option_index = 0; - while (true) { - static struct option long_options[] = { - { "version", no_argument, 0, 'v' }, - { "help", no_argument, 0, 'h' }, - { "output", required_argument, 0, 'o' }, - { "format", required_argument, 0, 'f' }, - { "kdm", required_argument, 0, 'k' }, - { "crf", required_argument, 0, 'c' }, - }; - - int c = getopt_long (argc, argv, "vho:f:k:c:", long_options, &option_index); - - if (c == -1) { - break; - } - - switch (c) { - case 'v': - cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n"; - exit (EXIT_SUCCESS); - case 'h': - help (argv[0]); - exit (EXIT_SUCCESS); - case 'o': - output = optarg; - break; - case 'f': - format = optarg; - break; - case 'k': - kdm = optarg; - break; - case 'c': - crf = atoi(optarg); - break; - } - } - - if (optind >= argc) { - help (argv[0]); - exit (EXIT_FAILURE); - } - - if (!output) { - cerr << "You must specify --output-media or -o\n"; - exit (EXIT_FAILURE); - } - - if (!format) { - format = "mov"; - } - - if (*format != "mov" && *format != "mp4") { - cerr << "Invalid format specified: must be mov or mp4\n"; - exit (EXIT_FAILURE); - } - - dcpomatic_setup_path_encoding (); - dcpomatic_setup (); - signal_manager = new SignalManager (); - - boost::filesystem::path input = argv[optind]; - boost::filesystem::path output_file; - if (boost::filesystem::is_directory(input)) { - output_file = *output / (input.parent_path().filename().string() + ".ecinema"); - } else { - output_file = *output / (input.filename().string() + ".ecinema"); - } - - if (!boost::filesystem::is_directory(*output)) { - boost::filesystem::create_directory (*output); - } - - av_register_all (); - - if (boost::filesystem::is_directory(input)) { - /* Assume input is a DCP */ - convert_dcp (input, output_file, kdm, crf); - } else { - convert_ffmpeg (input, output_file, *format); - } -} - -static void -convert_ffmpeg (boost::filesystem::path input, boost::filesystem::path output_file, string format) -{ - AVFormatContext* input_fc = avformat_alloc_context (); - if (avformat_open_input(&input_fc, input.string().c_str(), 0, 0) < 0) { - cerr << "Could not open input file\n"; - exit (EXIT_FAILURE); - } - - if (avformat_find_stream_info (input_fc, 0) < 0) { - cerr << "Could not read stream information\n"; - exit (EXIT_FAILURE); - } - - AVFormatContext* output_fc; - avformat_alloc_output_context2 (&output_fc, av_guess_format(format.c_str(), 0, 0), 0, 0); - - for (uint32_t i = 0; i < input_fc->nb_streams; ++i) { - AVStream* is = input_fc->streams[i]; - AVStream* os = avformat_new_stream (output_fc, is->codec->codec); - if (avcodec_parameters_copy (os->codecpar, is->codecpar) < 0) { - cerr << "Could not set up output stream.\n"; - exit (EXIT_FAILURE); - } - - os->avg_frame_rate = is->avg_frame_rate; - - switch (is->codec->codec_type) { - case AVMEDIA_TYPE_VIDEO: - os->time_base = is->time_base; - os->r_frame_rate = is->r_frame_rate; - os->sample_aspect_ratio = is->sample_aspect_ratio; - os->codec->time_base = is->codec->time_base; - os->codec->framerate = is->codec->framerate; - os->codec->pix_fmt = is->codec->pix_fmt; - break; - case AVMEDIA_TYPE_AUDIO: - os->codec->sample_fmt = is->codec->sample_fmt; - os->codec->bits_per_raw_sample = is->codec->bits_per_raw_sample; - os->codec->sample_rate = is->codec->sample_rate; - os->codec->channel_layout = is->codec->channel_layout; - os->codec->channels = is->codec->channels; - if (is->codecpar->codec_id == AV_CODEC_ID_PCM_S24LE) { - /* XXX: fix incoming 24-bit files labelled lpcm, which apparently isn't allowed */ - os->codecpar->codec_tag = MKTAG('i', 'n', '2', '4'); - } - break; - default: - /* XXX */ - break; - } - } - - if (avio_open2 (&output_fc->pb, output_file.string().c_str(), AVIO_FLAG_WRITE, 0, 0) < 0) { - cerr << "Could not open output file `" << output_file.string() << "'\n"; - exit (EXIT_FAILURE); - } - - dcp::Key key (AES_CTR_KEY_SIZE); - AVDictionary* options = 0; - av_dict_set (&options, "encryption_key", key.hex().c_str(), 0); - /* XXX: is this OK? */ - av_dict_set (&options, "encryption_kid", "00000000000000000000000000000000", 0); - av_dict_set (&options, "encryption_scheme", "cenc-aes-ctr", 0); - - string id = dcp::make_uuid (); - if (av_dict_set(&output_fc->metadata, SWAROOP_ID_TAG, id.c_str(), 0) < 0) { - cerr << "Could not write ID to output.\n"; - exit (EXIT_FAILURE); - } - - if (avformat_write_header (output_fc, &options) < 0) { - cerr << "Could not write header to output.\n"; - exit (EXIT_FAILURE); - } - - AVPacket packet; - while (av_read_frame(input_fc, &packet) >= 0) { - AVStream* is = input_fc->streams[packet.stream_index]; - AVStream* os = output_fc->streams[packet.stream_index]; - packet.pts = av_rescale_q_rnd(packet.pts, is->time_base, os->time_base, (AVRounding) (AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX)); - packet.dts = av_rescale_q_rnd(packet.dts, is->time_base, os->time_base, (AVRounding) (AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX)); - packet.duration = av_rescale_q(packet.duration, is->time_base, os->time_base); - packet.pos = -1; - if (av_interleaved_write_frame (output_fc, &packet) < 0) { - cerr << "Could not write frame to output.\n"; - exit (EXIT_FAILURE); - } - } - - av_write_trailer (output_fc); - - avformat_free_context (input_fc); - avformat_free_context (output_fc); - - write_kdm (id, output_file, key); -} - -static void -write_kdm (string id, boost::filesystem::path name, dcp::Key key) -{ - DecryptedECinemaKDM decrypted_kdm (id, name.filename().string(), key, optional(), optional()); - EncryptedECinemaKDM encrypted_kdm = decrypted_kdm.encrypt (Config::instance()->decryption_chain()->leaf()); - - ofstream f(string(name.string() + ".xml").c_str()); - f << encrypted_kdm.as_xml() << "\n"; -} - -static void -convert_dcp ( - boost::filesystem::path input, boost::filesystem::path output_file, optional kdm, int crf - ) -{ - shared_ptr film (new Film(boost::optional())); - shared_ptr dcp (new DCPContent(input)); - film->examine_and_add_content (dcp); - if (kdm) { - dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(*kdm))); - } - - JobManager* jm = JobManager::instance (); - while (jm->work_to_do ()) { - while (signal_manager->ui_idle ()) {} - dcpomatic_sleep_seconds (1); - } - DCPOMATIC_ASSERT (!jm->errors()); - - film->set_container (Ratio::nearest_from_ratio(dcp->video->size().ratio())); - - string id = dcp::make_uuid (); - dcp::Key key (AES_CTR_KEY_SIZE); - - shared_ptr job (new TranscodeJob(film)); - job->set_encoder ( - shared_ptr( - new FFmpegEncoder(film, job, output_file, EXPORT_FORMAT_H264_PCM, false, false, crf, key, id) - ) - ); - jm->add (job); - show_jobs_on_console (true); - - write_kdm (id, output_file, key); -} diff --git a/src/tools/swaroop_dcpomatic_playlist.cc b/src/tools/swaroop_dcpomatic_playlist.cc deleted file mode 100644 index e22961240..000000000 --- a/src/tools/swaroop_dcpomatic_playlist.cc +++ /dev/null @@ -1,482 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#include "../wx/wx_util.h" -#include "../wx/wx_signal_manager.h" -#include "../wx/content_view.h" -#include "../wx/dcpomatic_button.h" -#include "../lib/util.h" -#include "../lib/config.h" -#include "../lib/cross.h" -#include "../lib/film.h" -#include "../lib/dcp_content.h" -#include "../lib/swaroop_spl_entry.h" -#include "../lib/swaroop_spl.h" -#include -#include -#include -#include -#ifdef __WXOSX__ -#include -#endif - -using std::exception; -using std::cout; -using std::string; -using boost::optional; -using boost::shared_ptr; -using boost::weak_ptr; -using boost::bind; -using boost::dynamic_pointer_cast; -#if BOOST_VERSION >= 106100 -using namespace boost::placeholders; -#endif - - -class ContentDialog : public wxDialog, public ContentStore -{ -public: - ContentDialog (wxWindow* parent) - : wxDialog (parent, wxID_ANY, _("Add content"), wxDefaultPosition, wxSize(800, 640)) - , _content_view (new ContentView(this)) - { - _content_view->update (); - - wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); - SetSizer (overall_sizer); - - overall_sizer->Add (_content_view, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); - - wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL); - if (buttons) { - overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); - } - - overall_sizer->Layout (); - } - - shared_ptr selected () const - { - return _content_view->selected (); - } - - shared_ptr get (string digest) const - { - return _content_view->get (digest); - } - -private: - ContentView* _content_view; -}; - -class DOMFrame : public wxFrame -{ -public: - explicit DOMFrame (wxString const & title) - : wxFrame (0, -1, title) - , _content_dialog (new ContentDialog(this)) - { - /* Use a panel as the only child of the Frame so that we avoid - the dark-grey background on Windows. - */ - wxPanel* overall_panel = new wxPanel (this, wxID_ANY); - wxBoxSizer* h_sizer = new wxBoxSizer (wxHORIZONTAL); - - _list = new wxListCtrl ( - overall_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL - ); - - _list->AppendColumn (_("Name"), wxLIST_FORMAT_LEFT, 400); - _list->AppendColumn (_("CPL"), wxLIST_FORMAT_LEFT, 350); - _list->AppendColumn (_("Type"), wxLIST_FORMAT_CENTRE, 100); - _list->AppendColumn (_("Format"), wxLIST_FORMAT_CENTRE, 75); - _list->AppendColumn (_("Encrypted"), wxLIST_FORMAT_CENTRE, 90); - _list->AppendColumn (_("Skippable"), wxLIST_FORMAT_CENTRE, 90); - _list->AppendColumn (_("Disable timeline"), wxLIST_FORMAT_CENTRE, 125); - _list->AppendColumn (_("Stop after play"), wxLIST_FORMAT_CENTRE, 125); - - wxImageList* images = new wxImageList (16, 16); - wxIcon tick_icon; - wxIcon no_tick_icon; -#ifdef DCPOMATIX_OSX - tick_icon.LoadFile ("tick.png", wxBITMAP_TYPE_PNG_RESOURCE); - no_tick_icon.LoadFile ("no_tick.png", wxBITMAP_TYPE_PNG_RESOURCE); -#else - boost::filesystem::path tick_path = resources_path() / "tick.png"; - tick_icon.LoadFile (std_to_wx(tick_path.string())); - boost::filesystem::path no_tick_path = resources_path() / "no_tick.png"; - no_tick_icon.LoadFile (std_to_wx(no_tick_path.string())); -#endif - images->Add (tick_icon); - images->Add (no_tick_icon); - - _list->SetImageList (images, wxIMAGE_LIST_SMALL); - - h_sizer->Add (_list, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); - - wxBoxSizer* button_sizer = new wxBoxSizer (wxVERTICAL); - _up = new Button (overall_panel, _("Up")); - _down = new Button (overall_panel, _("Down")); - _add = new Button (overall_panel, _("Add")); - _remove = new Button (overall_panel, _("Remove")); - _save = new Button (overall_panel, _("Save playlist")); - _load = new Button (overall_panel, _("Load playlist")); - button_sizer->Add (_up, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - button_sizer->Add (_down, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - button_sizer->Add (_add, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - button_sizer->Add (_remove, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - button_sizer->Add (_save, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - button_sizer->Add (_load, 0, wxEXPAND | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - - h_sizer->Add (button_sizer, 0, wxALL, DCPOMATIC_SIZER_GAP); - - wxBoxSizer* v_sizer = new wxBoxSizer (wxVERTICAL); - - wxBoxSizer* allowed_shows_sizer = new wxBoxSizer (wxHORIZONTAL); - _allowed_shows_enable = new wxCheckBox (overall_panel, wxID_ANY, _("Limit number of shows with this playlist to")); - allowed_shows_sizer->Add (_allowed_shows_enable, 0, wxRIGHT, DCPOMATIC_SIZER_GAP); - _allowed_shows = new wxSpinCtrl (overall_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 65536, 100); - allowed_shows_sizer->Add (_allowed_shows); - - v_sizer->Add (allowed_shows_sizer, 0, wxALL, DCPOMATIC_SIZER_GAP); - v_sizer->Add (h_sizer); - - overall_panel->SetSizer (v_sizer); - - _list->Bind (wxEVT_LEFT_DOWN, bind(&DOMFrame::list_left_click, this, _1)); - _list->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&DOMFrame::selection_changed, this)); - _list->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&DOMFrame::selection_changed, this)); - _up->Bind (wxEVT_BUTTON, bind(&DOMFrame::up_clicked, this)); - _down->Bind (wxEVT_BUTTON, bind(&DOMFrame::down_clicked, this)); - _add->Bind (wxEVT_BUTTON, bind(&DOMFrame::add_clicked, this)); - _remove->Bind (wxEVT_BUTTON, bind(&DOMFrame::remove_clicked, this)); - _save->Bind (wxEVT_BUTTON, bind(&DOMFrame::save_clicked, this)); - _load->Bind (wxEVT_BUTTON, bind(&DOMFrame::load_clicked, this)); - _allowed_shows_enable->Bind (wxEVT_CHECKBOX, bind(&DOMFrame::allowed_shows_changed, this)); - _allowed_shows->Bind (wxEVT_SPINCTRL, bind(&DOMFrame::allowed_shows_changed, this)); - - setup_sensitivity (); - } - -private: - - void allowed_shows_changed () - { - if (_allowed_shows_enable->GetValue()) { - _playlist.set_allowed_shows (_allowed_shows->GetValue()); - } else { - _playlist.unset_allowed_shows (); - } - setup_sensitivity (); - } - - void add (SPLEntry e) - { - wxListItem item; - item.SetId (_list->GetItemCount()); - long const N = _list->InsertItem (item); - set_item (N, e); - } - - void selection_changed () - { - setup_sensitivity (); - } - - void set_item (long N, SPLEntry e) - { - _list->SetItem (N, 0, std_to_wx(e.name)); - _list->SetItem (N, 1, std_to_wx(e.id)); - _list->SetItem (N, 2, std_to_wx(dcp::content_kind_to_string(e.kind))); - _list->SetItem (N, 3, e.type == SPLEntry::DCP ? _("DCP") : _("E-cinema")); - _list->SetItem (N, 4, e.encrypted ? S_("Question|Y") : S_("Question|N")); - _list->SetItem (N, COLUMN_SKIPPABLE, wxEmptyString, e.skippable ? 0 : 1); - _list->SetItem (N, COLUMN_DISABLE_TIMELINE, wxEmptyString, e.disable_timeline ? 0 : 1); - _list->SetItem (N, COLUMN_STOP_AFTER_PLAY, wxEmptyString, e.stop_after_play ? 0 : 1); - } - - void setup_sensitivity () - { - int const num_selected = _list->GetSelectedItemCount (); - long int selected = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - _up->Enable (selected > 0); - _down->Enable (selected != -1 && selected < (_list->GetItemCount() - 1)); - _remove->Enable (num_selected > 0); - _allowed_shows->Enable (_allowed_shows_enable->GetValue()); - } - - void list_left_click (wxMouseEvent& ev) - { - int flags; - long item = _list->HitTest (ev.GetPosition(), flags, 0); - int x = ev.GetPosition().x; - optional column; - for (int i = 0; i < _list->GetColumnCount(); ++i) { - x -= _list->GetColumnWidth (i); - if (x < 0) { - column = i; - break; - } - } - - if (item != -1 && column) { - switch (*column) { - case COLUMN_SKIPPABLE: - _playlist[item].skippable = !_playlist[item].skippable; - break; - case COLUMN_DISABLE_TIMELINE: - _playlist[item].disable_timeline = !_playlist[item].disable_timeline; - break; - case COLUMN_STOP_AFTER_PLAY: - _playlist[item].stop_after_play = !_playlist[item].stop_after_play; - break; - default: - ev.Skip (); - } - set_item (item, _playlist[item]); - } else { - ev.Skip (); - } - } - - void add_clicked () - { - int const r = _content_dialog->ShowModal (); - if (r == wxID_OK) { - shared_ptr content = _content_dialog->selected (); - if (content) { - SPLEntry e (content); - add (e); - _playlist.add (e); - } - } - } - - void up_clicked () - { - long int s = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (s < 1) { - return; - } - - SPLEntry tmp = _playlist[s]; - _playlist[s] = _playlist[s-1]; - _playlist[s-1] = tmp; - - set_item (s - 1, _playlist[s-1]); - set_item (s, _playlist[s]); - } - - void down_clicked () - { - long int s = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (s > (_list->GetItemCount() - 1)) { - return; - } - - SPLEntry tmp = _playlist[s]; - _playlist[s] = _playlist[s+1]; - _playlist[s+1] = tmp; - - set_item (s + 1, _playlist[s+1]); - set_item (s, _playlist[s]); - } - - void remove_clicked () - { - long int s = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (s == -1) { - return; - } - - _playlist.remove (s); - _list->DeleteItem (s); - } - - void save_clicked () - { - Config* c = Config::instance (); - wxString default_dir = c->player_playlist_directory() ? std_to_wx(c->player_playlist_directory()->string()) : wxString(wxEmptyString); - wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), default_dir, wxEmptyString, wxT("XML files (*.xml)|*.xml"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); - if (d->ShowModal() == wxID_OK) { - boost::filesystem::path file = wx_to_std (d->GetPath()); - file.replace_extension (".xml"); - _playlist.write (file); - } - } - - void load_clicked () - { - Config* c = Config::instance (); - wxString default_dir = c->player_playlist_directory() ? std_to_wx(c->player_playlist_directory()->string()) : wxString(wxEmptyString); - wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), default_dir, wxEmptyString, wxT("XML files (*.xml)|*.xml")); - if (d->ShowModal() == wxID_OK) { - _list->DeleteAllItems (); - _playlist.read (wx_to_std(d->GetPath()), _content_dialog); - if (!_playlist.missing()) { - _list->DeleteAllItems (); - BOOST_FOREACH (SPLEntry i, _playlist.get()) { - add (i); - } - } else { - error_dialog (this, _("Some content in this playlist was not found.")); - } - optional allowed_shows = _playlist.allowed_shows (); - _allowed_shows_enable->SetValue (static_cast(allowed_shows)); - if (allowed_shows) { - _allowed_shows->SetValue (*allowed_shows); - } else { - _allowed_shows->SetValue (65536); - } - setup_sensitivity (); - } - } - - wxListCtrl* _list; - wxButton* _up; - wxButton* _down; - wxButton* _add; - wxButton* _remove; - wxButton* _save; - wxButton* _load; - wxCheckBox* _allowed_shows_enable; - wxSpinCtrl* _allowed_shows; - SPL _playlist; - ContentDialog* _content_dialog; - - enum { - COLUMN_SKIPPABLE = 5, - COLUMN_DISABLE_TIMELINE = 6, - COLUMN_STOP_AFTER_PLAY = 7 - }; -}; - -/** @class App - * @brief The magic App class for wxWidgets. - */ -class App : public wxApp -{ -public: - App () - : wxApp () - , _frame (0) - {} - -private: - - bool OnInit () - try - { - SetAppName (_("DCP-o-matic KDM Creator")); - - if (!wxApp::OnInit()) { - return false; - } - -#ifdef DCPOMATIC_LINUX - unsetenv ("UBUNTU_MENUPROXY"); -#endif - -#ifdef __WXOSX__ - ProcessSerialNumber serial; - GetCurrentProcess (&serial); - TransformProcessType (&serial, kProcessTransformToForegroundApplication); -#endif - - dcpomatic_setup_path_encoding (); - - /* Enable i18n; this will create a Config object - to look for a force-configured language. This Config - object will be wrong, however, because dcpomatic_setup - hasn't yet been called and there aren't any filters etc. - set up yet. - */ - dcpomatic_setup_i18n (); - - /* Set things up, including filters etc. - which will now be internationalised correctly. - */ - dcpomatic_setup (); - - /* Force the configuration to be re-loaded correctly next - time it is needed. - */ - Config::drop (); - - _frame = new DOMFrame (_("DCP-o-matic Playlist Editor")); - SetTopWindow (_frame); - _frame->Maximize (); - _frame->Show (); - - signal_manager = new wxSignalManager (this); - Bind (wxEVT_IDLE, boost::bind (&App::idle, this)); - - return true; - } - catch (exception& e) - { - error_dialog (0, _("DCP-o-matic could not start"), std_to_wx(e.what())); - return true; - } - - /* An unhandled exception has occurred inside the main event loop */ - bool OnExceptionInMainLoop () - { - try { - throw; - } catch (FileError& e) { - error_dialog ( - 0, - wxString::Format ( - _("An exception occurred: %s (%s)\n\n") + REPORT_PROBLEM, - std_to_wx (e.what()), - std_to_wx (e.file().string().c_str ()) - ) - ); - } catch (exception& e) { - error_dialog ( - 0, - wxString::Format ( - _("An exception occurred: %s.\n\n") + " " + REPORT_PROBLEM, - std_to_wx (e.what ()) - ) - ); - } catch (...) { - error_dialog (0, _("An unknown exception occurred.") + " " + REPORT_PROBLEM); - } - - /* This will terminate the program */ - return false; - } - - void OnUnhandledException () - { - error_dialog (0, _("An unknown exception occurred.") + " " + REPORT_PROBLEM); - } - - void idle () - { - signal_manager->ui_idle (); - } - - DOMFrame* _frame; -}; - -IMPLEMENT_APP (App) diff --git a/src/tools/swaroop_dcpomatic_uuid.cc b/src/tools/swaroop_dcpomatic_uuid.cc deleted file mode 100644 index 65582ac0c..000000000 --- a/src/tools/swaroop_dcpomatic_uuid.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#include - -int main () -{ -#ifdef DCPOMATIC_LINUX - FILE* f = fopen ("/sys/class/dmi/id/product_uuid", "r"); - if (!f) { - printf ("unknown"); - return 1; - } - char buffer[256]; - int const N = fread (buffer, 1, 255, f); - buffer[N] = '\0'; - printf ("%s", buffer); - fclose (f); - return 0; -#endif - printf ("unknown"); - return 1; -} diff --git a/src/tools/wscript b/src/tools/wscript index 49b339218..81575c5dc 100644 --- a/src/tools/wscript +++ b/src/tools/wscript @@ -42,15 +42,9 @@ def build(bld): if bld.env.TARGET_LINUX: uselib += 'DL ' - cli_tools = [] - if bld.env.VARIANT == 'swaroop-theater': - cli_tools = ['swaroop_dcpomatic_uuid'] - elif bld.env.VARIANT == 'swaroop-studio': - cli_tools = ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test', 'dcpomatic_kdm_cli', 'dcpomatic_create', 'swaroop_dcpomatic_ecinema', 'swaroop_dcpomatic_uuid'] - else: - cli_tools = ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test', 'dcpomatic_kdm_cli', 'dcpomatic_create'] - if bld.env.ENABLE_DISK: - cli_tools.append('dcpomatic_disk_writer') + cli_tools = ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test', 'dcpomatic_kdm_cli', 'dcpomatic_create'] + if bld.env.ENABLE_DISK: + cli_tools.append('dcpomatic_disk_writer') for t in cli_tools: obj = bld(features='cxx cxxprogram') @@ -62,20 +56,15 @@ def build(bld): obj.source += ' ../../platform/windows/%s.rc' % t # Prevent a console window opening when we start dcpomatic2_disk_writer obj.env.append_value('LINKFLAGS', '-Wl,-subsystem,windows') - obj.target = t.replace('dcpomatic', 'dcpomatic2').replace('swaroop_', '') + obj.target = t.replace('dcpomatic', 'dcpomatic2') if t == 'server_test': obj.install_path = None gui_tools = [] if not bld.env.DISABLE_GUI: - if bld.env.VARIANT == 'swaroop-theater': - gui_tools = ['dcpomatic_player', 'swaroop_dcpomatic_playlist'] - elif bld.env.VARIANT == 'swaroop-studio': - gui_tools = ['dcpomatic', 'dcpomatic_batch', 'dcpomatic_server', 'dcpomatic_kdm', 'dcpomatic_player', 'swaroop_dcpomatic_playlist'] - else: - gui_tools = ['dcpomatic', 'dcpomatic_batch', 'dcpomatic_server', 'dcpomatic_kdm', 'dcpomatic_player', 'dcpomatic_playlist', 'dcpomatic_combiner'] - if bld.env.ENABLE_DISK: - gui_tools.append('dcpomatic_disk') + gui_tools = ['dcpomatic', 'dcpomatic_batch', 'dcpomatic_server', 'dcpomatic_kdm', 'dcpomatic_player', 'dcpomatic_playlist', 'dcpomatic_combiner'] + if bld.env.ENABLE_DISK: + gui_tools.append('dcpomatic_disk') for t in gui_tools: obj = bld(features='cxx cxxprogram') @@ -92,7 +81,7 @@ def build(bld): obj.source = '%s.cc' % t if bld.env.TARGET_WINDOWS: obj.source += ' ../../platform/windows/%s.rc' % t - obj.target = t.replace('dcpomatic', 'dcpomatic2').replace('swaroop_', '') + obj.target = t.replace('dcpomatic', 'dcpomatic2') i18n.po_to_mo(os.path.join('src', 'tools'), 'dcpomatic2', bld) diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 957fd32db..2319754f0 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -1077,19 +1077,9 @@ LocationsPage::setup () table->Add (_kdm_directory, wxGBPosition (r, 1)); ++r; -#ifdef DCPOMATIC_VARIANT_SWAROOP - add_label_to_sizer (table, _panel, _("Background image"), true, wxGBPosition (r, 0)); - _background_image = new FilePickerCtrl (_panel, _("Select image file"), "*.png;*.jpg;*.jpeg;*.tif;*.tiff", true, false); - table->Add (_background_image, wxGBPosition (r, 1)); - ++r; -#endif - _content_directory->Bind (wxEVT_DIRPICKER_CHANGED, bind(&LocationsPage::content_directory_changed, this)); _playlist_directory->Bind (wxEVT_DIRPICKER_CHANGED, bind(&LocationsPage::playlist_directory_changed, this)); _kdm_directory->Bind (wxEVT_DIRPICKER_CHANGED, bind(&LocationsPage::kdm_directory_changed, this)); -#ifdef DCPOMATIC_VARIANT_SWAROOP - _background_image->Bind (wxEVT_FILEPICKER_CHANGED, bind(&LocationsPage::background_image_changed, this)); -#endif } void @@ -1106,11 +1096,6 @@ LocationsPage::config_changed () if (config->player_kdm_directory()) { checked_set (_kdm_directory, *config->player_kdm_directory()); } -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (config->player_background_image()) { - checked_set (_background_image, *config->player_background_image()); - } -#endif } void @@ -1130,20 +1115,3 @@ LocationsPage::kdm_directory_changed () { Config::instance()->set_player_kdm_directory(wx_to_std(_kdm_directory->GetPath())); } - -#ifdef DCPOMATIC_VARIANT_SWAROOP -void -LocationsPage::background_image_changed () -{ - boost::filesystem::path const f = wx_to_std(_background_image->GetPath()); - if (!boost::filesystem::is_regular_file(f) || !wxImage::CanRead(std_to_wx(f.string()))) { - error_dialog (0, _("Could not load image file.")); - if (Config::instance()->player_background_image()) { - checked_set (_background_image, *Config::instance()->player_background_image()); - } - return; - } - - Config::instance()->set_player_background_image(f); -} -#endif diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h index afbe9ed2e..a698b252a 100644 --- a/src/wx/config_dialog.h +++ b/src/wx/config_dialog.h @@ -232,15 +232,8 @@ private: void playlist_directory_changed (); void kdm_directory_changed (); -#ifdef DCPOMATIC_VARIANT_SWAROOP - void background_image_changed (); -#endif - wxDirPickerCtrl* _content_directory; wxDirPickerCtrl* _playlist_directory; wxDirPickerCtrl* _kdm_directory; -#ifdef DCPOMATIC_VARIANT_SWAROOP - FilePickerCtrl* _background_image; -#endif }; #endif diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 9561c32b5..ee0322d6f 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -93,9 +93,6 @@ FilmViewer::FilmViewer (wxWindow* p) , _closed_captions_dialog (new ClosedCaptionsDialog(p, this)) , _outline_content (false) , _pad_black (false) -#ifdef DCPOMATIC_VARIANT_SWAROOP - , _background_image (false) -#endif , _idle_get (false) { switch (Config::instance()->video_view_type()) { @@ -507,13 +504,6 @@ FilmViewer::seek (DCPTime t, bool accurate) void FilmViewer::config_changed (Config::Property p) { -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (p == Config::PLAYER_BACKGROUND_IMAGE) { - _video_view->update (); - return; - } -#endif - if (p == Config::AUDIO_MAPPING) { recreate_butler (); return; diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index a0edafe95..15d6bfaf5 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -105,17 +105,6 @@ public: int audio_callback (void* out, unsigned int frames); -#ifdef DCPOMATIC_VARIANT_SWAROOP - void set_background_image (bool b) { - _background_image = b; - _video_view->update (); - } - - bool background_image () const { - return _background_image; - } -#endif - StateTimer const & state_timer () const { return _video_view->state_timer (); } @@ -206,10 +195,6 @@ private: */ bool _pad_black; -#ifdef DCPOMATIC_VARIANT_SWAROOP - bool _background_image; -#endif - /** true if an get() is required next time we are idle */ bool _idle_get; diff --git a/src/wx/player_config_dialog.cc b/src/wx/player_config_dialog.cc index a68376530..7af429326 100644 --- a/src/wx/player_config_dialog.cc +++ b/src/wx/player_config_dialog.cc @@ -133,28 +133,12 @@ private: table->Add (_debug_log_file, wxGBPosition(r, 1)); ++r; -#ifdef DCPOMATIC_VARIANT_SWAROOP - add_label_to_sizer (table, _panel, _("KDM server URL"), true, wxGBPosition(r, 0)); - _kdm_server_url = new wxTextCtrl (_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(400, -1)); - table->Add (_kdm_server_url, wxGBPosition (r, 1)); - ++r; - - add_label_to_sizer (table, _panel, _("Lock file"), true, wxGBPosition(r, 0)); - _lock_file = new FilePickerCtrl (_panel, _("Select lock file"), "*", true, true); - table->Add (_lock_file, wxGBPosition (r, 1)); - ++r; -#endif - _player_mode->Bind (wxEVT_CHOICE, bind(&PlayerGeneralPage::player_mode_changed, this)); _image_display->Bind (wxEVT_CHOICE, bind(&PlayerGeneralPage::image_display_changed, this)); _video_display_mode->Bind (wxEVT_CHOICE, bind(&PlayerGeneralPage::video_display_mode_changed, this)); _respect_kdm->Bind (wxEVT_CHECKBOX, bind(&PlayerGeneralPage::respect_kdm_changed, this)); _activity_log_file->Bind (wxEVT_FILEPICKER_CHANGED, bind(&PlayerGeneralPage::activity_log_file_changed, this)); _debug_log_file->Bind (wxEVT_FILEPICKER_CHANGED, bind(&PlayerGeneralPage::debug_log_file_changed, this)); -#ifdef DCPOMATIC_VARIANT_SWAROOP - _kdm_server_url->Bind (wxEVT_TEXT, bind(&PlayerGeneralPage::kdm_server_url_changed, this)); - _lock_file->Bind (wxEVT_FILEPICKER_CHANGED, bind(&PlayerGeneralPage::lock_file_changed, this)); -#endif } void config_changed () @@ -192,12 +176,6 @@ private: if (config->player_debug_log_file()) { checked_set (_debug_log_file, *config->player_debug_log_file()); } -#ifdef DCPOMATIC_VARIANT_SWAROOP - checked_set (_kdm_server_url, config->kdm_server_url()); - if (config->player_lock_file()) { - checked_set (_lock_file, config->player_lock_file().get()); - } -#endif } private: @@ -245,28 +223,12 @@ private: Config::instance()->set_player_debug_log_file(wx_to_std(_debug_log_file->GetPath())); } -#ifdef DCPOMATIC_VARIANT_SWAROOP - void kdm_server_url_changed () - { - Config::instance()->set_kdm_server_url(wx_to_std(_kdm_server_url->GetValue())); - } - - void lock_file_changed () - { - Config::instance()->set_player_lock_file(wx_to_std(_lock_file->GetPath())); - } -#endif - wxChoice* _player_mode; wxChoice* _image_display; wxChoice* _video_display_mode; wxCheckBox* _respect_kdm; FilePickerCtrl* _activity_log_file; FilePickerCtrl* _debug_log_file; -#ifdef DCPOMATIC_VARIANT_SWAROOP - wxTextCtrl* _kdm_server_url; - FilePickerCtrl* _lock_file; -#endif }; @@ -392,169 +354,6 @@ private: }; -#ifdef DCPOMATIC_VARIANT_SWAROOP -class WatermarkPage : public StandardPage -{ -public: - WatermarkPage (wxSize panel_size, int border) - : StandardPage (panel_size, border) - {} - - wxString GetName () const - { - return _("Watermark"); - } - -#ifdef DCPOMATIC_OSX - wxBitmap GetLargeIcon () const - { - /* XXX: this icon doesn't exist; this is just to make the swaroop variant build on OS X */ - return wxBitmap ("watermark", wxBITMAP_TYPE_PNG_RESOURCE); - } -#endif - -private: - void setup () - { - wxGridBagSizer* table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border); - - int r = 0; - - add_label_to_sizer (table, _panel, _("Theatre name"), true, wxGBPosition(r, 0)); - _theatre = new wxTextCtrl (_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1)); - table->Add (_theatre, wxGBPosition(r, 1), wxGBSpan(1, 2)); - ++r; - - add_label_to_sizer (table, _panel, _("Period"), true, wxGBPosition(r, 0)); - _period = new wxSpinCtrl (_panel, wxID_ANY); - _period->SetRange (1, 60); - table->Add (_period, wxGBPosition(r, 1)); - add_label_to_sizer (table, _panel, _("minutes"), false, wxGBPosition(r, 2)); - ++r; - - add_label_to_sizer (table, _panel, _("Duration"), true, wxGBPosition(r, 0)); - _duration = new wxSpinCtrl (_panel, wxID_ANY); - _duration->SetRange (100, 5000); - table->Add (_duration, wxGBPosition(r, 1)); - add_label_to_sizer (table, _panel, _("milliseconds"), false, wxGBPosition(r, 2)); - ++r; - - _theatre->Bind (wxEVT_TEXT, bind(&WatermarkPage::theatre_changed, this)); - _duration->Bind (wxEVT_SPINCTRL, bind(&WatermarkPage::duration_changed, this)); - _period->Bind (wxEVT_SPINCTRL, bind(&WatermarkPage::period_changed, this)); - } - - void config_changed () - { - Config* config = Config::instance (); - checked_set (_theatre, config->player_watermark_theatre()); - checked_set (_duration, config->player_watermark_duration()); - checked_set (_period, config->player_watermark_period()); - } - - void theatre_changed () - { - Config::instance()->set_player_watermark_theatre(wx_to_std(_theatre->GetValue())); - } - - void period_changed () - { - Config::instance()->set_player_watermark_period(_period->GetValue()); - } - - void duration_changed () - { - Config::instance()->set_player_watermark_duration(_duration->GetValue()); - } - - wxTextCtrl* _theatre; - wxSpinCtrl* _period; - wxSpinCtrl* _duration; -}; - -class DevicesPage : public StandardPage -{ -public: - DevicesPage (wxSize panel_size, int border) - : StandardPage (panel_size, border) - {} - - wxString GetName () const - { - return _("Devices"); - } - -#ifdef DCPOMATIC_OSX - wxBitmap GetLargeIcon () const - { - /* XXX: this icon doesn't exist; this is just to make the swaroop variant build on OS X */ - return wxBitmap ("devices", wxBITMAP_TYPE_PNG_RESOURCE); - } -#endif - -private: - void setup () - { - vector columns; - columns.push_back(EditableListColumn(_("Manufacturer ID"))); - columns.push_back(EditableListColumn(_("Product code"))); - columns.push_back(EditableListColumn(_("Serial"))); - columns.push_back(EditableListColumn(_("Manufacture week"))); - columns.push_back(EditableListColumn(_("Manufacture year"))); - _monitor_list = new EditableList ( - _panel, - columns, - boost::bind (&Config::required_monitors, Config::instance()), - boost::bind (&Config::set_required_monitors, Config::instance(), _1), - boost::bind (&DevicesPage::monitor_column, this, _1, _2), - true, - true - ); - _panel->GetSizer()->Add(_monitor_list, 1, wxEXPAND | wxALL, _border); - - wxButton* get = new Button(_panel, _("Read current devices")); - _panel->GetSizer()->Add(get, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP); - get->Bind(wxEVT_BUTTON, bind(&DevicesPage::get_clicked, this)); - } - - void get_clicked () - { - Config::instance()->set_required_monitors(get_monitors()); - _monitor_list->refresh (); - } - - string monitor_column (Monitor m, int c) - { - switch (c) { - case 0: - return m.manufacturer_id; - case 1: - return locale_convert(m.manufacturer_product_code); - case 2: - return locale_convert(m.serial_number); - case 3: - return locale_convert(m.week_of_manufacture); - case 4: - return locale_convert(m.year_of_manufacture); - default: - DCPOMATIC_ASSERT(false); - } - - return ""; - } - - void config_changed () - { - _monitor_list->refresh (); - } - -private: - EditableList* _monitor_list; -}; - -#endif - wxPreferencesEditor* create_player_config_dialog () { @@ -576,10 +375,6 @@ create_player_config_dialog () e->AddPage (new SoundPage(ps, border)); e->AddPage (new LocationsPage(ps, border)); e->AddPage (new KeysPage(ps, border)); -#ifdef DCPOMATIC_VARIANT_SWAROOP - e->AddPage (new WatermarkPage(ps, border)); - e->AddPage (new DevicesPage(ps, border)); -#endif e->AddPage (new PlayerAdvancedPage(ps, border)); return e; } diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc index dd1296ed6..117eee218 100644 --- a/src/wx/simple_video_view.cc +++ b/src/wx/simple_video_view.cc @@ -66,19 +66,6 @@ SimpleVideoView::paint () dcp::Size const out_size = _viewer->out_size (); wxSize const panel_size = _panel->GetSize (); -#ifdef DCPOMATIC_VARIANT_SWAROOP - if (_viewer->background_image()) { - dc.Clear (); - optional bg = Config::instance()->player_background_image(); - if (bg) { - wxImage image (std_to_wx(bg->string())); - wxBitmap bitmap (image); - dc.DrawBitmap (bitmap, max(0, (panel_size.GetWidth() - image.GetSize().GetWidth()) / 2), max(0, (panel_size.GetHeight() - image.GetSize().GetHeight()) / 2)); - } - return; - } -#endif - if (!out_size.width || !out_size.height || !_image || out_size != _image->size()) { dc.Clear (); } else { @@ -86,27 +73,6 @@ SimpleVideoView::paint () wxImage frame (out_size.width, out_size.height, _image->data()[0], true); wxBitmap frame_bitmap (frame); dc.DrawBitmap (frame_bitmap, 0, max(0, (panel_size.GetHeight() - out_size.height) / 2)); - -#ifdef DCPOMATIC_VARIANT_SWAROOP - DCPTime const period = DCPTime::from_seconds(Config::instance()->player_watermark_period() * 60); - int64_t n = position().get() / period.get(); - DCPTime from(n * period.get()); - DCPTime to = from + DCPTime::from_seconds(Config::instance()->player_watermark_duration() / 1000.0); - if (from <= position() && position() <= to) { - if (!_in_watermark) { - _in_watermark = true; - _watermark_x = rand() % panel_size.GetWidth(); - _watermark_y = rand() % panel_size.GetHeight(); - } - dc.SetTextForeground(*wxWHITE); - string wm = Config::instance()->player_watermark_theatre(); - boost::posix_time::ptime t = boost::posix_time::second_clock::local_time(); - wm += "\n" + boost::posix_time::to_iso_extended_string(t); - dc.DrawText(std_to_wx(wm), _watermark_x, _watermark_y); - } else { - _in_watermark = false; - } -#endif } if (out_size.width < panel_size.GetWidth()) { diff --git a/src/wx/swaroop_controls.cc b/src/wx/swaroop_controls.cc deleted file mode 100644 index add9bf3e0..000000000 --- a/src/wx/swaroop_controls.cc +++ /dev/null @@ -1,610 +0,0 @@ -/* - Copyright (C) 2018-2019 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#include "swaroop_controls.h" -#include "film_viewer.h" -#include "wx_util.h" -#include "content_view.h" -#include "dcpomatic_button.h" -#include "static_text.h" -#include "lib/player_video.h" -#include "lib/dcp_content.h" -#include "lib/cross.h" -#include "lib/scoped_temporary.h" -#include "lib/internet.h" -#include "lib/ffmpeg_content.h" -#include "lib/compose.hpp" -#include -#include -#include -#include - -using std::string; -using std::cout; -using std::exception; -using std::sort; -using boost::shared_ptr; -using boost::dynamic_pointer_cast; -using boost::optional; -using namespace dcpomatic; - -SwaroopControls::SwaroopControls (wxWindow* parent, shared_ptr viewer) - : Controls (parent, viewer, false) - , _play_button (new Button(this, _("Play"))) - , _pause_button (new Button(this, _("Pause"))) - , _stop_button (new Button(this, _("Stop"))) - , _next_button (new Button(this, "Next")) - , _previous_button (new Button(this, "Previous")) - , _current_disable_timeline (false) - , _current_disable_next (false) - , _timer (this) -{ - _button_sizer->Add (_previous_button, 0, wxEXPAND); - _button_sizer->Add (_play_button, 0, wxEXPAND); - _button_sizer->Add (_pause_button, 0, wxEXPAND); - _button_sizer->Add (_stop_button, 0, wxEXPAND); - _button_sizer->Add (_next_button, 0, wxEXPAND); - - _spl_view = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER); - _spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 740); - - wxBoxSizer* left_sizer = new wxBoxSizer (wxVERTICAL); - wxBoxSizer* e_sizer = new wxBoxSizer (wxHORIZONTAL); - - wxFont subheading_font (*wxNORMAL_FONT); - subheading_font.SetWeight (wxFONTWEIGHT_BOLD); - - wxBoxSizer* spl_header = new wxBoxSizer (wxHORIZONTAL); - { - wxStaticText* m = new StaticText (this, "Playlists"); - m->SetFont (subheading_font); - spl_header->Add (m, 1, wxALIGN_CENTER_VERTICAL); - } - _refresh_spl_view = new Button (this, "Refresh"); - spl_header->Add (_refresh_spl_view, 0, wxBOTTOM, DCPOMATIC_SIZER_GAP / 2); - - left_sizer->Add (spl_header, 0, wxLEFT | wxRIGHT | wxEXPAND, DCPOMATIC_SIZER_GAP); - left_sizer->Add (_spl_view, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, DCPOMATIC_SIZER_GAP); - - _content_view = new ContentView (this); - - wxBoxSizer* content_header = new wxBoxSizer (wxHORIZONTAL); - { - wxStaticText* m = new StaticText (this, "Content"); - m->SetFont (subheading_font); - content_header->Add (m, 1, wxALIGN_CENTER_VERTICAL); - } - _refresh_content_view = new Button (this, "Refresh"); - content_header->Add (_refresh_content_view, 0, wxBOTTOM, DCPOMATIC_SIZER_GAP / 2); - - left_sizer->Add (content_header, 0, wxTOP | wxLEFT | wxRIGHT | wxEXPAND, DCPOMATIC_SIZER_GAP); - left_sizer->Add (_content_view, 1, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, DCPOMATIC_SIZER_GAP); - - _current_spl_view = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER); - _current_spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 500); - _current_spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80); - e_sizer->Add (left_sizer, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP); - e_sizer->Add (_current_spl_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP); - - _v_sizer->Add (e_sizer, 1, wxEXPAND); - - _play_button->Bind (wxEVT_BUTTON, boost::bind(&SwaroopControls::play_clicked, this)); - _pause_button->Bind (wxEVT_BUTTON, boost::bind(&SwaroopControls::pause_clicked, this)); - _stop_button->Bind (wxEVT_BUTTON, boost::bind(&SwaroopControls::stop_clicked, this)); - _next_button->Bind (wxEVT_BUTTON, boost::bind(&SwaroopControls::next_clicked, this)); - _previous_button->Bind (wxEVT_BUTTON, boost::bind(&SwaroopControls::previous_clicked, this)); - _spl_view->Bind (wxEVT_LIST_ITEM_SELECTED, boost::bind(&SwaroopControls::spl_selection_changed, this)); - _spl_view->Bind (wxEVT_LIST_ITEM_DESELECTED, boost::bind(&SwaroopControls::spl_selection_changed, this)); - _viewer->Finished.connect (boost::bind(&SwaroopControls::viewer_finished, this)); - _refresh_spl_view->Bind (wxEVT_BUTTON, boost::bind(&SwaroopControls::update_playlist_directory, this)); - _refresh_content_view->Bind (wxEVT_BUTTON, boost::bind(&ContentView::update, _content_view)); - - /* Write position every two minutes if we're playing */ - Bind (wxEVT_TIMER, boost::bind(&SwaroopControls::write_position, this)); - _timer.Start (2 * 60 * 1000, wxTIMER_CONTINUOUS); - - _content_view->update (); - update_playlist_directory (); - - _viewer->set_background_image (true); -} - -void -SwaroopControls::check_restart () -{ - cout << "check_restart called\n"; - FILE* f = fopen_boost (Config::path("position"), "r"); - if (!f) { - cout << "could not open position file (" << errno << ")\n"; - return; - } - - char id[64]; - int index; - int64_t time; - fscanf (f, "%63s %d %ld", id, &index, &time); - - cout << "Looking for playlist " << id << " to restart.\n"; - - for (size_t i = 0; i < _playlists.size(); ++i) { - if (_playlists[i].id() == id) { - cout << "Found playlist " << id << "\n"; - select_playlist (i, index); - update_current_content (); - _viewer->seek (DCPTime(time), false); - _viewer->start (); - } - } - - fclose (f); -} - -void -SwaroopControls::write_position () -{ - if (!_selected_playlist || !_viewer->playing()) { - return; - } - - FILE* f = fopen_boost (Config::path("position"), "w"); - if (f) { - string const p = _playlists[*_selected_playlist].id() - + " " + dcp::raw_convert(_selected_playlist_position) - + " " + dcp::raw_convert(_viewer->position().get()); - - checked_fwrite (p.c_str(), p.length(), f, Config::path("position")); -#ifdef DCPOMATIC_LINUX - fflush (f); - fsync (fileno(f)); -#endif - fclose (f); - } -} - -void -SwaroopControls::started () -{ - Controls::started (); - _play_button->Enable (false); - _pause_button->Enable (true); - _viewer->set_background_image (false); -} - -/** Called when the viewer finishes a single piece of content, or it is explicitly stopped */ -void -SwaroopControls::stopped () -{ - Controls::stopped (); - _play_button->Enable (true); - _pause_button->Enable (false); -} - -void -SwaroopControls::deselect_playlist () -{ - long int const selected = _spl_view->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (selected != -1) { - _selected_playlist = boost::none; - _spl_view->SetItemState (selected, 0, wxLIST_STATE_SELECTED); - } - ResetFilm (shared_ptr(new Film(optional()))); -} - -void -SwaroopControls::decrement_allowed_shows () -{ - if (_selected_playlist) { - SPL& spl = _playlists[*_selected_playlist]; - spl.decrement_allowed_shows(); - if (spl.path()) { - spl.write (*spl.path()); - } - } -} - -void -SwaroopControls::play_clicked () -{ - _viewer->start (); -} - -void -SwaroopControls::setup_sensitivity () -{ - Controls::setup_sensitivity (); - bool const active_job = _active_job && *_active_job != "examine_content"; - bool const c = _film && !_film->content().empty() && !active_job; - _play_button->Enable (c && !_viewer->playing()); - _pause_button->Enable (_viewer->playing()); - _slider->Enable (!_current_disable_timeline); - _spl_view->Enable (!_viewer->playing()); - _next_button->Enable (!_current_disable_next && can_do_next()); - _previous_button->Enable (can_do_previous()); -} - -void -SwaroopControls::pause_clicked () -{ - _viewer->stop (); -} - -void -SwaroopControls::stop_clicked () -{ - _viewer->stop (); - _viewer->seek (DCPTime(), true); - if (_selected_playlist) { - _selected_playlist_position = 0; - update_current_content (); - } - _viewer->set_background_image (true); - decrement_allowed_shows (); - deselect_playlist (); -} - -bool -SwaroopControls::can_do_previous () -{ - return _selected_playlist && (_selected_playlist_position - 1) >= 0; -} - -void -SwaroopControls::previous_clicked () -{ - if (!can_do_previous ()) { - return; - } - - _selected_playlist_position--; - update_current_content (); -} - -bool -SwaroopControls::can_do_next () -{ - return _selected_playlist && (_selected_playlist_position + 1) < int(_playlists[*_selected_playlist].get().size()); -} - -void -SwaroopControls::next_clicked () -{ - if (!can_do_next ()) { - return; - } - - _selected_playlist_position++; - update_current_content (); -} - -void -SwaroopControls::log (wxString s) -{ - optional log = Config::instance()->player_activity_log_file(); - if (!log) { - return; - } - - struct timeval time; - gettimeofday (&time, 0); - char buffer[64]; - time_t const sec = time.tv_sec; - struct tm* t = localtime (&sec); - strftime (buffer, 64, "%c", t); - wxString ts = std_to_wx(string(buffer)) + N_(": "); - FILE* f = fopen_boost (*log, "a"); - if (!f) { - return; - } - fprintf (f, "%s%s\n", wx_to_std(ts).c_str(), wx_to_std(s).c_str()); - fclose (f); -} - -void -SwaroopControls::add_playlist_to_list (SPL spl) -{ - int const N = _spl_view->GetItemCount(); - - wxListItem it; - it.SetId(N); - it.SetColumn(0); - string t = spl.name(); - if (spl.missing()) { - t += " (content missing)"; - } - it.SetText (std_to_wx(t)); - _spl_view->InsertItem (it); -} - -struct SPLComparator -{ - bool operator() (SPL const & a, SPL const & b) { - return a.name() < b.name(); - } -}; - -void -SwaroopControls::update_playlist_directory () -{ - using namespace boost::filesystem; - - _spl_view->DeleteAllItems (); - optional dir = Config::instance()->player_playlist_directory(); - if (!dir) { - return; - } - - _playlists.clear (); - - for (directory_iterator i = directory_iterator(*dir); i != directory_iterator(); ++i) { - try { - if (is_regular_file(i->path()) && i->path().extension() == ".xml") { - SPL spl; - spl.read (i->path(), _content_view); - _playlists.push_back (spl); - } - } catch (exception& e) { - /* Never mind */ - } - } - - sort (_playlists.begin(), _playlists.end(), SPLComparator()); - BOOST_FOREACH (SPL i, _playlists) { - add_playlist_to_list (i); - } - - _selected_playlist = boost::none; -} - -optional -SwaroopControls::get_kdm_from_url (shared_ptr dcp) -{ - ScopedTemporary temp; - string url = Config::instance()->kdm_server_url(); - boost::algorithm::replace_all (url, "{CPL}", *dcp->cpl()); - optional kdm; - if (dcp->cpl() && !get_from_url(url, false, false, temp)) { - try { - kdm = dcp::EncryptedKDM (dcp::file_to_string(temp.file())); - if (kdm->cpl_id() != dcp->cpl()) { - kdm = boost::none; - } - } catch (std::exception& e) { - /* Hey well */ - } - } - return kdm; -} - -optional -SwaroopControls::get_kdm_from_directory (shared_ptr dcp) -{ - using namespace boost::filesystem; - optional kdm_dir = Config::instance()->player_kdm_directory(); - if (!kdm_dir) { - return optional(); - } - for (directory_iterator i = directory_iterator(*kdm_dir); i != directory_iterator(); ++i) { - try { - if (file_size(i->path()) < MAX_KDM_SIZE) { - dcp::EncryptedKDM kdm (dcp::file_to_string(i->path())); - if (kdm.cpl_id() == dcp->cpl()) { - return kdm; - } - } - } catch (std::exception& e) { - /* Hey well */ - } - } - return optional(); -} - -optional -SwaroopControls::get_kdm_from_directory (shared_ptr ffmpeg) -{ - using namespace boost::filesystem; - optional kdm_dir = Config::instance()->player_kdm_directory(); - if (!kdm_dir) { - return optional(); - } - for (directory_iterator i = directory_iterator(*kdm_dir); i != directory_iterator(); ++i) { - try { - if (file_size(i->path()) < MAX_KDM_SIZE) { - EncryptedECinemaKDM kdm (dcp::file_to_string(i->path())); - if (kdm.id() == ffmpeg->id().get_value_or("")) { - return kdm; - } - } - } catch (std::exception& e) { - /* Hey well */ - } - } - return optional(); -} -void -SwaroopControls::spl_selection_changed () -{ - long int selected = _spl_view->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if (selected == -1) { - _current_spl_view->DeleteAllItems (); - _selected_playlist = boost::none; - return; - } - - if (_playlists[selected].missing()) { - error_dialog (this, "This playlist cannot be loaded as some content is missing."); - deselect_playlist (); - return; - } - - if (_playlists[selected].get().empty()) { - error_dialog (this, "This playlist is empty."); - return; - } - - if (!_playlists[selected].have_allowed_shows()) { - error_dialog (this, "There are no more allowed shows of this playlist."); - return; - } - - select_playlist (selected, 0); -} - -void -SwaroopControls::select_playlist (int selected, int position) -{ - log (wxString::Format("load-playlist %s", std_to_wx(_playlists[selected].name()).data())); - - wxProgressDialog dialog (_("DCP-o-matic"), "Loading playlist and KDMs"); - - BOOST_FOREACH (SPLEntry const & i, _playlists[selected].get()) { - dialog.Pulse (); - shared_ptr dcp = dynamic_pointer_cast (i.content); - if (dcp && dcp->needs_kdm()) { - optional kdm; - kdm = get_kdm_from_url (dcp); - if (!kdm) { - kdm = get_kdm_from_directory (dcp); - } - if (kdm) { - try { - dcp->add_kdm (*kdm); - dcp->examine (_film, shared_ptr()); - } catch (KDMError& e) { - error_dialog (this, "Could not load KDM."); - } - } - if (dcp->needs_kdm()) { - /* We didn't get a KDM for this */ - error_dialog (this, "This playlist cannot be loaded as a KDM is missing or incorrect."); - deselect_playlist (); - return; - } - } - shared_ptr ffmpeg = dynamic_pointer_cast (i.content); - if (ffmpeg && ffmpeg->encrypted()) { - optional kdm = get_kdm_from_directory (ffmpeg); - if (kdm) { - try { - ffmpeg->add_kdm (*kdm); - ffmpeg->examine (_film, shared_ptr()); - } catch (KDMError& e) { - error_dialog (this, "This playlist cannot be loaded as a KDM is missing or incorrect."); - deselect_playlist (); - return; - } - } else { - error_dialog (this, "This playlist cannot be loaded as a KDM is missing or incorrect."); - deselect_playlist (); - return; - } - } - } - - _current_spl_view->DeleteAllItems (); - - int N = 0; - BOOST_FOREACH (SPLEntry i, _playlists[selected].get()) { - wxListItem it; - it.SetId (N); - it.SetColumn (0); - it.SetText (std_to_wx(i.name)); - _current_spl_view->InsertItem (it); - ++N; - } - - _selected_playlist = selected; - _selected_playlist_position = position; - dialog.Pulse (); - reset_film (); - dialog.Pulse (); - update_current_content (); -} - -void -SwaroopControls::reset_film () -{ - DCPOMATIC_ASSERT (_selected_playlist); - shared_ptr film (new Film(optional())); - film->add_content (_playlists[*_selected_playlist].get()[_selected_playlist_position].content); - ResetFilm (film); -} - -void -SwaroopControls::config_changed (int property) -{ - Controls::config_changed (property); - - if (property == Config::PLAYER_CONTENT_DIRECTORY) { - _content_view->update (); - } else if (property == Config::PLAYER_PLAYLIST_DIRECTORY) { - update_playlist_directory (); - } -} - -void -SwaroopControls::set_film (shared_ptr film) -{ - Controls::set_film (film); - setup_sensitivity (); -} - -void -SwaroopControls::update_current_content () -{ - DCPOMATIC_ASSERT (_selected_playlist); - - wxProgressDialog dialog (_("DCP-o-matic"), "Loading content"); - - SPLEntry const & e = _playlists[*_selected_playlist].get()[_selected_playlist_position]; - _current_disable_timeline = e.disable_timeline; - _current_disable_next = !e.skippable; - - setup_sensitivity (); - dialog.Pulse (); - reset_film (); -} - -/** One piece of content in our SPL has finished playing */ -void -SwaroopControls::viewer_finished () -{ - if (!_selected_playlist) { - return; - } - - bool const stop = _playlists[*_selected_playlist].get()[_selected_playlist_position].stop_after_play; - - _selected_playlist_position++; - if (_selected_playlist_position < int(_playlists[*_selected_playlist].get().size())) { - /* Next piece of content on the SPL */ - update_current_content (); - if (!stop) { - _viewer->start (); - } - } else { - /* Finished the whole SPL */ - _selected_playlist_position = 0; - _viewer->set_background_image (true); - ResetFilm (shared_ptr(new Film(optional()))); - decrement_allowed_shows (); - _play_button->Enable (true); - _pause_button->Enable (false); - } -} diff --git a/src/wx/swaroop_controls.h b/src/wx/swaroop_controls.h deleted file mode 100644 index f773bf901..000000000 --- a/src/wx/swaroop_controls.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) 2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#include "controls.h" -#include "lib/swaroop_spl.h" - -class DCPContent; -class EncryptedECinemaKDM; - -class SwaroopControls : public Controls -{ -public: - SwaroopControls (wxWindow* parent, boost::shared_ptr viewer); - - void log (wxString s); - void set_film (boost::shared_ptr film); - void check_restart (); - - /** This is so that we can tell our parent player to reset the film - when we have created one from a SPL. We could call a method - in the player's DOMFrame but we don't have that in a header. - */ - boost::signals2::signal)> ResetFilm; - -private: - void play_clicked (); - void pause_clicked (); - void stop_clicked (); - void next_clicked (); - void previous_clicked (); - void add_playlist_to_list (SPL spl); - void update_content_directory (); - void update_playlist_directory (); - void spl_selection_changed (); - void select_playlist (int selected, int position); - void started (); - void stopped (); - void setup_sensitivity (); - void config_changed (int); - void viewer_finished (); - void write_position (); - void reset_film (); - void update_current_content (); - bool can_do_previous (); - bool can_do_next (); - void decrement_allowed_shows (); - void deselect_playlist (); - - boost::optional get_kdm_from_url (boost::shared_ptr dcp); - boost::optional get_kdm_from_directory (boost::shared_ptr dcp); - boost::optional get_kdm_from_directory (boost::shared_ptr ffmpeg); - - wxButton* _play_button; - wxButton* _pause_button; - wxButton* _stop_button; - wxButton* _next_button; - wxButton* _previous_button; - - ContentView* _content_view; - wxButton* _refresh_content_view; - wxListCtrl* _spl_view; - wxButton* _refresh_spl_view; - wxListCtrl* _current_spl_view; - - bool _current_disable_timeline; - bool _current_disable_next; - - std::vector _playlists; - boost::optional _selected_playlist; - int _selected_playlist_position; - - wxTimer _timer; -}; diff --git a/src/wx/video_view.cc b/src/wx/video_view.cc index 7eea4b786..aa3a469da 100644 --- a/src/wx/video_view.cc +++ b/src/wx/video_view.cc @@ -31,9 +31,6 @@ using boost::optional; VideoView::VideoView (FilmViewer* viewer) : _viewer (viewer) -#ifdef DCPOMATIC_VARIANT_SWAROOP - , _in_watermark (false) -#endif , _state_timer ("viewer") , _video_frame_rate (0) , _eyes (EYES_LEFT) diff --git a/src/wx/video_view.h b/src/wx/video_view.h index 50ea40fc7..4e0b89ed7 100644 --- a/src/wx/video_view.h +++ b/src/wx/video_view.h @@ -142,12 +142,6 @@ protected: FilmViewer* _viewer; -#ifdef DCPOMATIC_VARIANT_SWAROOP - bool _in_watermark; - int _watermark_x; - int _watermark_y; -#endif - StateTimer _state_timer; private: diff --git a/src/wx/wscript b/src/wx/wscript index dee54e038..429e9c857 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -304,10 +304,7 @@ def build(bld): if bld.env.TARGET_OSX: obj.framework = ['CoreAudio', 'OpenGL'] obj.use = 'libdcpomatic2' - if not len(bld.env.VARIANT) == 0 and bld.env.VARIANT.startswith('swaroop-'): - obj.source = sources + " swaroop_controls.cc" - else: - obj.source = sources + obj.source = sources obj.target = 'dcpomatic2-wx' i18n.po_to_mo(os.path.join('src', 'wx'), 'libdcpomatic2-wx', bld) diff --git a/test/ecinema_kdm_test.cc b/test/ecinema_kdm_test.cc deleted file mode 100644 index e44a626ba..000000000 --- a/test/ecinema_kdm_test.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2019 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - -#include "lib/decrypted_ecinema_kdm.h" -#include "lib/encrypted_ecinema_kdm.h" -#include "lib/config.h" -#include -extern "C" { -#include -} -#include - -using std::string; -using boost::optional; - -#ifdef DCPOMATIC_VARIANT_SWAROOP - -BOOST_AUTO_TEST_CASE (ecinema_kdm_roundtrip_test1) -{ - dcp::Key key (AES_CTR_KEY_SIZE); - DecryptedECinemaKDM dec ("123-456-789-0", "Hello world", key, optional(), optional()); - EncryptedECinemaKDM enc = dec.encrypt (Config::instance()->decryption_chain()->leaf()); - DecryptedECinemaKDM dec2 (enc, *Config::instance()->decryption_chain()->key()); - BOOST_CHECK_EQUAL (dec2.id(), "123-456-789-0"); - BOOST_CHECK_EQUAL (dec2.name(), "Hello world"); - BOOST_CHECK (dec2.key() == key); - BOOST_CHECK (!static_cast(dec2.not_valid_before())); - BOOST_CHECK (!static_cast(dec2.not_valid_after())); -} - -BOOST_AUTO_TEST_CASE (ecinema_kdm_roundtrip_test2) -{ - dcp::Key key (AES_CTR_KEY_SIZE); - DecryptedECinemaKDM dec ("123-456-789-0", "Hello world", key, dcp::LocalTime("2019-06-01T15:05:23+01:00"), dcp::LocalTime("2019-07-02T19:10:12+02:00")); - EncryptedECinemaKDM enc = dec.encrypt (Config::instance()->decryption_chain()->leaf()); - DecryptedECinemaKDM dec2 (enc, *Config::instance()->decryption_chain()->key()); - BOOST_CHECK_EQUAL (dec2.id(), "123-456-789-0"); - BOOST_CHECK_EQUAL (dec2.name(), "Hello world"); - BOOST_CHECK (dec2.key() == key); - BOOST_REQUIRE (static_cast(dec2.not_valid_before())); - BOOST_CHECK_EQUAL (dec2.not_valid_before()->as_string(), "2019-06-01T15:05:23+01:00"); - BOOST_REQUIRE (static_cast(dec2.not_valid_after())); - BOOST_CHECK_EQUAL (dec2.not_valid_after()->as_string(), "2019-07-02T19:10:12+02:00"); -} - -BOOST_AUTO_TEST_CASE (ecinema_kdm_roundtrip_test3) -{ - dcp::Key key (AES_CTR_KEY_SIZE); - DecryptedECinemaKDM dec ("123-456-789-0", "Hello world", key, optional(), optional()); - EncryptedECinemaKDM enc = dec.encrypt (Config::instance()->decryption_chain()->leaf()); - string const enc_xml = enc.as_xml (); - EncryptedECinemaKDM enc2 (enc_xml); - DecryptedECinemaKDM dec2 (enc2, *Config::instance()->decryption_chain()->key()); - BOOST_CHECK_EQUAL (dec2.id(), "123-456-789-0"); - BOOST_CHECK_EQUAL (dec2.name(), "Hello world"); - BOOST_CHECK (dec2.key() == key); - BOOST_CHECK (!static_cast(dec2.not_valid_before())); - BOOST_CHECK (!static_cast(dec2.not_valid_after())); -} - -BOOST_AUTO_TEST_CASE (ecinema_kdm_roundtrip_test4) -{ - dcp::Key key (AES_CTR_KEY_SIZE); - DecryptedECinemaKDM dec ("123-456-789-0", "Hello world", key, dcp::LocalTime("2019-06-01T15:05:23+01:00"), dcp::LocalTime("2019-07-02T19:10:12+02:00")); - EncryptedECinemaKDM enc = dec.encrypt (Config::instance()->decryption_chain()->leaf()); - string const enc_xml = enc.as_xml(); - EncryptedECinemaKDM enc2 (dcp::file_to_string("build/test/shit_the_bed.xml")); - DecryptedECinemaKDM dec2 (enc2, *Config::instance()->decryption_chain()->key()); - BOOST_CHECK_EQUAL (dec2.id(), "123-456-789-0"); - BOOST_CHECK_EQUAL (dec2.name(), "Hello world"); - BOOST_CHECK (dec2.key() == key); - BOOST_REQUIRE (static_cast(dec2.not_valid_before())); - BOOST_CHECK_EQUAL (dec2.not_valid_before()->as_string(), "2019-06-01T15:05:23+01:00"); - BOOST_REQUIRE (static_cast(dec2.not_valid_after())); - BOOST_CHECK_EQUAL (dec2.not_valid_after()->as_string(), "2019-07-02T19:10:12+02:00"); -} - -#endif diff --git a/test/ffmpeg_encoder_test.cc b/test/ffmpeg_encoder_test.cc index 1b030ce80..505bca766 100644 --- a/test/ffmpeg_encoder_test.cc +++ b/test/ffmpeg_encoder_test.cc @@ -71,11 +71,7 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f film->write_metadata (); shared_ptr job (new TranscodeJob (film)); - FFmpegEncoder encoder (film, job, String::compose("build/test/%1.%2", name, extension), format, false, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder (film, job, String::compose("build/test/%1.%2", name, extension), format, false, false, false, 23); encoder.go (); } @@ -119,11 +115,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test5) film->write_metadata (); shared_ptr job (new TranscodeJob (film)); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test5.mov", EXPORT_FORMAT_PRORES, false, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test5.mov", EXPORT_FORMAT_PRORES, false, false, false, 23); encoder.go (); } @@ -144,11 +136,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test6) film->write_metadata(); shared_ptr job (new TranscodeJob (film)); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test6.mov", EXPORT_FORMAT_PRORES, false, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test6.mov", EXPORT_FORMAT_PRORES, false, false, false, 23); encoder.go (); } @@ -172,11 +160,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test7) s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255)); shared_ptr job (new TranscodeJob (film)); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test7.mov", EXPORT_FORMAT_PRORES, false, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test7.mov", EXPORT_FORMAT_PRORES, false, false, false, 23); encoder.go (); } @@ -203,11 +187,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test2) film->write_metadata(); shared_ptr job (new TranscodeJob (film)); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test2.mp4", EXPORT_FORMAT_H264_AAC, false, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test2.mp4", EXPORT_FORMAT_H264_AAC, false, false, false, 23); encoder.go (); } @@ -232,11 +212,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3) film->write_metadata(); shared_ptr job (new TranscodeJob (film)); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test3.mp4", EXPORT_FORMAT_H264_AAC, false, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test3.mp4", EXPORT_FORMAT_H264_AAC, false, false, false, 23); encoder.go (); } @@ -250,11 +226,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test4) film->set_container(Ratio::from_id("185")); shared_ptr job(new TranscodeJob(film)); - FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test4.mp4", EXPORT_FORMAT_H264_AAC, false, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test4.mp4", EXPORT_FORMAT_H264_AAC, false, false, false, 23); encoder.go(); } @@ -308,11 +280,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test5) Rs->audio->set_mapping (map); shared_ptr job (new TranscodeJob (film)); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test5.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test5.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23); encoder.go (); check_ffmpeg ("build/test/ffmpeg_encoder_h264_test5.mp4", "test/data/ffmpeg_encoder_h264_test5.mp4", 1); @@ -340,11 +308,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test6) } shared_ptr job (new TranscodeJob (film2)); - FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test6_vf.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test6_vf.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23); encoder.go (); } @@ -371,11 +335,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test7) BOOST_REQUIRE (!wait_for_jobs()); shared_ptr job (new TranscodeJob (film2)); - FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test7.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test7.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23); encoder.go (); } @@ -389,11 +349,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test8) film->set_audio_channels (2); shared_ptr job(new TranscodeJob(film)); - FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test8.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test8.mp4", EXPORT_FORMAT_H264_AAC, true, false, false, 23); encoder.go(); } @@ -414,10 +370,6 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test9) film->write_metadata (); shared_ptr job (new TranscodeJob (film)); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test9.mov", EXPORT_FORMAT_H264_AAC, false, false, false, 23 -#ifdef DCPOMATIC_VARIANT_SWAROOP - , optional(), optional() -#endif - ); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test9.mov", EXPORT_FORMAT_H264_AAC, false, false, false, 23); encoder.go (); } diff --git a/test/util_test.cc b/test/util_test.cc index c1d11b761..df494b0f4 100644 --- a/test/util_test.cc +++ b/test/util_test.cc @@ -106,27 +106,6 @@ BOOST_AUTO_TEST_CASE (utf8_strlen_test) BOOST_CHECK_EQUAL (utf8_strlen("hëłlo wørld"), 11U); } -#ifdef DCPOMATIC_VARIANT_SWAROOP -BOOST_AUTO_TEST_CASE (swaroop_chain_test) -{ - shared_ptr cc ( - new dcp::CertificateChain ( - openssl_path(), - "dcpomatic.com", - "dcpomatic.com", - ".dcpomatic.smpte-430-2.ROOT", - ".dcpomatic.smpte-430-2.INTERMEDIATE", - "CS.dcpomatic.smpte-430-2.LEAF" - ) - ); - - write_swaroop_chain (cc, "build/test/swaroop_chain"); - shared_ptr back = read_swaroop_chain ("build/test/swaroop_chain"); - - BOOST_CHECK (cc->root_to_leaf() == back->root_to_leaf()); -} -#endif - BOOST_AUTO_TEST_CASE (careful_string_filter_test) { BOOST_CHECK_EQUAL ("hello_world", careful_string_filter("hello_world")); diff --git a/test/wscript b/test/wscript index c9e9f2188..39b96e39d 100644 --- a/test/wscript +++ b/test/wscript @@ -67,7 +67,6 @@ def build(bld): dcp_playback_test.cc dcp_subtitle_test.cc digest_test.cc - ecinema_kdm_test.cc empty_test.cc ffmpeg_audio_only_test.cc ffmpeg_audio_test.cc diff --git a/wscript b/wscript index 00665bbac..4ad119067 100644 --- a/wscript +++ b/wscript @@ -72,7 +72,6 @@ def options(opt): opt.add_option('--static-curl', action='store_true', default=False, help='link statically to libcurl') opt.add_option('--workaround-gssapi', action='store_true', default=False, help='link to gssapi_krb5') opt.add_option('--force-cpp11', action='store_true', default=False, help='force use of C++11') - opt.add_option('--variant', help='build variant (swaroop-studio, swaroop-theater)', choices=['swaroop-studio', 'swaroop-theater']) opt.add_option('--use-lld', action='store_true', default=False, help='use lld linker') opt.add_option('--enable-disk', action='store_true', default=False, help='build dcpomatic2_disk tool; requires Boost process, lwext4 and nanomsg libraries') opt.add_option('--warnings-are-errors', action='store_true', default=False, help='build with -Werror') @@ -133,11 +132,6 @@ def configure(conf): else: conf.env.append_value('CXXFLAGS', '-O2') - if conf.options.variant is not None: - conf.env.VARIANT = conf.options.variant - if conf.options.variant.startswith('swaroop-'): - conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_VARIANT_SWAROOP') - if conf.options.enable_disk: conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_DISK') -- 2.30.2