summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-04-02 23:10:39 +0200
committerCarl Hetherington <cth@carlh.net>2023-04-04 23:37:44 +0200
commit3d7d70e0cf79cf5bb68c24d830d4e08e22ca4308 (patch)
treed57833ed66125fe893549f57e00c73b82dc25306 /test
parent2da55dbe6da21975612584365db17db2ae9935b8 (diff)
Add check for mismatched sound channel counts.
Diffstat (limited to 'test')
-rw-r--r--test/verify_test.cc71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/verify_test.cc b/test/verify_test.cc
index d853bc81..a0786d9c 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -3445,3 +3445,74 @@ BOOST_AUTO_TEST_CASE(verify_duplicate_assetmap_asset_ids)
});
}
+
+BOOST_AUTO_TEST_CASE(verify_mismatched_sound_channel_counts)
+{
+ boost::filesystem::path const path = "build/test/verify_mismatched_sound_channel_counts";
+
+ dcp::MXFMetadata mxf_meta;
+ mxf_meta.company_name = "OpenDCP";
+ mxf_meta.product_name = "OpenDCP";
+ mxf_meta.product_version = "0.0.25";
+
+ auto constexpr sample_rate = 48000;
+ auto constexpr frames = 240;
+
+ boost::filesystem::remove_all(path);
+ boost::filesystem::create_directories(path);
+ auto dcp = make_shared<dcp::DCP>(path);
+ auto cpl = make_shared<dcp::CPL>("hello", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE);
+ cpl->set_annotation_text("hello");
+ cpl->set_main_sound_configuration(dcp::MainSoundConfiguration("51/L,R"));
+ cpl->set_main_sound_sample_rate(sample_rate);
+ cpl->set_main_picture_stored_area(dcp::Size(1998, 1080));
+ cpl->set_main_picture_active_area(dcp::Size(1998, 1080));
+ cpl->set_version_number(1);
+
+ {
+
+ /* Reel with 2 channels of audio */
+
+ auto mp = simple_picture(path, "1", frames, {});
+ auto ms = simple_sound(path, "1", mxf_meta, "en-US", frames, sample_rate, {}, 2);
+
+ auto reel = make_shared<dcp::Reel>(
+ std::make_shared<dcp::ReelMonoPictureAsset>(mp, 0),
+ std::make_shared<dcp::ReelSoundAsset>(ms, 0)
+ );
+
+ auto markers = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), frames);
+ markers->set(dcp::Marker::FFOC, dcp::Time(0, 0, 0, 1, 24));
+ reel->add(markers);
+
+ cpl->add(reel);
+ }
+
+ {
+ /* Reel with 6 channels of audio */
+
+ auto mp = simple_picture(path, "2", frames, {});
+ auto ms = simple_sound(path, "2", mxf_meta, "en-US", frames, sample_rate, {}, 6);
+
+ auto reel = make_shared<dcp::Reel>(
+ std::make_shared<dcp::ReelMonoPictureAsset>(mp, 0),
+ std::make_shared<dcp::ReelSoundAsset>(ms, 0)
+ );
+
+ auto markers = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), frames);
+ markers->set(dcp::Marker::LFOC, dcp::Time(0, 0, 0, frames - 1, 24));
+ reel->add(markers);
+
+ cpl->add(reel);
+ }
+
+ dcp->add(cpl);
+ dcp->set_annotation_text("hello");
+ dcp->write_xml();
+
+ check_verify_result(
+ { path },
+ {
+ { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_SOUND_CHANNEL_COUNTS, canonical(find_file(path, "audio2")) },
+ });
+}