/** @param f Film to compare.
* @param o Decode options.
*/
-ABTranscodeJob::ABTranscodeJob (shared_ptr<Film> f, DecodeOptions o, shared_ptr<Job> req)
- : Job (f, req)
+ABTranscodeJob::ABTranscodeJob (shared_ptr<Film> f, DecodeOptions o)
+ : Job (f)
, _decode_opt (o)
{
_film_b.reset (new Film (*_film));
public:
ABTranscodeJob (
boost::shared_ptr<Film> f,
- DecodeOptions o,
- boost::shared_ptr<Job> req
+ DecodeOptions o
);
std::string name () const;
using std::pair;
using boost::shared_ptr;
-ExamineContentJob::ExamineContentJob (shared_ptr<Film> f, shared_ptr<Job> req)
- : Job (f, req)
+ExamineContentJob::ExamineContentJob (shared_ptr<Film> f)
+ : Job (f)
{
}
class ExamineContentJob : public Job
{
public:
- ExamineContentJob (boost::shared_ptr<Film>, boost::shared_ptr<Job> req);
+ ExamineContentJob (boost::shared_ptr<Film>);
~ExamineContentJob ();
std::string name () const;
if (transcode) {
if (dcp_ab()) {
- r = JobManager::instance()->add (shared_ptr<Job> (new ABTranscodeJob (shared_from_this(), od, shared_ptr<Job> ())));
+ r = JobManager::instance()->add (shared_ptr<Job> (new ABTranscodeJob (shared_from_this(), od)));
} else {
- r = JobManager::instance()->add (shared_ptr<Job> (new TranscodeJob (shared_from_this(), od, shared_ptr<Job> ())));
+ r = JobManager::instance()->add (shared_ptr<Job> (new TranscodeJob (shared_from_this(), od)));
}
}
}
return;
}
- _examine_content_job.reset (new ExamineContentJob (shared_from_this(), shared_ptr<Job> ()));
+ _examine_content_job.reset (new ExamineContentJob (shared_from_this()));
_examine_content_job->Finished.connect (bind (&Film::examine_content_finished, this));
JobManager::instance()->add (_examine_content_job);
}
void
Film::send_dcp_to_tms ()
{
- shared_ptr<Job> j (new SCPDCPJob (shared_from_this(), shared_ptr<Job> ()));
+ shared_ptr<Job> j (new SCPDCPJob (shared_from_this()));
JobManager::instance()->add (j);
}
using boost::shared_ptr;
/** @param s Film that we are operating on.
- * @param req Job that must be completed before this job is run.
*/
-Job::Job (shared_ptr<Film> f, shared_ptr<Job> req)
+Job::Job (shared_ptr<Film> f)
: _film (f)
- , _required (req)
, _state (NEW)
, _start_time (0)
, _progress_unknown (false)
class Job : public boost::enable_shared_from_this<Job>
{
public:
- Job (boost::shared_ptr<Film> s, boost::shared_ptr<Job> req);
+ Job (boost::shared_ptr<Film> s);
virtual ~Job() {}
/** @return user-readable name of this job */
void descend (float);
float overall_progress () const;
- boost::shared_ptr<Job> required () const {
- return _required;
- }
-
boost::signals2::signal<void()> Finished;
protected:
void run_wrapper ();
- boost::shared_ptr<Job> _required;
-
/** mutex for _state and _error */
mutable boost::mutex _state_mutex;
/** current state of the job */
}
if ((*i)->is_new()) {
- shared_ptr<Job> r = (*i)->required ();
- if (!r || r->finished_ok ()) {
- (*i)->start ();
-
- /* Only start one job at once */
- break;
- }
+ (*i)->start ();
+
+ /* Only start one job at once */
+ break;
}
}
}
};
-SCPDCPJob::SCPDCPJob (shared_ptr<Film> f, shared_ptr<Job> req)
- : Job (f, req)
+SCPDCPJob::SCPDCPJob (shared_ptr<Film> f)
+ : Job (f)
, _status ("Waiting")
{
class SCPDCPJob : public Job
{
public:
- SCPDCPJob (boost::shared_ptr<Film>, boost::shared_ptr<Job> req);
+ SCPDCPJob (boost::shared_ptr<Film>);
std::string name () const;
void run ();
/** @param s Film to use.
* @param o Decode options.
- * @param req Job that must be completed before this job is run.
*/
-TranscodeJob::TranscodeJob (shared_ptr<Film> f, DecodeOptions o, shared_ptr<Job> req)
- : Job (f, req)
+TranscodeJob::TranscodeJob (shared_ptr<Film> f, DecodeOptions o)
+ : Job (f)
, _decode_opt (o)
{
class TranscodeJob : public Job
{
public:
- TranscodeJob (boost::shared_ptr<Film> f, DecodeOptions od, boost::shared_ptr<Job> req);
+ TranscodeJob (boost::shared_ptr<Film> f, DecodeOptions od);
std::string name () const;
void run ();
class TestJob : public Job
{
public:
- TestJob (shared_ptr<Film> f, shared_ptr<Job> req)
- : Job (f, req)
+ TestJob (shared_ptr<Film> f)
+ : Job (f)
{
}
{
shared_ptr<Film> f;
- /* Single job, no dependency */
- shared_ptr<TestJob> a (new TestJob (f, shared_ptr<Job> ()));
+ /* Single job */
+ shared_ptr<TestJob> a (new TestJob (f));
JobManager::instance()->add (a);
dvdomatic_sleep (1);
a->set_finished_ok ();
dvdomatic_sleep (2);
BOOST_CHECK_EQUAL (a->finished_ok(), true);
-
- /* Two jobs, dependency */
- a.reset (new TestJob (f, shared_ptr<Job> ()));
- shared_ptr<TestJob> b (new TestJob (f, a));
-
- JobManager::instance()->add (a);
- JobManager::instance()->add (b);
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (a->running(), true);
- BOOST_CHECK_EQUAL (b->running(), false);
- a->set_finished_ok ();
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (a->finished_ok(), true);
- BOOST_CHECK_EQUAL (b->running(), true);
- b->set_finished_ok ();
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (b->finished_ok(), true);
-
- /* Two jobs, dependency, first fails */
- a.reset (new TestJob (f, shared_ptr<Job> ()));
- b.reset (new TestJob (f, a));
-
- JobManager::instance()->add (a);
- JobManager::instance()->add (b);
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (a->running(), true);
- BOOST_CHECK_EQUAL (b->running(), false);
- a->set_finished_error ();
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (a->finished_in_error(), true);
- BOOST_CHECK_EQUAL (b->running(), false);
}
BOOST_AUTO_TEST_CASE (compact_image_test)