Fix silent stereo mixdown exports when the project audio channel count is > 6.
[dcpomatic.git] / test / ffmpeg_properties_test.cc
1 /*
2     Copyright (C) 2022 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
22 #include "lib/compose.hpp"
23 #include "lib/content.h"
24 #include "lib/content_factory.h"
25 #include "lib/user_property.h"
26 #include "test.h"
27 #include <boost/test/unit_test.hpp>
28
29
30 using std::list;
31 using std::string;
32
33
34 static
35 void
36 colour_range_test(string name, boost::filesystem::path file, string ref)
37 {
38         auto content = content_factory(file);
39         BOOST_REQUIRE(!content.empty());
40         auto film = new_test_film2(String::compose("ffmpeg_properties_test_%1", name), { content.front() });
41
42         auto properties = content.front()->user_properties(film);
43         auto iter = std::find_if(properties.begin(), properties.end(), [](UserProperty const& property) { return property.key == "Colour range"; });
44         BOOST_REQUIRE(iter != properties.end());
45         BOOST_CHECK_EQUAL(iter->value, ref);
46 }
47
48
49 BOOST_AUTO_TEST_CASE(ffmpeg_properties_test)
50 {
51         colour_range_test("1", "test/data/test.mp4", "Unspecified");
52         colour_range_test("2", TestPaths::private_data() / "arrietty_JP-EN.mkv", "Limited / video (16-235)");
53         colour_range_test("3", "test/data/8bit_full_420.mp4", "Full (0-255)");
54         colour_range_test("4", "test/data/8bit_full_422.mp4", "Full (0-255)");
55         colour_range_test("5", "test/data/8bit_full_444.mp4", "Full (0-255)");
56         colour_range_test("6", "test/data/8bit_video_420.mp4", "Limited / video (16-235)");
57         colour_range_test("7", "test/data/8bit_video_422.mp4", "Limited / video (16-235)");
58         colour_range_test("8", "test/data/8bit_video_444.mp4", "Limited / video (16-235)");
59         colour_range_test("9", "test/data/10bit_full_420.mp4", "Full (0-1023)");
60         colour_range_test("10", "test/data/10bit_full_422.mp4", "Full (0-1023)");
61         colour_range_test("11", "test/data/10bit_full_444.mp4", "Full (0-1023)");
62         colour_range_test("12", "test/data/10bit_video_420.mp4", "Limited / video (64-940)");
63         colour_range_test("13", "test/data/10bit_video_422.mp4", "Limited / video (64-940)");
64         colour_range_test("14", "test/data/10bit_video_444.mp4", "Limited / video (64-940)");
65 }