Update of /cvsroot/playerstage/code/player/server/drivers/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12245/server/drivers/base
Modified Files:
imagebase.cc imagebase.h
Log Message:
applied
[ 1895643 ] CVS: big simpleshape patch
[ 1895540 ] CVS: imagebase cannot handle compressed camera images
Index: imagebase.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/base/imagebase.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** imagebase.h 23 Aug 2007 19:58:42 -0000 1.2
--- imagebase.h 18 Feb 2008 19:42:49 -0000 1.3
***************
*** 66,70 ****
ImageBase(ConfigFile *cf, int section, bool overwrite_cmds,
size_t queue_maxlen, int interf);
ImageBase(ConfigFile *cf, int section, bool overwrite_cmds =
true, size_t queue_maxlen = PLAYER_MSGQUEUE_DEFAULT_MAXLEN);
! virtual ~ImageBase() {};
// Setup/shutdown routines.
--- 66,74 ----
ImageBase(ConfigFile *cf, int section, bool overwrite_cmds,
size_t queue_maxlen, int interf);
ImageBase(ConfigFile *cf, int section, bool overwrite_cmds =
true, size_t queue_maxlen = PLAYER_MSGQUEUE_DEFAULT_MAXLEN);
! virtual ~ImageBase()
! {
! if (stored_data.image) delete [](stored_data.image);
! PLAYER_WARN("image deleted from the memory");
! }
// Setup/shutdown routines.
***************
*** 75,78 ****
--- 79,86 ----
int ProcessMessage (QueuePointer &resp_queue, player_msghdr *
hdr, void * data);
+ private:
+ ImageBase(); // no default constructor
+ ImageBase(const ImageBase &); // no copy constructor
+
protected:
virtual int ProcessFrame() = 0;
***************
*** 86,89 ****
bool HaveData;
};
-
-
--- 94,95 ----
Index: imagebase.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/base/imagebase.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** imagebase.cc 1 Nov 2007 22:16:17 -0000 1.3
--- imagebase.cc 18 Feb 2008 19:42:49 -0000 1.4
***************
*** 28,33 ****
--- 28,39 ----
///////////////////////////////////////////////////////////////////////////
+ #include <stddef.h>
+ #include <string.h>
+ #include <assert.h>
#include "imagebase.h"
#include <libplayerxdr/playerxdr.h>
+ #if HAVE_JPEGLIB_H
+ #include <libplayerjpeg/playerjpeg.h>
+ #endif
////////////////////////////////////////////////////////////////////////////////
***************
*** 38,42 ****
{
memset(&this->camera_addr, 0, sizeof(player_devaddr_t));
!
HaveData = false;
--- 44,49 ----
{
memset(&this->camera_addr, 0, sizeof(player_devaddr_t));
! stored_data.image = NULL;
! stored_data.image_count = 0;
HaveData = false;
***************
*** 56,60 ****
{
memset(&this->camera_addr, 0, sizeof(player_devaddr_t));
!
HaveData = false;
--- 63,68 ----
{
memset(&this->camera_addr, 0, sizeof(player_devaddr_t));
! stored_data.image = NULL;
! stored_data.image_count = 0;
HaveData = false;
***************
*** 96,100 ****
}
-
////////////////////////////////////////////////////////////////////////////////
// Shutdown the device (called by server thread).
--- 104,107 ----
***************
*** 112,118 ****
int ImageBase::ProcessMessage (QueuePointer &resp_queue, player_msghdr * hdr,
void * data)
{
assert(hdr);
! assert(data);
!
if(Message::MatchMessage (hdr, PLAYER_MSGTYPE_DATA,
PLAYER_CAMERA_DATA_STATE, camera_addr))
{
--- 119,128 ----
int ImageBase::ProcessMessage (QueuePointer &resp_queue, player_msghdr * hdr,
void * data)
{
+ uint32_t new_image_count;
+ player_camera_data_t * compdata = reinterpret_cast<player_camera_data_t
*>(data);
+
assert(hdr);
! assert(compdata);
!
if(Message::MatchMessage (hdr, PLAYER_MSGTYPE_DATA,
PLAYER_CAMERA_DATA_STATE, camera_addr))
{
***************
*** 120,125 ****
if (!HaveData)
{
! player_camera_data_t_copy(&stored_data, (player_camera_data_t
*)data);
! HaveData = true;
}
Unlock();
--- 130,188 ----
if (!HaveData)
{
! this->stored_data.width = (compdata->width);
! this->stored_data.height = (compdata->height);
! this->stored_data.fdiv = (compdata->fdiv);
! #if HAVE_JPEGLIB_H
! if (compdata->compression != PLAYER_CAMERA_COMPRESS_JPEG)
! {
! #endif
! this->stored_data.compression = (compdata->compression);
! this->stored_data.format = (compdata->format);
! this->stored_data.bpp = (compdata->bpp);
! if ((this->stored_data.image_count) != (compdata->image_count))
! {
! this->stored_data.image_count = (compdata->image_count);
! if (this->stored_data.image) delete
[](this->stored_data.image);
! this->stored_data.image = NULL;
! if (this->stored_data.image_count)
! {
! this->stored_data.image = new
uint8_t[this->stored_data.image_count];
! assert(this->stored_data.image);
! }
! }
! if (this->stored_data.image_count)
! {
! assert(this->stored_data.image);
! memcpy(this->stored_data.image, compdata->image,
this->stored_data.image_count);
! }
! #if HAVE_JPEGLIB_H
! } else
! {
! this->stored_data.compression = PLAYER_CAMERA_COMPRESS_RAW;
! this->stored_data.format = PLAYER_CAMERA_FORMAT_RGB888;
! this->stored_data.bpp = 24;
! new_image_count = (this->stored_data.width) *
(this->stored_data.height) * 3;
! if ((this->stored_data.image_count) != new_image_count)
! {
! this->stored_data.image_count = new_image_count;
! if (this->stored_data.image) delete
[](this->stored_data.image);
! this->stored_data.image = NULL;
! if (this->stored_data.image_count)
! {
! this->stored_data.image = new
uint8_t[this->stored_data.image_count];
! assert(this->stored_data.image);
! }
! }
! if (this->stored_data.image_count)
! {
! assert(this->stored_data.image);
! jpeg_decompress(reinterpret_cast<unsigned char
*>(this->stored_data.image),
! this->stored_data.image_count,
! reinterpret_cast<unsigned char
*>(compdata->image),
! compdata->image_count);
! }
! }
! #endif
! HaveData = true;
}
Unlock();
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit