using boost::shared_ptr;
using boost::dynamic_pointer_cast;
+/** Check that if we remake a DCP having turned off subtitles the code notices
+ * and doesn't re-use the old video data.
+ */
BOOST_AUTO_TEST_CASE (remake_with_subtitle_test)
{
shared_ptr<Film> film = new_test_film2 ("remake_with_subtitle_test");
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs ());
- /* Nothing is being checked here so this test is not complete */
- DCPOMATIC_ASSERT (false);
+ check_one_frame (film->dir(film->dcp_name()), 325, private_data / "prophet_frame_325_no_subs.j2c");
}
#include "lib/dcp_content_type.h"
#include "lib/log_entry.h"
#include <dcp/dcp.h>
+#include <dcp/cpl.h>
+#include <dcp/reel.h>
+#include <dcp/reel_picture_asset.h>
+#include <dcp/mono_picture_frame.h>
+#include <dcp/mono_picture_asset.h>
+#include <dcp/openjpeg_image.h>
#include <asdcp/AS_DCP.h>
#include <sndfile.h>
#include <libxml++/libxml++.h>
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE dcpomatic_test
#include <boost/test/unit_test.hpp>
+#include <boost/algorithm/string.hpp>
#include <list>
#include <vector>
#include <iostream>
using std::abs;
using boost::shared_ptr;
using boost::scoped_array;
+using boost::dynamic_pointer_cast;
boost::filesystem::path private_data = boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private");
BOOST_REQUIRE_EQUAL (memcmp (ref_p.buf->data, check_p.buf->data, ref_p.buf->size), 0);
}
}
+
+void
+check_one_frame (boost::filesystem::path dcp_dir, int64_t index, boost::filesystem::path ref)
+{
+ dcp::DCP dcp (dcp_dir);
+ dcp.read ();
+ shared_ptr<dcp::MonoPictureAsset> asset = dynamic_pointer_cast<dcp::MonoPictureAsset> (dcp.cpls().front()->reels().front()->main_picture()->asset());
+ BOOST_REQUIRE (asset);
+ shared_ptr<const dcp::MonoPictureFrame> frame = asset->start_read()->get_frame(index);
+
+ boost::uintmax_t const ref_size = boost::filesystem::file_size(ref);
+ BOOST_CHECK_EQUAL (frame->j2k_size(), ref_size);
+
+ FILE* ref_file = fopen_boost(ref, "rb");
+ BOOST_REQUIRE (ref_file);
+
+ uint8_t* ref_data = new uint8_t[ref_size];
+ fread (ref_data, ref_size, 1, ref_file);
+ fclose (ref_file);
+
+ BOOST_CHECK (memcmp(ref_data, frame->j2k_data(), ref_size) == 0);
+ delete[] ref_data;
+}
+
+boost::filesystem::path
+video_file (shared_ptr<const Film> film)
+{
+ boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (film->dir(film->dcp_name()));
+ while (i != boost::filesystem::directory_iterator() && !boost::algorithm::starts_with (i->path().leaf().string(), "j2c")) {
+ ++i;
+ }
+
+ BOOST_REQUIRE (i != boost::filesystem::directory_iterator());
+ return i->path();
+}
extern void check_image (boost::filesystem::path, boost::filesystem::path);
extern boost::filesystem::path test_film_dir (std::string);
extern void write_image (boost::shared_ptr<const Image> image, boost::filesystem::path file, std::string format);
+boost::filesystem::path video_file (boost::shared_ptr<const Film> film);
+void check_one_frame (boost::filesystem::path dcp, int64_t index, boost::filesystem::path ref);