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) {
72 buffer_size_ = colorspace_buffer_size(b->colorspace(), b->width(), b->height());
73 _payload_size = buffer_size_ +
sizeof(FUSE_image_message_header_t);
83 strncpy(header_->
image_id, b->image_id(), IMAGE_ID_MAX_LENGTH - 1);
84 header_->
format = FUSE_IF_RAW;
87 header_->
width = htonl(b->width());
88 header_->
height = htonl(b->height());
91 long int cts = 0, ctus = 0;
92 b->capture_time(&cts, &ctus);
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),