Add DiskWriterBackendResponse::write_to_nanomsg() and use it
[dcpomatic.git] / src / tools / dcpomatic_cli.cc
index dae904eb44335199a54fdcfb081a46c9bbd445ee..5e55b4da273d93e93ff1ad749a228d046d896269 100644 (file)
@@ -196,6 +196,62 @@ list_servers ()
 }
 
 
+bool
+show_jobs_on_console (bool progress)
+{
+       bool first = true;
+       bool error = false;
+       while (true) {
+
+               dcpomatic_sleep_seconds (5);
+
+               auto 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;
+
+               for (auto 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;
+}
+
+
 int
 main (int argc, char* argv[])
 {
@@ -399,7 +455,7 @@ main (int argc, char* argv[])
                auto job = std::make_shared<TranscodeJob>(film, behaviour);
                job->set_encoder (
                        std::make_shared<FFmpegEncoder> (
-                               film, job, *export_filename, *export_format == "mp4" ? ExportFormat::H264_AAC : ExportFormat::PRORES, false, false, false, 23
+                               film, job, *export_filename, *export_format == "mp4" ? ExportFormat::H264_AAC : ExportFormat::PRORES_HQ, false, false, false, 23
                                )
                        );
                JobManager::instance()->add (job);
@@ -412,7 +468,6 @@ main (int argc, char* argv[])
                }
        }
 
-       make_dcp (film, behaviour);
        bool const error = show_jobs_on_console (progress);
 
        if (keep_going) {