/* Copyright (C) 2016 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #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 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 cpl = imp.cpls().front (); BOOST_REQUIRE_EQUAL (cpl->segments().size(), 1); shared_ptr segment = cpl->segments().front (); BOOST_REQUIRE (segment->main_image ()); shared_ptr main_image = segment->main_image (); BOOST_REQUIRE_EQUAL (main_image->resources().size(), 1); shared_ptr resource = main_image->resources().front (); BOOST_REQUIRE (resource->asset()); shared_ptr picture = resource->asset (); shared_ptr frame = picture->get_frame (100); FILE* out = fopen ("/home/carl/piss.j2c", "wb"); fwrite (frame->j2k_data(), 1, frame->j2k_size(), out); fclose (out); }