Image Component Library (ICL)
|
Internally spawned thread class to provide continuous grabbing without drop frames. More...
#include <DCGrabberThread.h>
Public Member Functions | |
virtual ICLIO_API void | run () |
the thread function (moved frames) More... | |
ICLIO_API void | resetBus () |
internally calls dc1394_reset_bus (not save!) More... | |
Public Member Functions inherited from icl::utils::Thread | |
Thread () | |
Create a new Thread. More... | |
virtual | ~Thread () |
Destructor (if the thread is still running, it is ended) More... | |
void | start () |
starts the thread More... | |
virtual void | stop () |
stops the thread and waits till it is ended More... | |
void | wait () |
waits for this thread to be ended More... | |
virtual void | finalize () |
at the end of the stop function, this function is called More... | |
bool | running () const |
returns the internal running state More... | |
bool | runningNoLock () const |
returns the running state of the thread (without locking the mutex) More... | |
Public Member Functions inherited from icl::utils::ShallowCopyable< ThreadImpl, ThreadImplDelOp > | |
bool | isNull () const |
returns wheter the objects implementation holds a null pointer More... | |
Static Public Member Functions | |
static ICLIO_API void | stopAllGrabberThreads () |
called by the signal handler to stop all grabber threads More... | |
Static Public Member Functions inherited from icl::utils::Thread | |
static void | usleep (unsigned int usec) |
just calling usleep More... | |
static void | msleep (unsigned int msecs) |
sets the current thread to sleep for some milli-seconds More... | |
static void | sleep (float secs) |
sets the current thread to sleep for some seconds More... | |
Private Member Functions | |
DCGrabberThread (dc1394camera_t *c, DCDeviceOptions *options) | |
private constructor )can only be called by icl::DCGrabber More... | |
~DCGrabberThread () | |
Destructor. More... | |
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 More... | |
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) More... | |
dc1394video_frame_t * | waitForNextImageFrame () |
Private Attributes | |
DCFrameQueue * | m_poFrameQueue |
internally used DCFrameQueue object More... | |
dc1394camera_t * | m_poCam |
Associated camera. More... | |
std::vector< icl8u > | m_oRGBInterleavedBuffer |
internally used buffer for RGB-Bayer image conversion More... | |
DCDeviceOptions * | m_poOptions |
Parents DCGrabbers options pointer. More... | |
utils::Time | m_lastFramesTimeStamp |
to remember the time stamp of the last frame grabbed More... | |
Friends | |
class | icl::io::DCGrabber |
A DCGrabberThread can only be instantiated by a DCGrabber. More... | |
Additional Inherited Members | |
Public Types inherited from icl::utils::ShallowCopyable< ThreadImpl, ThreadImplDelOp > | |
typedef ShallowCopyable< ThreadImpl, ThreadImplDelOp > | ParentSC |
Protected Member Functions inherited from icl::utils::Thread | |
void | exit () |
exits the thread using pthread_exit (must be called from within the run function) More... | |
void | lock () |
internal used lock function More... | |
int | trylock () |
internal used trylock function More... | |
void | unlock () |
internal used unlock function More... | |
void | join () |
internal used join function More... | |
Protected Member Functions inherited from icl::utils::ShallowCopyable< ThreadImpl, ThreadImplDelOp > | |
ShallowCopyable (ThreadImpl *t=0) | |
create a the implementation with a given T* value More... | |
Protected Attributes inherited from icl::utils::ShallowCopyable< ThreadImpl, ThreadImplDelOp > | |
SmartPtrBase< ThreadImpl, ThreadImplDelOp > | impl |
shared pointer for the classes implementation More... | |
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.
|
private |
private constructor )can only be called by icl::DCGrabber
|
private |
Destructor.
|
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 !
|
private |
returns the current image directly (if no desried parameters are set)
ICLIO_API void icl::io::dc::DCGrabberThread::resetBus | ( | ) |
internally calls dc1394_reset_bus (not save!)
|
virtual |
the thread function (moved frames)
Implements icl::utils::Thread.
|
static |
called by the signal handler to stop all grabber threads
|
private |
|
friend |
A DCGrabberThread can only be instantiated by a DCGrabber.
|
private |
to remember the time stamp of the last frame grabbed
|
private |
internally used buffer for RGB-Bayer image conversion
|
private |
Associated camera.
|
private |
internally used DCFrameQueue object
|
private |
Parents DCGrabbers options pointer.