diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-02-20 11:51:12 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-02-20 11:51:12 +0000 |
| commit | dc08d2da6bf14fd469005ea3512992c66b041da9 (patch) | |
| tree | 0bd7a60cfa4cfe21732f648ed25299db79e7920a /src/lib/server.cc | |
| parent | 490af0bac5ec51120f6fed9c5b8b1a0c01427e45 (diff) | |
Fix servomatic build. Hopefully resolve confusion wrt linesize and
stride for FilterBufferImage; the linesize can apparently sometimes
be (slightly) larger than the width for byte-per-pixel images (e.g.
YUV420P). Remove grotty peek-style socket communication and use a
hopefully more robust send of the length of data as a binary word
before the data itself. Should fix #62.
Diffstat (limited to 'src/lib/server.cc')
| -rw-r--r-- | src/lib/server.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/server.cc b/src/lib/server.cc index d75ab0fb6..3614ed9e4 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -28,6 +28,7 @@ #include <iostream> #include <boost/algorithm/string.hpp> #include <boost/lexical_cast.hpp> +#include <boost/scoped_array.hpp> #include "server.h" #include "util.h" #include "scaler.h" @@ -45,6 +46,7 @@ using boost::algorithm::is_any_of; using boost::algorithm::split; using boost::thread; using boost::bind; +using boost::scoped_array; using libdcp::Size; /** Create a server description from a string of metadata returned from as_metadata(). @@ -82,11 +84,11 @@ Server::Server (Log* log) int Server::process (shared_ptr<Socket> socket) { - char buffer[512]; - socket->read_indefinite ((uint8_t *) buffer, sizeof (buffer), 30); - socket->consume (strlen (buffer) + 1); + uint32_t length = socket->read_uint32 (); + scoped_array<char> buffer (new char[length]); + socket->read (reinterpret_cast<uint8_t*> (buffer.get()), length); - stringstream s (buffer); + stringstream s (buffer.get()); multimap<string, string> kv = read_key_value (s); if (get_required_string (kv, "encode") != "please") { |
