summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-21 13:17:04 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-21 13:17:04 +0100
commit4488ca79635bda37e034b888d1c43618f5e4285e (patch)
tree89857796342721270a5a8f148139c2ea96c2201f
parent6b368187e7bc16cbe0e83858f35990e536c5ccc8 (diff)
Pass options only to jobs that need them.
-rw-r--r--src/lib/ab_transcode_job.cc3
-rw-r--r--src/lib/ab_transcode_job.h2
-rw-r--r--src/lib/check_hashes_job.cc3
-rw-r--r--src/lib/check_hashes_job.h1
-rw-r--r--src/lib/copy_from_dvd_job.cc2
-rw-r--r--src/lib/examine_content_job.cc2
-rw-r--r--src/lib/job.cc4
-rw-r--r--src/lib/job.h4
-rw-r--r--src/lib/make_dcp_job.cc3
-rw-r--r--src/lib/make_dcp_job.h2
-rw-r--r--src/lib/scp_dcp_job.cc2
-rw-r--r--src/lib/transcode_job.cc3
-rw-r--r--src/lib/transcode_job.h1
-rw-r--r--test/test.cc15
14 files changed, 26 insertions, 21 deletions
diff --git a/src/lib/ab_transcode_job.cc b/src/lib/ab_transcode_job.cc
index 89967bfca..cffb2cef1 100644
--- a/src/lib/ab_transcode_job.cc
+++ b/src/lib/ab_transcode_job.cc
@@ -36,7 +36,8 @@ using namespace boost;
* @Param l A log that we can write to.
*/
ABTranscodeJob::ABTranscodeJob (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l, shared_ptr<Job> req)
- : Job (s, o, l, req)
+ : Job (s, l, req)
+ , _opt (o)
{
_fs_b.reset (new FilmState (*_fs));
_fs_b->set_scaler (Config::instance()->reference_scaler ());
diff --git a/src/lib/ab_transcode_job.h b/src/lib/ab_transcode_job.h
index 4b80593f4..2485608e6 100644
--- a/src/lib/ab_transcode_job.h
+++ b/src/lib/ab_transcode_job.h
@@ -40,6 +40,8 @@ public:
void run ();
private:
+ boost::shared_ptr<const Options> _opt;
+
/** Copy of our FilmState with filters removed and scaler set back to bicubic;
* this is the `reference' (left-half-frame) state.
*/
diff --git a/src/lib/check_hashes_job.cc b/src/lib/check_hashes_job.cc
index eff9153d9..478e4c91a 100644
--- a/src/lib/check_hashes_job.cc
+++ b/src/lib/check_hashes_job.cc
@@ -32,7 +32,8 @@ using namespace std;
using namespace boost;
CheckHashesJob::CheckHashesJob (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l, shared_ptr<Job> req)
- : Job (s, o, l, req)
+ : Job (s, l, req)
+ , _opt (o)
, _bad (0)
{
diff --git a/src/lib/check_hashes_job.h b/src/lib/check_hashes_job.h
index 6a68e936c..7cf1789f6 100644
--- a/src/lib/check_hashes_job.h
+++ b/src/lib/check_hashes_job.h
@@ -29,5 +29,6 @@ public:
std::string status () const;
private:
+ boost::shared_ptr<const Options> _opt;
int _bad;
};
diff --git a/src/lib/copy_from_dvd_job.cc b/src/lib/copy_from_dvd_job.cc
index f7281fc10..e08718072 100644
--- a/src/lib/copy_from_dvd_job.cc
+++ b/src/lib/copy_from_dvd_job.cc
@@ -36,7 +36,7 @@ using namespace boost;
* @param l Log that we can write to.
*/
CopyFromDVDJob::CopyFromDVDJob (shared_ptr<const FilmState> fs, Log* l, shared_ptr<Job> req)
- : Job (fs, shared_ptr<Options> (), l, req)
+ : Job (fs, l, req)
{
}
diff --git a/src/lib/examine_content_job.cc b/src/lib/examine_content_job.cc
index 5800c6f24..44a9f4ce9 100644
--- a/src/lib/examine_content_job.cc
+++ b/src/lib/examine_content_job.cc
@@ -33,7 +33,7 @@ using namespace std;
using namespace boost;
ExamineContentJob::ExamineContentJob (shared_ptr<const FilmState> fs, Log* l, shared_ptr<Job> req)
- : Job (fs, shared_ptr<Options> (), l, req)
+ : Job (fs, l, req)
{
}
diff --git a/src/lib/job.cc b/src/lib/job.cc
index d3871bf72..2049e69b0 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -31,12 +31,10 @@ using namespace std;
using namespace boost;
/** @param s FilmState for the film that we are operating on.
- * @param o Options.
* @param l A log that we can write to.
*/
-Job::Job (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l, shared_ptr<Job> req)
+Job::Job (shared_ptr<const FilmState> s, Log* l, shared_ptr<Job> req)
: _fs (s)
- , _opt (o)
, _log (l)
, _required (req)
, _state (NEW)
diff --git a/src/lib/job.h b/src/lib/job.h
index f50ed0784..6b2b69b9d 100644
--- a/src/lib/job.h
+++ b/src/lib/job.h
@@ -39,7 +39,7 @@ class Options;
class Job : public boost::enable_shared_from_this<Job>
{
public:
- Job (boost::shared_ptr<const FilmState> s, boost::shared_ptr<const Options> o, Log* l, boost::shared_ptr<Job> req);
+ Job (boost::shared_ptr<const FilmState> s, Log* l, boost::shared_ptr<Job> req);
/** @return user-readable name of this job */
virtual std::string name () const = 0;
@@ -91,8 +91,6 @@ protected:
/** FilmState for this job */
boost::shared_ptr<const FilmState> _fs;
- /** options in use for this job */
- boost::shared_ptr<const Options> _opt;
/** a log that this job can write to */
Log* _log;
diff --git a/src/lib/make_dcp_job.cc b/src/lib/make_dcp_job.cc
index 83904fd60..fcfce4b07 100644
--- a/src/lib/make_dcp_job.cc
+++ b/src/lib/make_dcp_job.cc
@@ -44,7 +44,8 @@ using namespace boost;
* @param l Log.
*/
MakeDCPJob::MakeDCPJob (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l, shared_ptr<Job> req)
- : Job (s, o, l, req)
+ : Job (s, l, req)
+ , _opt (o)
{
}
diff --git a/src/lib/make_dcp_job.h b/src/lib/make_dcp_job.h
index c350a819c..d430ac3ce 100644
--- a/src/lib/make_dcp_job.h
+++ b/src/lib/make_dcp_job.h
@@ -38,5 +38,7 @@ private:
void dcp_progress (float);
std::string j2c_path (int) const;
std::string wav_path (libdcp::Channel) const;
+
+ boost::shared_ptr<const Options> _opt;
};
diff --git a/src/lib/scp_dcp_job.cc b/src/lib/scp_dcp_job.cc
index 300a8fe33..3f400fca4 100644
--- a/src/lib/scp_dcp_job.cc
+++ b/src/lib/scp_dcp_job.cc
@@ -92,7 +92,7 @@ public:
SCPDCPJob::SCPDCPJob (shared_ptr<const FilmState> s, Log* l, shared_ptr<Job> req)
- : Job (s, shared_ptr<const Options> (), l, req)
+ : Job (s, l, req)
, _status ("Waiting")
{
diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc
index 3776ea4c1..fe34867b2 100644
--- a/src/lib/transcode_job.cc
+++ b/src/lib/transcode_job.cc
@@ -40,7 +40,8 @@ using namespace boost;
* @param l A log that we can write to.
*/
TranscodeJob::TranscodeJob (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l, shared_ptr<Job> req)
- : Job (s, o, l, req)
+ : Job (s, l, req)
+ , _opt (o)
{
}
diff --git a/src/lib/transcode_job.h b/src/lib/transcode_job.h
index fe68a4910..d185cb65d 100644
--- a/src/lib/transcode_job.h
+++ b/src/lib/transcode_job.h
@@ -42,5 +42,6 @@ protected:
int remaining_time () const;
private:
+ boost::shared_ptr<const Options> _opt;
boost::shared_ptr<Encoder> _encoder;
};
diff --git a/test/test.cc b/test/test.cc
index 468e6c1fd..5aed18c52 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -426,8 +426,8 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
class TestJob : public Job
{
public:
- TestJob (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l, shared_ptr<Job> req)
- : Job (s, o, l, req)
+ TestJob (shared_ptr<const FilmState> s, Log* l, shared_ptr<Job> req)
+ : Job (s, l, req)
{
}
@@ -457,11 +457,10 @@ public:
BOOST_AUTO_TEST_CASE (job_manager_test)
{
shared_ptr<const FilmState> s;
- shared_ptr<const Options> o;
FileLog log ("build/test/job_manager_test.log");
/* Single job, no dependency */
- shared_ptr<TestJob> a (new TestJob (s, o, &log, shared_ptr<Job> ()));
+ shared_ptr<TestJob> a (new TestJob (s, &log, shared_ptr<Job> ()));
JobManager::instance()->add (a);
dvdomatic_sleep (1);
@@ -471,8 +470,8 @@ BOOST_AUTO_TEST_CASE (job_manager_test)
BOOST_CHECK_EQUAL (a->finished_ok(), true);
/* Two jobs, dependency */
- a.reset (new TestJob (s, o, &log, shared_ptr<Job> ()));
- shared_ptr<TestJob> b (new TestJob (s, o, &log, a));
+ a.reset (new TestJob (s, &log, shared_ptr<Job> ()));
+ shared_ptr<TestJob> b (new TestJob (s, &log, a));
JobManager::instance()->add (a);
JobManager::instance()->add (b);
@@ -488,8 +487,8 @@ BOOST_AUTO_TEST_CASE (job_manager_test)
BOOST_CHECK_EQUAL (b->finished_ok(), true);
/* Two jobs, dependency, first fails */
- a.reset (new TestJob (s, o, &log, shared_ptr<Job> ()));
- b.reset (new TestJob (s, o, &log, a));
+ a.reset (new TestJob (s, &log, shared_ptr<Job> ()));
+ b.reset (new TestJob (s, &log, a));
JobManager::instance()->add (a);
JobManager::instance()->add (b);