Work around deadlock when destroying J2KEncoder with a full writer queue (#2784).
[dcpomatic.git] / src / lib / transcode_job.h
index 9e827e41259d1b0981a17edc2fa9488758577e0a..b05b20a1693373b33cc9b6416f37aef53fa1b5ae 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
+#ifndef DCPOMATIC_TRANSCODE_JOB_H
+#define DCPOMATIC_TRANSCODE_JOB_H
+
+
 /** @file src/transcode_job.h
  *  @brief A job which transcodes from one format to another.
  */
 
+
 #include "job.h"
-#include <boost/shared_ptr.hpp>
 
-class DCPTranscoder;
+
+/* Defined by Windows */
+#undef IGNORE
+
+
+class Encoder;
+
 
 /** @class TranscodeJob
- *  @brief A job which transcodes from one format to another.
+ *  @brief A job which transcodes a Film to another format.
  */
 class TranscodeJob : public Job
 {
 public:
-       TranscodeJob (boost::shared_ptr<const Film> film);
+       enum class ChangedBehaviour {
+               EXAMINE_THEN_STOP,
+               STOP,
+               IGNORE
+       };
+
+       explicit TranscodeJob (std::shared_ptr<const Film> film, ChangedBehaviour changed);
+       ~TranscodeJob ();
 
-       std::string name () const;
-       std::string json_name () const;
-       void run ();
-       std::string status () const;
+       std::string name () const override;
+       std::string json_name () const override;
+       void run () override;
+       std::string status () const override;
+       bool enable_notify () const override {
+               return true;
+       }
+
+       void set_encoder (std::shared_ptr<Encoder> t);
 
 private:
-       int remaining_time () const;
+       virtual void post_transcode () {}
+       float frames_per_second() const;
+
+       int remaining_time () const override;
 
-       boost::shared_ptr<DCPTranscoder> _transcoder;
+       std::shared_ptr<Encoder> _encoder;
+       ChangedBehaviour _changed;
 };
+
+
+#endif
+