From: Carl Hetherington Date: Tue, 30 May 2017 12:22:11 +0000 (+0100) Subject: Check content_test1 output. X-Git-Tag: v2.11.9~3 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=dd879e5254c1e005e60ccd135a37f70cb2fe3a75 Check content_test1 output. --- diff --git a/test/content_test.cc b/test/content_test.cc index 91b5756d1..cc703bfb8 100644 --- a/test/content_test.cc +++ b/test/content_test.cc @@ -45,4 +45,18 @@ BOOST_AUTO_TEST_CASE (content_test1) BOOST_REQUIRE (!wait_for_jobs ()); film->make_dcp (); BOOST_REQUIRE (!wait_for_jobs ()); + + boost::filesystem::path check; + + for ( + boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator("build/test/content_test1/" + film->dcp_name()); + i != boost::filesystem::directory_iterator(); + ++i) { + + if (i->path().leaf().string().substr(0, 4) == "pcm_") { + check = *i; + } + } + + check_mxf_audio_file ("test/data/content_test1.mxf", check); } diff --git a/test/data b/test/data index 30d3455d6..e4609c383 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit 30d3455d626c1a08554b9f77cb5fe67fd5b1fd82 +Subproject commit e4609c3834cebb4732614c16f6167457c8ac9a3e diff --git a/test/test.cc b/test/test.cc index 7e0f57340..699dea6c3 100644 --- a/test/test.cc +++ b/test/test.cc @@ -34,6 +34,7 @@ #include "lib/ratio.h" #include "lib/log_entry.h" #include +#include #include #include #include @@ -162,6 +163,32 @@ check_wav_file (boost::filesystem::path ref, boost::filesystem::path check) } } +void +check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check) +{ + ASDCP::PCM::MXFReader ref_reader; + BOOST_REQUIRE (!ASDCP_FAILURE (ref_reader.OpenRead (ref.string().c_str()))); + + ASDCP::PCM::AudioDescriptor ref_desc; + BOOST_REQUIRE (!ASDCP_FAILURE (ref_reader.FillAudioDescriptor (ref_desc))); + + ASDCP::PCM::MXFReader check_reader; + BOOST_REQUIRE (!ASDCP_FAILURE (check_reader.OpenRead (check.string().c_str()))); + + ASDCP::PCM::AudioDescriptor check_desc; + BOOST_REQUIRE (!ASDCP_FAILURE (check_reader.FillAudioDescriptor (check_desc))); + + BOOST_REQUIRE_EQUAL (ref_desc.ContainerDuration, check_desc.ContainerDuration); + + ASDCP::PCM::FrameBuffer ref_buffer (Kumu::Megabyte); + ASDCP::PCM::FrameBuffer check_buffer (Kumu::Megabyte); + for (size_t i = 0; i < ref_desc.ContainerDuration; ++i) { + ref_reader.ReadFrame (i, ref_buffer, 0); + check_reader.ReadFrame (i, check_buffer, 0); + BOOST_REQUIRE (memcmp(ref_buffer.RoData(), check_buffer.RoData(), ref_buffer.Size()) == 0); + } +} + void check_image (boost::filesystem::path ref, boost::filesystem::path check) { diff --git a/test/test.h b/test/test.h index 40163d8ff..94b15a199 100644 --- a/test/test.h +++ b/test/test.h @@ -30,6 +30,7 @@ extern boost::shared_ptr new_test_film (std::string); extern void check_dcp (boost::filesystem::path, boost::filesystem::path); extern void check_file (boost::filesystem::path ref, boost::filesystem::path check); extern void check_wav_file (boost::filesystem::path ref, boost::filesystem::path check); +extern void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check); extern void check_xml (boost::filesystem::path, boost::filesystem::path, std::list); extern void check_file (boost::filesystem::path, boost::filesystem::path); extern void check_image (boost::filesystem::path, boost::filesystem::path);