OpenVideo Documentation

   Main Page       Modules       Class Hierarchy       Alphabetical List       Compound List       File List       Compound Members       Related Pages   

openvideo::State Class Reference
[Core Classes]

A State is used to pass data along OpenVideo's graph. More...

#include <State.h>

Inherited by openvideo::DSVLSrcState, openvideo::ImageSrcState, openvideo::TestSrcState, openvideo::V4L2SrcState, and openvideo::VideoWrapperSrcState.

List of all members.

Public Member Functions

 State ()
virtual ~State ()
void clear ()
void addElement (std::string key, void *value)
void * getElementData (std::string key)
void removeElement (std::string key)
virtual BuffergetCurrentBuffer ()
void unlockAllBuffers ()
BufferfindFreeBuffer ()
int getNumFrames () const
int getNumLockedBuffers () const

Public Attributes

int width
int height
PIXEL_FORMAT format

Protected Attributes

BufferVector buffers
BuffercurrentBuffer

Private Attributes

std::map< std::string, void * > elements


Detailed Description

A State is used to pass data along OpenVideo's graph.

An OpenTracker node passes exactly one state object to all of its children. Since each node is allowed to create a new State a node can in turn access multiple states.
The Statet implementation holds variables specific for video data like (image)width, (image)height, image(format) or the current(frame). On top of this, a State implements the ability to share any arbitraty data in its elements map. Therefore It provides functions to set, access and remove those data from the map.
The following drawing demonstrates the use of multiple State objects in an OpenVideo graph.

Stategraph.gif

Definition at line 104 of file State.h.


Constructor & Destructor Documentation

openvideo::State::State  )  [inline]
 

constructor

Definition at line 234 of file State.h.

References clear().

openvideo::State::~State  )  [inline, virtual]
 

destructor

Definition at line 238 of file State.h.

References clear().


Member Function Documentation

void openvideo::State::addElement std::string  key,
void *  value
[inline]
 

Adds an Element to the element map.

Definition at line 253 of file State.h.

References elements.

void openvideo::State::clear  )  [inline]
 

Clear the entire State.

Definition at line 244 of file State.h.

References currentBuffer, elements, format, openvideo::FORMAT_UNKNOWN, height, and width.

Referenced by openvideo::VideoWrapperSrc::init(), openvideo::V4L2Src::init(), openvideo::TestSrc::init(), openvideo::OpenCVSrc::init(), openvideo::ImageSrc::init(), openvideo::DSVLSrc::init(), State(), and ~State().

Buffer * openvideo::State::findFreeBuffer  ) 
 

Returns a frame with state STATE_UNUSED. If no frame can be found, NULL is returned.

Definition at line 86 of file State.cxx.

References buffers.

Referenced by openvideo::VideoWrapperSrc::process(), openvideo::TestSrc::process(), openvideo::DSVLSrc::process(), and openvideo::V4L2Src::processImage().

virtual Buffer* openvideo::State::getCurrentBuffer  )  [inline, virtual]
 

Returns the latest updated buffer.

Definition at line 153 of file State.h.

Referenced by openvideo::GLUTSink::process(), and openvideo::GL_TEXTURE_2D_Sink::process().

void * openvideo::State::getElementData std::string  key  )  [inline]
 

Returns an element from the map.

Definition at line 259 of file State.h.

References elements.

int openvideo::State::getNumFrames  )  const [inline]
 

Definition at line 162 of file State.h.

int openvideo::State::getNumLockedBuffers  )  const
 

Definition at line 97 of file State.cxx.

References buffers.

void openvideo::State::removeElement std::string  key  )  [inline]
 

Remove an element from the map.

Definition at line 269 of file State.h.

References elements.

void openvideo::State::unlockAllBuffers  ) 
 

Unlocks all frame buffers.

Definition at line 78 of file State.cxx.

References buffers.

Referenced by openvideo::DSVLSrc::~DSVLSrc(), openvideo::ImageSrc::~ImageSrc(), and openvideo::V4L2Src::~V4L2Src().


Member Data Documentation

BufferVector openvideo::State::buffers [protected]
 

Definition at line 174 of file State.h.

Referenced by findFreeBuffer(), openvideo::VideoWrapperSrcState::getBuffers(), openvideo::V4L2SrcState::getBuffers(), openvideo::TestSrcState::getBuffers(), openvideo::ImageSrcState::getBuffers(), openvideo::DSVLSrcState::getBuffers(), getNumLockedBuffers(), unlockAllBuffers(), openvideo::DSVLSrcState::~DSVLSrcState(), and openvideo::ImageSrcState::~ImageSrcState().

Buffer* openvideo::State::currentBuffer [protected]
 

Definition at line 175 of file State.h.

Referenced by clear(), openvideo::VideoWrapperSrcState::setCurrentBuffer(), openvideo::V4L2SrcState::setCurrentBuffer(), openvideo::ImageSrcState::setCurrentBuffer(), and openvideo::DSVLSrcState::setCurrentBuffer().

std::map<std::string,void*> openvideo::State::elements [private]
 

A map to store additional data in the State.

Definition at line 170 of file State.h.

Referenced by addElement(), clear(), getElementData(), and removeElement().

PIXEL_FORMAT openvideo::State::format
 

Store the image format.

Definition at line 130 of file State.h.

Referenced by clear(), openvideo::DSVLSrcBuffer::DSVLSrcBuffer(), openvideo::ImageSrcBuffer::ImageSrcBuffer(), openvideo::VideoWrapperSrc::init(), openvideo::V4L2Src::init(), openvideo::ImageSrc::init(), openvideo::DSVLSrc::init(), openvideo::OpenCVSrc::process(), openvideo::TestSrcBuffer::TestSrcBuffer(), and openvideo::VideoWrapperSrcBuffer::VideoWrapperSrcBuffer().

int openvideo::State::height
 

Store the image height.

Definition at line 125 of file State.h.

Referenced by clear(), openvideo::DSVLSrcBuffer::DSVLSrcBuffer(), openvideo::ImageSrcBuffer::ImageSrcBuffer(), openvideo::VideoWrapperSrc::init(), openvideo::V4L2Src::init(), openvideo::TestSrc::init(), openvideo::OpenCVSrc::init(), openvideo::ImageSrc::init(), openvideo::GLUTSink::init(), openvideo::GL_TEXTURE_2D_Sink::init(), openvideo::DSVLSrc::init(), openvideo::OpenCVSrc::process(), openvideo::TestSrcBuffer::TestSrcBuffer(), and openvideo::VideoWrapperSrcBuffer::VideoWrapperSrcBuffer().

int openvideo::State::width
 

Store the image width.

Definition at line 120 of file State.h.

Referenced by clear(), openvideo::DSVLSrcBuffer::DSVLSrcBuffer(), openvideo::ImageSrcBuffer::ImageSrcBuffer(), openvideo::VideoWrapperSrc::init(), openvideo::V4L2Src::init(), openvideo::TestSrc::init(), openvideo::OpenCVSrc::init(), openvideo::ImageSrc::init(), openvideo::GLUTSink::init(), openvideo::GL_TEXTURE_2D_Sink::init(), openvideo::DSVLSrc::init(), openvideo::OpenCVSrc::process(), openvideo::TestSrcBuffer::TestSrcBuffer(), and openvideo::VideoWrapperSrcBuffer::VideoWrapperSrcBuffer().


The documentation for this class was generated from the following files:
 This page was generated at Wed May 31 13:04:19 2006 for OpenVideo by Doxygen.
 If you have any comments, please send a message to schmalstieg@icg.tu-graz.ac.at.
www.studierstube.org