23 cursor = (
char*)(img.getRawImage());
24 remaining = img.getRawImageSize();
25 }
else if (phase==3) {
28 remaining = blobHeader.blobLen;
33 while (phase==0 && delegate->getInputStream().isOk()) {
36 s = delegate->getInputStream().readLine();
38 }
while ((s.length()==0||s[0]!=
'-') && delegate->getInputStream().isOk());
39 s = delegate->getInputStream().readLine();
40 if (s!=
"Content-Type: image/jpeg") {
41 if (!delegate->getInputStream().isOk()) {
49 s = delegate->getInputStream().readLine();
53 if (!delegate->getInputStream().isOk()) {
62 s = delegate->getInputStream().readLine();
64 }
while (s.length()>0);
67 delegate->getInputStream().readFull(cimg.bytes());
68 if (!decompression.decompress(cimg.bytes(), img)) {
69 if (delegate->getInputStream().isOk()) {
73 imgHeader.setFromImage(img);
75 cursor = (
char*)(&imgHeader);
76 remaining =
sizeof(imgHeader);
84 cursor = (
char*)(&blobHeader);
85 remaining =
sizeof(blobHeader);
90 int allow = remaining;
91 if ((
int)b.
length()<allow) {
94 if (cursor!=
nullptr) {
95 memcpy(b.
get(),cursor,allow);
101 int result = delegate->getInputStream().read(b);
115 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.