Merge master.
[dcpomatic.git] / src / lib / ab_transcode_job.cc
index d94f56d0a4c0a46538fc19d3e437273a3ff4b4bf..a29e7877666fc3c18ac82812f9f7247120dda0c0 100644 (file)
 
 #include <stdexcept>
 #include "ab_transcode_job.h"
-#include "j2k_wav_encoder.h"
 #include "film.h"
-#include "format.h"
-#include "filter.h"
 #include "ab_transcoder.h"
-#include "film_state.h"
-#include "encoder_factory.h"
 #include "config.h"
+#include "log.h"
 
-using namespace std;
-using namespace boost;
+#include "i18n.h"
 
-/** @param s FilmState to compare (with filters and/or a non-bicubic scaler).
- *  @param o Options.
- *  @Param l A log that we can write to.
+using std::string;
+using boost::shared_ptr;
+
+/** @param f Film to compare.
  */
-ABTranscodeJob::ABTranscodeJob (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l)
-       : Job (s, o, l)
+ABTranscodeJob::ABTranscodeJob (shared_ptr<Film> f)
+       : Job (f)
 {
-       _fs_b.reset (new FilmState (*_fs));
-       _fs_b->scaler = Config::instance()->reference_scaler ();
-       _fs_b->filters = Config::instance()->reference_filters ();
+       _film_b.reset (new Film (*_film));
+       _film_b->set_scaler (Config::instance()->reference_scaler ());
+       /* XXX */
+//     _film_b->set_filters (Config::instance()->reference_filters ());
 }
 
 string
 ABTranscodeJob::name () const
 {
-       return String::compose ("A/B transcode %1", _fs->name);
+       return String::compose (_("A/B transcode %1"), _film->name());
 }
 
 void
 ABTranscodeJob::run ()
 {
        try {
-               /* _fs_b is the one with no filters */
-               ABTranscoder w (_fs_b, _fs, _opt, this, _log, encoder_factory (_fs, _opt, _log));
+               /* _film_b is the one with reference filters */
+               ABTranscoder w (_film_b, _film, shared_from_this ());
                w.go ();
                set_progress (1);
                set_state (FINISHED_OK);
 
+               _film->log()->log ("A/B transcode job completed successfully");
+
        } catch (std::exception& e) {
 
+               set_progress (1);
                set_state (FINISHED_ERROR);
-
+               _film->log()->log (String::compose ("A/B transcode job failed (%1)", e.what()));
+               throw;
        }
 }