*/
-#include <fstream>
-#include <cerrno>
-#include <dcp/mono_picture_mxf.h>
-#include <dcp/stereo_picture_mxf.h>
-#include <dcp/sound_mxf.h>
-#include <dcp/sound_mxf_writer.h>
-#include <dcp/reel.h>
-#include <dcp/reel_mono_picture_asset.h>
-#include <dcp/reel_stereo_picture_asset.h>
-#include <dcp/reel_sound_asset.h>
-#include <dcp/reel_subtitle_asset.h>
-#include <dcp/dcp.h>
-#include <dcp/cpl.h>
-#include <dcp/signer.h>
#include "writer.h"
#include "compose.hpp"
#include "film.h"
#include "md5_digester.h"
#include "encoded_data.h"
#include "version.h"
+#include "font.h"
+#include <dcp/mono_picture_mxf.h>
+#include <dcp/stereo_picture_mxf.h>
+#include <dcp/sound_mxf.h>
+#include <dcp/sound_mxf_writer.h>
+#include <dcp/reel.h>
+#include <dcp/reel_mono_picture_asset.h>
+#include <dcp/reel_stereo_picture_asset.h>
+#include <dcp/reel_sound_asset.h>
+#include <dcp/reel_subtitle_asset.h>
+#include <dcp/dcp.h>
+#include <dcp/cpl.h>
+#include <dcp/signer.h>
+#include <dcp/interop_subtitle_content.h>
+#include <fstream>
+#include <cerrno>
#include "i18n.h"
#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL);
#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_ERROR(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_ERROR);
/* OS X strikes again */
#undef set_key
boost::filesystem::remove_all (_film->dir (_film->dcp_name ()));
shared_ptr<Job> job = _job.lock ();
- assert (job);
+ DCPOMATIC_ASSERT (job);
job->sub (_("Checking existing image data"));
check_existing_picture_mxf ();
_last_written_eyes = qi.eyes;
shared_ptr<Job> job = _job.lock ();
- assert (job);
+ DCPOMATIC_ASSERT (job);
int64_t total = _film->length().frames (_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
++i;
}
- assert (i != _queue.rend());
+ DCPOMATIC_ASSERT (i != _queue.rend());
QueueItem qi = *i;
++_pushed_to_disk;
boost::system::error_code ec;
boost::filesystem::create_hard_link (video_from, video_to, ec);
if (ec) {
- /* hard link failed; copy instead */
- boost::filesystem::copy_file (video_from, video_to);
- LOG_WARNING_NC ("Hard-link failed; fell back to copying");
+ LOG_WARNING_NC ("Hard-link failed; copying instead");
+ boost::filesystem::copy_file (video_from, video_to, ec);
+ if (ec) {
+ LOG_ERROR ("Failed to copy video file from %1 to %2 (%3)", video_from.string(), video_to.string(), ec.message ());
+ throw FileError (ec.message(), video_from);
+ }
}
_picture_mxf->set_file (video_to);
cpl->add (reel);
shared_ptr<Job> job = _job.lock ();
- assert (job);
+ DCPOMATIC_ASSERT (job);
job->sub (_("Computing image digest"));
_picture_mxf->hash (boost::bind (&Job::set_progress, job.get(), _1, false));
while (true) {
shared_ptr<Job> job = _job.lock ();
- assert (job);
+ DCPOMATIC_ASSERT (job);
if (N > 0) {
job->set_progress (float (_first_nonexistant_frame) / N);
}
if (!_subtitle_content) {
- _subtitle_content.reset (
- new dcp::SubtitleContent (_film->name(), _film->isdcf_metadata().subtitle_language)
- );
+ _subtitle_content.reset (new dcp::InteropSubtitleContent (_film->name(), _film->subtitle_language ()));
}
for (list<dcp::SubtitleString>::const_iterator i = subs.text.begin(); i != subs.text.end(); ++i) {
}
}
+void
+Writer::write (list<shared_ptr<Font> > fonts)
+{
+ if (!_subtitle_content) {
+ _subtitle_content.reset (new dcp::InteropSubtitleContent (_film->name(), _film->subtitle_language ()));
+ }
+
+ for (list<shared_ptr<Font> >::const_iterator i = fonts.begin(); i != fonts.end(); ++i) {
+ /* XXX: this LiberationSans-Regular needs to be a path to a DCP-o-matic-distributed copy */
+ _subtitle_content->add_font ((*i)->id, (*i)->file.get_value_or ("LiberationSans-Regular.ttf").leaf().string ());
+ }
+}
+
bool
operator< (QueueItem const & a, QueueItem const & b)
{