X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Ffilm.cc;h=e54268805ca9c71d752ecd89026d84cf6ebdc6ca;hb=006e38346a8bcdcc889979b7c00802d9bb8fc6f8;hp=b40b439f528628e577484fb6d40eab4d4322559a;hpb=8c365af343a15bee11af53fc6bc16487b83260d1;p=dcpomatic.git diff --git a/src/lib/film.cc b/src/lib/film.cc index b40b439f5..e54268805 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -99,6 +99,7 @@ using boost::dynamic_pointer_cast; using boost::optional; using boost::is_any_of; using dcp::raw_convert; +using namespace dcpomatic; string const Film::metadata_file = "metadata.xml"; @@ -408,6 +409,9 @@ Film::metadata (bool with_content_paths) const m->set_attribute("Type", dcp::marker_to_string(i->first)); m->add_child_text(raw_convert(i->second.get())); } + BOOST_FOREACH (dcp::Rating i, _ratings) { + i.as_xml (root->add_child("Rating")); + } _playlist->as_xml (root->add_child ("Playlist"), with_content_paths); return doc; @@ -540,8 +544,11 @@ Film::read_metadata (optional path) _markers[dcp::marker_from_string(i->string_attribute("Type"))] = DCPTime(dcp::raw_convert(i->content())); } + BOOST_FOREACH (cxml::ConstNodePtr i, f.node_children("Rating")) { + _ratings.push_back (dcp::Rating(i)); + } + list notes; - /* This method is the only one that can return notes (so far) */ _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes); /* Write backtraces to this film's directory, until another film is loaded */ @@ -1377,26 +1384,25 @@ Film::make_kdm ( map, dcp::Key> keys; - BOOST_FOREACH(shared_ptr i, cpl->reel_assets ()) { - shared_ptr mxf = boost::dynamic_pointer_cast (i); - if (!mxf || !mxf->key_id()) { + BOOST_FOREACH(shared_ptr i, cpl->reel_mxfs()) { + if (!i->key_id()) { continue; } /* Get any imported key for this ID */ bool done = false; BOOST_FOREACH (dcp::DecryptedKDMKey j, imported_keys) { - if (j.id() == mxf->key_id().get()) { - LOG_GENERAL ("Using imported key for %1", mxf->key_id().get()); - keys[mxf] = j.key(); + if (j.id() == i->key_id().get()) { + LOG_GENERAL ("Using imported key for %1", i->key_id().get()); + keys[i] = j.key(); done = true; } } if (!done) { /* No imported key; it must be an asset that we encrypted */ - LOG_GENERAL ("Using our own key for %1", mxf->key_id().get()); - keys[mxf] = key(); + LOG_GENERAL ("Using our own key for %1", i->key_id().get()); + keys[i] = key(); } } @@ -1414,7 +1420,7 @@ Film::make_kdm ( * @param disable_forensic_marking_audio if not set, don't disable forensic marking of audio. If set to 0, * disable all forensic marking; if set above 0, disable forensic marking above that channel. */ -list +list > Film::make_kdms ( list > screens, boost::filesystem::path cpl_file, @@ -1425,7 +1431,7 @@ Film::make_kdms ( optional disable_forensic_marking_audio ) const { - list kdms; + list > kdms; BOOST_FOREACH (shared_ptr i, screens) { if (i->recipient) { @@ -1440,7 +1446,7 @@ Film::make_kdms ( disable_forensic_marking_audio ); - kdms.push_back (ScreenKDM (i, kdm)); + kdms.push_back (shared_ptr(new DCPScreenKDM(i, kdm))); } } @@ -1710,6 +1716,13 @@ Film::unset_marker (dcp::Marker type) _markers.erase (type); } +void +Film::set_ratings (vector r) +{ + ChangeSignaller ch (this, RATINGS); + _ratings = r; +} + optional Film::marker (dcp::Marker type) const {