Valkka
1.6.1
OpenSource Video Management
|
A thread-safe combination of a fifo (first-in-first-out) queue and an associated stack. More...
#include <framefifo.h>
Public Member Functions | |
FrameFifo (const char *name, FrameFifoContext ctx=FrameFifoContext()) | |
Default ctor | |
virtual | ~FrameFifo () |
Default virtual dtor | |
ban_copy_ctor (FrameFifo) | |
ban_copy_asm (FrameFifo) | |
Reservoir & | getReservoir (FrameClass cl) |
Get the reservoir .. in the case you want to manipulate the frames. | |
virtual bool | writeCopy (Frame *f, bool wait=false) |
Take a frame "ftmp" from the stack, copy contents of "f" into "ftmp" and insert "ftmp" into the beginning of the fifo (i.e. perform "copy-on-insert"). The size of "ftmp" is also checked and set to target_size, if necessary. If wait is set to true, will wait until there are frames available in the stack. More... | |
virtual Frame * | read (unsigned short int mstimeout=0) |
Pop a frame from the end of the fifo when available. | |
virtual void | recycle (Frame *f) |
Like FrameFifo::recycle_ but with mutex protection. | |
virtual void | recycleAll () |
Recycle all frames from fifo back to stack (make a "flush") | |
virtual void | dumpStacks () |
Dump frames in the stacks. | |
virtual void | dumpFifo () |
Dump frames in the fifo. | |
virtual void | diagnosis () |
Print a resumen of fifo and stack usage. | |
bool | isEmpty () |
Tell if fifo is empty. | |
Protected Member Functions | |
virtual void | recycle_ (Frame *f) |
Return Frame f back into the stack. Update target_size if necessary. | |
virtual void | recycleAll_ () |
Recycle all frames back to the stack. | |
Protected Attributes | |
std::string | name |
FrameFifoContext | ctx |
Parameters defining the stack and overflow behaviour. | |
std::map< FrameClass, Reservoir > | reservoirs |
The actual frames. | |
std::map< FrameClass, Stack > | stacks |
Pointers to the actual frames, sorted by FrameClass. | |
Fifo | fifo |
The fifo queue. | |
std::mutex | mutex |
The Lock. | |
std::condition_variable | condition |
The Event/Flag. | |
std::condition_variable | ready_condition |
The Event/Flag for FrameFifo::ready_mutex. | |
A thread-safe combination of a fifo (first-in-first-out) queue and an associated stack.
Frame instances are placed into FrameFifo with FrameFifo::writeCopy that draws a Frame from the stack and performs a copy of the frame.
If no frames are available, an "overflow" occurs. The behaviour at overflow event can be defined (see FrameFifoContext).
When Frame has been used, it should be returned to the FrameFifo by calling FrameFifo::recycle. This returns the Frame to the stack.
|
virtual |
Take a frame "ftmp" from the stack, copy contents of "f" into "ftmp" and insert "ftmp" into the beginning of the fifo (i.e. perform "copy-on-insert"). The size of "ftmp" is also checked and set to target_size, if necessary. If wait is set to true, will wait until there are frames available in the stack.
Reimplemented in RGBFrameFifo, OpenGLFrameFifo, LiveFifo, and FDFrameFifo.