Add rx timestamp for video cameras

parent c7238050
......@@ -139,7 +139,7 @@ namespace lima
void _read_hw_params();
void _check_video_mode(VideoMode);
void _prepareAcq();
void _startAcqTime();
#ifdef WITH_CONFIG
class _ConfigHandler;
CtConfig::ModuleTypeCallback* _getConfigHandler();
......
......@@ -410,6 +410,7 @@ void CtControl::startAcq()
AutoMutex aLock(m_cond.mutex());
m_ct_video->_startAcqTime();
m_hw->startAcq();
m_status.AcquisitionStatus = AcqRunning;
DEB_TRACE() << "Hardware Acquisition started";
......
......@@ -108,6 +108,7 @@ public:
m_video(video),m_buffer(video.m_video->getBuffer()) {}
virtual ~_InternalImageCBK() {}
Timestamp m_start_time;
protected:
virtual bool newImage(char * data,int width,int height,VideoMode mode);
private:
......@@ -120,10 +121,13 @@ bool CtVideo::_InternalImageCBK::newImage(char * data,int width,int height,Video
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR4((void*)data,width,height,mode);
bool liveFlag;
AutoMutex aLock(m_video.m_cond.mutex());
if(m_video.m_stopping_live) return false;
Timestamp now = Timestamp::now();
liveFlag = m_video.m_pars.live;
int image_counter = (int) m_video.m_image_counter + 1;
aLock.unlock();
......@@ -136,6 +140,7 @@ bool CtVideo::_InternalImageCBK::newImage(char * data,int width,int height,Video
lima::image2YUV((unsigned char*)data,width,height,mode,(unsigned char*)ptr);
HwFrameInfoType frame_info;
frame_info.acq_frame_nb = image_counter;
frame_info.frame_timestamp = now - m_start_time;
m_buffer.newFrameReady(frame_info);
}
// Should happen only when video format is not implemented (Debug mode)
......@@ -913,6 +918,10 @@ void CtVideo::_prepareAcq()
m_write_image->frameNumber = -1;
}
void CtVideo::_startAcqTime()
{
m_internal_image_callback->m_start_time = Timestamp::now();
}
#ifdef WITH_CONFIG
CtConfig::ModuleTypeCallback* CtVideo::_getConfigHandler()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment