summaryrefslogtreecommitdiff
path: root/src/camera.cc
diff options
context:
space:
mode:
authordeva <deva>2005-05-03 08:31:58 +0000
committerdeva <deva>2005-05-03 08:31:58 +0000
commit16aeeeb8110893e14c2d134542981cdc0f257411 (patch)
treefbcd9ec22c27d9f82a049055ec9d37035a1e3c03 /src/camera.cc
parenta8456a6a949178ff06ca66cc10c0079da9f9f067 (diff)
Removed the error object, and replaced it with a more generic info object.
Diffstat (limited to 'src/camera.cc')
-rw-r--r--src/camera.cc75
1 files changed, 42 insertions, 33 deletions
diff --git a/src/camera.cc b/src/camera.cc
index 03aa87f..57f4a17 100644
--- a/src/camera.cc
+++ b/src/camera.cc
@@ -8,25 +8,32 @@
****************************************************************************/
/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This file is part of MIaV.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
+ * MIaV is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * MIaV is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with MIaV; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+
/*
* $Id$
*/
+
/*
* $Log$
+ * Revision 1.14 2005/05/03 08:31:59 deva
+ * Removed the error object, and replaced it with a more generic info object.
+ *
* Revision 1.13 2005/05/02 14:06:55 deva
* Added unfreeze to decoder (called from camera).
*
@@ -45,20 +52,20 @@
*
* Revision 1.8 2005/05/01 09:56:26 deva
* Added Id and Log tags to all files
- *
*/
+
#include <config.h>
#ifdef USE_GUI
#include "camera.h"
-Camera::Camera()
+Camera::Camera(Info *ginfo)
{
+ info = ginfo;
}
void Camera::connect(const char *ip, const int port)
{
- errorstatus = new Error();
initialized = false;
pthread_mutex_init (&mutex, NULL);
@@ -77,55 +84,64 @@ void Camera::connect(const char *ip, const int port)
sem_init(&encode_sem, 0, 0);
sem_init(&player_sem, 0, 0);
- decoder = new Decoder(errorstatus,
+ decoder = new Decoder(info,
&encode_sem,
&player_sem,
encode_queue,
player_queue,
&mutex,
&running);
+ /*
if(errorstatus->hasError()) {
errorstatus->pushError("Camera initialization failed (decoder).");
return;
}
-
- encoder = new Encoder(errorstatus,
+ */
+ 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(errorstatus,
+ */
+ player = new Player(info,
&running,
&player_sem,
player_queue,
&mutex);
+ /*
if(errorstatus->hasError()) {
errorstatus->pushError("Camera initialization failed (player).");
return;
}
+ */
pthread_create (&decodetid, NULL, thread_run, decoder);
+ /*
if(errorstatus->hasError()) {
errorstatus->pushError("Camera initialization failed (decoder thread).");
return;
}
+ */
pthread_create (&encodetid, NULL, thread_run, encoder);
+ /*
if(errorstatus->hasError()) {
errorstatus->pushError("Camera initialization failed (encoder thread).");
return;
}
+ */
pthread_create (&playertid, NULL, thread_run, player);
+ /*
if(errorstatus->hasError()) {
errorstatus->pushError("Camera initialization failed (player thread).");
return;
}
-
+ */
initialized = true;
}
@@ -147,15 +163,13 @@ Camera::~Camera()
delete player_queue;
delete encode_queue;
-
- delete errorstatus;
}
void Camera::setCpr(char *newcpr)
{
if(initialized) encoder->setCpr(newcpr);
- else errorstatus->pushError("Camera not initialized.");
+ else info->error("Camera not initialized.");
}
@@ -166,7 +180,7 @@ void Camera::start()
encoder->start();
decoder->start();
} else {
- errorstatus->pushError("Camera not initialized.");
+ info->error("Camera not initialized.");
}
}
@@ -176,7 +190,7 @@ void Camera::stop(n_savestate save)
decoder->stop(save);
encoder->stop(save);
} else {
- errorstatus->pushError("Camera not initialized.");
+ info->error("Camera not initialized.");
}
}
@@ -187,7 +201,7 @@ void Camera::freeze()
// encoder->freeze();
decoder->freeze();
} else {
- errorstatus->pushError("Camera not initialized.");
+ info->error("Camera not initialized.");
}
}
@@ -197,7 +211,7 @@ void Camera::unfreeze()
player->start();
decoder->unfreeze();
} else {
- errorstatus->pushError("Camera not initialized.");
+ info->error("Camera not initialized.");
}
}
@@ -207,13 +221,8 @@ void Camera::snapshot(unsigned char *rgb)
decoder->shoot(rgb);
encoder->shoot();
} else {
- errorstatus->pushError("Camera not initialized.");
+ info->error("Camera not initialized.");
}
}
-Error *Camera::errorObject()
-{
- return errorstatus;
-}
-
#endif/* USE_GUI */