_sound_asset->set_key (_film->key ());
}
+ DCPOMATIC_ASSERT (_film->directory());
+
/* Write the sound asset into the film directory so that we leave the creation
of the DCP directory until the last minute.
*/
_sound_asset_writer = _sound_asset->start_write (
- _film->directory() / audio_asset_filename (_sound_asset, _reel_index, _reel_count, _content_summary),
+ _film->directory().get() / audio_asset_filename (_sound_asset, _reel_index, _reel_count, _content_summary),
_film->interop() ? dcp::INTEROP : dcp::SMPTE
);
}
{
FILE* file = 0;
boost::filesystem::path info_file = _film->info_file (_period);
- if (boost::filesystem::exists (info_file)) {
+
+ bool const read = boost::filesystem::exists (info_file);
+
+#ifdef DCPOMATIC_WINDOWS
+ LOG_GENERAL (
+ "Checked %1 (exists %2) length is %3 perms are %4",
+ info_file, read ? 1 : 0, boost::filesystem::file_size (info_file), int(boost::filesystem::status(info_file).permissions())
+ );
+#endif
+
+ if (read) {
file = fopen_boost (info_file, "r+b");
} else {
file = fopen_boost (info_file, "wb");
}
if (!file) {
- throw OpenFileError (info_file);
+ throw OpenFileError (info_file, errno, read);
}
dcpomatic_fseek (file, frame_info_position (frame, eyes), SEEK_SET);
fwrite (&info.offset, sizeof (info.offset), 1, file);
ReelWriter::check_existing_picture_asset ()
{
/* Try to open the existing asset */
- FILE* asset_file = fopen_boost (_picture_asset->file(), "rb");
+ DCPOMATIC_ASSERT (_picture_asset->file());
+ FILE* asset_file = fopen_boost (_picture_asset->file().get(), "rb");
if (!asset_file) {
- LOG_GENERAL ("Could not open existing asset at %1 (errno=%2)", _picture_asset->file().string(), errno);
+ LOG_GENERAL ("Could not open existing asset at %1 (errno=%2)", _picture_asset->file()->string(), errno);
return;
} else {
- LOG_GENERAL ("Opened existing asset at %1", _picture_asset->file().string());
+ LOG_GENERAL ("Opened existing asset at %1", _picture_asset->file()->string());
}
/* Offset of the last dcp::FrameInfo in the info file */
/* Hard-link any video asset file into the DCP */
if (_picture_asset) {
- boost::filesystem::path video_from = _picture_asset->file ();
+ DCPOMATIC_ASSERT (_picture_asset->file());
+ boost::filesystem::path video_from = _picture_asset->file().get();
boost::filesystem::path video_to;
video_to /= _film->dir (_film->dcp_name());
video_to /= video_asset_filename (_picture_asset, _reel_index, _reel_count, _content_summary);
s->set_reel_number (1);
s->set_time_code_rate (_film->video_frame_rate ());
s->set_start_time (dcp::Time ());
+ if (_film->encrypted ()) {
+ s->set_key (_film->key ());
+ }
_subtitle_asset = s;
}
}
- BOOST_FOREACH (dcp::SubtitleString i, subs.text) {
+ BOOST_FOREACH (SubtitleString i, subs.text) {
i.set_in (i.in() - dcp::Time (_period.from.seconds(), i.in().tcr));
i.set_out (i.out() - dcp::Time (_period.from.seconds(), i.out().tcr));
_subtitle_asset->add (i);