summaryrefslogtreecommitdiff
path: root/src/lib/encode_server.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-05-20 11:12:55 +0200
committerCarl Hetherington <cth@carlh.net>2022-05-23 16:55:28 +0200
commitef051b519b678e0c8b59e2e1a13acdabccc36a67 (patch)
tree82b3a681da436aa110402223caddd0e99bae0492 /src/lib/encode_server.cc
parent8e017c66d86c09a4689afeac0d7989d24daef745 (diff)
Move encode_{locally,remotely} into the frame encoder classes.
Diffstat (limited to 'src/lib/encode_server.cc')
-rw-r--r--src/lib/encode_server.cc40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/lib/encode_server.cc b/src/lib/encode_server.cc
index d326c767b..47c28654a 100644
--- a/src/lib/encode_server.cc
+++ b/src/lib/encode_server.cc
@@ -25,18 +25,19 @@
*/
-#include "encode_server.h"
-#include "util.h"
-#include "dcpomatic_socket.h"
-#include "image.h"
-#include "dcp_video.h"
+#include "compose.hpp"
#include "config.h"
+#include "cpu_j2k_frame_encoder.h"
#include "cross.h"
-#include "player_video.h"
-#include "compose.hpp"
-#include "log.h"
+#include "dcp_video.h"
#include "dcpomatic_log.h"
+#include "dcpomatic_socket.h"
+#include "encode_server.h"
#include "encoded_log_entry.h"
+#include "image.h"
+#include "log.h"
+#include "player_video.h"
+#include "util.h"
#include "version.h"
#include <dcp/raw_convert.h>
#include <dcp/warnings.h>
@@ -49,25 +50,25 @@ LIBDCP_ENABLE_WARNINGS
#ifdef HAVE_VALGRIND_H
#include <valgrind/memcheck.h>
#endif
+#include <iostream>
#include <string>
#include <vector>
-#include <iostream>
#include "i18n.h"
-using std::string;
-using std::vector;
-using std::list;
-using std::cout;
using std::cerr;
+using std::cout;
using std::fixed;
-using std::shared_ptr;
+using std::list;
using std::make_shared;
-using boost::thread;
+using std::shared_ptr;
+using std::string;
+using std::vector;
using boost::bind;
-using boost::scoped_array;
using boost::optional;
+using boost::scoped_array;
+using boost::thread;
using dcp::ArrayData;
using dcp::Size;
using dcp::raw_convert;
@@ -151,14 +152,15 @@ EncodeServer::process (shared_ptr<Socket> socket, struct timeval& after_read, st
gettimeofday (&after_read, 0);
- auto encoded = dcp_video_frame.encode_locally ();
+ CPUJ2KFrameEncoder cpu;
+ auto encoded = cpu.encode(dcp_video_frame);
gettimeofday (&after_encode, 0);
try {
Socket::WriteDigestScope ds (socket);
- socket->write (encoded.size());
- socket->write (encoded.data(), encoded.size());
+ socket->write (encoded->size());
+ socket->write (encoded->data(), encoded->size());
} catch (std::exception& e) {
cerr << "Send failed; frame " << dcp_video_frame.index() << "\n";
LOG_ERROR ("Send failed; frame %1", dcp_video_frame.index());