2 Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "lib/content_factory.h"
22 #include "lib/dcp_content.h"
24 #include <boost/test/unit_test.hpp>
26 using boost::shared_ptr;
27 using boost::dynamic_pointer_cast;
29 void check_within_n (int64_t a, int64_t b, int64_t n)
31 BOOST_CHECK (abs (a - b) <= n);
35 BOOST_AUTO_TEST_CASE (required_disk_space_test)
37 shared_ptr<Film> film = new_test_film ("required_disk_space_test");
38 film->set_j2k_bandwidth (100000000);
39 film->set_audio_channels (6);
40 shared_ptr<Content> content_a = content_factory (film, "test/data/flat_blue.png");
41 film->examine_and_add_content (content_a);
42 shared_ptr<DCPContent> content_b = dynamic_pointer_cast<DCPContent> (content_factory (film, "test/data/burnt_subtitle_test_dcp"));
43 film->examine_and_add_content (content_b);
45 film->write_metadata ();
48 film->required_disk_space(),
49 289LL * (100000000 / 8) / 24 + // video
50 289LL * 48000 * 6 * 3 / 24 + // audio
55 content_b->set_reference_video (true);
58 film->required_disk_space(),
59 240LL * (100000000 / 8) / 24 + // video
60 289LL * 48000 * 6 * 3 / 24 + // audio
65 content_b->set_reference_audio (true);
68 film->required_disk_space(),
69 240LL * (100000000 / 8) / 24 + // video
70 240LL * 48000 * 6 * 3 / 24 + // audio