Merge branch 'master' of ssh://git.carlh.net/home/carl/git/dcpomatic
[dcpomatic.git] / src / lib / job_manager.h
index 70ac00b37bc4b86747639548601384a31059a0ec..9cba0fd094a46bd44796532543e6e7ac9ebce4ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -32,7 +32,7 @@ class Job;
 class Film;
 class Playlist;
 
-extern void wait_for_jobs ();
+extern bool wait_for_jobs ();
 
 /** @class JobManager
  *  @brief A simple scheduler for jobs.
@@ -40,20 +40,23 @@ extern void wait_for_jobs ();
 class JobManager : public Signaller, public boost::noncopyable
 {
 public:
-
        boost::shared_ptr<Job> add (boost::shared_ptr<Job>);
        std::list<boost::shared_ptr<Job> > get () const;
        bool work_to_do () const;
        bool errors () const;
+       void increase_priority (boost::shared_ptr<Job>);
+       void decrease_priority (boost::shared_ptr<Job>);
 
        void analyse_audio (
                boost::shared_ptr<const Film> film,
                boost::shared_ptr<const Playlist> playlist,
+               bool from_zero,
                boost::signals2::connection& connection,
                boost::function<void()> ready
                );
 
        boost::signals2::signal<void (boost::weak_ptr<Job>)> JobAdded;
+       boost::signals2::signal<void ()> JobsReordered;
        boost::signals2::signal<void (boost::optional<std::string>, boost::optional<std::string>)> ActiveJobsChanged;
 
        static JobManager* instance ();
@@ -61,14 +64,16 @@ public:
 
 private:
        /* This function is part of the test suite */
-       friend void ::wait_for_jobs ();
+       friend bool ::wait_for_jobs ();
 
        JobManager ();
        ~JobManager ();
        void scheduler ();
        void start ();
+       void priority_changed ();
 
        mutable boost::mutex _mutex;
+       /** List of jobs in the order that they will be executed */
        std::list<boost::shared_ptr<Job> > _jobs;
        bool _terminate;