Changes to libdcp.
[dcpomatic.git] / src / lib / writer.cc
index 7099f51c2c995559fc6d1b78dbcb3559cf4ebb7b..7b2cfa3d215fdf528f19224125dc700db43a8cf0 100644 (file)
@@ -45,7 +45,7 @@
 #include <dcp/reel_subtitle_asset.h>
 #include <dcp/dcp.h>
 #include <dcp/cpl.h>
-#include <dcp/signer.h>
+#include <dcp/certificate_chain.h>
 #include <dcp/interop_subtitle_asset.h>
 #include <dcp/smpte_subtitle_asset.h>
 #include <boost/foreach.hpp>
@@ -55,6 +55,7 @@
 #include "i18n.h"
 
 #define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL);
+#define LOG_DEBUG_ENCODE(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_DEBUG_ENCODE);
 #define LOG_TIMING(...) _film->log()->microsecond_log (String::compose (__VA_ARGS__), Log::TYPE_TIMING);
 #define LOG_WARNING_NC(...) _film->log()->log (__VA_ARGS__, Log::TYPE_WARNING);
 #define LOG_WARNING(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_WARNING);
@@ -361,7 +362,7 @@ try
                        switch (qi.type) {
                        case QueueItem::FULL:
                        {
-                               LOG_GENERAL (N_("Writer FULL-writes %1 (%2)"), qi.frame, qi.eyes);
+                               LOG_DEBUG_ENCODE (N_("Writer FULL-writes %1 (%2)"), qi.frame, qi.eyes);
                                if (!qi.encoded) {
                                        qi.encoded = Data (_film->j2c_path (qi.frame, qi.eyes, false));
                                }
@@ -373,13 +374,13 @@ try
                                break;
                        }
                        case QueueItem::FAKE:
-                               LOG_GENERAL (N_("Writer FAKE-writes %1"), qi.frame);
+                               LOG_DEBUG_ENCODE (N_("Writer FAKE-writes %1"), qi.frame);
                                _picture_asset_writer->fake_write (qi.size);
                                _last_written[qi.eyes].reset ();
                                ++_fake_written;
                                break;
                        case QueueItem::REPEAT:
-                               LOG_GENERAL (N_("Writer REPEAT-writes %1"), qi.frame);
+                               LOG_DEBUG_ENCODE (N_("Writer REPEAT-writes %1"), qi.frame);
                                dcp::FrameInfo fin = _picture_asset_writer->write (
                                        _last_written[qi.eyes]->data().get(),
                                        _last_written[qi.eyes]->size()
@@ -395,7 +396,7 @@ try
 
                        shared_ptr<Job> job = _job.lock ();
                        DCPOMATIC_ASSERT (job);
-                       int64_t total = _film->length().frames (_film->video_frame_rate ());
+                       int64_t total = _film->length().frames_round (_film->video_frame_rate ());
                        if (_film->three_d ()) {
                                /* _full_written and so on are incremented for each eye, so we need to double the total
                                   frames to get the correct progress.
@@ -403,7 +404,7 @@ try
                                total *= 2;
                        }
                        if (total) {
-                               job->set_progress (float (_full_written + _fake_written) / total);
+                               job->set_progress (float (_full_written + _fake_written + _repeat_written) / total);
                        }
                }
 
@@ -596,7 +597,7 @@ Writer::finish ()
        meta.creator = String::compose ("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit);
        meta.set_issue_date_now ();
 
-       shared_ptr<const dcp::Signer> signer;
+       shared_ptr<const dcp::CertificateChain> signer;
        if (_film->is_signed ()) {
                signer = Config::instance()->signer ();
                /* We did check earlier, but check again here to be on the safe side */
@@ -678,7 +679,7 @@ Writer::check_existing_picture_asset ()
                        }
                }
 
-               LOG_GENERAL ("Have existing frame %1", _first_nonexistant_frame);
+               LOG_DEBUG_ENCODE ("Have existing frame %1", _first_nonexistant_frame);
                ++_first_nonexistant_frame;
        }