Merge master.
[dcpomatic.git] / src / lib / film.cc
index 2697b062fb8211be7d4838e421f4359a134b2e2e..71836f2540fc1fa617241cf2a622fc1e34283527 100644 (file)
@@ -64,8 +64,6 @@ using std::multimap;
 using std::pair;
 using std::map;
 using std::vector;
-using std::ifstream;
-using std::ofstream;
 using std::setfill;
 using std::min;
 using std::make_pair;
@@ -83,7 +81,7 @@ using boost::optional;
 using libdcp::Size;
 using libdcp::Signer;
 
-int const Film::state_version = 4;
+int const Film::state_version = 5;
 
 /** Construct a Film object in a given directory.
  *
@@ -151,6 +149,12 @@ Film::video_identifier () const
          << "_" << scaler()->id()
          << "_" << j2k_bandwidth();
 
+       if (encrypted ()) {
+               s << "_E";
+       } else {
+               s << "_P";
+       }
+
        if (_interop) {
                s << "_I";
        } else {
@@ -368,6 +372,8 @@ Film::read_metadata ()
 
        cxml::Document f ("Metadata");
        f.read_file (file ("metadata.xml"));
+
+       int const version = f.number_child<int> ("Version");
        
        _name = f.string_child ("Name");
        _use_dci_name = f.bool_child ("UseDCIName");
@@ -399,7 +405,7 @@ Film::read_metadata ()
        _three_d = f.bool_child ("ThreeD");
        _interop = f.bool_child ("Interop");
        _key = libdcp::Key (f.string_child ("Key"));
-       _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"));
+       _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), version);
 
        _dirty = false;
 }
@@ -475,7 +481,7 @@ Film::dci_name (bool if_created_now) const
 
        if (!dm.audio_language.empty ()) {
                d << "_" << dm.audio_language;
-               if (!dm.subtitle_language.empty() && with_subtitles()) {
+               if (!dm.subtitle_language.empty()) {
                        d << "-" << dm.subtitle_language;
                } else {
                        d << "-XX";
@@ -844,6 +850,12 @@ Film::best_video_frame_rate () const
        return _playlist->best_dcp_frame_rate ();
 }
 
+bool
+Film::content_paths_valid () const
+{
+       return _playlist->content_paths_valid ();
+}
+
 void
 Film::playlist_content_changed (boost::weak_ptr<Content> c, int p)
 {