Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
icl::io::dc::DCGrabberThread Class Reference

Internally spawned thread class to provide continuous grabbing without drop frames. More...

#include <DCGrabberThread.h>

Inheritance diagram for icl::io::dc::DCGrabberThread:
icl::utils::Thread icl::utils::ShallowCopyable< ThreadImpl, ThreadImplDelOp >

List of all members.

Public Member Functions

virtual ICLIO_API void run ()
 the thread function (moved frames)
ICLIO_API void resetBus ()
 internally calls dc1394_reset_bus (not save!)

Static Public Member Functions

static ICLIO_API void stopAllGrabberThreads ()
 called by the signal handler to stop all grabber threads

Private Member Functions

 DCGrabberThread (dc1394camera_t *c, DCDeviceOptions *options)
 private constructor )can only be called by icl::DCGrabber
 ~DCGrabberThread ()
 Destructor.
void getCurrentImage (core::ImgBase **ppoDst, core::ImgBase **ppoDstTmp, bool &desiredParamsFullfilled, const utils::Size &desiredSizeHint, core::format desiredFormatHint, core::depth desiredDepthHint, dc1394color_filter_t bayerLayout, dc1394bayer_method_t bayerMethod=DC1394_BAYER_METHOD_BILINEAR)
 private image access function
void getCurrentImage (core::ImgBase **ppoDst, dc1394color_filter_t bayerLayout, dc1394bayer_method_t bayerMethod=DC1394_BAYER_METHOD_BILINEAR)
 returns the current image directly (if no desried parameters are set)
dc1394video_frame_t * waitForNextImageFrame ()

Private Attributes

DCFrameQueuem_poFrameQueue
 internally used DCFrameQueue object
dc1394camera_t * m_poCam
 Associated camera.
std::vector< icl8um_oRGBInterleavedBuffer
 internally used buffer for RGB-Bayer image conversion
DCDeviceOptionsm_poOptions
 Parents DCGrabbers options pointer.
utils::Time m_lastFramesTimeStamp
 to remember the time stamp of the last frame grabbed

Friends

class icl::io::DCGrabber
 A DCGrabberThread can only be instantiated by a DCGrabber.

Detailed Description

Internally spawned thread class to provide continuous grabbing without drop frames.

Each DCGrabber instance uses a DCGrabberThread, which continuously dequeues and enqueus frames. Each frame can either be inside of the DMA queue or inside of the DCGrabberThreads wrapped DCFrameQueue at on time. The following ASCII art should illustrate this:

          Example: using a 5-frame DMA ring buffer
          DMA-Queue           [ F1 ][ F2 ]
                                                           System-Space
          --------------------------------------------------------------
                                                           User-Space
                                <------------
          DCFrameQueue       [ F3 ][ F4 ][ F5 ] <-- new frames a pushed here
                               /\                   so the newest frame is always
                               |                    QUEUE.back()
                               |
                            old frames move more to the left, the leftest frame is 
                            then removed from the DCFrameQueue and enqeued into the
                            DMA-Queue, where it is filled with new frame data.
          

The DCGrabberThread continuously pops the oldest frame from its internal DCFrameQueue, and enques this frame into the DMA-Queue immediately. Then, it waits for the next frame that was filled by the DMA-Thread by calling dc1394_capture_deque(..,POLICY_WAIT). When this function call returns, the Thread will push the new frame into its internal DCFrameQueue, where it can be accessed by the application by calling the getCurrentImage() function.
Note: As it is strongly recommended not to create an own DCGrabberThread, but to use an instance of the DCGrabber instead, the DCGrabberThread has no public constructor.


Constructor & Destructor Documentation

icl::io::dc::DCGrabberThread::DCGrabberThread ( dc1394camera_t *  c,
DCDeviceOptions options 
) [private]

private constructor )can only be called by icl::DCGrabber

Destructor.


Member Function Documentation

void icl::io::dc::DCGrabberThread::getCurrentImage ( core::ImgBase **  ppoDst,
core::ImgBase **  ppoDstTmp,
bool &  desiredParamsFullfilled,
const utils::Size desiredSizeHint,
core::format  desiredFormatHint,
core::depth  desiredDepthHint,
dc1394color_filter_t  bayerLayout,
dc1394bayer_method_t  bayerMethod = DC1394_BAYER_METHOD_BILINEAR 
) [private]

private image access function

complex function to get the next image The function gets all desired params from the top level grabber, which it should fullfill. But in some cases it's not possible to satisfy all desired params constraints. In this case, this function will use the second given core::ImgBase** (ppoDstTmp) as destination image and it will set the boolean reference named desiredParamsFullfilled to false. The parent grabber can check this variable, to decide whether to use the original destination pointer (ppoDst) or to use the ppoDstTmp pointer temporarily and convert is into ppoDst by itself, using the desired params for ppoDst. TODO: some more text here !

void icl::io::dc::DCGrabberThread::getCurrentImage ( core::ImgBase **  ppoDst,
dc1394color_filter_t  bayerLayout,
dc1394bayer_method_t  bayerMethod = DC1394_BAYER_METHOD_BILINEAR 
) [private]

returns the current image directly (if no desried parameters are set)

internally calls dc1394_reset_bus (not save!)

virtual ICLIO_API void icl::io::dc::DCGrabberThread::run ( ) [virtual]

the thread function (moved frames)

Implements icl::utils::Thread.

called by the signal handler to stop all grabber threads

dc1394video_frame_t* icl::io::dc::DCGrabberThread::waitForNextImageFrame ( ) [private]

Friends And Related Function Documentation

friend class icl::io::DCGrabber [friend]

A DCGrabberThread can only be instantiated by a DCGrabber.


Member Data Documentation

to remember the time stamp of the last frame grabbed

internally used buffer for RGB-Bayer image conversion

dc1394camera_t* icl::io::dc::DCGrabberThread::m_poCam [private]

Associated camera.

internally used DCFrameQueue object

Parents DCGrabbers options pointer.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines