Untested basics of making client/server work again.
[dcpomatic.git] / src / lib / film.cc
index 9b339ea244bb4d08d3a41465cb4a60a75c77f2de..940e94fa7631053ffe1ac3070fbed1f0e7e855aa 100644 (file)
@@ -80,10 +80,10 @@ int const Film::state_version = 4;
 
 /** Construct a Film object in a given directory.
  *
- *  @param d Film directory.
+ *  @param dir Film directory.
  */
 
-Film::Film (string d)
+Film::Film (boost::filesystem::path dir)
        : _playlist (new Playlist)
        , _use_dci_name (true)
        , _dcp_content_type (Config::instance()->default_dcp_content_type ())
@@ -97,6 +97,7 @@ Film::Film (string d)
        , _audio_channels (MAX_AUDIO_CHANNELS)
        , _three_d (false)
        , _sequence_video (true)
+       , _interop (false)
        , _dirty (false)
 {
        set_dci_date_today ();
@@ -108,7 +109,7 @@ Film::Film (string d)
           (Code swiped from Adam Bowen on stackoverflow)
        */
        
-       boost::filesystem::path p (boost::filesystem::system_complete (d));
+       boost::filesystem::path p (boost::filesystem::system_complete (dir));
        boost::filesystem::path result;
        for (boost::filesystem::path::iterator i = p.begin(); i != p.end(); ++i) {
                if (*i == "..") {
@@ -142,6 +143,12 @@ Film::video_identifier () const
          << "_" << scaler()->id()
          << "_" << j2k_bandwidth();
 
+       if (_interop) {
+               s << "_I";
+       } else {
+               s << "_S";
+       }
+
        if (_three_d) {
                s << "_3D";
        }
@@ -331,6 +338,7 @@ Film::write_metadata () const
        root->add_child("AudioChannels")->add_child_text (lexical_cast<string> (_audio_channels));
        root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0");
        root->add_child("SequenceVideo")->add_child_text (_sequence_video ? "1" : "0");
+       root->add_child("Interop")->add_child_text (_interop ? "1" : "0");
        _playlist->as_xml (root->add_child ("Playlist"));
 
        doc.write_to_file_formatted (file ("metadata.xml"));
@@ -348,7 +356,8 @@ Film::read_metadata ()
                throw StringError (_("This film was created with an older version of DCP-o-matic, and unfortunately it cannot be loaded into this version.  You will need to create a new Film, re-add your content and set it up again.  Sorry!"));
        }
 
-       cxml::File f (file ("metadata.xml"), "Metadata");
+       cxml::Document f ("Metadata");
+       f.read_file (file ("metadata.xml"));
        
        _name = f.string_child ("Name");
        _use_dci_name = f.bool_child ("UseDCIName");
@@ -377,6 +386,7 @@ Film::read_metadata ()
        _audio_channels = f.number_child<int> ("AudioChannels");
        _sequence_video = f.bool_child ("SequenceVideo");
        _three_d = f.bool_child ("ThreeD");
+       _interop = f.bool_child ("Interop");
 
        _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"));
 
@@ -435,6 +445,7 @@ Film::dci_name (bool if_created_now) const
 
        if (dcp_content_type()) {
                d << "_" << dcp_content_type()->dci_name();
+               d << "-" << dci_metadata().content_version;
        }
 
        if (three_d ()) {
@@ -614,6 +625,13 @@ Film::set_three_d (bool t)
        signal_changed (THREE_D);
 }
 
+void
+Film::set_interop (bool i)
+{
+       _interop = i;
+       signal_changed (INTEROP);
+}
+
 void
 Film::signal_changed (Property p)
 {