Image Component Library (ICL)
Public Member Functions | Private Attributes | List of all members
icl::io::dc::DCFrameQueue Class Reference

Internal used utility class for fast handling of DMA buffers. More...

#include <DCFrameQueue.h>

Public Member Functions

ICLIO_API DCFrameQueue (dc1394camera_t *c, DCDeviceOptions *options, int nDMABuffers=5, int nQueuedBuffers=1)
 Creates a new DCFrameQueue objects with given camera, DMABuffer size and count of queued buffers. More...
 
ICLIO_API ~DCFrameQueue ()
 releases the internal camera using icl::dc::release_dc_cam() More...
 
ICLIO_API void step ()
 performs a new step More...
 
dc1394video_frame_t * front ()
 returns the oldest frame in the queue More...
 
dc1394video_frame_t * back ()
 returns the newest frame in the queue More...
 
void lock ()
 locks the queue More...
 
void unlock ()
 unlocks the queue More...
 
ICLIO_API void push (dc1394video_frame_t *f)
 pushes a new frame to the back of the internal queue (auto lock()/unlock()) More...
 
ICLIO_API dc1394video_frame_t * pop ()
 pops the oldest frame from the front of the internal queue (auto lock()/unlock()) More...
 
ICLIO_API void showDetails () const
 shows some debugging information for the wrapped camera More...
 
ICLIO_API void resetBus ()
 calls dc1394_reset_bus (not save!) More...
 

Private Attributes

std::queue< dc1394video_frame_t * > q
 wrapped queue structure More...
 
utils::Mutex mutex
 queue mutex More...
 
dc1394camera_t * m_poCam
 associated camera More...
 
int m_iBuffers
 count of internal used DMA buffers More...
 
int m_iQueuedBuffers
 count of queued buffers More...
 

Detailed Description

Internal used utility class for fast handling of DMA buffers.

This Queue implementation initializes the given camera. Then it dequeues all DMA ring buffer frames once, and pushes them into its wrapped std::queue<dc1394video_frame_t*>. After that, it re-enqueues a fixed number (given by the 3rd constructor argument nQueuedBuffers which is set to 2 by default) into the DMA-queue. This buffers are filled continuously with new frame data by the DMA-Thread. After this initialization, the Queue is used by the DCGrabberThread to buffer grabbed image data as fast a possible, and to offer the newest frame safely at any time to other threads.

Constructor & Destructor Documentation

◆ DCFrameQueue()

ICLIO_API icl::io::dc::DCFrameQueue::DCFrameQueue ( dc1394camera_t *  c,
DCDeviceOptions options,
int  nDMABuffers = 5,
int  nQueuedBuffers = 1 
)

Creates a new DCFrameQueue objects with given camera, DMABuffer size and count of queued buffers.

◆ ~DCFrameQueue()

ICLIO_API icl::io::dc::DCFrameQueue::~DCFrameQueue ( )

releases the internal camera using icl::dc::release_dc_cam()

Member Function Documentation

◆ back()

dc1394video_frame_t* icl::io::dc::DCFrameQueue::back ( )
inline

returns the newest frame in the queue

call lock() / unlock() before and after using this function to ensure, that the returned element remains the newest one and that is stays in the loop

◆ front()

dc1394video_frame_t* icl::io::dc::DCFrameQueue::front ( )
inline

returns the oldest frame in the queue

new frames are pushed from the back. call lock() / unlock() before and after using this function to ensure, that the returned element remains the front one and that it stay in the queue

◆ lock()

void icl::io::dc::DCFrameQueue::lock ( )
inline

locks the queue

◆ pop()

ICLIO_API dc1394video_frame_t* icl::io::dc::DCFrameQueue::pop ( )

pops the oldest frame from the front of the internal queue (auto lock()/unlock())

The function internally locks the queue

◆ push()

ICLIO_API void icl::io::dc::DCFrameQueue::push ( dc1394video_frame_t *  f)

pushes a new frame to the back of the internal queue (auto lock()/unlock())

The function internally locks the queue

◆ resetBus()

ICLIO_API void icl::io::dc::DCFrameQueue::resetBus ( )

calls dc1394_reset_bus (not save!)

◆ showDetails()

ICLIO_API void icl::io::dc::DCFrameQueue::showDetails ( ) const

shows some debugging information for the wrapped camera

◆ step()

ICLIO_API void icl::io::dc::DCFrameQueue::step ( )

performs a new step

  • enqueue the oldest frame front() in the DMA-queue and pop() it from the internal queue
  • dequeue a frame F ( this is the newest one now)
  • push F into the internal frame

◆ unlock()

void icl::io::dc::DCFrameQueue::unlock ( )
inline

unlocks the queue

Member Data Documentation

◆ m_iBuffers

int icl::io::dc::DCFrameQueue::m_iBuffers
private

count of internal used DMA buffers

◆ m_iQueuedBuffers

int icl::io::dc::DCFrameQueue::m_iQueuedBuffers
private

count of queued buffers

◆ m_poCam

dc1394camera_t* icl::io::dc::DCFrameQueue::m_poCam
private

associated camera

◆ mutex

utils::Mutex icl::io::dc::DCFrameQueue::mutex
private

queue mutex

◆ q

std::queue<dc1394video_frame_t*> icl::io::dc::DCFrameQueue::q
private

wrapped queue structure


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