oZone Server Framework
Enabling Innovation in Video Applications
MatrixVideo Class Reference

#include <ozMatrixVideo.h>

Inheritance diagram for MatrixVideo:

Public Member Functions

 MatrixVideo (const std::string &name, PixelFormat pixelFormat, int width, int height, FrameRate frameRate, int xTiles=2, int yTiles=2)
 
PixelFormat pixelFormat () const
 Return the image format of video frames supplied by this provider.
 
uint16_t width () const
 Return the width (in pixels) of video frames supplied by this provider.
 
uint16_t height () const
 Return the height (in pixels) of video frames supplied by this provider.
 
FrameRate frameRate () const
 Return the frame rate at this this provider supplies frames. May not be available or accurate.
 
bool registerProvider (FeedProvider &provider, const FeedLink &link=gQueuedFeedLink)
 
bool deregisterProvider (FeedProvider &provider, bool reciprocate=true)
 
- Public Member Functions inherited from VideoConsumer
VideoProvidervideoProvider () const
 Return the first provider cast appropriately, shortcut for when providers == 1. More...
 
- Public Member Functions inherited from FeedConsumer
virtual bool deregisterAllProviders ()
 
FeedProviderprovider () const
 Return the first provider, shortcut for when providers == 1.
 
virtual bool hasProvider () const
 
virtual bool hasProvider (FeedProvider &provider) const
 
virtual bool queueFrame (const FramePtr &, FeedProvider *)
 
- Public Member Functions inherited from FeedBase
const std::string & cl4ss () const
 Return the class string.
 
const char * cclass () const
 Return the class string as a c-style string.
 
const std::string & name () const
 Return the name string.
 
const char * cname () const
 Return the name string as a c-style string.
 
const std::string & identity () const
 Return the identity string.
 
const char * cidentity () const
 Return the identity string as a c-style string.
 
- Public Member Functions inherited from FeedProvider
bool hasVideo () const
 Provides video frames.
 
bool hasAudio () const
 Provides audio frames.
 
virtual bool registerConsumer (FeedConsumer &consumer, const FeedLink &link=gQueuedFeedLink)
 
virtual bool deregisterConsumer (FeedConsumer &consumer, bool reciprocate=true)
 
virtual bool hasConsumer () const
 
virtual bool hasConsumer (FeedConsumer &consumer) const
 
bool wait () const
 Indicate whether this provider is ready to supply frames.
 
bool ready () const
 
bool ended () const
 
bool error () const
 
bool frameReady (uint64_t lastFrameCount) const
 Return true if there is a new frame available that the one supplied.
 
uint64_t frameCount () const
 Return the number of frames this provider has supplied.
 
bool canPoll () const
 Indicate whether this provider can supply frames by polling.
 
void setPolling (bool poll)
 Enable the polled frame interface if supported.
 
FramePtr pollFrame () const
 Return a reference to the last generated frame. More...
 
- Public Member Functions inherited from Thread
pid_t tid () const
 < Return the thread id
 
void start ()
 Start the thread and invoke the run method, called by invoker.
 
void stop ()
 Stop the thread, by setting the mStop flag. Thread is responsible for actually existing.
 
void join ()
 Wait for the thread to terminate.
 
bool isThread ()
 
bool running () const
 < Indicate whether the thread is running or not
 
bool stopped () const
 < Indicate whether the thread has been signalled to stop
 

Protected Member Functions

int run ()
 
- Protected Member Functions inherited from VideoConsumer
 VideoConsumer (const std::string &tag, const std::string &id, int providerLimit=1)
 
 VideoConsumer (const std::string &tag, FeedProvider &provider, const FeedLink &link=gQueuedFeedLink)
 
- Protected Member Functions inherited from FeedConsumer
 FeedConsumer (int providerLimit=1)
 
 FeedConsumer (FeedProvider &provider, const FeedLink &link=gQueuedFeedLink)
 
bool waitForProviders (unsigned int=0)
 
bool checkProviders ()
 Verify that providers exist and are in good condition. More...
 
virtual void cleanup ()
 Tidy up relationships with providers etc before destruction.
 
- Protected Member Functions inherited from FeedBase
void setIdentity (const std::string &cl4ss, const std::string &name)
 Identify this instance.
 
- Protected Member Functions inherited from VideoProvider
 VideoProvider (const std::string &tag, const std::string &id)
 
- Protected Member Functions inherited from FeedProvider
virtual void distributeFrame (const FramePtr &frame)
 Pass a frame on to all registered consumers. More...
 
void addToMap ()
 Add this provider to the static provider map.
 
void removeFromMap ()
 Remove this provider from the static provider map.
 
virtual void cleanup ()
 Tidy up relations before destruction.
 
void setReady ()
 
void setEnded ()
 
void setError ()
 
- Protected Member Functions inherited from Thread
 Thread (const std::string &threadLabel)
 
 Thread (const char *threadLabel="...")
 
pid_t id () const
 
void exit (long int status=0)
 

Additional Inherited Members

- Public Types inherited from FeedConsumer
typedef std::map< FeedProvider *, FeedLinkProviderMap
 
typedef std::deque< FramePtrFrameQueue
 
- Public Types inherited from FeedProvider
enum  State { PROV_ERROR =-1, PROV_WAIT, PROV_READY, PROV_ENDED }
 
- Public Types inherited from Thread
typedef void *(* ThreadFunc) (void *)
 
