Keep signing certificates / keys in config.xml rather than on disk; allow configuration.
[dcpomatic.git] / src / lib / film.cc
index 1456314bebb58a700181947a3260283ff80e7017..eaf738b8ba004b12b4a0c11cbce84924fc4fdc32 100644 (file)
@@ -121,6 +121,7 @@ Film::Film (boost::filesystem::path dir, bool log)
        , _three_d (false)
        , _sequence_video (true)
        , _interop (false)
+       , _burn_subtitles (false)
        , _state_version (current_state_version)
        , _dirty (false)
 {
@@ -184,6 +185,10 @@ Film::video_identifier () const
                s << "_S";
        }
 
+       if (_burn_subtitles) {
+               s << "_B";
+       }
+
        if (_three_d) {
                s << "_3D";
        }
@@ -225,6 +230,12 @@ Film::audio_mxf_filename () const
        return filename_safe_name() + "_audio.mxf";
 }
 
+boost::filesystem::path
+Film::subtitle_xml_filename () const
+{
+       return filename_safe_name() + "_subtitle.xml";
+}
+
 string
 Film::filename_safe_name () const
 {
@@ -375,6 +386,7 @@ Film::metadata () const
        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");
+       root->add_child("BurnSubtitles")->add_child_text (_burn_subtitles ? "1" : "0");
        root->add_child("Signed")->add_child_text (_signed ? "1" : "0");
        root->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0");
        root->add_child("Key")->add_child_text (_key.hex ());
@@ -446,6 +458,9 @@ Film::read_metadata ()
        _sequence_video = f.bool_child ("SequenceVideo");
        _three_d = f.bool_child ("ThreeD");
        _interop = f.bool_child ("Interop");
+       if (_state_version >= 32) {
+               _burn_subtitles = f.bool_child ("BurnSubtitles");
+       }
        _key = dcp::Key (f.string_child ("Key"));
 
        list<string> notes;
@@ -681,7 +696,6 @@ Film::dcp_name (bool if_created_now) const
        return name();
 }
 
-
 void
 Film::set_directory (boost::filesystem::path d)
 {
@@ -773,6 +787,13 @@ Film::set_interop (bool i)
        signal_changed (INTEROP);
 }
 
+void
+Film::set_burn_subtitles (bool b)
+{
+       _burn_subtitles = b;
+       signal_changed (BURN_SUBTITLES);
+}
+
 void
 Film::signal_changed (Property p)
 {
@@ -1057,9 +1078,14 @@ Film::make_kdm (
        ) const
 {
        shared_ptr<const dcp::CPL> cpl (new dcp::CPL (cpl_file));
+       shared_ptr<const dcp::Signer> signer = Config::instance()->signer();
+       if (!signer->valid ()) {
+               throw InvalidSignerError ();
+       }
+       
        return dcp::DecryptedKDM (
                cpl, from, until, "DCP-o-matic", cpl->content_title_text(), dcp::LocalTime().as_string()
-               ).encrypt (make_signer(), target, formulation);
+               ).encrypt (signer, target, formulation);
 }
 
 list<dcp::EncryptedKDM>