Possibly-working basic DCP creation.
authorCarl Hetherington <cth@carlh.net>
Thu, 24 Jan 2013 20:00:12 +0000 (20:00 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 24 Jan 2013 20:00:12 +0000 (20:00 +0000)
src/lib/film.cc
src/lib/film.h
src/lib/writer.cc

index dc308078c2e31aaa72ea672b8aa4f1ee38ccf347..f6eb032fd7e7b0c4f98df7ea969d4140ec72b32c 100644 (file)
@@ -229,12 +229,16 @@ Film::hash_dir () const
 }
 
 string
-Film::video_mxf_path () const
+Film::video_mxf_dir () const
 {
        boost::filesystem::path p;
-       p /= "video";
-       p /= video_state_identifier ();
-       return file (p.string());
+       return dir ("video");
+}
+
+string
+Film::video_mxf_filename () const
+{
+       return video_state_identifier() + ".mxf";
 }
 
 /** Add suitable Jobs to the JobManager to create a DCP for this Film.
index 4d2819be30c9226bd67d0cbc8f44d1293a87b907..07764dac89da6be57bbe009d49af6c02378cee05 100644 (file)
@@ -62,7 +62,8 @@ public:
        std::string hash_dir () const;
        std::string j2c_path (int f, bool t) const;
        std::string hash_path (int f) const;
-       std::string video_mxf_path () const;
+       std::string video_mxf_dir () const;
+       std::string video_mxf_filename () const;
 
        void examine_content ();
        void send_dcp_to_tms ();
index 16ed5c3493cdf717f08e20607bd2f8756441364f..33a7f42af85fb9e10806b195f9c1eb62e9cc8c1d 100644 (file)
@@ -39,10 +39,15 @@ Writer::Writer (shared_ptr<Film> f)
        , _finish (false)
        , _last_written_frame (-1)
 {
+       /* Create our picture asset in a subdirectory, named according to the
+          film's parameters which affect the video output.  We will hard-link
+          it into the DCP later.
+       */
+       
        _picture_asset.reset (
                new libdcp::MonoPictureAsset (
-                       _film->dir (_film->dcp_name()),
-                       _film->video_mxf_path(),
+                       _film->video_mxf_dir (),
+                       _film->video_mxf_filename (),
                        DCPFrameRate (_film->frames_per_second()).frames_per_second,
                        _film->format()->dcp_size()
                        )
@@ -207,6 +212,23 @@ Writer::finish ()
        _picture_asset->set_entry_point (_film->trim_start ());
        _picture_asset->set_duration (duration);
 
+       /* Hard-link the video MXF into the DCP */
+
+       boost::filesystem::path from;
+       from /= _film->video_mxf_dir();
+       from /= _film->video_mxf_filename();
+       
+       boost::filesystem::path to;
+       to /= _film->dir (_film->dcp_name());
+       to /= "video.mxf";
+       
+       boost::filesystem::create_hard_link (from, to);
+
+       /* And update the asset */
+
+       _picture_asset->set_directory (_film->dir (_film->dcp_name ()));
+       _picture_asset->set_file_name ("video.mxf");
+
        if (_sound_asset) {
                _sound_asset->set_entry_point (_film->trim_start ());
                _sound_asset->set_duration (duration);