CVD::DiskBuffer2< T > Class Template Reference
[Video buffers]

#include <diskbuffer2.h>

Inheritance diagram for CVD::DiskBuffer2< T >:

CVD::LocalVideoBuffer< T > CVD::VideoBuffer< T > CVD::TimedDiskBuffer< T >

List of all members.


Detailed Description

template<typename T>
class CVD::DiskBuffer2< T >

Play a series of image files as a video stream.

Provides frames of type CVD::DiskBuffer2Frame and throws exceptions of type CVD::Exceptions::DiskBuffer2

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 91 of file diskbuffer2.h.


Public Member Functions

 DiskBuffer2 (const std::vector< std::string > &names, double fps, VideoBufferFlags::OnEndOfBuffer eob=VideoBufferFlags::RepeatLastFrame)
virtual ImageRef size ()
virtual bool frame_pending ()
virtual
DiskBuffer2Frame< T > * 
get_frame ()
virtual void put_frame (VideoFrame< T > *f)
virtual void seek_to (double t)
virtual void on_end_of_buffer (VideoBufferFlags::OnEndOfBuffer eob)
virtual double frame_rate ()

Protected Attributes

ImageRef my_size
int next_frame
double start_time
double time_per_frame
double frames_per_sec
bool frame_ready
std::vector
< std::string > 
file_names
VideoBufferFlags::OnEndOfBuffer end_of_buffer_behaviour

Related Functions

(Note that these are not member functions.)

std::vector
< std::string > 
globlist (const std::string &gl)

Constructor & Destructor Documentation

template<typename T>
CVD::DiskBuffer2< T >::DiskBuffer2 ( const std::vector< std::string > &  names,
double  fps,
VideoBufferFlags::OnEndOfBuffer  eob = VideoBufferFlags::RepeatLastFrame 
) [inline]

Construct a DiskBuffer2 from a vector of filenames.

Typically the globlist() helper function is used to provide the filenames e.g. DiskBuffer2 buffer(globlist("~/Images/lab*.jpg"), 25);

Parameters:
names The filenames to use (played in the order that they are in the vector)
fps The frames per second to report for this VideoBuffer
eob What should the buffer do when it reaches the end of the list of files?

Definition at line 137 of file diskbuffer2.h.

References CVD::DiskBuffer2< T >::file_names, CVD::DiskBuffer2< T >::frame_ready, CVD::DiskBuffer2< T >::frames_per_sec, CVD::img_load(), CVD::DiskBuffer2< T >::my_size, CVD::DiskBuffer2< T >::next_frame, CVD::SubImage< T >::size(), CVD::DiskBuffer2< T >::start_time, and CVD::DiskBuffer2< T >::time_per_frame.


Member Function Documentation

template<typename T>
virtual ImageRef CVD::DiskBuffer2< T >::size (  )  [inline, virtual]

The size of the VideoFrames returned by this buffer.

Implements CVD::LocalVideoBuffer< T >.

Definition at line 102 of file diskbuffer2.h.

References CVD::DiskBuffer2< T >::my_size.

template<typename T>
virtual bool CVD::DiskBuffer2< T >::frame_pending (  )  [inline, virtual]

Is there another frame waiting in the buffer? By default, this always returns true, but if the VideoBufferFlags::OnEndOfBuffer setting is VideoBufferFlags::UnsetPending, this will return false after the last frame has been returned by get_frame().

Implements CVD::LocalVideoBuffer< T >.

Definition at line 107 of file diskbuffer2.h.

References CVD::DiskBuffer2< T >::frame_ready.

Referenced by CVD::DiskBuffer2< T >::get_frame().

template<typename T>
DiskBuffer2Frame< T > * CVD::DiskBuffer2< T >::get_frame (  )  [inline, virtual]

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

Implements CVD::LocalVideoBuffer< T >.

Reimplemented in CVD::TimedDiskBuffer< T >.

Definition at line 175 of file diskbuffer2.h.

References CVD::DiskBuffer2< T >::end_of_buffer_behaviour, CVD::DiskBuffer2< T >::file_names, CVD::DiskBuffer2< T >::frame_pending(), CVD::DiskBuffer2< T >::frame_ready, CVD::img_load(), CVD::VideoBufferFlags::Loop, CVD::DiskBuffer2< T >::my_size, CVD::DiskBuffer2< T >::next_frame, CVD::VideoBufferFlags::RepeatLastFrame, CVD::DiskBuffer2< T >::start_time, CVD::DiskBuffer2< T >::time_per_frame, and CVD::VideoBufferFlags::UnsetPending.

Referenced by CVD::TimedDiskBuffer< T >::get_frame().

template<typename T>
void CVD::DiskBuffer2< T >::put_frame ( VideoFrame< T > *  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< T >.

Definition at line 227 of file diskbuffer2.h.

template<typename T>
void CVD::DiskBuffer2< T >::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< T >.

Definition at line 242 of file diskbuffer2.h.

References CVD::DiskBuffer2< T >::file_names, CVD::DiskBuffer2< T >::frame_ready, CVD::DiskBuffer2< T >::next_frame, CVD::DiskBuffer2< T >::start_time, and CVD::DiskBuffer2< T >::time_per_frame.

template<typename T>
virtual void CVD::DiskBuffer2< T >::on_end_of_buffer ( VideoBufferFlags::OnEndOfBuffer  eob  )  [inline, virtual]

What should the buffer do when it reaches the end of the list of files?

Parameters:
eob The desired behaviour

Definition at line 115 of file diskbuffer2.h.

References CVD::DiskBuffer2< T >::end_of_buffer_behaviour.

template<typename T>
virtual double CVD::DiskBuffer2< T >::frame_rate (  )  [inline, virtual]

What is the (expected) frame rate of this video buffer, in frames per second?

Implements CVD::VideoBuffer< T >.

Definition at line 118 of file diskbuffer2.h.

References CVD::DiskBuffer2< T >::frames_per_sec.


Friends And Related Function Documentation

template<typename T>
std::vector< std::string > globlist ( const std::string &  gl  )  [related]

Make a list of strings from a UNIX-style pattern pathname expansion.

Tilde expansion is done, and * ? [] and {} can all be used as normal. The filenames are returned in alphabetical (and numerical) order.

Parameters:
gl The pattern from which to generate the strings


The documentation for this class was generated from the following file:
Generated on Wed Feb 18 10:23:06 2009 for CVD by  doxygen 1.5.3