Fawkes API  Fawkes Development Version
mjpeg_reply.h
1 
2 /***************************************************************************
3  * mjpeg_reply.h - Web request MJPEG stream reply
4  *
5  * Created: Wed Feb 05 17:54:06 2014
6  * Copyright 2006-2014 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __PLUGINS_WEBVIEW_MJPEG_REPLY_H_
24 #define __PLUGINS_WEBVIEW_MJPEG_REPLY_H_
25 
26 #include "jpeg_stream_producer.h"
27 
28 #include <webview/reply.h>
29 #include <cstdio>
30 
31 namespace fawkes {
32 #if 0 /* just to make Emacs auto-indent happy */
33 }
34 #endif
35 
37 : public DynamicWebReply,
39 {
40  public:
43 
44  virtual size_t size();
45  virtual size_t next_chunk(size_t pos, char *buffer, size_t buf_max_size);
46 
47  virtual void handle_buffer(RefPtr<WebviewJpegStreamProducer::Buffer> buffer) throw();
48  private:
49  WebviewJpegStreamProducer *stream_producer_;
50 
52  size_t buffer_bytes_written_;
53 
55  fawkes::Mutex *next_buffer_mutex_;
56  fawkes::WaitCondition *next_buffer_waitcond_;
57 
58  bool next_frame_;
59 };
60 
61 } // end namespace fawkes
62 
63 #endif
Wait until a given condition holds.
virtual ~DynamicMJPEGStreamWebReply()
Destructor.
Definition: mjpeg_reply.cpp:64
Fawkes library namespace.
virtual void handle_buffer(RefPtr< WebviewJpegStreamProducer::Buffer > buffer)
Notification if a new buffer is available.
Definition: mjpeg_reply.cpp:78
virtual size_t size()
Total size of the web reply.
Definition: mjpeg_reply.cpp:72
Dynamic web reply.
Definition: reply.h:123
Dynamic raw file transfer reply.
Definition: mjpeg_reply.h:36
DynamicMJPEGStreamWebReply(WebviewJpegStreamProducer *stream_producer)
Constructor.
Definition: mjpeg_reply.cpp:51
RefPtr<> is a reference-counting shared smartpointer.
Definition: refptr.h:49
virtual size_t next_chunk(size_t pos, char *buffer, size_t buf_max_size)
Get data of next chunk.
Definition: mjpeg_reply.cpp:87
Mutex mutual exclusion lock.
Definition: mutex.h:32