summaryrefslogtreecommitdiff
path: root/src/camera.cc
diff options
context:
space:
mode:
authordeva <deva>2005-03-26 10:32:50 +0000
committerdeva <deva>2005-03-26 10:32:50 +0000
commit63ac729b32331438a607ec5b8be046143c7592e6 (patch)
tree4f4606119fe178024ccd9b27a0e44757a572d3ad /src/camera.cc
parent13149f3c34de4cad937b1866778030d540674a06 (diff)
Added an error object for genereic error message handling.
Diffstat (limited to 'src/camera.cc')
-rw-r--r--src/camera.cc36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/camera.cc b/src/camera.cc
index 574caf3..ac23fc9 100644
--- a/src/camera.cc
+++ b/src/camera.cc
@@ -27,8 +27,14 @@
#include "camera.h"
-Camera::Camera(const char *ip, const int port)
+Camera::Camera()
{
+}
+
+void Camera::connect(const char *ip, const int port)
+{
+ errorstatus = new Error();
+
pthread_mutex_init (&mutex, NULL);
//mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -48,7 +54,8 @@ Camera::Camera(const char *ip, const int port)
sem_init(&encode_sem, 0, 0);
sem_init(&player_sem, 0, 0);
- decoder = new Decoder(device,
+ decoder = new Decoder(errorstatus,
+ device,
channel,
&encode_sem,
&player_sem,
@@ -59,14 +66,16 @@ Camera::Camera(const char *ip, const int port)
// ifmtctx = decoder->fc;
if(!decoder->fc) return;
- encoder = new Encoder(ip, port,
+ encoder = new Encoder(errorstatus,
+ ip, port,
&encode_sem,
encode_queue,
&mutex,
&running);
ofmtctx = encoder->fc;
- player = new Player(&running,
+ player = new Player(errorstatus,
+ &running,
&player_sem,
player_queue,
&mutex);
@@ -94,26 +103,31 @@ Camera::~Camera()
delete player_queue;
delete encode_queue;
+
+ delete errorstatus;
}
void Camera::setCpr(char *newcpr)
{
+
encoder->setCpr(newcpr);
}
void Camera::start()
{
- encoder->stop();
+ encoder->start();
}
void Camera::stop()
{
- encoder->start();
+ encoder->stop();
}
void Camera::freeze()
{
+ // FIXME: Ensure they freeze the same frame, i.e. the player
+ // shows the same frame that is actually fronzen on the server.
player->stop();
encoder->freeze();
}
@@ -128,4 +142,14 @@ void Camera::snapshot()
encoder->shoot();
}
+bool Camera::hasError()
+{
+ return errorstatus->hasError();
+}
+
+string Camera::getErrorString()
+{
+ return errorstatus->getErrorString();
+}
+
#endif/* USE_GUI */