diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-04-04 23:09:29 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-04-04 23:37:44 +0200 |
| commit | ef41b0c235eaa9f02203fd8438873e951bf3de07 (patch) | |
| tree | 0511d4f08fee449fe12e461be349071dcce701ba | |
| parent | 3d7d70e0cf79cf5bb68c24d830d4e08e22ca4308 (diff) | |
Add check for mismatch between sound asset and MainSoundConfiguration.v1.8.66
| -rw-r--r-- | src/verify.cc | 12 | ||||
| -rw-r--r-- | src/verify.h | 8 | ||||
| -rw-r--r-- | test/verify_test.cc | 51 |
3 files changed, 70 insertions, 1 deletions
diff --git a/src/verify.cc b/src/verify.cc index 1cab0423..8b2b11d3 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -1571,6 +1571,16 @@ verify_cpl( verify_text_details(cpl->reels(), notes); if (dcp->standard() == Standard::SMPTE) { + if (auto msc = cpl->main_sound_configuration()) { + if (state.audio_channels && msc->channels() != *state.audio_channels) { + notes.push_back({ + VerificationNote::Type::ERROR, + VerificationNote::Code::INVALID_MAIN_SOUND_CONFIGURATION, + String::compose("MainSoundConfiguration has %1 channels but sound assets have %2", msc->channels(), *state.audio_channels), + cpl->file().get() + }); + } + } if (have_main_subtitle && have_no_main_subtitle) { notes.push_back({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISSING_MAIN_SUBTITLE_FROM_SOME_REELS}); @@ -1996,6 +2006,8 @@ dcp::note_to_string (VerificationNote note) return String::compose("<IssueDate> has an invalid value: %1", note.note().get()); case VerificationNote::Code::MISMATCHED_SOUND_CHANNEL_COUNTS: return String::compose("The sound assets do not all have the same channel count; the first to differ is %1", note.file()->filename()); + case VerificationNote::Code::INVALID_MAIN_SOUND_CONFIGURATION: + return String::compose("<MainSoundConfiguration> has an invalid value: %1", note.note().get()); } return ""; diff --git a/src/verify.h b/src/verify.h index d05c92eb..7696ea85 100644 --- a/src/verify.h +++ b/src/verify.h @@ -425,7 +425,13 @@ public: /** The sound assets in the CPL do not have the same audio channel count. * file contains the filename of the first asset to differ */ - MISMATCHED_SOUND_CHANNEL_COUNTS + MISMATCHED_SOUND_CHANNEL_COUNTS, + /** The CPL contains a MainSoundConfiguration tag which does not describe the number of + * channels in the audio assets. + * note contains details of what is wrong + * file contains the CPL filename + */ + INVALID_MAIN_SOUND_CONFIGURATION, }; VerificationNote (Type type, Code code) diff --git a/test/verify_test.cc b/test/verify_test.cc index a0786d9c..4c1d1b7d 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -3516,3 +3516,54 @@ BOOST_AUTO_TEST_CASE(verify_mismatched_sound_channel_counts) { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_SOUND_CHANNEL_COUNTS, canonical(find_file(path, "audio2")) }, }); } + + +BOOST_AUTO_TEST_CASE(verify_invalid_main_sound_configuration) +{ + boost::filesystem::path const path = "build/test/verify_invalid_main_sound_configuration"; + + 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,C,LFE,Ls,Rs")); + 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); + + 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)); + markers->set(dcp::Marker::LFOC, dcp::Time(0, 0, 9, 23, 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::INVALID_MAIN_SOUND_CONFIGURATION, std::string{"MainSoundConfiguration has 6 channels but sound assets have 2"}, canonical(find_cpl(path)) }, + }); +} + |
