diff options
| -rw-r--r-- | ChangeLog | 2 | ||||
| -rw-r--r-- | src/lib/image_proxy.cc | 3 | ||||
| -rw-r--r-- | src/lib/server.cc | 2 | ||||
| -rw-r--r-- | src/wx/about_dialog.cc | 1 | ||||
| -rw-r--r-- | test/client_server_test.cc | 83 |
5 files changed, 88 insertions, 3 deletions
@@ -1,5 +1,7 @@ 2014-06-09 Carl Hetherington <cth@carlh.net> + * Fix server/client with non-RGB24 sources. + * Version 1.69.25 released. 2014-06-09 Carl Hetherington <cth@carlh.net> diff --git a/src/lib/image_proxy.cc b/src/lib/image_proxy.cc index 618cdbcf3..4e2f8a135 100644 --- a/src/lib/image_proxy.cc +++ b/src/lib/image_proxy.cc @@ -55,7 +55,7 @@ RawImageProxy::RawImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> soc xml->number_child<int> ("Width"), xml->number_child<int> ("Height") ); - _image.reset (new Image (PIX_FMT_RGB24, size, true)); + _image.reset (new Image (static_cast<AVPixelFormat> (xml->number_child<int> ("PixelFormat")), size, true)); _image->read_from_socket (socket); } @@ -71,6 +71,7 @@ RawImageProxy::add_metadata (xmlpp::Node* node) const node->add_child("Type")->add_child_text (N_("Raw")); node->add_child("Width")->add_child_text (libdcp::raw_convert<string> (_image->size().width)); node->add_child("Height")->add_child_text (libdcp::raw_convert<string> (_image->size().height)); + node->add_child("PixelFormat")->add_child_text (libdcp::raw_convert<string> (_image->pixel_format ())); } void diff --git a/src/lib/server.cc b/src/lib/server.cc index 6b4064cd7..ed7fb6145 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -104,6 +104,7 @@ Server::process (shared_ptr<Socket> socket, struct timeval& after_read, struct t try { encoded->send (socket); } catch (std::exception& e) { + cerr << "Send failed; frame " << dcp_video_frame.index() << "\n"; LOG_ERROR ("Send failed; frame %1", dcp_video_frame.index()); throw; } @@ -139,6 +140,7 @@ Server::worker_thread () frame = process (socket, after_read, after_encode); ip = socket->socket().remote_endpoint().address().to_string(); } catch (std::exception& e) { + cerr << "Error: " << e.what() << "\n"; LOG_ERROR ("Error: %1", e.what()); } diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index e0296d60c..7ebc62a32 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -137,6 +137,7 @@ AboutDialog::AboutDialog (wxWindow* parent) supported_by.Add (wxT ("Lindsay Morris")); supported_by.Add (wxT ("Tim O'Brien")); supported_by.Add (wxT ("Ivan Pullman")); + supported_by.Add (wxT ("Mark Rolfe")); supported_by.Add (wxT ("Andrä Steiner")); supported_by.Add (wxT ("Jussi Siponen")); supported_by.Add (wxT ("Lasse Salling")); diff --git a/test/client_server_test.cc b/test/client_server_test.cc index 98993cc5b..07af1255c 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -42,7 +42,7 @@ do_remote_encode (shared_ptr<DCPVideoFrame> frame, ServerDescription description BOOST_CHECK (memcmp (locally_encoded->data(), remotely_encoded->data(), locally_encoded->size()) == 0); } -BOOST_AUTO_TEST_CASE (client_server_test) +BOOST_AUTO_TEST_CASE (client_server_test_rgb) { shared_ptr<Image> image (new Image (PIX_FMT_RGB24, libdcp::Size (1998, 1080), true)); uint8_t* p = image->data()[0]; @@ -70,7 +70,86 @@ BOOST_AUTO_TEST_CASE (client_server_test) p += sub_image->stride()[0]; } - shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test.log")); + shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_rgb.log")); + + shared_ptr<PlayerVideoFrame> pvf ( + new PlayerVideoFrame ( + shared_ptr<ImageProxy> (new RawImageProxy (image, log)), + Crop (), + libdcp::Size (1998, 1080), + libdcp::Size (1998, 1080), + Scaler::from_id ("bicubic"), + EYES_BOTH, + PART_WHOLE, + ColourConversion () + ) + ); + + pvf->set_subtitle (sub_image, Position<int> (50, 60)); + + shared_ptr<DCPVideoFrame> frame ( + new DCPVideoFrame ( + pvf, + 0, + 24, + 200000000, + RESOLUTION_2K, + log + ) + ); + + shared_ptr<EncodedData> locally_encoded = frame->encode_locally (); + BOOST_ASSERT (locally_encoded); + + Server* server = new Server (log, true); + + new thread (boost::bind (&Server::run, server, 2)); + + /* Let the server get itself ready */ + dcpomatic_sleep (1); + + ServerDescription description ("localhost", 2); + + list<thread*> threads; + for (int i = 0; i < 8; ++i) { + threads.push_back (new thread (boost::bind (do_remote_encode, frame, description, locally_encoded))); + } + + for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) { + (*i)->join (); + } + + for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) { + delete *i; + } +} + +BOOST_AUTO_TEST_CASE (client_server_test_yuv) +{ + shared_ptr<Image> image (new Image (PIX_FMT_YUV420P, libdcp::Size (1998, 1080), true)); + uint8_t* p = image->data()[0]; + + for (int i = 0; i < image->components(); ++i) { + uint8_t* p = image->data()[i]; + for (int j = 0; j < image->line_size()[i]; ++j) { + *p++ = j % 256; + } + } + + shared_ptr<Image> sub_image (new Image (PIX_FMT_RGBA, libdcp::Size (100, 200), true)); + p = sub_image->data()[0]; + for (int y = 0; y < 200; ++y) { + uint8_t* q = p; + for (int x = 0; x < 100; ++x) { + *q++ = y % 256; + *q++ = x % 256; + *q++ = (x + y) % 256; + *q++ = 1; + } + p += sub_image->stride()[0]; + } + + shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_yuv.log")); shared_ptr<PlayerVideoFrame> pvf ( new PlayerVideoFrame ( |
