Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
qwerty is currently offline  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 Go to previous message
qwerty is currently offline  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

Previous Topic: Problem with "SDL Example" in Upp 2008.1 [BUG?]
Next Topic: Suggested Bugfixes
Goto Forum:
  


Current Time: Thu Mar 28 20:17:59 CET 2024

Total time taken to generate the page: 0.00883 seconds