JeVoisBase  1.0
JeVois Smart Embedded Machine Vision Toolkit Base Modules
BufferedVideoReader Class Reference

Simple class to read video frames from a movie file, decode them, and buffer them for smooth playback. More...

#include </lab/itti/jevois/software/jevoisbase/src/Components/Utilities/BufferedVideoReader.H>

Inheritance diagram for BufferedVideoReader:
Collaboration diagram for BufferedVideoReader:

Public Member Functions

 BufferedVideoReader (std::string const &instance, size_t bufsize=100)
 Constructor. More...
 
 ~BufferedVideoReader ()
 Virtual destructor for safe inheritance. More...
 
cv::Mat get ()
 Get the next frame as a BGR cv::Mat, or an empty cv::Mat when the movie is finished. More...
 
- Public Member Functions inherited from jevois::Component
 Component (std::string const &instance)
 
virtual ~Component ()
 
std::shared_ptr< ComponentgetSubComponent (std::string const &instance) const
 
std::shared_ptr< Comp > addSubComponent (std::string const &instance, Args &&...args)
 
void removeSubComponent (std::shared_ptr< Comp > &component)
 
void removeSubComponent (std::string const &instance, bool warnIfNotFound=true)
 
std::shared_ptr< Comp > getSubComponent (std::string const &instance) const
 
bool isTopLevel () const
 
bool initialized () const
 
std::string const & className () const
 
std::string const & instanceName () const
 
std::vector< std::string > setParamVal (std::string const &paramdescriptor, T const &val)
 
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 
std::vector< std::pair< std::string, T > > getParamVal (std::string const &paramdescriptor) const
 
getParamValUnique (std::string const &paramdescriptor) const
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 
std::vector< std::pair< std::string, std::string > > getParamString (std::string const &paramdescriptor) const
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 
void freezeParam (std::string const &paramdescriptor)
 
void unFreezeParam (std::string const &paramdescriptor)
 
void freezeAllParams ()
 
void unFreezeAllParams ()
 
std::string descriptor () const
 
void setParamsFromFile (std::string const &filename)
 
std::istream & setParamsFromStream (std::istream &is, std::string const &absfile)
 
void setPath (std::string const &path)
 
std::string absolutePath (std::string const &path="")
 
std::shared_ptr< Comp > addSubComponent (std::string const &instance, Args &&...args)
 
void removeSubComponent (std::shared_ptr< Comp > &component)
 
void removeSubComponent (std::string const &instance, bool warnIfNotFound=true)
 
std::shared_ptr< Comp > getSubComponent (std::string const &instance) const
 
bool isTopLevel () const
 
bool initialized () const
 
std::string const & className () const
 
std::string const & instanceName () const
 
std::vector< std::string > setParamVal (std::string const &paramdescriptor, T const &val)
 
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 
std::vector< std::pair< std::string, T > > getParamVal (std::string const &paramdescriptor) const
 
getParamValUnique (std::string const &paramdescriptor) const
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 
std::vector< std::pair< std::string, std::string > > getParamString (std::string const &paramdescriptor) const
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 
void freezeParam (std::string const &paramdescriptor)
 
void unFreezeParam (std::string const &paramdescriptor)
 
void freezeAllParams ()
 
void unFreezeAllParams ()
 
std::string descriptor () const
 
void setParamsFromFile (std::string const &filename)
 
std::istream & setParamsFromStream (std::istream &is, std::string const &absfile)
 
void setPath (std::string const &path)
 
std::string absolutePath (std::string const &path="")
 
- Public Member Functions inherited from jevois::ParameterRegistry
virtual ~ParameterRegistry ()
 

Protected Member Functions

virtual void postInit () override
 Start the thread that loads, decodes and pushes the frames into our buffer. More...
 
virtual void postUninit () override
 Uninit, wait on our run thread and swallow any exception. More...
 
void run ()
 Reader thread. More...
 
- Protected Member Functions inherited from jevois::Component
virtual void preInit ()
 
virtual void preUninit ()
 
virtual void preInit ()
 
virtual void preUninit ()
 
- Protected Member Functions inherited from jevois::ParameterRegistry
void addParameter (ParameterBase *const param)
 
void removeParameter (ParameterBase *const param)
 
void callbackInitCall ()
 

Related Functions

(Note that these are not member functions.)

#define JEVOIS_DECLARE_PARAMETER(ParamName, ParamType, ...)
 Parameter. More...
 

Detailed Description

Simple class to read video frames from a movie file, decode them, and buffer them for smooth playback.

Reading and decoding is done in a thread, and decoded images are pushed into a producer/consumer queue. When the queue is full, decoding pauses until some images are popped off the queue by some other thread, for example to display them or to send them over USB link.

Definition at line 43 of file BufferedVideoReader.H.

Constructor & Destructor Documentation

BufferedVideoReader::BufferedVideoReader ( std::string const &  instance,
size_t  bufsize = 100 
)

Constructor.

Definition at line 22 of file BufferedVideoReader.C.

BufferedVideoReader::~BufferedVideoReader ( )

Virtual destructor for safe inheritance.

Definition at line 27 of file BufferedVideoReader.C.

Member Function Documentation

cv::Mat BufferedVideoReader::get ( )

Get the next frame as a BGR cv::Mat, or an empty cv::Mat when the movie is finished.

Definition at line 48 of file BufferedVideoReader.C.

References jevois::BoundedBuffer< T, WhenFull, WhenEmpty >::pop().

void BufferedVideoReader::postInit ( )
overrideprotectedvirtual

Start the thread that loads, decodes and pushes the frames into our buffer.

Reimplemented from jevois::Component.

Definition at line 31 of file BufferedVideoReader.C.

References run().

void BufferedVideoReader::postUninit ( )
overrideprotectedvirtual

Uninit, wait on our run thread and swallow any exception.

Reimplemented from jevois::Component.

Definition at line 38 of file BufferedVideoReader.C.

References jevois::BoundedBuffer< T, WhenFull, WhenEmpty >::filled_size(), jevois::BoundedBuffer< T, WhenFull, WhenEmpty >::pop(), and jevois::warnAndIgnoreException().

void BufferedVideoReader::run ( )
protected

Friends And Related Function Documentation

#define JEVOIS_DECLARE_PARAMETER (   ParamName,
  ParamType,
  ... 
)
related

Parameter.


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