iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::VideoReaderBase Class Referenceabstract

#include <nrt/ImageProc/IO/ImageSource/VideoReaders/details/VideoReaderBase.H>

A base class for video readers.

VideoReaderBase is an abstract base class for video file readers. A class which inherits from VideoReaderBase can be registered with the VideoSource (and thus, the ImageSource) framework, allowing users to easily read video files handled by your class.

In order to make a new video file reader, you should derive from this class (implementing all of the necessary pure-virtual methods) and then register the class using the NRT_REGISTER_VIDEO_READER(CLASSNAME) macro. Additionally, you must implement:

  • A static std::string id() method which returns the file extensions that your video reader can parse. Multiple choices can be specified by separating them with a '|' character, e.g. "mpg|mpeg".
  • A static std::string description() method which returns a helpful description of your video reader/format.

Optionally, you should also consider implementing a writer class which derives from VideoWriterBase so that users can write as well as read your new video format.

See Also
VideoSource
ImageSource

Definition at line 62 of file VideoReaderBase.H.

Public Member Functions

virtual void open (std::string const &filename)=0
 Open the given filename, and prepare to start reading frames. More...
 
virtual ~VideoReaderBase ()
 Destructor. More...
 
virtual bool const seek (size_t const frameNumber)=0
 Seek to the requested frame such that the next call to in() will read that frame. More...
 
virtual GenericImage const in ()=0
 Read the current frame, and seek to the next frame.
 
virtual FrameRange const frameRange ()=0
 Get the frame range of the video file.
 
virtual size_t const nextFrameNumber ()=0
 Get the number of the frame that will be returned by the next call to in()
 
virtual bool const ok ()=0
 Return whether or not a subsequent call to in() will return a valid frame. More...
 

Constructor & Destructor Documentation

virtual nrt::VideoReaderBase::~VideoReaderBase ( )
inlinevirtual

Destructor.

The destructor must clean up any allocated resources

Definition at line 74 of file VideoReaderBase.H.

Member Function Documentation

virtual void nrt::VideoReaderBase::open ( std::string const &  filename)
pure virtual

Open the given filename, and prepare to start reading frames.

This method must completely prepare the class such that an immediately subsequent call to in() should not fail. Additionally, this method may be called repeatedly with different filenames so it must clean up any allocated resources.

virtual bool const nrt::VideoReaderBase::seek ( size_t const  frameNumber)
pure virtual

Seek to the requested frame such that the next call to in() will read that frame.

If the given frameNumber is out of bounds, then this method should return false and take no other action.

virtual bool const nrt::VideoReaderBase::ok ( )
pure virtual

Return whether or not a subsequent call to in() will return a valid frame.

Gennerally, this function should check to make sure that the video file is open, and that the current frame number is within the bounds returned by frameRange()


The documentation for this class was generated from the following file: