- terminate_thread (true);
-
- BOOST_FOREACH (Reel& i, _reels) {
-
- if (!i.picture_asset_writer->finalize ()) {
- /* Nothing was written to the picture asset */
- i.picture_asset.reset ();
- }
-
- if (i.sound_asset_writer && !i.sound_asset_writer->finalize ()) {
- /* Nothing was written to the sound asset */
- cout << "nothing written to reel @ " << i.period << "\n";
- i.sound_asset.reset ();
- } else {
- cout << "something written to reel @ " << i.period << "\n";
- }
-
- /* Hard-link any video asset file into the DCP */
- if (i.picture_asset) {
- boost::filesystem::path video_from = i.picture_asset->file ();
- boost::filesystem::path video_to;
- video_to /= _film->dir (_film->dcp_name());
- video_to /= video_asset_filename (i.picture_asset);
-
- boost::system::error_code ec;
- boost::filesystem::create_hard_link (video_from, video_to, ec);
- if (ec) {
- LOG_WARNING_NC ("Hard-link failed; copying instead");
- boost::filesystem::copy_file (video_from, video_to, ec);
- if (ec) {
- LOG_ERROR ("Failed to copy video file from %1 to %2 (%3)", video_from.string(), video_to.string(), ec.message ());
- throw FileError (ec.message(), video_from);
- }
- }
-
- i.picture_asset->set_file (video_to);
- }
-
- /* Move the audio asset into the DCP */
- if (i.sound_asset) {
- boost::filesystem::path audio_to;
- audio_to /= _film->dir (_film->dcp_name ());
- audio_to /= audio_asset_filename (i.sound_asset);
-
- boost::system::error_code ec;
- boost::filesystem::rename (_film->file (audio_asset_filename (i.sound_asset)), audio_to, ec);
- if (ec) {
- throw FileError (
- String::compose (_("could not move audio asset into the DCP (%1)"), ec.value ()), audio_asset_filename (i.sound_asset)
- );
- }