Home » U++ Library support » U++ Library : Other (not classified elsewhere) » [SOLVED] httpcli and MJPEG
[SOLVED] httpcli and MJPEG [message #21406] |
Mon, 18 May 2009 15:41  |
qwerty
Messages: 130 Registered: May 2006
|
Experienced Member |
|
|
hi,
MJPEG is a continuous stream of http headers and binary data of jpeg.
I want:
- stop streaming after Execute(), when http header and(or) binary data was accepted
subject is IP camera here. it's sending data continuously. tested. grabed, parsed, checked -> header, data, header, data ... forever.
with HttpClient, how can I achieve this easly, please?
(except loading stream in chunks to buffer and parsing it ... last possibility)
... one thing comes to my mind: hook some callback to HTTPClient on ('this') event(s)
thank you
[Updated on: Tue, 19 May 2009 10:32] Report message to a moderator
|
|
|
Re: httpcli and MJPEG [message #21407 is a reply to message #21406] |
Mon, 18 May 2009 21:58  |
qwerty
Messages: 130 Registered: May 2006
|
Experienced Member |
|
|
done, it somehow works. it's from 'httpcli' buil-in example
...
for(;;) {
String resp = client.ExecuteRedirect();
int end = resp.Find("--myboundary"); // first in header
int beg; // begining of data
while((beg = resp.Find("\xFF\xD8", end)) != -1) { // 2 bytes begins... just for little sure
if((end = resp.Find("\r\n--myboundary", beg)) == -1) { // '<CL><CR>' after each jpeg
break;
}
String JPEG_data = resp.Mid(beg, end - beg); // <-- here's the jpeg in datas
}
}
...
it ignores inclomplete frames in chunks of stream.
I've set DEFAULT_MAX_CONTENT_SIZE in httpcli.h to some reasonable value for me. other possibility is to make it run in other threat. doh.
[Updated on: Tue, 19 May 2009 09:54] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Apr 27 22:12:10 CEST 2025
Total time taken to generate the page: 0.00595 seconds
|