summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/camera.cc55
-rw-r--r--src/camera.h6
-rw-r--r--src/mainwindow.cc6
-rw-r--r--src/player.cc21
-rw-r--r--src/player.h12
5 files changed, 43 insertions, 57 deletions
diff --git a/src/camera.cc b/src/camera.cc
index a9a0982..833b048 100644
--- a/src/camera.cc
+++ b/src/camera.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.19 2005/07/25 12:42:13 deva
+ * *** empty log message ***
+ *
* Revision 1.18 2005/06/16 21:28:57 deva
* Rewrote thread object
* Fixed bug in mov_encoder (pushed read_sem too many times, whihc lead to
@@ -81,19 +84,14 @@ Camera::Camera(Info *ginfo)
info = ginfo;
}
-void Camera::connect(const char *ip, const int port)
+void Camera::connect(const char *ip, const int port, int width, int height)
{
initialized = false;
pthread_mutex_init (&mutex, NULL);
//mutex = PTHREAD_MUTEX_INITIALIZER;
- /*
- AVFormatContext *ifmtctx;
- AVFormatContext *ofmtctx;
- */
- running = 1;
- // av_register_all();
+ running = 1;
encode_queue = new Queue<Frame>(); // infinite size
player_queue = new Queue<Frame>(1); // fixed size of 1
@@ -108,60 +106,25 @@ void Camera::connect(const char *ip, const int port)
player_queue,
&mutex,
&running);
- /*
- if(errorstatus->hasError()) {
- errorstatus->pushError("Camera initialization failed (decoder).");
- return;
- }
- */
+
encoder = new Encoder(info,
ip, port,
&encode_sem,
encode_queue,
&mutex,
&running);
- /*
- if(errorstatus->hasError()) {
- errorstatus->pushError("Camera initialization failed (encoder).");
- return;
- }
- */
+
player = new Player(info,
+ width, height,
&running,
&player_sem,
player_queue,
&mutex);
- /*
- if(errorstatus->hasError()) {
- errorstatus->pushError("Camera initialization failed (player).");
- return;
- }
- */
- // pthread_create (&decodetid, NULL, thread_run, decoder);
decoder->run();
- /*
- if(errorstatus->hasError()) {
- errorstatus->pushError("Camera initialization failed (decoder thread).");
- return;
- }
- */
- // pthread_create (&encodetid, NULL, thread_run, encoder);
encoder->run();
- /*
- if(errorstatus->hasError()) {
- errorstatus->pushError("Camera initialization failed (encoder thread).");
- return;
- }
- */
- // pthread_create (&playertid, NULL, thread_run, player);
player->run();
- /*
- if(errorstatus->hasError()) {
- errorstatus->pushError("Camera initialization failed (player thread).");
- return;
- }
- */
+
initialized = true;
}
diff --git a/src/camera.h b/src/camera.h
index 0ffdc3a..2da585b 100644
--- a/src/camera.h
+++ b/src/camera.h
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.14 2005/07/25 12:42:13 deva
+ * *** empty log message ***
+ *
* Revision 1.13 2005/06/16 21:28:57 deva
* Rewrote thread object
* Fixed bug in mov_encoder (pushed read_sem too many times, whihc lead to
@@ -91,7 +94,8 @@ public:
Camera(Info *ginfo);
~Camera();
void connect(const char *ip,
- const int port);
+ const int port,
+ int width, int height);
void setCpr(char *newcpr);
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 2623d80..8eb06f0 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.39 2005/07/25 12:42:13 deva
+ * *** empty log message ***
+ *
* Revision 1.38 2005/07/23 10:22:12 deva
* *** empty log message ***
*
@@ -170,7 +173,8 @@ MainWindow::MainWindow(QApplication *qApp, QWidget* parent, const char* name )
camera = new Camera(info);
camera->connect(config->readString("server_addr")->c_str(),
- config->readInt("server_port"));
+ config->readInt("server_port"),
+ img_live->width(), img_live->height());
// Make sure this is created *after* the camera object!
taskbartimer = new QTimer(this);
diff --git a/src/player.cc b/src/player.cc
index 8e39fa5..0fee7b1 100644
--- a/src/player.cc
+++ b/src/player.cc
@@ -39,6 +39,9 @@
/*
* $Log$
+ * Revision 1.26 2005/07/25 12:42:13 deva
+ * *** empty log message ***
+ *
* Revision 1.25 2005/06/16 21:28:57 deva
* Rewrote thread object
* Fixed bug in mov_encoder (pushed read_sem too many times, whihc lead to
@@ -66,6 +69,7 @@
#include <time.h>
Player::Player(Info *ginfo,
+ int w, int h,
volatile int *grunning,
sem_t *gsem,
Queue<Frame> *gqueue,
@@ -74,6 +78,9 @@ Player::Player(Info *ginfo,
// No errors has ocurred... yet!
noErrors = true;
+ width = w;
+ height = h;
+
info = ginfo;
running = grunning;
@@ -89,20 +96,20 @@ Player::Player(Info *ginfo,
return;
}
- screen = SDL_SetVideoMode(DISPLAYWIDTH,
- DISPLAYHEIGHT,
+ screen = SDL_SetVideoMode(width,
+ height,
0, // 0 bpp means 'use current display depth'
SDL_HWSURFACE | SDL_ANYFORMAT | SDL_HWACCEL);
if(!screen) {
info->error("Unable to set %dx%d video: %s.",
- DISPLAYWIDTH, DISPLAYHEIGHT, SDL_GetError());
+ width, height, SDL_GetError());
noErrors = false;
return;
}
- overlay = SDL_CreateYUVOverlay(DISPLAYWIDTH,
- DISPLAYHEIGHT,
+ overlay = SDL_CreateYUVOverlay(width,
+ height,
SDL_YUY2_OVERLAY, // Match for the libdv decoder output
screen);
if(!overlay) {
@@ -133,8 +140,8 @@ void Player::player()
// Setup the displayarea.
rect.x = 0;
rect.y = 0;
- rect.w = DISPLAYWIDTH;
- rect.h = DISPLAYHEIGHT;
+ rect.w = width;
+ rect.h = height;
bool first = true;
dv_decoder_t *decoder = dv_decoder_new(FALSE/*this value is unused*/, FALSE, FALSE);
diff --git a/src/player.h b/src/player.h
index fb7d9c9..23c517d 100644
--- a/src/player.h
+++ b/src/player.h
@@ -39,6 +39,9 @@
/*
* $Log$
+ * Revision 1.9 2005/07/25 12:42:13 deva
+ * *** empty log message ***
+ *
* Revision 1.8 2005/06/16 21:28:57 deva
* Rewrote thread object
* Fixed bug in mov_encoder (pushed read_sem too many times, whihc lead to
@@ -72,8 +75,8 @@
#include <qwidget.h>
-#define DISPLAYWIDTH 720 // FIXME: These numbers suck!
-#define DISPLAYHEIGHT 576
+//#define DISPLAYWIDTH 720 // FIXME: These numbers suck!
+//#define DISPLAYHEIGHT 576
/**
* This class contains the SDL code, for displaying the movie frames
@@ -82,6 +85,7 @@
class Player : public Thread {
public:
Player(Info *ginfo,
+ int width, int height,
volatile int *grunning,
sem_t *gsem,
Queue<Frame> *gqueue,
@@ -94,6 +98,10 @@ public:
void thread_main();
private:
+ // Output dimensions (overlay)
+ int width;
+ int height;
+
Info *info;
void player();