#include "ffmpeg_image_proxy.h"
#include "image.h"
#include "text_decoder.h"
+#include "job_manager.h"
#include <dcp/locale_convert.h>
#include <dcp/util.h>
#include <dcp/raw_convert.h>
using dcp::Size;
using dcp::raw_convert;
using dcp::locale_convert;
+using namespace dcpomatic;
/** Path to our executable, required by the stacktrace stuff and filled
* in during App::onInit().
Pango::init ();
dcp::init ();
-#ifdef DCPOMATIC_WINDOWS
+#if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX)
/* Render something to fontconfig to create its cache */
list<StringText> subs;
dcp::SubtitleString ss(
while (i < int64_t (files.size()) && to_do > 0) {
FILE* f = fopen_boost (files[i], "rb");
if (!f) {
- throw OpenFileError (files[i].string(), errno, true);
+ throw OpenFileError (files[i].string(), errno, OpenFileError::READ);
}
boost::uintmax_t this_time = min (to_do, boost::filesystem::file_size (files[i]));
while (i >= 0 && to_do > 0) {
FILE* f = fopen_boost (files[i], "rb");
if (!f) {
- throw OpenFileError (files[i].string(), errno, true);
+ throw OpenFileError (files[i].string(), errno, OpenFileError::READ);
}
boost::uintmax_t this_time = min (to_do, boost::filesystem::file_size (files[i]));
/** @param mapped List of mapped audio channels from a Film.
* @param channels Total number of channels in the Film.
- * @return First: number of non-LFE channels, second: number of LFE channels.
+ * @return First: number of non-LFE soundtrack channels (L/R/C/Ls/Rs/Lc/Rc/Bsl/Bsr), second: number of LFE channels.
*/
pair<int, int>
audio_channel_types (list<int> mapped, int channels)
continue;
}
- if (static_cast<dcp::Channel> (i) == dcp::LFE) {
+ switch (static_cast<dcp::Channel>(i)) {
+ case dcp::LFE:
++lfe;
- } else {
+ break;
+ case dcp::LEFT:
+ case dcp::RIGHT:
+ case dcp::CENTRE:
+ case dcp::LS:
+ case dcp::RS:
+ case dcp::LC:
+ case dcp::RC:
+ case dcp::BSL:
+ case dcp::BSR:
++non_lfe;
+ break;
+ case dcp::HI:
+ case dcp::VI:
+ break;
}
}
decoder->emit_bitmap (period, image, rect);
}
+bool
+show_jobs_on_console (bool progress)
+{
+ bool first = true;
+ bool error = false;
+ while (true) {
+
+ dcpomatic_sleep (5);
+
+ list<shared_ptr<Job> > jobs = JobManager::instance()->get();
+
+ if (!first && progress) {
+ for (size_t i = 0; i < jobs.size(); ++i) {
+ cout << "\033[1A\033[2K";
+ }
+ cout.flush ();
+ }
+
+ first = false;
+
+ BOOST_FOREACH (shared_ptr<Job> i, jobs) {
+ if (progress) {
+ cout << i->name();
+ if (!i->sub_name().empty()) {
+ cout << "; " << i->sub_name();
+ }
+ cout << ": ";
+
+ if (i->progress ()) {
+ cout << i->status() << " \n";
+ } else {
+ cout << ": Running \n";
+ }
+ }
+
+ if (!progress && i->finished_in_error()) {
+ /* We won't see this error if we haven't been showing progress,
+ so show it now.
+ */
+ cout << i->status() << "\n";
+ }
+
+ if (i->finished_in_error()) {
+ error = true;
+ }
+ }
+
+ if (!JobManager::instance()->work_to_do()) {
+ break;
+ }
+ }
+
+ return error;
+}
+
#ifdef DCPOMATIC_VARIANT_SWAROOP
/* Make up a key from the machine UUID */