summaryrefslogtreecommitdiff
path: root/test/cpl_metadata_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-10-29 22:19:24 +0100
committerCarl Hetherington <cth@carlh.net>2025-10-29 22:19:24 +0100
commitbcc9e32cd3c886fbe02f1b2573bd19ca9ec340dc (patch)
treed4eb3f4ebd7e7b0793c1812301777d7d96692953 /test/cpl_metadata_test.cc
parentc070eecb967ed17116866d79f705860a8321630b (diff)
Don't report channels as mapped when they are not included in the film's channel count.
So e.g. if you map the 7.1 surrounds but have a 6-channel film it should consider those channels un-mapped.
Diffstat (limited to 'test/cpl_metadata_test.cc')
-rw-r--r--test/cpl_metadata_test.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/cpl_metadata_test.cc b/test/cpl_metadata_test.cc
index b3c269919..b8857968d 100644
--- a/test/cpl_metadata_test.cc
+++ b/test/cpl_metadata_test.cc
@@ -119,3 +119,49 @@ BOOST_AUTO_TEST_CASE(main_sound_configuration_test_71)
BOOST_CHECK_EQUAL(msc->as_string(), "71/L,R,C,LFE,Lss,Rss,-,VIN,-,-,Lrs,Rrs");
}
+
+
+BOOST_AUTO_TEST_CASE(main_sound_configuration_test_71_mapped_but_51_dcp)
+{
+ auto picture = content_factory("test/data/flat_red.png")[0];
+ auto L = content_factory("test/data/L.wav")[0];
+ auto R = content_factory("test/data/R.wav")[0];
+ auto C = content_factory("test/data/C.wav")[0];
+ auto Lfe = content_factory("test/data/Lfe.wav")[0];
+ auto Ls = content_factory("test/data/Ls.wav")[0];
+ auto Rs = content_factory("test/data/Rs.wav")[0];
+ auto BsL = content_factory("test/data/Ls.wav")[0];
+ auto BsR = content_factory("test/data/Rs.wav")[0];
+ auto VI = content_factory("test/data/sine_440.wav")[0];
+
+ auto film = new_test_film("main_sound_configuration_test_71_mapped_51_set_vi", { picture, L, R, C, Lfe, Ls, Rs, BsL, BsR, VI });
+ film->set_audio_channels(6);
+
+ auto set_map = [](shared_ptr<Content> content, dcp::Channel channel) {
+ auto map = content->audio->mapping();
+ map.set(0, channel, 1.0f);
+ content->audio->set_mapping(map);
+ };
+
+ set_map(L, dcp::Channel::LEFT);
+ set_map(R, dcp::Channel::RIGHT);
+ set_map(C, dcp::Channel::CENTRE);
+ set_map(Lfe, dcp::Channel::LFE);
+ set_map(Ls, dcp::Channel::LS);
+ set_map(Rs, dcp::Channel::RS);
+ set_map(BsL, dcp::Channel::BSL);
+ set_map(BsR, dcp::Channel::BSR);
+ set_map(VI, dcp::Channel::VI);
+
+ make_and_verify_dcp(film);
+
+ dcp::DCP dcp(film->dir(film->dcp_name()));
+ dcp.read();
+ BOOST_REQUIRE_EQUAL(dcp.cpls().size(), 1U);
+ auto cpl = dcp.cpls()[0];
+
+ auto msc = cpl->main_sound_configuration();
+ BOOST_REQUIRE(msc);
+
+ BOOST_CHECK_EQUAL(msc->as_string(), "51/L,R,C,LFE,Ls,Rs");
+}