diff --git a/lib/components/base/basicCamera.h b/lib/components/base/basicCamera.h index 41b69654..1cbd3e25 100644 --- a/lib/components/base/basicCamera.h +++ b/lib/components/base/basicCamera.h @@ -123,7 +123,7 @@ public: virtual bool init(void){ return true; }; virtual bool stop(void){ if (m_pVideoSource != NULL){ - if (!m_pVideoSource->stop()){ + if (!m_pVideoSource->_stop()){ return false; }; }; diff --git a/lib/components/base/basicMediaSource.h b/lib/components/base/basicMediaSource.h index f86bccd4..4c36b7e4 100644 --- a/lib/components/base/basicMediaSource.h +++ b/lib/components/base/basicMediaSource.h @@ -33,7 +33,7 @@ public: return false; }; void setStreaming(bool T){ m_bStreamingSource = T; }; - virtual bool stop(void){ return true; }; + virtual bool _stop(void){ return true; }; MediaStateStatus getStatus( void ){ return m_eMediaStatus;}; // Copy constructor // TODO: Uncomment the copy constructor when you need it. diff --git a/lib/components/base/basicThread.cpp b/lib/components/base/basicThread.cpp index 69dc358a..34be81a7 100644 --- a/lib/components/base/basicThread.cpp +++ b/lib/components/base/basicThread.cpp @@ -16,10 +16,12 @@ basicThread::basicThread(){ // Destructor implementation basicThread::~basicThread(){ - if( m_bThreadStatus > TH_PRE_INIT ) { + if (m_bThreadStatus > TH_ARMED ) { waitThreadEnd( true ); + // JOIN in Wait function!! + //pthread_detach(m_sThreadHandler); + //pthread_join(m_sThreadHandler, NULL); }; - pthread_detach( m_sThreadHandler ); }; diff --git a/lib/components/object/objectCameraPTZ.cpp b/lib/components/object/objectCameraPTZ.cpp index e115fd62..00b2d9f5 100644 --- a/lib/components/object/objectCameraPTZ.cpp +++ b/lib/components/object/objectCameraPTZ.cpp @@ -43,6 +43,7 @@ bool objectCameraPTZ::stop(void){ delete((videoAVLIBSource*)m_pVideoSource); m_pVideoSource = NULL; }; + if (m_pVideoAnalyzer != NULL){ switch (m_pVideoAnalyzer->getType()){ case VA_BLOB_DETECT: delete((blobDetector*)m_pVideoAnalyzer); break; diff --git a/lib/components/object/objectStaticCamera.cpp b/lib/components/object/objectStaticCamera.cpp index 893d7f8b..58150528 100644 --- a/lib/components/object/objectStaticCamera.cpp +++ b/lib/components/object/objectStaticCamera.cpp @@ -1,5 +1,8 @@ #include "objectStaticCamera.h" +#define LOG( X ) m_pLog->Log( "objectStatic", this, X ) +#define LOG_ERROR( X ) m_pLog->Log( "objectStatic", this, _LOG_ERROR, X ) + objectStaticCamera::objectStaticCamera(config_setting_t *Settings) : basicCamera( Settings ){ m_pLog = basicLogCollection::getInstance(); }; @@ -111,6 +114,7 @@ bool objectStaticCamera::create(void){ }; return true; }; + bool objectStaticCamera::create(mediaSourceInfo *SI){ /* This Method Only to Create New Instances */ if ( m_pSettings == NULL) return false; @@ -120,6 +124,10 @@ bool objectStaticCamera::create(mediaSourceInfo *SI){ float tfVal; int tiVal; pSetting = config_setting_add(m_pSettings, BCI_TAG_OPTIC_DATA_ENA, CONFIG_TYPE_BOOL); + if (pSetting == NULL){ + LOG_ERROR("Some Trouble to create Camera Settings!"); + return false; + }; if (SI->FLMin > 0 && SI->FLMax > 0){ config_setting_set_bool(pSetting, true); m_sCameraInfo.m_bOpticEna = true; @@ -223,4 +231,8 @@ void objectStaticCamera::updateSettings(void){ }; void objectStaticCamera::dispatchEvent(basicEvent *Evt){ -}; \ No newline at end of file +}; + + +#undef LOG +#undef ERROR_LOG \ No newline at end of file diff --git a/lib/data/media/video/videoAVLIBSource.cpp b/lib/data/media/video/videoAVLIBSource.cpp index aa101e59..3854d666 100644 --- a/lib/data/media/video/videoAVLIBSource.cpp +++ b/lib/data/media/video/videoAVLIBSource.cpp @@ -276,7 +276,7 @@ bool videoAVLIBSource::_open(char *URI, bool ShowDeviceMenu, float framerate, in av_dict_set(&options, "framerate", tChar, 0); //av_dict_set(&options, "frame_rate", tChar, 0); }; - av_dict_set(&options, "pixel_format", "mjpeg", 0); + //av_dict_set(&options, "pixel_format", "mjpeg", 0); //av_dict_set(&options, "timeout", "8000", 0); int RetVal = 0; if( ( RetVal = avformat_open_input(&m_pVideoState->m_pFormatCtx, URI, NULL, &options) ) != 0 ){ @@ -500,8 +500,8 @@ void videoAVLIBSource::m_fThreadProc( void ){ #endif if( RetVal < 0 ){ LOG_ERROR( "MediaSource::DecoderProc - Decode Error." ); - //m_bThreadStatus = TH_ENDED; - //m_pVideoState->m_bStatus = MS_STOPED; + m_bThreadStatus = TH_ENDED; + m_pVideoState->m_bStatus = MS_STOPED; continue; }; if( m_bThreadStatus == TH_ENDED ){ diff --git a/lib/data/media/videoNode.cpp b/lib/data/media/videoNode.cpp index c36f6e83..33f3ffd5 100644 --- a/lib/data/media/videoNode.cpp +++ b/lib/data/media/videoNode.cpp @@ -15,7 +15,7 @@ videoNode::~videoNode(){ stopConveyour(); }; void videoNode::stopConveyour(void){ - waitThreadEnd(); + waitThreadEnd(true); if (m_vDestinations.size())m_vDestinations.empty(); if (m_pMatProtector){ //m_pMatProtector->unlock(); diff --git a/lib/gui/controls/OGLRadarWidget.cpp b/lib/gui/controls/OGLRadarWidget.cpp index 19720dfb..bad53e1d 100644 --- a/lib/gui/controls/OGLRadarWidget.cpp +++ b/lib/gui/controls/OGLRadarWidget.cpp @@ -32,7 +32,8 @@ GLRadar::GLRadar(QWidget* parent, const QColor &background) : m_texture(0), m_background(background), QOpenGLWidget(parent), - m_mDataProtectorMutex() + m_mDataProtectorMutex(), + targetDisplay() { m_fAngleX = -65.f; m_fAngleY = 0.f; @@ -51,7 +52,6 @@ GLRadar::GLRadar(QWidget* parent, const QColor &background) m_zOutputBufferSize = 0; }; m_bMustUpdateVBOData = false; - m_pRanges = NULL; m_pActiveRanges = NULL; m_nRangesCount = 0; m_texture = NULL; @@ -68,10 +68,6 @@ GLRadar::~GLRadar(){ if(m_fshader)delete m_fshader; m_vbo.destroy(); doneCurrent(); - if (m_pRanges != NULL){ - //saveToFile("data/draw.raw"); - free(m_pRanges); - }; }; void GLRadar::keyPressEvent(QKeyEvent *event){ diff --git a/lib/gui/controls/targetDisplay.cpp b/lib/gui/controls/targetDisplay.cpp index a795df27..c3ee2435 100644 --- a/lib/gui/controls/targetDisplay.cpp +++ b/lib/gui/controls/targetDisplay.cpp @@ -8,6 +8,8 @@ targetDisplay::targetDisplay(): basicEventHandler() { }; targetDisplay::~targetDisplay(){ + m_pRanges = NULL; + m_nRangesCount = 0; }; void targetDisplay::updateRanges(uint32_t *Ranges, uint32_t count){