#include "config.h"
#include "job.h"
#include "cross.h"
+#include "md5_digester.h"
+#include "version.h"
#include "i18n.h"
-#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), Log::GENERAL);
-#define LOG_TIMING(...) _film->log()->microsecond_log (String::compose (__VA_ARGS__), Log::TIMING);
-#define LOG_WARNING_NC(...) _film->log()->log (__VA_ARGS__, Log::WARNING);
+#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);
/* OS X strikes again */
#undef set_key
using std::string;
using std::list;
using std::cout;
-using std::stringstream;
using boost::shared_ptr;
using boost::weak_ptr;
boost::mutex::scoped_lock lock (_mutex);
while (_queued_full_in_memory > _maximum_frames_in_memory) {
+ /* The queue is too big; wait until that is sorted out */
_full_condition.wait (lock);
}
_queue.push_back (qi);
++_queued_full_in_memory;
}
-
+
+ /* Now there's something to do: wake anything wait()ing on _empty_condition */
_empty_condition.notify_all ();
}
boost::mutex::scoped_lock lock (_mutex);
while (_queued_full_in_memory > _maximum_frames_in_memory) {
+ /* The queue is too big; wait until that is sorted out */
_full_condition.wait (lock);
}
_queue.push_back (qi);
}
+ /* Now there's something to do: wake anything wait()ing on _empty_condition */
_empty_condition.notify_all ();
}
Writer::thread ()
try
{
- while (1)
+ while (true)
{
boost::mutex::scoped_lock lock (_mutex);
- while (1) {
+ while (true) {
if (_finish || _queued_full_in_memory > _maximum_frames_in_memory || have_sequenced_image_at_queue_head ()) {
+ /* We've got something to do: go and do it */
break;
}
+ /* Nothing to do: wait until something happens which may indicate that we do */
LOG_TIMING (N_("writer sleeps with a queue of %1"), _queue.size());
_empty_condition.wait (lock);
LOG_TIMING (N_("writer wakes with a queue of %1"), _queue.size());
--_queued_full_in_memory;
}
+ /* The queue has probably just gone down a bit; notify anything wait()ing on _full_condition */
_full_condition.notify_all ();
}
}
_sound_asset->compute_digest (boost::bind (&Job::set_progress, job.get(), _1, false));
}
- libdcp::XMLMetadata meta = Config::instance()->dcp_metadata ();
+ libdcp::XMLMetadata meta;
+ meta.issuer = Config::instance()->dcp_issuer ();
+ meta.creator = String::compose ("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit);
meta.set_issue_date_now ();
dcp.write_xml (_film->interop (), meta, _film->is_signed() ? make_signer () : shared_ptr<const libdcp::Signer> ());
boost::mutex::scoped_lock lock (_mutex);
while (_queued_full_in_memory > _maximum_frames_in_memory) {
+ /* The queue is too big; wait until that is sorted out */
_full_condition.wait (lock);
}
_queue.push_back (qi);
}
+ /* Now there's something to do: wake anything wait()ing on _empty_condition */
_empty_condition.notify_all ();
}
LOG_GENERAL ("Existing frame %1 is incomplete", f);
return false;
}
-
- string const existing_hash = md5_digest (data.data(), data.size());
- if (existing_hash != info.hash) {
+
+ MD5Digester digester;
+ digester.add (data.data(), data.size());
+ if (digester.get() != info.hash) {
LOG_GENERAL ("Existing frame %1 failed hash check", f);
return false;
}
++N;
}
- while (1) {
+ while (true) {
shared_ptr<Job> job = _job.lock ();
assert (job);