Fixed NetSend so it can be used in debug mode.
[qt/compvision.git] / NetReceive.h
1 #include "ImageSource.h"\r
2 \r
3 #include <QUdpSocket>\r
4 #include <QMutex>\r
5 \r
6 class NetReceive : public ImageSource\r
7 {\r
8         Q_OBJECT\r
9         \r
10         public:\r
11                 NetReceive(ImagePool *source, ImagePool *destination);\r
12                 void connect();\r
13                 void disconnect();\r
14                 bool isConnected();\r
15                 void process();\r
16         \r
17         public slots:\r
18                 void receive();\r
19 \r
20         private:\r
21                 bool run,connected;\r
22                 QUdpSocket *udp;\r
23                 char incoming[640*3+2]; // enough space for a row of 640 pixels plus a 2-byte row index\r
24                 char buffer[512*480];\r
25                 unsigned int lastRow;\r
26                 int imgSize, stopcode; // # of bytes in compressed image\r
27                 int sanity; // implement a simple sanity check -- do we receive enough packets?\r
28                 QSemaphore sync;\r
29                 QMutex key;\r
30                 QImage *decodeImg;\r
31 };\r