summaryrefslogtreecommitdiff
path: root/src/lib/util.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-02-20 11:51:12 +0000
committerCarl Hetherington <cth@carlh.net>2013-02-20 11:51:12 +0000
commitdc08d2da6bf14fd469005ea3512992c66b041da9 (patch)
tree0bd7a60cfa4cfe21732f648ed25299db79e7920a /src/lib/util.h
parent490af0bac5ec51120f6fed9c5b8b1a0c01427e45 (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/util.h')
-rw-r--r--src/lib/util.h22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/lib/util.h b/src/lib/util.h
index c4940a5d7..87735ea8e 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -194,39 +194,35 @@ extern std::string get_optional_string (std::multimap<std::string, std::string>
* that are useful for DVD-o-matic.
*
* This class wraps some things that I could not work out how to do with boost;
- * most notably, sync read/write calls with timeouts, and the ability to peek into
- * data being read.
+ * most notably, sync read/write calls with timeouts.
*/
class Socket
{
public:
- Socket ();
+ Socket (int timeout = 30);
/** @return Our underlying socket */
boost::asio::ip::tcp::socket& socket () {
return _socket;
}
- void connect (boost::asio::ip::basic_resolver_entry<boost::asio::ip::tcp> const & endpoint, int timeout);
- void write (uint8_t const * data, int size, int timeout);
+ void connect (boost::asio::ip::basic_resolver_entry<boost::asio::ip::tcp> const & endpoint);
+
+ void write (uint32_t n);
+ void write (uint8_t const * data, int size);
- void read_definite_and_consume (uint8_t* data, int size, int timeout);
- void read_indefinite (uint8_t* data, int size, int timeout);
- void consume (int amount);
+ void read (uint8_t* data, int size);
+ uint32_t read_uint32 ();
private:
void check ();
- int read (uint8_t* data, int size, int timeout);
Socket (Socket const &);
boost::asio::io_service _io_service;
boost::asio::deadline_timer _deadline;
boost::asio::ip::tcp::socket _socket;
- /** a buffer for small reads */
- uint8_t _buffer[1024];
- /** amount of valid data in the buffer */
- int _buffer_data;
+ int _timeout;
};
/** @class AudioBuffers