+ LogSwitcher ls (make_shared<FileLog>("build/test/client_server_test_j2k.log"));
+
+ auto raw_pvf = std::make_shared<PlayerVideo> (
+ std::make_shared<RawImageProxy>(image),
+ Crop(),
+ optional<double>(),
+ dcp::Size(1998, 1080),
+ dcp::Size(1998, 1080),
+ Eyes::BOTH,
+ Part::WHOLE,
+ ColourConversion(),
+ VideoRange::FULL,
+ weak_ptr<Content>(),
+ optional<ContentTime>(),
+ false
+ );
+
+ auto raw_frame = make_shared<DCPVideo> (
+ raw_pvf,
+ 0,
+ 24,
+ 200000000,
+ Resolution::TWO_K
+ );
+
+ auto raw_locally_encoded = raw_frame->encode_locally ();
+
+ auto j2k_pvf = std::make_shared<PlayerVideo> (
+ std::make_shared<J2KImageProxy>(raw_locally_encoded, dcp::Size(1998, 1080), AV_PIX_FMT_XYZ12LE),
+ Crop(),
+ optional<double>(),
+ dcp::Size(1998, 1080),
+ dcp::Size(1998, 1080),
+ Eyes::BOTH,
+ Part::WHOLE,
+ PresetColourConversion::all().front().conversion,
+ VideoRange::FULL,
+ weak_ptr<Content>(),
+ optional<ContentTime>(),
+ false
+ );
+
+ auto j2k_frame = make_shared<DCPVideo> (
+ j2k_pvf,
+ 0,
+ 24,
+ 200000000,
+ Resolution::TWO_K
+ );
+
+ auto j2k_locally_encoded = j2k_frame->encode_locally ();
+
+ auto server = make_shared<EncodeServer>(true, 2);
+
+ thread server_thread(boost::bind (&EncodeServer::run, server));
+
+ /* Let the server get itself ready */
+ dcpomatic_sleep_seconds (1);
+
+ /* "localhost" rather than "127.0.0.1" here fails on docker; go figure */
+ EncodeServerDescription description ("127.0.0.1", 2, SERVER_LINK_VERSION);
+
+ list<thread> threads;
+ for (int i = 0; i < 8; ++i) {
+ threads.push_back(thread(boost::bind(do_remote_encode, j2k_frame, description, j2k_locally_encoded)));
+ }
+
+ for (auto& i: threads) {
+ i.join();
+ }
+
+ threads.clear();
+
+ server->stop ();
+ server_thread.join();