X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ffilm.cc;h=ecc98d7dc698be487248ce5870636cde9be334cc;hb=59e769023c392c332331567a1aea94660002c463;hp=af58dcefb5167db4359cc3ba19220981e73f8339;hpb=3ea29cc912632a74116b42f3f14a018e265722e9;p=dcpomatic.git diff --git a/src/lib/film.cc b/src/lib/film.cc index af58dcefb..ecc98d7dc 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington 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 @@ -17,6 +17,11 @@ */ +/** @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" @@ -48,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -55,6 +61,7 @@ #include #include #include +#include #include "i18n.h" @@ -69,6 +76,7 @@ using std::make_pair; 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; @@ -149,7 +157,7 @@ Film::Film (boost::filesystem::path dir, bool log) } } - set_directory (result); + set_directory (result.make_preferred ()); if (log) { _log.reset (new FileLog (file ("log"))); } else { @@ -162,7 +170,7 @@ Film::Film (boost::filesystem::path dir, bool log) string Film::video_identifier () const { - assert (container ()); + DCPOMATIC_ASSERT (container ()); SafeStringStream s; s.imbue (std::locale::classic ()); @@ -944,20 +952,20 @@ Film::content () const } void -Film::examine_content (shared_ptr c, bool calculate_digest) +Film::examine_content (shared_ptr c) { - shared_ptr j (new ExamineContentJob (shared_from_this(), c, calculate_digest)); + shared_ptr j (new ExamineContentJob (shared_from_this(), c)); JobManager::instance()->add (j); } void -Film::examine_and_add_content (shared_ptr c, bool calculate_digest) +Film::examine_and_add_content (shared_ptr c) { if (dynamic_pointer_cast (c)) { run_ffprobe (c->path(0), file ("ffprobe.log"), _log); } - shared_ptr j (new ExamineContentJob (shared_from_this(), c, calculate_digest)); + shared_ptr j (new ExamineContentJob (shared_from_this(), c)); j->Finished.connect (bind (&Film::maybe_add_content, this, boost::weak_ptr (j), boost::weak_ptr (c))); JobManager::instance()->add (j); } @@ -1067,7 +1075,7 @@ Film::full_frame () const return dcp::Size (4096, 2160); } - assert (false); + DCPOMATIC_ASSERT (false); return dcp::Size (); } @@ -1142,3 +1150,28 @@ Film::should_be_enough_disk_space (double& required, double& available) const available = double (s.available) / 1073741824.0f; return (available - required) > 1; } + +string +Film::subtitle_language () const +{ + set languages; + + ContentList cl = content (); + BOOST_FOREACH (shared_ptr& c, cl) { + shared_ptr sc = dynamic_pointer_cast (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; +}