libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [libmicrohttpd] JPEG Streaming with libmicrohttpd


From: David J Myers
Subject: RE: [libmicrohttpd] JPEG Streaming with libmicrohttpd
Date: Thu, 11 Nov 2010 17:41:47 -0000

So you don't need to call MHD_queue_response for each frame? Just copying
the data into the buffer in the callback is enough to send the data to the
client? What about the inter-frame headers, 
--myboundary 
Content-Type: image/jpeg
Do I just put these manually in the callback buffer at the start of the JPEG
data? ie. not using MHD_add_reponse_header?
Thanks again
David


-----Original Message-----
From: Christian Grothoff [mailto:address@hidden 
Sent: 11 November 2010 17:30
To: David J Myers
Cc: 'libmicrohttpd development and user mailinglist'
Subject: Re: [libmicrohttpd] JPEG Streaming with libmicrohttpd

You do NOT create another response object, you simply return the next
frame(s) 
the next time you are called.  If the next frame is not (yet) ready, you 
return zero (if in 'external select' mode) or simply block (if in
thread-per-
connection mode).

Best,

Christian

On Thursday, November 11, 2010 05:50:48 pm David J Myers wrote:
> Ok, thanks again, Christian.
> Just to get this straight then. In the Access Handler Callback, I call
> 'MHD_create_response_from_callback' with
> MHD_SIZE_UNKNOWN. Then call MHD_add_response_header to add my headers.
Then
> in the Content Reader Callback, I can fill in the JPEG data, but what
about
> subsequent frames? Do I create another response_from_callback and repeat
> for each frame, or do I return zero from the Content Reader Callback so
> that it calls me again for the same response? Can you add headers within
> the Content Reader Callback?
> Best regards
> David
> 
> 
> -----Original Message-----
> From: Christian Grothoff [mailto:address@hidden
> Sent: 11 November 2010 16:12
> To: David J Myers
> Cc: 'libmicrohttpd development and user mailinglist'
> Subject: Re: [libmicrohttpd] JPEG Streaming with libmicrohttpd
> 
> Dear David,
> 
> You must use 'MHD_create_response_from_callback', not 'from_data'; use
> MHD_SIZE_UNKNOWN for the size argument and your data will be transmitted
> while
> you're still (incrementally) creating the response.
> 
> Happy hacking,
> 
> Christian
> 
> On Thursday, November 11, 2010 04:35:06 pm David J Myers wrote:
> > Hi Christian,
> > Thanks for the response. The infinite method is the one I need, but
could
> > you give me a bit more detail on the MHD calls I need to make.
> > 
> > I don't understand how to send each response part ie how to make an
> > incremental response. In my callback, I can call
> > MHD_Create_response_from_Data then MHD_queue_response, multiple times,
> > but these responses won't be sent until the callback returns which won't
> > work.
> > 
> > Thanks again,
> > David
> > 
> > -----Original Message-----
> > From: Christian Grothoff [mailto:address@hidden
> > Sent: 11 November 2010 15:04
> > To: libmicrohttpd development and user mailinglist
> > Cc: David J Myers
> > Subject: Re: [libmicrohttpd] JPEG Streaming with libmicrohttpd
> > 
> > Dear David,
> > 
> > MHD does very little for you here.  You'll need to set the content type
> > header
> > (MHD_add_response_header) and then somehow create the response with the


> > boundaries yourself.  Depending on the requirements of your application,
> > you
> > 
> > can either create it in-memory a-priori (if the stream is fixed size and
> > small) or incrementally with the possibility of making the stream
> > infinite in
> > size (choose there respective MHD method to create the response object).
> > 
> > Either case will work, and in either case MHD will not help with the
> > formatting of the response.
> > 
> > I hope this helps a bit.
> > 
> > Best,
> > 
> > Christian
> > 
> > On Thursday, November 11, 2010 01:30:52 pm David J Myers wrote:
> > > Hi, I'm new to libmicrohttpd and I want to implement a motion JPEG
> > > stream. Could someone please show me how to build the following
> > > responses ie. A multipart response stream. This is what I want to send
> > > back to the client when I receive the GET :-
> > > 
> > > 
> > > 
> > > HTTP Code: 200 OK
> > > Content-Type: multipart/x-mixed-replace; boundary=myboundary
> > > 
> > > --myboundary
> > > Content-Type: image/jpeg
> > > 
> > > <JPEG Image data>
> > > --myboundary
> > > Content-Type: image/jpeg
> > > 
> > > <JPEG Image data>
> > > --myboundary
> > > .
> > > 
> > > 
> > > 
> > > Thanks for your time
> > > 
> > > David
> > 
> > No virus found in this incoming message.
> > Checked by AVG - www.avg.com
> > Version: 9.0.869 / Virus Database: 271.1.1/3248 - Release Date: 11/10/10
> > 19:34:00
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.869 / Virus Database: 271.1.1/3248 - Release Date: 11/10/10
> 19:34:00
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.869 / Virus Database: 271.1.1/3248 - Release Date: 11/10/10
19:34:00




reply via email to

[Prev in Thread] Current Thread [Next in Thread]