2 Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
23 #include "lib/dcp_subtitle_content.h"
24 #include "lib/ratio.h"
25 #include "lib/dcp_content_type.h"
26 #include "lib/dcp_content.h"
27 #include "lib/ffmpeg_content.h"
28 #include "lib/config.h"
29 #include "lib/cross.h"
31 #include <boost/test/unit_test.hpp>
32 #include <boost/make_shared.hpp>
35 using boost::shared_ptr;
36 using boost::make_shared;
38 /** Make an encrypted DCP, import it and make a new unencrypted DCP */
39 BOOST_AUTO_TEST_CASE (import_dcp_test)
41 shared_ptr<Film> A = new_test_film ("import_dcp_test");
42 A->set_container (Ratio::from_id ("185"));
43 A->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
44 A->set_name ("frobozz");
46 shared_ptr<FFmpegContent> c = make_shared<FFmpegContent> (A, "test/data/test.mp4");
47 A->examine_and_add_content (c);
48 A->set_encrypted (true);
54 dcp::DCP A_dcp ("build/test/import_dcp_test/" + A->dcp_name());
57 Config::instance()->set_decryption_chain (make_shared<dcp::CertificateChain> (openssl_path ()));
59 dcp::EncryptedKDM kdm = A->make_kdm (
60 Config::instance()->decryption_chain()->leaf (),
61 vector<dcp::Certificate> (),
62 A_dcp.cpls().front()->file (),
63 dcp::LocalTime ("2014-07-21T00:00:00+00:00"),
64 dcp::LocalTime ("2024-07-21T00:00:00+00:00"),
65 dcp::MODIFIED_TRANSITIONAL_1
68 shared_ptr<Film> B = new_test_film ("import_dcp_test2");
69 B->set_container (Ratio::from_id ("185"));
70 B->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
71 B->set_name ("frobozz");
73 shared_ptr<DCPContent> d = boost::make_shared<DCPContent> (B, "build/test/import_dcp_test/" + A->dcp_name());
75 B->examine_and_add_content (d);
81 /* Should be 1s red, 1s green, 1s blue */
82 check_dcp ("test/data/import_dcp_test2", "build/test/import_dcp_test2/" + B->dcp_name());