- Static Public Member Functions inherited from FeedBase
static std::string makeIdentity (const std::string &cl4ss, const std::string &name)
 Build identity from the class and name strings.
 
- Static Public Member Functions inherited from FeedProvider
static FeedProviderfind (const std::string &identity)
 Locate a provider with the given identity. More...
 
static bool videoFramesOnly (const FramePtr &, const FeedConsumer *)
 Comparator function to allow consumers to select only video frames. More...
 
static bool audioFramesOnly (const FramePtr &, const FeedConsumer *)
 Comparator function to allow consumers to select only audio frames. More...
 
static bool dataFramesOnly (const FramePtr &, const FeedConsumer *)
 Comparator function to allow consumers to select only data frames. More...
 
static bool noFrames (const FramePtr &, const FeedConsumer *)
 Comparator function that can be used to suppress frames.
 
- Protected Types inherited from FeedProvider
typedef std::deque< FeedConsumer * > ConsumerList
 
typedef std::map< FeedConsumer *, FeedLinkConsumerMap
 
- Static Protected Member Functions inherited from Thread
static void * mThreadFunc (void *arg)
 
- Protected Attributes inherited from FeedConsumer
Mutex mQueueMutex
 Protects the frame queue.
 
FrameQueue mFrameQueue
 Queue of frames from providers that are ready to be handled.
 
int mProviderLimit
 Max number of providers, many consumers can only have one.
 
Mutex mProviderMutex
 Protects the provider map.
 
ProviderMap mProviders
 Collection of providers.
 
- Protected Attributes inherited from FeedBase
std::string mClass
 Identifier for the class of provider/consumer.
 
std::string mName
 Unique identifier of this provider/consumer instance.
 
- Protected Attributes inherited from FeedProvider
State mState
 Provider state.
 
uint64_t mFrameCount
 Number of frames, advisory only.
 
bool mCanPoll
 Whether consumers can request frames on demand.
 
Mutex mFrameMutex
 Protects the 'on-demand' frame.
 
FramePtr mLastFrame
 The 'on-demand' frame.
 
Mutex mConsumerMutex
 Protects the consumers.
 
ConsumerMap mConsumers
 Collection of frame consumer.
 
bool mHasVideo
 
bool mHasAudio
 
- Protected Attributes inherited from Thread
pthread_t mThread
 Base pthread data.
 
std::string mThreadLabel
 Label to help identify the thread.
 
Mutex mThreadMutex
 Mutex protecting this thread from concurrent access.
 
Condition mThreadCondition
 Used to signal thread states to invoking process/thread.
 
pid_t mTid
 Thread id.
 
bool mRunning
 Flag indicating whether this thread has begun and is running.
 
bool mStop
 Flag indicating whether this thread has been signalled to stop.
 
- Static Protected Attributes inherited from FeedBase
static const int INTERFRAME_TIMEOUT = 10000
 Needs to be short enough to cope with all possible frame rates.This allows for 100fps.
 
- Static Protected Attributes inherited from FeedProvider
static const int RECONNECT_TIMEOUT = 1
 How long to wait before reconnecting to a lost source, in seconds.
 

Detailed Description

Processor that amalgamates video streams into a mxn matrix video matrix. Can easily be extended for other geometries but the overall image size must be exactly divisble by the number of tiles. Bit of a kludge implementation, a more flexible variant should be possible using ffmpeg filters.

Definition at line 17 of file ozMatrixVideo.h.

Constructor & Destructor Documentation

MatrixVideo::MatrixVideo ( const std::string &  name,
PixelFormat  pixelFormat,
int  width,
int  height,
FrameRate  frameRate,
int  xTiles = 2,
int  yTiles = 2 
)
Parameters
nameInstance name
pixelFormatformat of image (PIX_FMT_YUV420 or other AVPixelFormat types)
widthaTotal width of matrix
heightTotal height of matrix
frameRateframerate per second to update the matrix feeds
xTilesm (of mxn tiles)
yTilesn (of mxn tiles)
MatrixVideo matrixVideo( "matrixcammux", PIX_FMT_YUV420P, 640, 480, FrameRate( 1, 10 ), 2, 2 );
matrixVideo.registerProvider( cam1 );
matrixVideo.registerProvider( *motionDetector1.deltaImageSlave() );
matrixVideo.registerProvider( cam2 );
matrixVideo.registerProvider( *motionDetector2.deltaImageSlave() );
app.addThread( &matrixVideo );
Parameters
name
pixelFormat
width
height
frameRate
xTiles
yTiles

Definition at line 17 of file ozMatrixVideo.cpp.

Member Function Documentation

bool MatrixVideo::deregisterProvider ( FeedProvider provider,
bool  reciprocate = true 
)
virtual
Parameters
provider
reciprocate
Returns

Reimplemented from FeedConsumer.

Definition at line 79 of file ozMatrixVideo.cpp.

Here is the call graph for this function:

bool MatrixVideo::registerProvider ( FeedProvider provider,
const FeedLink link = gQueuedFeedLink 
)
virtual
Parameters
provider
link
Returns

Reimplemented from FeedConsumer.

Definition at line 55 of file ozMatrixVideo.cpp.

Here is the call graph for this function:

int MatrixVideo::run ( )
protectedvirtual
Returns

Implements Thread.

Definition at line 103 of file ozMatrixVideo.cpp.

Here is the call graph for this function:


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