if (_film->encrypted ()) {
_picture_asset->set_key (_film->key ());
+ _picture_asset->set_context_id (_film->context_id ());
}
_picture_asset->set_file (
_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
+ if (read) {
+ LOG_GENERAL (
+ "Checked %1 (which exists) length is %2 perms are %3",
+ info_file, boost::filesystem::file_size (info_file), int(boost::filesystem::status(info_file).permissions())
+ );
+ } else {
+ LOG_GENERAL ("Checked %1 (which does not exist)", info_file);
+ }
+#endif
+
+ if (read) {
file = fopen_boost (info_file, "r+b");
} else {
file = fopen_boost (info_file, "wb");
}
if (!file) {
- throw OpenFileError (info_file, errno);
+ throw OpenFileError (info_file, errno, read);
}
dcpomatic_fseek (file, frame_info_position (frame, eyes), SEEK_SET);
fwrite (&info.offset, sizeof (info.offset), 1, file);
{
if (!_picture_asset_writer->finalize ()) {
/* Nothing was written to the picture asset */
+ LOG_GENERAL ("Nothing was written to reel %1 of %2", _reel_index, _reel_count);
_picture_asset.reset ();
}
reel_picture_asset.reset (new dcp::ReelStereoPictureAsset (stereo, 0));
}
} else {
+ LOG_GENERAL ("no picture asset of our own; look through %1", refs.size());
/* We don't have a picture asset of our own; hopefully we have one to reference */
BOOST_FOREACH (ReferencedReelAsset j, refs) {
shared_ptr<dcp::ReelPictureAsset> k = dynamic_pointer_cast<dcp::ReelPictureAsset> (j.asset);
+ if (k) {
+ LOG_GENERAL ("candidate picture asset period is %1-%2", j.period.from.get(), j.period.to.get());
+ }
if (k && j.period == _period) {
reel_picture_asset = k;
}
}
}
+ LOG_GENERAL ("create_reel for %1-%2; %3 of %4", _period.from.get(), _period.to.get(), _reel_index, _reel_count);
+
DCPOMATIC_ASSERT (reel_picture_asset);
+ DCPOMATIC_ASSERT (reel_picture_asset->duration() == _period.duration().frames_round (_film->video_frame_rate ()));
reel->add (reel_picture_asset);
/* If we have a hash for this asset in the CPL, assume that it is correct */
reel_picture_asset->asset_ref()->set_hash (reel_picture_asset->hash().get());
}
+ shared_ptr<dcp::ReelSoundAsset> reel_sound_asset;
+
if (_sound_asset) {
/* We have made a sound asset of our own. Put it into the reel */
- reel->add (shared_ptr<dcp::ReelSoundAsset> (new dcp::ReelSoundAsset (_sound_asset, 0)));
+ reel_sound_asset.reset (new dcp::ReelSoundAsset (_sound_asset, 0));
} else {
/* We don't have a sound asset of our own; hopefully we have one to reference */
BOOST_FOREACH (ReferencedReelAsset j, refs) {
shared_ptr<dcp::ReelSoundAsset> k = dynamic_pointer_cast<dcp::ReelSoundAsset> (j.asset);
if (k && j.period == _period) {
- reel->add (k);
+ reel_sound_asset = k;
/* If we have a hash for this asset in the CPL, assume that it is correct */
if (k->hash()) {
k->asset_ref()->set_hash (k->hash().get());
}
}
+ DCPOMATIC_ASSERT (reel_sound_asset);
+ DCPOMATIC_ASSERT (reel_sound_asset->duration() == _period.duration().frames_round (_film->video_frame_rate ()));
+ reel->add (reel_sound_asset);
+
+ shared_ptr<dcp::ReelSubtitleAsset> reel_subtitle_asset;
+
if (_subtitle_asset) {
boost::filesystem::path liberation_normal;
);
}
- reel->add (shared_ptr<dcp::ReelSubtitleAsset> (
- new dcp::ReelSubtitleAsset (
- _subtitle_asset,
- dcp::Fraction (_film->video_frame_rate(), 1),
- reel_picture_asset->intrinsic_duration (),
- 0
- )
- ));
+ reel_subtitle_asset.reset (
+ new dcp::ReelSubtitleAsset (
+ _subtitle_asset,
+ dcp::Fraction (_film->video_frame_rate(), 1),
+ reel_picture_asset->intrinsic_duration (),
+ 0
+ )
+ );
} else {
/* We don't have a subtitle asset of our own; hopefully we have one to reference */
BOOST_FOREACH (ReferencedReelAsset j, refs) {
shared_ptr<dcp::ReelSubtitleAsset> k = dynamic_pointer_cast<dcp::ReelSubtitleAsset> (j.asset);
if (k && j.period == _period) {
- reel->add (k);
+ reel_subtitle_asset = k;
/* If we have a hash for this asset in the CPL, assume that it is correct */
if (k->hash()) {
k->asset_ref()->set_hash (k->hash().get());
}
}
+ if (reel_subtitle_asset) {
+ DCPOMATIC_ASSERT (reel_subtitle_asset->duration() == _period.duration().frames_round (_film->video_frame_rate ()));
+ reel->add (reel_subtitle_asset);
+ }
+
return reel;
}
_sound_asset_writer->write (audio->data(), audio->frames());
}
- ++_total_written_audio_frames;
+ _total_written_audio_frames += audio->frames ();
}
void
}
}
- 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);