diff --git a/acatcher/README b/acatcher/README index 0f5d57d..b7a3370 100644 --- a/acatcher/README +++ b/acatcher/README @@ -3,6 +3,8 @@ host side: apt-get install libopencv-dev clang++ -O2 -lopencv_core -lopencv_highgui -lopencv_imgproc -o acatcher acatcher.cxx +(add -DSHOWALL to get all windows up at once, and change "const int MAX" to +reduce the number of windows up at once.) to actually run it: ./acatcher | (aplay -t raw -c 1 -f S16_LE -r 22050 > /dev/null 2> /dev/null) diff --git a/acatcher/acatcher.cxx b/acatcher/acatcher.cxx index e644607..41fe6ba 100644 --- a/acatcher/acatcher.cxx +++ b/acatcher/acatcher.cxx @@ -39,6 +39,8 @@ THE SOFTWARE. using namespace cv; using namespace std; +const int MAX = 16; + const char *names[] = { "0", "1", @@ -64,7 +66,6 @@ void cls() } int baseport = 4000; -const int MAX = 16; const int BUFLEN = 1024*1024; // in bytes //const int ABUFLEN = 1024; // in words @@ -72,6 +73,12 @@ const int BUFLEN = 1024*1024; // in bytes // Yes this is ugly. :P bool failure = false; +#ifdef SHOWALL + bool showall = true; +#else + bool showall = false; +#endif + struct sockin { int listener_fd, data_fd; struct sockaddr_in serv_addr, cli_addr; @@ -149,6 +156,8 @@ struct audio_sockin : public sockin { const int IBUFLEN = 2048*1024; // in bytes +bool displayed = false; + struct image_sockin : public sockin { uint8_t buf[IBUFLEN]; int bufsize; @@ -158,16 +167,16 @@ struct image_sockin : public sockin { } void showImage(int begin, int end, int listener) { - if (listener == id) { + if (showall || (listener == id)) { Mat imgbuf = cv::Mat(480, 640, CV_8U, &buf[begin]); Mat imgMat = cv::imdecode(imgbuf, CV_LOAD_IMAGE_COLOR); if (!imgMat.data) cerr << "reading failed\r\n"; // cerr << "x " << imgMat.rows << ' ' << imgMat.cols << "\r\n"; - imshow("Display Window", imgMat); + imshow(showall ? names[id] : "Display Window", imgMat); // cerr << "updated\r\n"; - waitKey(1); + displayed = true; } } @@ -201,9 +210,6 @@ struct image_sockin : public sockin { } -// if (listener == id) { -// if (have_fd3) write(3, data, len); -// } } virtual void newconn() { @@ -273,7 +279,14 @@ int main(void) if (have_fd3) cerr << "Have video output socket\n"; #endif // namedWindow("Display Window", WINDOW_AUTOSIZE ); - namedWindow("Display Window", WINDOW_AUTOSIZE ); + + if (showall) { + for (int i = 0; i < MAX; i++) { + namedWindow(names[i], WINDOW_AUTOSIZE ); + } + } else { + namedWindow("Display Window", WINDOW_AUTOSIZE ); + } // catch signals if (((void *)signal(SIGINT,sigcatch) < 0) || @@ -365,6 +378,7 @@ int main(void) } } + displayed = false; for (int i = 0; (rv > 0) && (i < num_sockets); i++) { if (!s[i]) break; @@ -408,6 +422,7 @@ int main(void) } } } + if (displayed) waitKey(1); }; diff --git a/external/happycube b/external/happycube index 7918f6c..7acccfe 160000 --- a/external/happycube +++ b/external/happycube @@ -1 +1 @@ -Subproject commit 7918f6c2650811d0254f8a541634e999cb674daa +Subproject commit 7acccfe272023de74864b1a83eee9ddbac9b8fd4