summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-01-05 01:24:19 +0000
committerCarl Hetherington <cth@carlh.net>2016-01-05 01:24:19 +0000
commit5ee3348142f4cfafdbcf2c9c833843d717affc11 (patch)
tree1c97c80eeccc6b5f515a611e35dee35b21d3b09b /test
parent740938890d95e853cf13d4780a5d674c3d6c7f6f (diff)
Various IMF hacks.imf
Diffstat (limited to 'test')
-rw-r--r--test/cpl_sar_test.cc2
-rw-r--r--test/imf_test.cc28
-rw-r--r--test/read_smpte_subtitle_test.cc3
-rw-r--r--test/round_trip_test.cc2
-rw-r--r--test/sound_frame_test.cc8
-rw-r--r--test/subs_in_out.cc2
6 files changed, 38 insertions, 7 deletions
diff --git a/test/cpl_sar_test.cc b/test/cpl_sar_test.cc
index 3f5b07d1..3c5c9a6d 100644
--- a/test/cpl_sar_test.cc
+++ b/test/cpl_sar_test.cc
@@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE (cpl_sar)
{
shared_ptr<dcp::ReelMonoPictureAsset> pa (
new dcp::ReelMonoPictureAsset (
- shared_ptr<dcp::MonoPictureAsset> (new dcp::MonoPictureAsset ("test/ref/DCP/dcp_test1/video.mxf")),
+ shared_ptr<dcp::MonoPictureAsset> (new dcp::MonoPictureAsset ("test/ref/DCP/dcp_test1/video.mxf", dcp::ASSET_DCP)),
0
)
);
diff --git a/test/imf_test.cc b/test/imf_test.cc
index 3b95416b..0a3c8914 100644
--- a/test/imf_test.cc
+++ b/test/imf_test.cc
@@ -18,12 +18,40 @@
*/
#include "imp.h"
+#include "imp_cpl.h"
+#include "sequence.h"
+#include "segment.h"
#include "test.h"
+#include "resource.h"
+#include "mono_picture_asset.h"
+#include "mono_picture_frame.h"
#include <boost/test/unit_test.hpp>
+using boost::shared_ptr;
+
/** Simple test of reading an IMF package */
BOOST_AUTO_TEST_CASE (imf_test1)
{
dcp::IMP imp (private_test / "data" / "BelleSebastian2_TLR-2-2398_HD-239_DE-XX_CH_51_HD_PATH_20151229_DGL_SMPTE_IMPAPP2_OV");
imp.read ();
+
+ BOOST_REQUIRE_EQUAL (imp.cpls().size(), 1);
+ shared_ptr<dcp::IMPCPL> cpl = imp.cpls().front ();
+
+ BOOST_REQUIRE_EQUAL (cpl->segments().size(), 1);
+ shared_ptr<dcp::Segment> segment = cpl->segments().front ();
+
+ BOOST_REQUIRE (segment->main_image ());
+ shared_ptr<dcp::Sequence> main_image = segment->main_image ();
+
+ BOOST_REQUIRE_EQUAL (main_image->resources().size(), 1);
+ shared_ptr<dcp::Resource> resource = main_image->resources().front ();
+
+ BOOST_REQUIRE (resource->asset<dcp::MonoPictureAsset>());
+ shared_ptr<dcp::MonoPictureAsset> picture = resource->asset<dcp::MonoPictureAsset> ();
+
+ shared_ptr<const dcp::MonoPictureFrame> frame = picture->get_frame (100);
+ FILE* out = fopen ("/home/carl/piss.j2c", "wb");
+ fwrite (frame->j2k_data(), 1, frame->j2k_size(), out);
+ fclose (out);
}
diff --git a/test/read_smpte_subtitle_test.cc b/test/read_smpte_subtitle_test.cc
index f4d28106..e90b849c 100644
--- a/test/read_smpte_subtitle_test.cc
+++ b/test/read_smpte_subtitle_test.cc
@@ -36,7 +36,8 @@ BOOST_AUTO_TEST_CASE (read_smpte_subtitle_test)
private_test /
"data" /
"JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV" /
- "8b48f6ae-c74b-4b80-b994-a8236bbbad74_sub.mxf"
+ "8b48f6ae-c74b-4b80-b994-a8236bbbad74_sub.mxf",
+ dcp::ASSET_DCP
);
BOOST_CHECK_EQUAL (sc.id(), "8b48f6ae-c74b-4b80-b994-a8236bbbad74");
diff --git a/test/round_trip_test.cc b/test/round_trip_test.cc
index 8eff55a3..796b0c95 100644
--- a/test/round_trip_test.cc
+++ b/test/round_trip_test.cc
@@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE (round_trip_test)
/* Reload the picture asset */
shared_ptr<dcp::MonoPictureAsset> asset_B (
- new dcp::MonoPictureAsset (work_dir / "video.mxf")
+ new dcp::MonoPictureAsset (work_dir / "video.mxf", dcp::ASSET_DCP)
);
BOOST_CHECK (!kdm_B.keys().empty ());
diff --git a/test/sound_frame_test.cc b/test/sound_frame_test.cc
index 31e8b265..cf6695a6 100644
--- a/test/sound_frame_test.cc
+++ b/test/sound_frame_test.cc
@@ -31,7 +31,9 @@ BOOST_AUTO_TEST_CASE (sound_frame_test)
dcp::SoundFrame frame (
private_test / "TONEPLATES-SMPTE-PLAINTEXT_TST_F_XX-XX_ITL-TD_51-XX_2K_WOE_20111001_WOE_OV/pcm_95734608-5d47-4d3f-bf5f-9e9186b66afa_.mxf",
42,
- 0
+ 0,
+ dcp::ASSET_DCP,
+ dcp::Fraction (48000, 1)
);
BOOST_REQUIRE_EQUAL (frame.size(), channels * frame_length * 3);
@@ -60,11 +62,11 @@ BOOST_AUTO_TEST_CASE (sound_frame_test)
BOOST_AUTO_TEST_CASE (sound_frame_test2)
{
- BOOST_CHECK_THROW (dcp::SoundFrame ("frobozz", 42, 0), dcp::FileError);
+ BOOST_CHECK_THROW (dcp::SoundFrame ("frobozz", 42, 0, dcp::ASSET_DCP, dcp::Fraction (48000, 1)), dcp::FileError);
BOOST_CHECK_THROW (dcp::SoundFrame (
private_test /
"TONEPLATES-SMPTE-PLAINTEXT_TST_F_XX-XX_ITL-TD_51-XX_2K_WOE_20111001_WOE_OV/pcm_95734608-5d47-4d3f-bf5f-9e9186b66afa_.mxf",
- 999999999, 0
+ 999999999, 0, dcp::ASSET_DCP, dcp::Fraction (48000, 1)
), dcp::PackageReadError
);
}
diff --git a/test/subs_in_out.cc b/test/subs_in_out.cc
index 154eb9e8..31b623b4 100644
--- a/test/subs_in_out.cc
+++ b/test/subs_in_out.cc
@@ -37,7 +37,7 @@ main (int argc, char* argv[])
} catch (exception& e) {
cerr << "Could not load as interop: " << e.what() << "\n";
try {
- dcp::SMPTESubtitleAsset sc (argv[1]);
+ dcp::SMPTESubtitleAsset sc (argv[1], dcp::ASSET_DCP);
cout << sc.xml_as_string();
} catch (exception& e) {
cerr << "Could not load as SMPTE (" << e.what() << ")\n";