27 cursor = (
char*)(img.getRawImage());
28 remaining = img.getRawImageSize();
29 }
else if (phase==3) {
32 remaining = blobHeader.blobLen;
37 while (phase==0 && delegate->getInputStream().isOk()) {
40 s = delegate->getInputStream().readLine();
42 }
while ((s.length()==0||s[0]!=
'-') && delegate->getInputStream().isOk());
43 s = delegate->getInputStream().readLine();
44 if (s!=
"Content-Type: image/jpeg") {
45 if (!delegate->getInputStream().isOk()) {
53 s = delegate->getInputStream().readLine();
57 if (!delegate->getInputStream().isOk()) {
66 s = delegate->getInputStream().readLine();
68 }
while (s.length()>0);
71 delegate->getInputStream().readFull(cimg.bytes());
72 if (!decompression.decompress(cimg.bytes(), img)) {
73 if (delegate->getInputStream().isOk()) {
77 imgHeader.setFromImage(img);
79 cursor = (
char*)(&imgHeader);
80 remaining =
sizeof(imgHeader);
88 cursor = (
char*)(&blobHeader);
89 remaining =
sizeof(blobHeader);
94 int allow = remaining;
95 if ((
int)b.
length()<allow) {
98 if (cursor!=
nullptr) {
99 memcpy(b.
get(),cursor,allow);
105 int result = delegate->getInputStream().read(b);
119 delegate->getOutputStream().write(b);
const yarp::os::LogComponent & MJPEGCARRIER()
void write(const yarp::os::Bytes &b) override
Write a block of bytes to the stream.
A simple collection of objects that can be described and transmitted in a portable way.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
A simple abstraction for a block of bytes.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual std::string asString() const
Get string value.
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
An interface to the operating system, including Port based communication.