_writer.finish(_film->dir(_film->dcp_name()));
}
-void DCPEncoder::pause(void) {
+
+void
+DCPEncoder::pause()
+{
_j2k_encoder.pause();
}
-void DCPEncoder::resume(void) {
+
+void
+DCPEncoder::resume()
+{
_j2k_encoder.resume();
}
+
void
DCPEncoder::video (shared_ptr<PlayerVideo> data, DCPTime time)
{
bool finishing () const override {
return _finishing;
}
- void pause(void) override;
- void resume(void) override;
+
+ void pause() override;
+ void resume() override;
private:
}
dcp::Size
-DCPVideo::get_size(void) {
- auto image = _frame->image (bind(&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, false);
+DCPVideo::get_size() const
+{
+ auto image = _frame->image(bind(&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, false);
return image->size();
}
-void
-DCPVideo::convert_to_xyz (uint16_t *dst) {
- auto image = _frame->image (bind(&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, false);
+void
+DCPVideo::convert_to_xyz(uint16_t* dst) const
+{
+ auto image = _frame->image(bind(&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, false);
if (_frame->colour_conversion()) {
dcp::rgb_to_xyz (
image->data()[0],
}
}
+
/** J2K-encode this frame on the local host.
* @return Encoded data.
*/
class DCPVideo
{
public:
- DCPVideo (void) : DCPVideo(nullptr,0,0,0,Resolution::TWO_K){}
+ DCPVideo() : DCPVideo(nullptr, 0, 0, 0, Resolution::TWO_K) {}
DCPVideo (std::shared_ptr<const PlayerVideo>, int index, int dcp_fps, int bandwidth, Resolution r);
DCPVideo (std::shared_ptr<const PlayerVideo>, cxml::ConstNodePtr);
static std::shared_ptr<dcp::OpenJPEGImage> convert_to_xyz(std::shared_ptr<const PlayerVideo> frame);
- void convert_to_xyz (uint16_t *dst);
- dcp::Size get_size(void);
+ void convert_to_xyz(uint16_t* dst) const;
+ dcp::Size get_size() const;
+
private:
void add_metadata (xmlpp::Element *) const;
/** @return the number of frames that are done */
virtual Frame frames_done () const = 0;
virtual bool finishing () const = 0;
- virtual void pause(void) {}
- virtual void resume(void) {}
+ virtual void pause() {}
+ virtual void resume() {}
protected:
std::shared_ptr<const Film> _film;
J2KEncoder::J2KEncoder(shared_ptr<const Film> film, Writer& writer)
: _film (film)
, _history (200)
- , _writer (writer) ,
- dcpomaticContext_(film,writer,_history, Config::instance()->gpu_binary_location ()),
- context_(Config::instance()->enable_gpu () ? new grk_plugin::GrokContext(dcpomaticContext_) : nullptr)
+ , _writer (writer)
+ , _dcpomatic_context(film, writer, _history, Config::instance()->gpu_binary_location())
+ , _context(Config::instance()->enable_gpu() ? new grk_plugin::GrokContext(_dcpomatic_context) : nullptr)
{
}
terminate_threads ();
}
- delete context_;
+ delete _context;
}
void
servers_list_changed ();
}
-void J2KEncoder::pause(void){
- if (Config::instance()->enable_gpu ())
+
+void
+J2KEncoder::pause()
+{
+ if (Config::instance()->enable_gpu()) {
end(false);
+ }
}
-void J2KEncoder::resume(void){
- if (Config::instance()->enable_gpu ()) {
- context_ = new grk_plugin::GrokContext(dcpomaticContext_);
- servers_list_changed ();
+
+void J2KEncoder::resume()
+{
+ if (Config::instance()->enable_gpu()) {
+ _context = new grk_plugin::GrokContext(_dcpomatic_context);
+ servers_list_changed();
}
}
+
void
J2KEncoder::end (bool isFinal)
{
if (isFinal) {
for (auto & i: _queue) {
if (Config::instance()->enable_gpu ()) {
- if (!context_->scheduleCompress(i)){
+ if (!_context->scheduleCompress(i)){
LOG_GENERAL (N_("[%1] J2KEncoder thread pushes frame %2 back onto queue after failure"), thread_id(), i.index());
// handle error
}
}
}
}
- delete context_;
- context_ = nullptr;
+ delete _context;
+ _context = nullptr;
}
}
} else {
- if (context_) {
- if (!context_->launch(vf, config->selected_gpu()) || !context_->scheduleCompress(vf)) {
+ if (_context) {
+ if (!_context->launch(vf, config->selected_gpu()) || !_context->scheduleCompress(vf)) {
LOG_GENERAL (N_("[%1] J2KEncoder thread pushes frame %2 back onto queue after failure"), thread_id(), vf.index());
_queue.push_front (vf);
}
/** Called to pass a bit of video to be encoded as the next DCP frame */
void encode (std::shared_ptr<PlayerVideo> pv, dcpomatic::DCPTime time);
- void pause(void);
- void resume(void);
+ void pause();
+ void resume();
/** Called when a processing run has finished */
void end (bool isFinal);
boost::signals2::scoped_connection _server_found_connection;
- grk_plugin::DcpomaticContext dcpomaticContext_;
- grk_plugin::GrokContext *context_;
+ grk_plugin::DcpomaticContext _dcpomatic_context;
+ grk_plugin::GrokContext *_context;
};
}
}
-void TranscodeJob::pause() {
+
+void
+TranscodeJob::pause()
+{
_encoder->pause();
}
-void TranscodeJob::resume() {
+
+void TranscodeJob::resume()
+{
_encoder->resume();
Job::resume();
}
+
string
TranscodeJob::status () const
{