Adapt for changes to libdcp API.
[dcpomatic.git] / src / lib / writer.cc
index 7d1088276995a242300402684facbf0290e3876f..8cfd712a0d92cad3c8576caadb47676b408893fa 100644 (file)
@@ -489,17 +489,18 @@ catch (...)
 void
 Writer::terminate_thread (bool can_throw)
 {
+       boost::this_thread::disable_interruption dis;
+
        boost::mutex::scoped_lock lock (_state_mutex);
-       if (!_thread.joinable()) {
-               return;
-       }
 
        _finish = true;
        _empty_condition.notify_all ();
        _full_condition.notify_all ();
        lock.unlock ();
 
-       _thread.join ();
+       try {
+               _thread.join ();
+       } catch (...) {}
 
        if (can_throw) {
                rethrow ();
@@ -567,21 +568,23 @@ Writer::finish ()
                cpl->add (i.create_reel (_reel_assets, _fonts));
        }
 
-       dcp::XMLMetadata meta;
-       meta.annotation_text = cpl->annotation_text ();
-       meta.creator = Config::instance()->dcp_creator ();
-       if (meta.creator.empty ()) {
-               meta.creator = String::compose ("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit);
+       string creator = Config::instance()->dcp_creator();
+       if (creator.empty()) {
+               creator = String::compose("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit);
        }
-       meta.issuer = Config::instance()->dcp_issuer ();
-       if (meta.issuer.empty ()) {
-               meta.issuer = String::compose ("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit);
+
+       string issuer = Config::instance()->dcp_issuer();
+       if (issuer.empty()) {
+               issuer = String::compose("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit);
        }
-       meta.set_issue_date_now ();
 
-       cpl->set_metadata (meta);
-       cpl->set_ratings (vector_to_list(_film->ratings()));
-       cpl->set_content_version_label_text (_film->content_version());
+       cpl->set_ratings (_film->ratings());
+
+       dcp::ContentVersion cv = cpl->content_version ();
+       cv.label_text = _film->content_version();
+       cpl->set_content_version (cv);
+
+       cpl->set_full_content_title_text (_film->name());
 
        shared_ptr<const dcp::CertificateChain> signer;
        signer = Config::instance()->signer_chain ();
@@ -591,7 +594,15 @@ Writer::finish ()
                throw InvalidSignerError (reason);
        }
 
-       dcp.write_xml (_film->interop () ? dcp::INTEROP : dcp::SMPTE, meta, signer, Config::instance()->dcp_metadata_filename_format());
+       dcp.write_xml (
+               _film->interop() ? dcp::INTEROP : dcp::SMPTE,
+               issuer,
+               creator,
+               dcp::LocalTime().as_string(),
+               String::compose("Created by libdcp %1", dcp::version),
+               signer,
+               Config::instance()->dcp_metadata_filename_format()
+               );
 
        LOG_GENERAL (
                N_("Wrote %1 FULL, %2 FAKE, %3 REPEAT, %4 pushed to disk"), _full_written, _fake_written, _repeat_written, _pushed_to_disk