summaryrefslogtreecommitdiff
path: root/src/lib/j2k_encoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-08 21:32:44 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-08 21:32:44 +0200
commit3339d3bce70afe9ae2ca10e9fcfc4b54b748fbf4 (patch)
tree9cac355432ba25cc3d43017382d73e0640f50996 /src/lib/j2k_encoder.cc
parent00762c2d9a4240d016150cd7555aee3dad8542ae (diff)
Assorted C++11/formatting cleanups.
Diffstat (limited to 'src/lib/j2k_encoder.cc')
-rw-r--r--src/lib/j2k_encoder.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc
index a7fa657f8..c2553854b 100644
--- a/src/lib/j2k_encoder.cc
+++ b/src/lib/j2k_encoder.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,10 +18,12 @@
*/
+
/** @file src/j2k_encoder.cc
* @brief J2K encoder class.
*/
+
#include "j2k_encoder.h"
#include "util.h"
#include "film.h"
@@ -41,6 +43,7 @@
#include "i18n.h"
+
using std::list;
using std::cout;
using std::exception;
@@ -51,6 +54,7 @@ using boost::optional;
using dcp::Data;
using namespace dcpomatic;
+
/** @param film Film that we are encoding.
* @param writer Writer that we are using.
*/
@@ -62,21 +66,24 @@ J2KEncoder::J2KEncoder (shared_ptr<const Film> film, shared_ptr<Writer> writer)
servers_list_changed ();
}
+
J2KEncoder::~J2KEncoder ()
{
boost::mutex::scoped_lock lm (_threads_mutex);
terminate_threads ();
}
+
void
J2KEncoder::begin ()
{
- weak_ptr<J2KEncoder> wp = shared_from_this ();
+ auto wp = shared_from_this ();
_server_found_connection = EncodeServerFinder::instance()->ServersListChanged.connect (
boost::bind (&J2KEncoder::call_servers_list_changed, wp)
);
}
+
/* We don't want the servers-list-changed callback trying to do things
during destruction of J2KEncoder, and I think this is the neatest way
to achieve that.
@@ -90,6 +97,7 @@ J2KEncoder::call_servers_list_changed (weak_ptr<J2KEncoder> encoder)
}
}
+
void
J2KEncoder::end ()
{
@@ -142,6 +150,7 @@ J2KEncoder::end ()
}
}
+
/** @return an estimate of the current number of frames we are encoding per second,
* if known.
*/
@@ -151,6 +160,7 @@ J2KEncoder::current_encoding_rate () const
return _history.rate ();
}
+
/** @return Number of video frames that have been queued for encoding */
int
J2KEncoder::video_frames_enqueued () const
@@ -162,6 +172,7 @@ J2KEncoder::video_frames_enqueued () const
return _last_player_video_time->frames_floor (_film->video_frame_rate ());
}
+
/** Should be called when a frame has been encoded successfully */
void
J2KEncoder::frame_done ()
@@ -169,6 +180,7 @@ J2KEncoder::frame_done ()
_history.event ();
}
+
/** Called to request encoding of the next video frame in the DCP. This is called in order,
* so each time the supplied frame is the one after the previous one.
* pv represents one video frame, and could be empty if there is nothing to encode
@@ -266,6 +278,7 @@ J2KEncoder::terminate_threads ()
_threads.reset ();
}
+
void
J2KEncoder::encoder_thread (optional<EncodeServerDescription> server)
try
@@ -373,6 +386,7 @@ catch (...)
_full_condition.notify_all ();
}
+
void
J2KEncoder::servers_list_changed ()
{