projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
82af503
)
Re-transcode and re-check J2Ks after a bad one is found.
author
Carl Hetherington
<cth@carlh.net>
Tue, 25 Sep 2012 00:36:53 +0000
(
01:36
+0100)
committer
Carl Hetherington
<cth@carlh.net>
Tue, 25 Sep 2012 00:36:53 +0000
(
01:36
+0100)
src/lib/check_hashes_job.cc
patch
|
blob
|
history
src/lib/job.h
patch
|
blob
|
history
src/lib/job_manager.cc
patch
|
blob
|
history
src/lib/job_manager.h
patch
|
blob
|
history
src/lib/transcode_job.cc
patch
|
blob
|
history
diff --git
a/src/lib/check_hashes_job.cc
b/src/lib/check_hashes_job.cc
index 87eb40d144a0a4926155b48b7aeab869d7f767a8..5a927f752bb5815517dfb488787545849884dbe3 100644
(file)
--- a/
src/lib/check_hashes_job.cc
+++ b/
src/lib/check_hashes_job.cc
@@
-24,6
+24,9
@@
#include "film_state.h"
#include "options.h"
#include "log.h"
#include "film_state.h"
#include "options.h"
#include "log.h"
+#include "job_manager.h"
+#include "ab_transcode_job.h"
+#include "transcode_job.h"
using namespace std;
using namespace boost;
using namespace std;
using namespace boost;
@@
-66,6
+69,19
@@
CheckHashesJob::run ()
set_progress (float (i) / _fs->length);
}
set_progress (float (i) / _fs->length);
}
+ if (_bad) {
+ shared_ptr<Job> tc;
+
+ if (_fs->dcp_ab) {
+ tc.reset (new ABTranscodeJob (_fs, _opt, _log));
+ } else {
+ tc.reset (new TranscodeJob (_fs, _opt, _log));
+ }
+
+ JobManager::instance()->add_after (shared_from_this(), tc);
+ JobManager::instance()->add_after (tc, shared_ptr<Job> (new CheckHashesJob (_fs, _opt, _log)));
+ }
+
set_progress (1);
set_state (FINISHED_OK);
}
set_progress (1);
set_state (FINISHED_OK);
}
@@
-74,6
+90,15
@@
string
CheckHashesJob::status () const
{
stringstream s;
CheckHashesJob::status () const
{
stringstream s;
- s << Job::status () << "; " << _bad << " bad frames found";
+ s << Job::status ();
+ if (overall_progress() > 0) {
+ if (_bad == 0) {
+ s << "; no bad frames found";
+ } else if (_bad == 1) {
+ s << "; 1 bad frame found";
+ } else {
+ s << "; " << _bad << " bad frames found";
+ }
+ }
return s.str ();
}
return s.str ();
}
diff --git
a/src/lib/job.h
b/src/lib/job.h
index fee887b428673d3501112bc613408a76e4fab2e7..b391304792e0a3e9ab0a926ae440b3dfcf806e8d 100644
(file)
--- a/
src/lib/job.h
+++ b/
src/lib/job.h
@@
-26,6
+26,7
@@
#include <string>
#include <boost/thread/mutex.hpp>
#include <string>
#include <boost/thread/mutex.hpp>
+#include <boost/enable_shared_from_this.hpp>
#include <sigc++/sigc++.h>
class Log;
#include <sigc++/sigc++.h>
class Log;
@@
-35,7
+36,7
@@
class Options;
/** @class Job
* @brief A parent class to represent long-running tasks which are run in their own thread.
*/
/** @class Job
* @brief A parent class to represent long-running tasks which are run in their own thread.
*/
-class Job
+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);
{
public:
Job (boost::shared_ptr<const FilmState> s, boost::shared_ptr<const Options> o, Log* l);
diff --git
a/src/lib/job_manager.cc
b/src/lib/job_manager.cc
index 93fdbd27a8d43472a1a93b64aad2a05b4a978c67..a166b5924dd0e3c472c89bdcc24bdd378c07797a 100644
(file)
--- a/
src/lib/job_manager.cc
+++ b/
src/lib/job_manager.cc
@@
-41,15
+41,23
@@
void
JobManager::add (shared_ptr<Job> j)
{
boost::mutex::scoped_lock lm (_mutex);
JobManager::add (shared_ptr<Job> j)
{
boost::mutex::scoped_lock lm (_mutex);
-
_jobs.push_back (j);
}
_jobs.push_back (j);
}
+void
+JobManager::add_after (shared_ptr<Job> after, shared_ptr<Job> j)
+{
+ boost::mutex::scoped_lock lm (_mutex);
+ list<shared_ptr<Job> >::iterator i = find (_jobs.begin(), _jobs.end(), after);
+ assert (i != _jobs.end ());
+ ++i;
+ _jobs.insert (i, j);
+}
+
list<shared_ptr<Job> >
JobManager::get () const
{
boost::mutex::scoped_lock lm (_mutex);
list<shared_ptr<Job> >
JobManager::get () const
{
boost::mutex::scoped_lock lm (_mutex);
-
return _jobs;
}
return _jobs;
}
diff --git
a/src/lib/job_manager.h
b/src/lib/job_manager.h
index f2f5e0057c946c6bc02e767bc755252d7f5adb2e..d1d33cfc2ce7e7dc3ac4693d579d7309e0ec30e5 100644
(file)
--- a/
src/lib/job_manager.h
+++ b/
src/lib/job_manager.h
@@
-38,6
+38,7
@@
class JobManager
public:
void add (boost::shared_ptr<Job>);
public:
void add (boost::shared_ptr<Job>);
+ void add_after (boost::shared_ptr<Job> after, boost::shared_ptr<Job> j);
std::list<boost::shared_ptr<Job> > get () const;
bool work_to_do () const;
std::list<boost::shared_ptr<Job> > get () const;
bool work_to_do () const;
diff --git
a/src/lib/transcode_job.cc
b/src/lib/transcode_job.cc
index 2de6e90ca850e76769f5907c6839d4a955b63846..9113593f0c1976c4967df5df7e9c7bea509d38d4 100644
(file)
--- a/
src/lib/transcode_job.cc
+++ b/
src/lib/transcode_job.cc
@@
-89,7
+89,7
@@
TranscodeJob::status () const
}
if (_encoder->skipping () && !finished ()) {
}
if (_encoder->skipping () && !finished ()) {
- return "skipping
frames already encoded
";
+ return "skipping
already-encoded frames
";
}
}