/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
shared_ptr<Job> job = _job.lock ();
DCPOMATIC_ASSERT (job);
- job->sub (_("Checking existing image data"));
- check_existing_picture_mxf ();
-
/* Create our picture asset in a subdirectory, named according to those
film's parameters which affect the video output. We will hard-link
it into the DCP later.
_picture_mxf.reset (new dcp::MonoPictureMXF (dcp::Fraction (_film->video_frame_rate (), 1)));
}
+ job->sub (_("Checking existing image data"));
+ check_existing_picture_mxf ();
+
_picture_mxf->set_size (_film->frame_size ());
if (_film->encrypted ()) {
_full_condition.wait (lock);
}
- FILE* ifi = fopen_boost (_film->info_path (frame, eyes), "r");
- if (!ifi) {
- throw ReadFileError (_film->info_path (frame, eyes));
+ FILE* file = fopen_boost (_film->info_file (), "rb");
+ if (!file) {
+ throw ReadFileError (_film->info_file ());
}
- dcp::FrameInfo info (ifi);
- fclose (ifi);
+ dcp::FrameInfo info = read_frame_info (file, frame, eyes);
+ fclose (file);
QueueItem qi;
qi.type = QueueItem::FAKE;
}
/* Hard-link the video MXF into the DCP */
- boost::filesystem::path video_from;
- video_from /= _film->internal_video_mxf_dir();
- video_from /= _film->internal_video_mxf_filename();
+ boost::filesystem::path video_from = _picture_mxf->file ();
boost::filesystem::path video_to;
video_to /= _film->dir (_film->dcp_name());
Writer::check_existing_picture_mxf_frame (FILE* mxf, int f, Eyes eyes)
{
/* Read the frame info as written */
- FILE* ifi = fopen_boost (_film->info_path (f, eyes), "r");
- if (!ifi) {
+ FILE* file = fopen_boost (_film->info_file (), "rb");
+ if (!file) {
LOG_GENERAL ("Existing frame %1 has no info file", f);
return false;
}
- dcp::FrameInfo info (ifi);
- fclose (ifi);
+ dcp::FrameInfo info = read_frame_info (file, f, eyes);
+ fclose (file);
if (info.size == 0) {
LOG_GENERAL ("Existing frame %1 has no info file", f);
return false;
Writer::check_existing_picture_mxf ()
{
/* Try to open the existing MXF */
- boost::filesystem::path p;
- p /= _film->internal_video_mxf_dir ();
- p /= _film->internal_video_mxf_filename ();
- FILE* mxf = fopen_boost (p, "rb");
+ FILE* mxf = fopen_boost (_picture_mxf->file(), "rb");
if (!mxf) {
- LOG_GENERAL ("Could not open existing MXF at %1 (errno=%2)", p.string(), errno);
+ LOG_GENERAL ("Could not open existing MXF at %1 (errno=%2)", _picture_mxf->file().string(), errno);
return;
}
- int N = 0;
- for (boost::filesystem::directory_iterator i (_film->info_dir ()); i != boost::filesystem::directory_iterator (); ++i) {
- ++N;
- }
-
while (true) {
shared_ptr<Job> job = _job.lock ();
DCPOMATIC_ASSERT (job);
- if (N > 0) {
- job->set_progress (float (_first_nonexistant_frame) / N);
- }
+ job->set_progress_unknown ();
if (_film->three_d ()) {
if (!check_existing_picture_mxf_frame (mxf, _first_nonexistant_frame, EYES_LEFT)) {