diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-13 02:16:37 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-17 20:13:23 +0100 |
| commit | 33942a6c7ab40dfe1ccb87e80497fc0b5390b76a (patch) | |
| tree | 8e77c3aa3927fe9d186d921ed8a0a8e0dd96d974 /test | |
| parent | 5c57052dfeda55dc218001b089ebcdaaf6bedc3b (diff) | |
Bv2.1 7.3: audio sample rate must be 48kHz.
Diffstat (limited to 'test')
| -rw-r--r-- | test/test.cc | 5 | ||||
| -rw-r--r-- | test/test.h | 2 | ||||
| -rw-r--r-- | test/verify_test.cc | 21 |
3 files changed, 24 insertions, 4 deletions
diff --git a/test/test.cc b/test/test.cc index 88fdb3a9..f110c9cb 100644 --- a/test/test.cc +++ b/test/test.cc @@ -276,9 +276,8 @@ simple_picture (boost::filesystem::path path, string suffix, int frames) shared_ptr<dcp::SoundAsset> -simple_sound (boost::filesystem::path path, string suffix, dcp::MXFMetadata mxf_meta, string language, int frames) +simple_sound (boost::filesystem::path path, string suffix, dcp::MXFMetadata mxf_meta, string language, int frames, int sample_rate) { - int const sample_rate = 48000; int const channels = 1; /* Set a valid language, then overwrite it, so that the language parameter can be badly formed */ @@ -289,7 +288,7 @@ simple_sound (boost::filesystem::path path, string suffix, dcp::MXFMetadata mxf_ active_channels.push_back (dcp::LEFT); shared_ptr<dcp::SoundAssetWriter> sound_writer = ms->start_write (path / dcp::String::compose("audio%1.mxf", suffix), active_channels); - int const samples_per_frame = 48000 / 24; + int const samples_per_frame = sample_rate / 24; float* silence[channels]; for (auto i = 0; i < channels; ++i) { diff --git a/test/test.h b/test/test.h index 6a6a57d2..5ed424bc 100644 --- a/test/test.h +++ b/test/test.h @@ -44,7 +44,7 @@ extern void check_xml (xmlpp::Element* ref, xmlpp::Element* test, std::vector<st extern void check_xml (std::string ref, std::string test, std::vector<std::string> ignore, bool ignore_whitespace = false); extern void check_file (boost::filesystem::path ref, boost::filesystem::path check); extern std::shared_ptr<dcp::MonoPictureAsset> simple_picture (boost::filesystem::path path, std::string suffix, int frames = 24); -extern std::shared_ptr<dcp::SoundAsset> simple_sound (boost::filesystem::path path, std::string suffix, dcp::MXFMetadata mxf_meta, std::string language, int frames = 24); +extern std::shared_ptr<dcp::SoundAsset> simple_sound (boost::filesystem::path path, std::string suffix, dcp::MXFMetadata mxf_meta, std::string language, int frames = 24, int sample_rate = 48000); extern std::shared_ptr<dcp::Subtitle> simple_subtitle (); extern std::shared_ptr<dcp::DCP> make_simple (boost::filesystem::path path, int reels = 1, int frames = 24); extern std::shared_ptr<dcp::DCP> make_simple_with_interop_subs (boost::filesystem::path path); diff --git a/test/verify_test.cc b/test/verify_test.cc index 1877e284..1789aafe 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -1607,3 +1607,24 @@ BOOST_AUTO_TEST_CASE (verify_closed_caption_lines_too_long1) check_verify_result ({dir}, {{ dcp::VerificationNote::VERIFY_BV21_ERROR, dcp::VerificationNote::CLOSED_CAPTION_LINE_TOO_LONG }}); } + +BOOST_AUTO_TEST_CASE (verify_sound_sampling_rate_must_be_48k) +{ + boost::filesystem::path const dir("verify_sound_sampling_rate_must_be_48k"); + prepare_directory (dir); + + auto picture = simple_picture (dir, "foo"); + auto reel_picture = make_shared<dcp::ReelMonoPictureAsset>(picture, 0); + auto reel = make_shared<dcp::Reel>(); + reel->add (reel_picture); + auto sound = simple_sound (dir, "foo", dcp::MXFMetadata(), "de-DE", 24, 96000); + auto reel_sound = make_shared<dcp::ReelSoundAsset>(sound, 0); + reel->add (reel_sound); + auto cpl = make_shared<dcp::CPL>("hello", dcp::FEATURE); + cpl->add (reel); + auto dcp = make_shared<dcp::DCP>(dir); + dcp->add (cpl); + dcp->write_xml (dcp::SMPTE); + + check_verify_result ({dir}, {{ dcp::VerificationNote::VERIFY_BV21_ERROR, dcp::VerificationNote::INVALID_SOUND_FRAME_RATE }}); +} |
