Re-work again so that there's just one encoder; various tweaks to still-image-with...
[dcpomatic.git] / src / lib / ab_transcode_job.cc
index 1a6104251040036b33c2357acb42075e6d2fa3a5..a6233c185783d42055be316361ff4e4713c76a3a 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 "encoder.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using boost::shared_ptr;
 
-/** @param s FilmState to compare (with filters and/or a non-bicubic scaler).
+/** @param f Film to compare.
  *  @param o Options.
- *  @Param l A log that we can write to.
  */
-ABTranscodeJob::ABTranscodeJob (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Log* l)
-       : Job (s, o, l)
+ABTranscodeJob::ABTranscodeJob (shared_ptr<Film> f, shared_ptr<const DecodeOptions> od, shared_ptr<const EncodeOptions> oe, shared_ptr<Job> req)
+       : Job (f, req)
+       , _decode_opt (od)
+       , _encode_opt (oe)
 {
-       _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 ());
+       _film_b->set_filters (Config::instance()->reference_filters ());
 }
 
 string
 ABTranscodeJob::name () const
 {
-       stringstream s;
-       s << "A/B transcode " << _fs->name;
-       return s.str ();
+       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, _decode_opt, this, shared_ptr<Encoder> (new Encoder (_film, _encode_opt)));
                w.go ();
                set_progress (1);
                set_state (FINISHED_OK);