From b0b5d621c851ea22f5328fcb4d212936d670804f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 10 Jan 2014 14:13:56 +0000 Subject: More windows debug. --- src/lib/writer.cc | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'src/lib') diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 558eda97e..cfc19a13d 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -45,6 +45,7 @@ using std::pair; using std::string; using std::list; using std::cout; +using std::stringstream; using boost::shared_ptr; using boost::weak_ptr; @@ -91,6 +92,17 @@ Writer::Writer (shared_ptr f, weak_ptr j) _picture_asset->set_key (_film->key ()); } + _picture_asset_writer = _picture_asset->start_write (_first_nonexistant_frame > 0); + + _sound_asset.reset (new libdcp::SoundAsset (_film->directory (), _film->audio_mxf_filename ())); + _sound_asset->set_edit_rate (_film->video_frame_rate ()); + _sound_asset->set_channels (_film->audio_channels ()); + _sound_asset->set_sampling_rate (_film->audio_frame_rate ()); + + if (_film->encrypted ()) { + _sound_asset->set_key (_film->key ()); + } + /* Write the sound asset into the film directory so that we leave the creation of the DCP directory until the last minute. Some versions of windows inexplicably don't like overwriting existing files here, so try to remove it using boost. @@ -98,25 +110,32 @@ Writer::Writer (shared_ptr f, weak_ptr j) boost::system::error_code ec; boost::filesystem::remove_all (_film->file (_film->audio_mxf_filename ()), ec); if (ec) { + + stringstream s; + boost::filesystem::path p = _film->file (_film->audio_mxf_filename ()); + s << p << "\n" + << "exists=" << boost::filesystem::exists (p) << "\n" + << "file_size=" << boost::filesystem::file_size (p) << "\n" + << "hard_link_count=" << boost::filesystem::hard_link_count (p) << "\n" + << "is_directory=" << boost::filesystem::is_directory (p) << "\n" + << "is_empty=" << boost::filesystem::is_empty (p) << "\n" + << "is_other=" << boost::filesystem::is_other (p) << "\n" + << "is_regular_file=" << boost::filesystem::is_regular_file (p) << "\n" + << "last_write_time=" << boost::filesystem::last_write_time (p) << "\n" + << "type=" << boost::filesystem::status (p).type () << "\n" + << "permissions=" << boost::filesystem::status (p).permissions () << "\n"; + + _film->log()->log (s.str ()); + _film->log()->log ( String::compose ( "Could not remove existing audio MXF file %1 (%2)", _film->file (_film->audio_mxf_filename ()), - ec.value ()) + ec.value () + ) ); } - _picture_asset_writer = _picture_asset->start_write (_first_nonexistant_frame > 0); - - _sound_asset.reset (new libdcp::SoundAsset (_film->directory (), _film->audio_mxf_filename ())); - _sound_asset->set_edit_rate (_film->video_frame_rate ()); - _sound_asset->set_channels (_film->audio_channels ()); - _sound_asset->set_sampling_rate (_film->audio_frame_rate ()); - - if (_film->encrypted ()) { - _sound_asset->set_key (_film->key ()); - } - _sound_asset_writer = _sound_asset->start_write (); _thread = new boost::thread (boost::bind (&Writer::thread, this)); -- cgit v1.2.3