24 #include <core/exceptions/software.h>
25 #include <core/exceptions/system.h>
26 #include <fvutils/color/conversions.h>
27 #include <fvutils/compression/jpeg_decompressor.h>
28 #include <fvutils/ipc/shm_image.h>
29 #include <fvutils/net/fuse_image_content.h>
30 #include <netinet/in.h>
35 namespace firevision {
51 if (type != FUSE_MT_IMAGE) {
84 header_->
format = FUSE_IF_RAW;
91 long int cts = 0, ctus = 0;
99 memcpy(buffer_, b->
buffer(), buffer_size_);
116 const char * image_id,
117 unsigned char * buffer,
119 colorspace_t colorspace,
122 long int capture_time_sec,
123 long int capture_time_usec)
136 strncpy(header_->
image_id, image_id, IMAGE_ID_MAX_LENGTH - 1);
137 header_->
format = image_format;
140 header_->
width = htonl(width);
141 header_->
height = htonl(height);
146 capture_time_ = NULL;
148 memcpy(buffer_,
buffer, buffer_size_);
154 delete capture_time_;
181 return ntohl(header_->
width);
190 return ntohl(header_->
height);
217 if (!capture_time_) {
221 return capture_time_;
244 < colorspace_buffer_size(YUV422_PLANAR, ntohs(header_->
width), ntohs(header_->
height))) {
247 if (header_->
format != FUSE_IF_JPEG) {
254 convert((colorspace_t)ntohs(header_->
colorspace),
257 yuv422_planar_buffer,
258 ntohs(header_->
width),
Expected parameter is missing.
System ran out of memory and desired operation could not be fulfilled.
void unlock()
Unlock memory.
void lock_for_read()
Lock shared memory segment for reading.
A class for handling time.
unsigned int format() const
Get image format.
virtual void serialize()
Serialize message content.
size_t buffer_size() const
Get size of buffer.
~FuseImageContent()
Destructor.
void decompress(unsigned char *yuv422_planar_buffer, size_t buffer_size)
Decompress image data.
unsigned int colorspace() const
Get colorspace.
fawkes::Time * capture_time() const
Get capture time.
unsigned char * buffer() const
Image buffer.
unsigned int pixel_height() const
Get image height.
unsigned int pixel_width() const
Get image width.
FuseImageContent(SharedMemoryImageBuffer *b)
Constructor.
virtual void * payload() const
Return pointer to payload.
size_t _payload_size
Payloda size.
virtual size_t payload_size() const
Return payload size.
void * _payload
Pointer to payload.
virtual void set_decompressed_buffer(unsigned char *buf, unsigned int buf_size)
Set decompressed buffer.
virtual void set_compressed_buffer(unsigned char *buf, unsigned int buf_size)
Set compressed buffer.
Decompressor for JPEG images.
virtual void decompress()
Decompress image.
Shared memory image buffer.
unsigned int height() const
Get image height.
fawkes::Time capture_time() const
Get the time when the image was captured.
colorspace_t colorspace() const
Get color space.
const char * image_id() const
Get Image ID.
unsigned int width() const
Get image width.
unsigned char * buffer() const
Get image buffer.