summaryrefslogtreecommitdiff
path: root/test/imf_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/imf_test.cc')
-rw-r--r--test/imf_test.cc28
1 files changed, 28 insertions, 0 deletions
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);
}