/*
- 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
*/
+/** @file src/film.cc
+ * @brief A representation of some audio and video content, and details of
+ * how they should be presented in a DCP.
+ */
+
#include "film.h"
#include "job.h"
#include "util.h"
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
+#include <boost/foreach.hpp>
#include <unistd.h>
#include <stdexcept>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>
+#include <set>
#include "i18n.h"
using std::endl;
using std::cout;
using std::list;
+using std::set;
using boost::shared_ptr;
using boost::weak_ptr;
using boost::dynamic_pointer_cast;
}
}
- set_directory (result);
+ set_directory (result.make_preferred ());
if (log) {
_log.reset (new FileLog (file ("log")));
} else {
string
Film::video_identifier () const
{
- assert (container ());
+ DCPOMATIC_ASSERT (container ());
SafeStringStream s;
s.imbue (std::locale::classic ());
throw BadSettingError (_("name"), _("cannot contain slashes"));
}
- /* It seems to make sense to auto-save metadata here, since the make DCP may last
- a long time, and crashes/power failures are moderately likely.
- */
- write_metadata ();
-
LOG_GENERAL ("DCP-o-matic %1 git %2 using %3", dcpomatic_version, dcpomatic_git_commit, dependency_version_summary());
{
}
void
-Film::examine_content (shared_ptr<Content> c, bool calculate_digest)
+Film::examine_content (shared_ptr<Content> c)
{
- shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c, calculate_digest));
+ shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
JobManager::instance()->add (j);
}
void
-Film::examine_and_add_content (shared_ptr<Content> c, bool calculate_digest)
+Film::examine_and_add_content (shared_ptr<Content> c)
{
if (dynamic_pointer_cast<FFmpegContent> (c)) {
run_ffprobe (c->path(0), file ("ffprobe.log"), _log);
}
- shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c, calculate_digest));
+ shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
j->Finished.connect (bind (&Film::maybe_add_content, this, boost::weak_ptr<Job> (j), boost::weak_ptr<Content> (c)));
JobManager::instance()->add (j);
}
return dcp::Size (4096, 2160);
}
- assert (false);
+ DCPOMATIC_ASSERT (false);
return dcp::Size ();
}
available = double (s.available) / 1073741824.0f;
return (available - required) > 1;
}
+
+string
+Film::subtitle_language () const
+{
+ set<string> languages;
+
+ ContentList cl = content ();
+ BOOST_FOREACH (shared_ptr<Content>& c, cl) {
+ shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (c);
+ if (sc) {
+ languages.insert (sc->subtitle_language ());
+ }
+ }
+
+ string all;
+ BOOST_FOREACH (string s, languages) {
+ if (!all.empty ()) {
+ all += "/" + s;
+ } else {
+ all += s;
+ }
+ }
+
+ return all;
+}