Make Atmos content work more like other content. Now its MXFs
[dcpomatic.git] / src / lib / writer.cc
index 699f220c4df31fdef6dfbae02086515119e60fd6..7d1088276995a242300402684facbf0290e3876f 100644 (file)
@@ -97,10 +97,11 @@ Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j)
        BOOST_FOREACH (DCPTextTrack i, _film->closed_caption_tracks()) {
                _caption_reels[i] = _reels.begin ();
        }
+       _atmos_reel = _reels.begin ();
 
-       /* Check that the signer is OK if we need one */
+       /* Check that the signer is OK */
        string reason;
-       if (_film->is_signed() && !Config::instance()->signer_chain()->valid(&reason)) {
+       if (!Config::instance()->signer_chain()->valid(&reason)) {
                throw InvalidSignerError (reason);
        }
 }
@@ -303,6 +304,19 @@ Writer::write (shared_ptr<const AudioBuffers> audio, DCPTime const time)
 }
 
 
+void
+Writer::write (shared_ptr<const dcp::AtmosFrame> atmos, DCPTime time, AtmosMetadata metadata)
+{
+       if (_atmos_reel->period().to == time) {
+               ++_atmos_reel;
+               DCPOMATIC_ASSERT (_atmos_reel != _reels.end());
+       }
+
+       /* We assume that we get a video frame's worth of data here */
+       _atmos_reel->write (atmos, metadata);
+}
+
+
 /** Caller must hold a lock on _state_mutex */
 bool
 Writer::have_sequenced_image_at_queue_head ()
@@ -570,13 +584,11 @@ Writer::finish ()
        cpl->set_content_version_label_text (_film->content_version());
 
        shared_ptr<const dcp::CertificateChain> signer;
-       if (_film->is_signed ()) {
-               signer = Config::instance()->signer_chain ();
-               /* We did check earlier, but check again here to be on the safe side */
-               string reason;
-               if (!signer->valid (&reason)) {
-                       throw InvalidSignerError (reason);
-               }
+       signer = Config::instance()->signer_chain ();
+       /* We did check earlier, but check again here to be on the safe side */
+       string reason;
+       if (!signer->valid (&reason)) {
+               throw InvalidSignerError (reason);
        }
 
        dcp.write_xml (_film->interop () ? dcp::INTEROP : dcp::SMPTE, meta, signer, Config::instance()->dcp_metadata_filename_format());