Hand-apply dbaf6da70557cc94550e95130cb697ce6a100586 from master;
authorCarl Hetherington <cth@carlh.net>
Tue, 21 Apr 2015 10:39:55 +0000 (11:39 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 21 Apr 2015 10:39:55 +0000 (11:39 +0100)
use the picture MXF's filename decided at the start of the encode
the whole way through the encode.

src/lib/writer.cc

index e8a4ac10b4f2192b43140b662aee72ad95d21e7e..4270a42a7684a76f2f64a34392e26e28bffb501f 100644 (file)
@@ -92,9 +92,6 @@ Writer::Writer (shared_ptr<const Film> f, weak_ptr<Job> j)
        shared_ptr<Job> job = _job.lock ();
        DCPOMATIC_ASSERT (job);
 
-       job->sub (_("Checking existing image data"));
-       check_existing_picture_mxf ();
-
        /* Create our picture asset in a subdirectory, named according to those
           film's parameters which affect the video output.  We will hard-link
           it into the DCP later.
@@ -106,6 +103,9 @@ Writer::Writer (shared_ptr<const Film> f, weak_ptr<Job> j)
                _picture_mxf.reset (new dcp::MonoPictureMXF (dcp::Fraction (_film->video_frame_rate (), 1)));
        }
 
+       job->sub (_("Checking existing image data"));
+       check_existing_picture_mxf ();
+
        _picture_mxf->set_size (_film->frame_size ());
 
        if (_film->encrypted ()) {
@@ -438,9 +438,7 @@ Writer::finish ()
        }
        
        /* Hard-link the video MXF into the DCP */
-       boost::filesystem::path video_from;
-       video_from /= _film->internal_video_mxf_dir();
-       video_from /= _film->internal_video_mxf_filename();
+       boost::filesystem::path video_from = _picture_mxf->file ();
        
        boost::filesystem::path video_to;
        video_to /= _film->dir (_film->dcp_name());
@@ -594,12 +592,9 @@ void
 Writer::check_existing_picture_mxf ()
 {
        /* Try to open the existing MXF */
-       boost::filesystem::path p;
-       p /= _film->internal_video_mxf_dir ();
-       p /= _film->internal_video_mxf_filename ();
-       FILE* mxf = fopen_boost (p, "rb");
+       FILE* mxf = fopen_boost (_picture_mxf->file(), "rb");
        if (!mxf) {
-               LOG_GENERAL ("Could not open existing MXF at %1 (errno=%2)", p.string(), errno);
+               LOG_GENERAL ("Could not open existing MXF at %1 (errno=%2)", _picture_mxf->file().string(), errno);
                return;
        }