Check content_test1 output.
authorCarl Hetherington <cth@carlh.net>
Tue, 30 May 2017 12:22:11 +0000 (13:22 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 30 May 2017 12:22:11 +0000 (13:22 +0100)
test/content_test.cc
test/data
test/test.cc
test/test.h

index 91b5756d105d4c9a945b47ab2b0d4f4a5e32e55d..cc703bfb887b71df605515ec81dcf91b60b1f16b 100644 (file)
@@ -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);
 }
index 30d3455d626c1a08554b9f77cb5fe67fd5b1fd82..e4609c3834cebb4732614c16f6167457c8ac9a3e 160000 (submodule)
--- a/test/data
+++ b/test/data
@@ -1 +1 @@
-Subproject commit 30d3455d626c1a08554b9f77cb5fe67fd5b1fd82
+Subproject commit e4609c3834cebb4732614c16f6167457c8ac9a3e
index 7e0f5734035bcd54dc8c9c0ec721e3e9e66d6c4e..699dea6c3a223bb3947064372c2fe6fc7901b48e 100644 (file)
@@ -34,6 +34,7 @@
 #include "lib/ratio.h"
 #include "lib/log_entry.h"
 #include <dcp/dcp.h>
+#include <asdcp/AS_DCP.h>
 #include <sndfile.h>
 #include <libxml++/libxml++.h>
 #include <Magick++.h>
@@ -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)
 {
index 40163d8ffbd5ca1d535e80aac39115e542de7298..94b15a199d1bdb4f0dda7633a6250dc9efc54aed 100644 (file)
@@ -30,6 +30,7 @@ extern boost::shared_ptr<Film> 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<std::string>);
 extern void check_file (boost::filesystem::path, boost::filesystem::path);
 extern void check_image (boost::filesystem::path, boost::filesystem::path);