Update to latest upstream version of acatcher
This commit is contained in:
parent
ca552ae331
commit
9a00ee2118
3 changed files with 51 additions and 40 deletions
|
@ -3,8 +3,6 @@ host side:
|
||||||
|
|
||||||
apt-get install libopencv-dev
|
apt-get install libopencv-dev
|
||||||
clang++ -O2 -lopencv_core -lopencv_highgui -lopencv_imgproc -o acatcher acatcher.cxx
|
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:
|
to actually run it:
|
||||||
./acatcher | (aplay -t raw -c 1 -f S16_LE -r 22050 > /dev/null 2> /dev/null)
|
./acatcher | (aplay -t raw -c 1 -f S16_LE -r 22050 > /dev/null 2> /dev/null)
|
||||||
|
|
|
@ -42,22 +42,22 @@ using namespace std;
|
||||||
const int MAX = 16;
|
const int MAX = 16;
|
||||||
|
|
||||||
const char *names[] = {
|
const char *names[] = {
|
||||||
"0-Century AB",
|
"0",
|
||||||
"1-Century CD",
|
"1",
|
||||||
"2-La Jolla",
|
"2",
|
||||||
"3-Carmel",
|
"3",
|
||||||
"4-Los Angeles A",
|
"4",
|
||||||
"5-Los Angeles B",
|
"5",
|
||||||
"6-Los Angeles C",
|
"6",
|
||||||
"7-Marina",
|
"7",
|
||||||
"8-Bel Air",
|
"8",
|
||||||
"9-San Lorenzo D",
|
"9",
|
||||||
"A-San Lorenzo E",
|
"A",
|
||||||
"B-San Lorenzo F",
|
"B",
|
||||||
"C-Plaza BC",
|
"C",
|
||||||
"D-Plaza D",
|
"D",
|
||||||
"E-Int'l Ballroom",
|
"E",
|
||||||
"F-Pacific Ballroom",
|
"F",
|
||||||
};
|
};
|
||||||
|
|
||||||
void cls()
|
void cls()
|
||||||
|
@ -73,11 +73,8 @@ const int BUFLEN = 1024*1024; // in bytes
|
||||||
// Yes this is ugly. :P
|
// Yes this is ugly. :P
|
||||||
bool failure = false;
|
bool failure = false;
|
||||||
|
|
||||||
#ifdef SHOWALL
|
bool f_showall = false;
|
||||||
bool showall = true;
|
bool f_saveaudio = false;
|
||||||
#else
|
|
||||||
bool showall = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct sockin {
|
struct sockin {
|
||||||
int listener_fd, data_fd;
|
int listener_fd, data_fd;
|
||||||
|
@ -123,6 +120,7 @@ struct sockin {
|
||||||
|
|
||||||
struct audio_sockin : public sockin {
|
struct audio_sockin : public sockin {
|
||||||
int leftover;
|
int leftover;
|
||||||
|
int a_fd;
|
||||||
|
|
||||||
// uint16_t buf[ABUFLEN];
|
// uint16_t buf[ABUFLEN];
|
||||||
// int bufsize;
|
// int bufsize;
|
||||||
|
@ -130,6 +128,12 @@ struct audio_sockin : public sockin {
|
||||||
audio_sockin(int _id) : sockin(_id, 4000) {
|
audio_sockin(int _id) : sockin(_id, 4000) {
|
||||||
leftover = -1;
|
leftover = -1;
|
||||||
//bufsize = 0;
|
//bufsize = 0;
|
||||||
|
|
||||||
|
a_fd = -1;
|
||||||
|
|
||||||
|
if (f_saveaudio) {
|
||||||
|
a_fd = open(names[id], O_WRONLY | O_APPEND | O_CREAT, S_IRWXU | S_IROTH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void handle(unsigned char *data, int len, int listener) {
|
virtual void handle(unsigned char *data, int len, int listener) {
|
||||||
|
@ -138,13 +142,14 @@ struct audio_sockin : public sockin {
|
||||||
new_leftover = data[len - 1];
|
new_leftover = data[len - 1];
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
if (listener == id) {
|
|
||||||
if (leftover >= 0) {
|
if (leftover >= 0) {
|
||||||
write(1, &leftover, 1);
|
if (a_fd >= 2) write(a_fd, &leftover, 1);
|
||||||
leftover = -1;
|
if (listener == id) write(1, &leftover, 1);
|
||||||
}
|
leftover = -1;
|
||||||
write(1, data, len);
|
|
||||||
}
|
}
|
||||||
|
if (a_fd >= 2) write(a_fd, data, len);
|
||||||
|
if (listener == id) write(1, data, len);
|
||||||
leftover = new_leftover;
|
leftover = new_leftover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,14 +172,14 @@ struct image_sockin : public sockin {
|
||||||
}
|
}
|
||||||
|
|
||||||
void showImage(int begin, int end, int listener) {
|
void showImage(int begin, int end, int listener) {
|
||||||
if (showall || (listener == id)) {
|
if (f_showall || (listener == id)) {
|
||||||
Mat imgbuf = cv::Mat(480, 640, CV_8U, &buf[begin]);
|
Mat imgbuf = cv::Mat(480, 640, CV_8U, &buf[begin]);
|
||||||
Mat imgMat = cv::imdecode(imgbuf, CV_LOAD_IMAGE_COLOR);
|
Mat imgMat = cv::imdecode(imgbuf, CV_LOAD_IMAGE_COLOR);
|
||||||
|
|
||||||
if (!imgMat.data) cerr << "reading failed\r\n";
|
if (!imgMat.data) cerr << "reading failed\r\n";
|
||||||
// cerr << "x " << imgMat.rows << ' ' << imgMat.cols << "\r\n";
|
// cerr << "x " << imgMat.rows << ' ' << imgMat.cols << "\r\n";
|
||||||
|
|
||||||
imshow(showall ? names[id] : "Display Window", imgMat);
|
imshow(f_showall ? names[id] : "Display Window", imgMat);
|
||||||
// cerr << "updated\r\n";
|
// cerr << "updated\r\n";
|
||||||
displayed = true;
|
displayed = true;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +270,7 @@ bool setrawkbd()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int main_rv = 0;
|
int main_rv = 0;
|
||||||
int cur_listener = 0;
|
int cur_listener = 0;
|
||||||
|
@ -273,14 +278,22 @@ int main(void)
|
||||||
int num_sockets = (MAX * 2);
|
int num_sockets = (MAX * 2);
|
||||||
sockin *s[num_sockets];
|
sockin *s[num_sockets];
|
||||||
|
|
||||||
#if 0
|
opterr = 0;
|
||||||
// check to see if we have a video socket
|
|
||||||
have_fd3 = (fcntl(3, F_GETFD) >= 0);
|
|
||||||
if (have_fd3) cerr << "Have video output socket\n";
|
|
||||||
#endif
|
|
||||||
// namedWindow("Display Window", WINDOW_AUTOSIZE );
|
|
||||||
|
|
||||||
if (showall) {
|
int c;
|
||||||
|
|
||||||
|
while ((c = getopt(argc, argv, "as")) != -1) {
|
||||||
|
switch (c) {
|
||||||
|
case 's':
|
||||||
|
f_saveaudio = true;
|
||||||
|
break;
|
||||||
|
case 'a':
|
||||||
|
f_showall = true;
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f_showall) {
|
||||||
for (int i = 0; i < MAX; i++) {
|
for (int i = 0; i < MAX; i++) {
|
||||||
namedWindow(names[i], WINDOW_AUTOSIZE );
|
namedWindow(names[i], WINDOW_AUTOSIZE );
|
||||||
}
|
}
|
||||||
|
|
2
external/happycube
vendored
2
external/happycube
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 7acccfe272023de74864b1a83eee9ddbac9b8fd4
|
Subproject commit 3471bb87e16cf76e9c0bce20ec09417782274ea2
|
Loading…
Add table
Add a link
Reference in a new issue