24 #include <fvutils/net/fuse_image_content.h> 25 #include <fvutils/ipc/shm_image.h> 26 #include <fvutils/color/conversions.h> 27 #include <fvutils/compression/jpeg_decompressor.h> 29 #include <core/exceptions/system.h> 30 #include <core/exceptions/software.h> 33 #include <netinet/in.h> 54 void *payload,
size_t payload_size)
56 if ( type != FUSE_MT_IMAGE ) {
82 if ( _payload == NULL ) {
90 __header->
format = FUSE_IF_RAW;
97 long int cts = 0, ctus = 0;
102 __capture_time = NULL;
105 memcpy(__buffer, b->
buffer(), __buffer_size);
125 unsigned int width,
unsigned int height,
126 long int capture_time_sec,
127 long int capture_time_usec)
133 if ( _payload == NULL ) {
140 strncpy(__header->
image_id, image_id, IMAGE_ID_MAX_LENGTH);
141 __header->
format = image_format;
144 __header->
width = htonl(width);
145 __header->
height = htonl(height);
150 __capture_time = NULL;
152 memcpy(__buffer, buffer, __buffer_size);
159 delete __capture_time;
178 return __buffer_size;
188 return ntohl(__header->
width);
198 return ntohl(__header->
height);
228 if ( ! __capture_time ) {
232 return __capture_time;
255 if ( buffer_size < colorspace_buffer_size(YUV422_PLANAR, ntohs(__header->
width),
256 ntohs(__header->
height)) ) {
259 if ( __header->
format != FUSE_IF_JPEG ) {
266 convert((colorspace_t)ntohs(__header->
colorspace), YUV422_PLANAR,
267 __buffer, yuv422_planar_buffer,
virtual void serialize()
Serialize message content.
fawkes::Time capture_time() const
Get the time when the image was captured.
Decompressor for JPEG images.
virtual void decompress()
Decompress image.
virtual void set_compressed_buffer(unsigned char *buf, unsigned int buf_size)
Set compressed buffer.
const char * image_id() const
Get Image ID.
virtual void set_decompressed_buffer(unsigned char *buf, unsigned int buf_size)
Set decompressed buffer.
unsigned char * buffer() const
Image buffer.
void decompress(unsigned char *yuv422_planar_buffer, size_t buffer_size)
Decompress image data.
A class for handling time.
unsigned int pixel_width() const
Get image width.
void lock_for_read()
Lock shared memory segment for reading.
virtual void * payload() const
Return pointer to payload.
unsigned int pixel_height() const
Get image height.
unsigned char * buffer() const
Get image buffer.
void * _payload
Pointer to payload.
size_t buffer_size() const
Get size of buffer.
unsigned int format() const
Get image format.
FuseImageContent(SharedMemoryImageBuffer *b)
Constructor.
virtual size_t payload_size() const
Return payload size.
Shared memory image buffer.
fawkes::Time * capture_time() const
Get capture time.
unsigned int colorspace() const
Get colorspace.
unsigned int width() const
Get image width.
Expected parameter is missing.
~FuseImageContent()
Destructor.
unsigned int height() const
Get image height.
System ran out of memory and desired operation could not be fulfilled.
void unlock()
Unlock memory.
colorspace_t colorspace() const
Get color space.
size_t _payload_size
Payloda size.