BOOST_AUTO_TEST_CASE (client_server_test_rgb)
{
- auto image = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size (1998, 1080), true);
+ auto image = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size (1998, 1080), Image::Alignment::PADDED);
uint8_t* p = image->data()[0];
for (int y = 0; y < 1080; ++y) {
p += image->stride()[0];
}
- auto sub_image = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (100, 200), true);
+ auto sub_image = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (100, 200), Image::Alignment::PADDED);
p = sub_image->data()[0];
for (int y = 0; y < 200; ++y) {
uint8_t* q = p;
auto locally_encoded = frame->encode_locally ();
- auto server = new EncodeServer (true, 2);
+ auto server = make_shared<EncodeServer>(true, 2);
- auto server_thread = new thread (boost::bind(&EncodeServer::run, server));
+ 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", 1, SERVER_LINK_VERSION);
- list<thread*> threads;
+ list<thread> threads;
for (int i = 0; i < 8; ++i) {
- threads.push_back (new thread (boost::bind (do_remote_encode, frame, description, locally_encoded)));
+ threads.push_back(thread(boost::bind(do_remote_encode, frame, description, locally_encoded)));
}
- for (auto i: threads) {
- i->join ();
+ for (auto& i: threads) {
+ i.join();
}
- for (auto i: threads) {
- delete i;
- }
+ threads.clear();
server->stop ();
- server_thread->join ();
- delete server_thread;
- delete server;
+ server_thread.join();
}
BOOST_AUTO_TEST_CASE (client_server_test_yuv)
{
- auto image = make_shared<Image>(AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true);
+ auto image = make_shared<Image>(AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), Image::Alignment::PADDED);
for (int i = 0; i < image->planes(); ++i) {
uint8_t* p = image->data()[i];
}
}
- auto sub_image = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (100, 200), true);
+ auto sub_image = make_shared<Image>(AV_PIX_FMT_BGRA, dcp::Size (100, 200), Image::Alignment::PADDED);
uint8_t* p = sub_image->data()[0];
for (int y = 0; y < 200; ++y) {
uint8_t* q = p;
auto locally_encoded = frame->encode_locally ();
- auto server = new EncodeServer (true, 2);
+ auto server = make_shared<EncodeServer>(true, 2);
- auto server_thread = new thread(boost::bind(&EncodeServer::run, server));
+ 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;
+ list<thread> threads;
for (int i = 0; i < 8; ++i) {
- threads.push_back (new thread(boost::bind(do_remote_encode, frame, description, locally_encoded)));
+ threads.push_back(thread(boost::bind(do_remote_encode, frame, description, locally_encoded)));
}
- for (auto i: threads) {
- i->join ();
+ for (auto& i: threads) {
+ i.join();
}
- for (auto i: threads) {
- delete i;
- }
+ threads.clear();
server->stop ();
- server_thread->join ();
- delete server_thread;
- delete server;
+ server_thread.join();
}
BOOST_AUTO_TEST_CASE (client_server_test_j2k)
{
- auto image = make_shared<Image>(AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), true);
+ auto image = make_shared<Image>(AV_PIX_FMT_YUV420P, dcp::Size (1998, 1080), Image::Alignment::PADDED);
for (int i = 0; i < image->planes(); ++i) {
uint8_t* p = image->data()[i];
auto j2k_locally_encoded = j2k_frame->encode_locally ();
- auto server = new EncodeServer (true, 2);
+ auto server = make_shared<EncodeServer>(true, 2);
- auto server_thread = new thread (boost::bind (&EncodeServer::run, server));
+ 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;
+ list<thread> threads;
for (int i = 0; i < 8; ++i) {
- threads.push_back (new thread(boost::bind(do_remote_encode, j2k_frame, description, j2k_locally_encoded)));
+ threads.push_back(thread(boost::bind(do_remote_encode, j2k_frame, description, j2k_locally_encoded)));
}
- for (auto i: threads) {
- i->join ();
+ for (auto& i: threads) {
+ i.join();
}
- for (auto i: threads) {
- delete i;
- }
+ threads.clear();
server->stop ();
- server_thread->join ();
- delete server_thread;
- delete server;
+ server_thread.join();
}
+
+