summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2006-04-19 14:13:11 +0000
committerdeva <deva>2006-04-19 14:13:11 +0000
commit1b68dd554e2e238f499ebfd12c222263fe050bd2 (patch)
treefa9fe9e22b232db22a7bf3d45f7d5a4b6825ed7c
parenta6aaea79af5c166bcaad26edf6e0f8354f4d2b0b (diff)
*** empty log message ***
-rw-r--r--client/decoder.cc3
-rw-r--r--client/decoder.h5
-rw-r--r--client/mainwindow.cc4
-rw-r--r--client/miav_client.cc2
-rw-r--r--client/networksender.cc17
-rw-r--r--client/networksender.h8
-rw-r--r--client/player.cc13
-rw-r--r--client/xvaccelrenderer.cc10
-rw-r--r--client/xvaccelrenderer.h5
9 files changed, 41 insertions, 26 deletions
diff --git a/client/decoder.cc b/client/decoder.cc
index ef2185c..1a85db7 100644
--- a/client/decoder.cc
+++ b/client/decoder.cc
@@ -44,8 +44,9 @@
#include "libdv_wrapper.h"
-Decoder::Decoder(): closesem(1)
+Decoder::Decoder(NetworkSender *ns): closesem(1)
{
+ sender = ns;
running = true;
memset(pframe, 0, sizeof(pframe)); // Init an empty frame
qApp->installEventFilter(this);
diff --git a/client/decoder.h b/client/decoder.h
index 6cb6a22..a8fb4f9 100644
--- a/client/decoder.h
+++ b/client/decoder.h
@@ -32,12 +32,13 @@
#include <QMutex>
#include "dv.h"
+#include "networksender.h"
class Decoder : public QThread
{
Q_OBJECT
public:
- Decoder();
+ Decoder(NetworkSender *sender);
~Decoder();
char *getFrame();
@@ -60,6 +61,8 @@ private:
char pframe[DVPACKAGE_SIZE]; // Player frame
QMutex mutex;
+
+ NetworkSender *sender;
};
#endif/*__MIAV_DECODER_H__*/
diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index dd05b69..fa73a9e 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -152,11 +152,7 @@ void MainWindow::snapshot_clicked()
{
MIaV::control.shoot();
- char rgb[720 * 576 * 4];
-
- // QImage screenshot((uchar*)rgb, 720, 576, QImage::Format_RGB32);
QImage screenshot((uchar*)rgb, 720, 576, QImage::Format_RGB32);
- // decoder->snapshot(rgb);
decoder->snapshot((char*)screenshot.bits());
QPixmap *p = new QPixmap();
diff --git a/client/miav_client.cc b/client/miav_client.cc
index e34eaf6..38b8894 100644
--- a/client/miav_client.cc
+++ b/client/miav_client.cc
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
MIaV::initInfo(&info);
NetworkSender sender;
- Decoder decoder;
+ Decoder decoder(&sender);
MainWindow mainwindow(&decoder);
Player player(mainwindow.getVideoWidget(), &decoder);
diff --git a/client/networksender.cc b/client/networksender.cc
index 7b286aa..21c107c 100644
--- a/client/networksender.cc
+++ b/client/networksender.cc
@@ -29,11 +29,26 @@
#include "info.h"
NetworkSender::NetworkSender()
-{}
+{
+ ip = "192.168.0.10";
+ port = 6666;
+}
NetworkSender::~NetworkSender()
{}
+void NetworkSender::newConnection(char *cpr)
+{
+}
+
+void NetworkSender::pushFrame(char* frame, bool freeze, bool snapshot)
+{
+}
+
+void NetworkSender::endConnection()
+{
+}
+
void NetworkSender::run()
{
// MIaV::info->info("The NetworkSender thread is running.");
diff --git a/client/networksender.h b/client/networksender.h
index 9276ea3..89c522a 100644
--- a/client/networksender.h
+++ b/client/networksender.h
@@ -35,7 +35,15 @@ public:
NetworkSender();
~NetworkSender();
+ void newConnection(char *cpr);
+ void pushFrame(char* frame, bool freeze, bool snapshot);
+ void endConnection();
+
void run();
+
+private:
+ std::string ip;
+ unsigned short port;
};
#endif/*__MIAV_NETWORKSENDER_H__*/
diff --git a/client/player.cc b/client/player.cc
index a7d0a7c..44e9cc9 100644
--- a/client/player.cc
+++ b/client/player.cc
@@ -29,14 +29,13 @@
#define WIDTH 720
#define HEIGHT 576
-Player::Player(QWidget *w, Decoder *d)
+Player::Player(QWidget *w, Decoder *d) :
+ render(w, WIDTH, HEIGHT)
{
widget = w;
decoder = d;
dvdecoder = new LibDVWrapper(DV::ColorBest, DV::PAL, DV::YUV_422);
- render.init(widget, WIDTH, HEIGHT);
-
connect(this, SIGNAL(timeout()), this, SLOT(show_frame()));
dvdecoder->setOutputBuffer(render.getDisplayData());
@@ -44,7 +43,6 @@ Player::Player(QWidget *w, Decoder *d)
Player::~Player()
{
- render.end();
delete dvdecoder;
}
@@ -53,9 +51,10 @@ void Player::show_frame()
char *frame;
frame = decoder->pframeAcquire(); // Acquire frame data
- dvdecoder->decode(frame);
+ dvdecoder->decode(frame); // Decode the DV frame to YUV
decoder->pframeRelease(); // Release frame data
+ // Scale the video in aspect:
if((double)widget->width() / WIDTH < (double)widget->height() / HEIGHT) {
render.width = widget->width();
render.height = (unsigned int)((double)render.width / (double)WIDTH * (double)HEIGHT);
@@ -64,8 +63,6 @@ void Player::show_frame()
render.width = (unsigned int)((double)render.height / (double)HEIGHT * (double)WIDTH);
}
- // render.width = widget->width();
- // render.height = widget->height();
-
+ // Display the YUV frame
render.display(WIDTH, HEIGHT);
}
diff --git a/client/xvaccelrenderer.cc b/client/xvaccelrenderer.cc
index 4ba8a9f..984c57a 100644
--- a/client/xvaccelrenderer.cc
+++ b/client/xvaccelrenderer.cc
@@ -30,28 +30,24 @@
#define VERBOSE_XV
//________________Wrapper around Xv_______________
-XvAccelRender::XvAccelRender( void )
+XvAccelRender::XvAccelRender(QWidget *window, uint32_t w, uint32_t h)
{
xvimage = NULL;
-}
-uint8_t XvAccelRender::init(QWidget *window, uint32_t w, uint32_t h)
-{
#ifdef VERBOSE_XV
printf("Xv start\n");
#endif
width = w;
height = h;
- return GUI_XvInit(window, w, h);
+ GUI_XvInit(window, w, h);
}
-uint8_t XvAccelRender::end(void)
+XvAccelRender::~XvAccelRender()
{
GUI_XvEnd( );
#ifdef VERBOSE_XV
printf("Xv end\n");
#endif
- return 1;
}
char *XvAccelRender::getDisplayData()
diff --git a/client/xvaccelrenderer.h b/client/xvaccelrenderer.h
index 3d70e91..a9cd383 100644
--- a/client/xvaccelrenderer.h
+++ b/client/xvaccelrenderer.h
@@ -28,9 +28,8 @@ typedef unsigned int uint32_t;
class XvAccelRender
{
public:
- XvAccelRender();
- uint8_t init(QWidget *window, uint32_t w, uint32_t h);
- uint8_t end(void);
+ XvAccelRender(QWidget *window, uint32_t w, uint32_t h);
+ ~XvAccelRender();
uint8_t display(uint32_t w, uint32_t h);
unsigned int width, height;