From 4bbd02c04777308912206008ef54ba4d379b73b4 Mon Sep 17 00:00:00 2001 From: fattony Date: Tue, 19 Jul 2011 17:28:46 +0200 Subject: [PATCH] added byte decoding for current image stream --- src/apps/qgcvideo/QGCVideoMainWindow.cc | 138 ++++++++++++++++++------ 1 file changed, 104 insertions(+), 34 deletions(-) diff --git a/src/apps/qgcvideo/QGCVideoMainWindow.cc b/src/apps/qgcvideo/QGCVideoMainWindow.cc index a6754de33..6aeab61fc 100644 --- a/src/apps/qgcvideo/QGCVideoMainWindow.cc +++ b/src/apps/qgcvideo/QGCVideoMainWindow.cc @@ -35,7 +35,8 @@ #include "UDPLink.h" #include - QByteArray imageRecBuffer = QByteArray(376*240,255); + QByteArray imageRecBuffer1 = QByteArray(376*240,255); + QByteArray imageRecBuffer2 = QByteArray(376*240,255); static int part = 0; QGCVideoMainWindow::QGCVideoMainWindow(QWidget *parent) : @@ -91,71 +92,140 @@ void QGCVideoMainWindow::receiveBytes(LinkInterface* link, QByteArray data) QString header("P5\n%1 %2\n%3\n"); header = header.arg(imgWidth).arg(imgHeight).arg(imgColors); - switch (data[0]) + unsigned char i0 = data[0]; + + switch (i0) { - case (1): + case 0x01: { for (int i=4; ivideo1Widget->copyImage(test); - ui->video2Widget->copyImage(image); - //ui->video3Widget->copyImage(test); + if (!image2.loadFromData(tmpImage2, "PGM")) + { + qDebug()<< "could not create extracted image2"; + + } + tmpImage1.clear(); + tmpImage2.clear(); + //ui->video1Widget->copyImage(test); + ui->video2Widget->copyImage(image1); + ui->video3Widget->copyImage(image2); //ui->video4Widget->copyImage(test); part = 0; - imageRecBuffer.clear(); + imageRecBuffer1.clear(); + imageRecBuffer2.clear(); } - unsigned char i0 = data[0]; + index.append(QString().sprintf("%02x ", i0)); for (int j=0; j