CVD::ServerPushJpegBuffer< C > Class Template Reference
[Video buffers]

#include <serverpushjpegbuffer.h>

Inheritance diagram for CVD::ServerPushJpegBuffer< C >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

bool frame_pending ()
double frame_rate ()
 This value is not currently correct.
LocalVideoFrame< C > * get_frame ()
 Returns the next frame from the buffer. This function blocks until a frame is ready.
void put_frame (VideoFrame< C > *f)
void seek_to (double)
 ServerPushJpegBuffer (std::istream &i, bool warnings_=0, int eat_frames=0)
virtual ImageRef size ()
 The size of the VideoFrames returned by this buffer.

Private Member Functions

Image< C > gimme_an_image (std::string &data)

Private Attributes

std::istream & is
ImageRef s
bool warnings

Detailed Description

template<class C>
class CVD::ServerPushJpegBuffer< C >

Play a server push stream as a video stream. This is a standard used by a number of HTTP based security cameras. The format is as follows:

 --ImageSeparator\n
 Content-Type: image/jpeg\r\n
 Content-Length: 123456789\r\n
 \r\n
 <123456789 bytes of JPEG go here>\r\n

This exact format is from the InVision IQEye series of cameras. Other cameras have a different image separator, and do not miss the carriage return.

The buffer reads a number of frames from the stream on initiation (by default 10), in order to flush the camera's inbuilt buffer. With some cameras, changing the video size does not flush the buffer, so the first few frames will be of the incorrect size. After flushing the buffer, the size of the first frame is taken to be the size of the video stream. If spurious frames arrive of a different size later, these will be ignored.

WARNING: error checking is currently very minimal. The result of failure will probably result in an exception being thrown from the JPEG loader.

Parameters:
T The pixel type of the frames to provide (usually CVD::Rgb<CVD::byte> or CVD::byte. If the image files are of a different type, they will be automatically converted (see Image loading and saving, and format conversion).

Definition at line 33 of file serverpushjpegbuffer.h.


Constructor & Destructor Documentation

template<class C >
CVD::ServerPushJpegBuffer< C >::ServerPushJpegBuffer ( std::istream &  i,
bool  warnings_ = 0,
int  eat_frames = 0 
) [inline]

Construct a ServerPushJpegBuffer from an istream. The istream

Parameters:
i The stream to use for video.
warnings Whether to print warnings if mis-sized frames arrive.
eat_frames Number of frames to discard on initialization.

Member Function Documentation

template<class C >
bool CVD::ServerPushJpegBuffer< C >::frame_pending (  )  [inline, virtual]

Is there a frame waiting in the buffer? This function does not block. See is_live and is_flushable.

Implements CVD::LocalVideoBuffer< C >.

Definition at line 63 of file serverpushjpegbuffer.h.

template<class C >
double CVD::ServerPushJpegBuffer< C >::frame_rate (  )  [inline, virtual]

This value is not currently correct.

Implements CVD::RawVideoBuffer.

Definition at line 71 of file serverpushjpegbuffer.h.

template<class C >
LocalVideoFrame<C>* CVD::ServerPushJpegBuffer< C >::get_frame (  )  [inline, virtual]

Returns the next frame from the buffer. This function blocks until a frame is ready.

Implements CVD::LocalVideoBuffer< C >.

Definition at line 35 of file serverpushjpegbuffer.h.

template<class C >
Image<C> CVD::ServerPushJpegBuffer< C >::gimme_an_image ( std::string &  data  )  [inline, private]

Definition at line 81 of file serverpushjpegbuffer.h.

template<class C >
void CVD::ServerPushJpegBuffer< C >::put_frame ( VideoFrame< C > *  f  )  [inline, virtual]

Tell the buffer that you are finished with this frame. Typically the VideoBuffer then destroys the frame.

Parameters:
f The frame that you are finished with.

Implements CVD::LocalVideoBuffer< C >.

Definition at line 53 of file serverpushjpegbuffer.h.

template<class C >
void CVD::ServerPushJpegBuffer< C >::seek_to ( double   )  [inline, virtual]

Go to a particular point in the video buffer (only implemented in buffers of recorded video)

Parameters:
t The frame time in seconds

Reimplemented from CVD::LocalVideoBuffer< C >.

Definition at line 68 of file serverpushjpegbuffer.h.

template<class C >
virtual ImageRef CVD::ServerPushJpegBuffer< C >::size (  )  [inline, virtual]

The size of the VideoFrames returned by this buffer.

Implements CVD::LocalVideoBuffer< C >.

Definition at line 30 of file serverpushjpegbuffer.h.


Member Data Documentation

template<class C >
std::istream& CVD::ServerPushJpegBuffer< C >::is [private]

Definition at line 77 of file serverpushjpegbuffer.h.

template<class C >
ImageRef CVD::ServerPushJpegBuffer< C >::s [private]

Definition at line 78 of file serverpushjpegbuffer.h.

template<class C >
bool CVD::ServerPushJpegBuffer< C >::warnings [private]

Definition at line 79 of file serverpushjpegbuffer.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


libcvd
Author(s): Edward Rosten, Paul Smith, Tom Drummond, Gerhard Reitmayr, Ethan Eade, Timothy Gan, Chris Kemp, Georg Klein
autogenerated on Fri Jan 11 09:13:52 2013