Rearrange encoding so that the different methods / backends are not all crammed into...
[dcpomatic.git] / test / test.h
1 /*
2     Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
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.
10
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.
15
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/>.
18
19 */
20
21 #include "lib/warnings.h"
22 DCPOMATIC_DISABLE_WARNINGS
23 #include <Magick++.h>
24 DCPOMATIC_ENABLE_WARNINGS
25 #include <boost/filesystem.hpp>
26 #include <boost/shared_ptr.hpp>
27
28 class Film;
29 class Log;
30
31 namespace dcpomatic {
32         class Image;
33 }
34
35 class TestPaths
36 {
37 public:
38         static boost::filesystem::path private_data;
39         static boost::filesystem::path xsd;
40 };
41
42 extern bool wait_for_jobs ();
43 extern void setup_test_config ();
44 extern boost::shared_ptr<Film> new_test_film (std::string);
45 extern boost::shared_ptr<Film> new_test_film2 (std::string);
46 extern void check_dcp (boost::filesystem::path, boost::filesystem::path);
47 extern void check_dcp (boost::filesystem::path, boost::shared_ptr<const Film>);
48 extern void check_file (boost::filesystem::path ref, boost::filesystem::path check);
49 extern void check_wav_file (boost::filesystem::path ref, boost::filesystem::path check);
50 extern void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check);
51 extern bool mxf_atmos_files_same (boost::filesystem::path ref, boost::filesystem::path check, bool verbose = false);
52 extern void check_xml (boost::filesystem::path, boost::filesystem::path, std::list<std::string>);
53 extern void check_file (boost::filesystem::path, boost::filesystem::path);
54 extern void check_ffmpeg (boost::filesystem::path, boost::filesystem::path, int audio_tolerance);
55 extern void check_image (boost::filesystem::path, boost::filesystem::path, double threshold = 0.01);
56 extern boost::filesystem::path test_film_dir (std::string);
57 extern void write_image (boost::shared_ptr<const dcpomatic::Image> image, boost::filesystem::path file, std::string format, MagickCore::StorageType pixel_type = MagickCore::CharPixel);
58 boost::filesystem::path dcp_file (boost::shared_ptr<const Film> film, std::string prefix);
59 void check_one_frame (boost::filesystem::path dcp, int64_t index, boost::filesystem::path ref);
60 extern boost::filesystem::path subtitle_file (boost::shared_ptr<Film> film);
61 extern void make_random_file (boost::filesystem::path path, size_t size);
62
63 class LogSwitcher
64 {
65 public:
66         LogSwitcher (boost::shared_ptr<Log> log);
67         ~LogSwitcher ();
68
69 private:
70         boost::shared_ptr<Log> _old;
71 };
72