summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-30 13:22:11 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-30 13:22:11 +0100
commitdd879e5254c1e005e60ccd135a37f70cb2fe3a75 (patch)
tree505edd6a2aaf6261c8cb5c2d17fc3644c74e9dfa
parenteea4471bb8c681b9130d4c5049f386b240a3ac3a (diff)
Check content_test1 output.
-rw-r--r--test/content_test.cc14
m---------test/data0
-rw-r--r--test/test.cc27
-rw-r--r--test/test.h1
4 files changed, 42 insertions, 0 deletions
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
-Subproject 30d3455d626c1a08554b9f77cb5fe67fd5b1fd8
+Subproject e4609c3834cebb4732614c16f6167457c8ac9a3
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 <dcp/dcp.h>
+#include <asdcp/AS_DCP.h>
#include <sndfile.h>
#include <libxml++/libxml++.h>
#include <Magick++.h>
@@ -163,6 +164,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)
{
#ifdef DCPOMATIC_IMAGE_MAGICK
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<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);