Browse Source

Fixed VideoStub locking

AGP
Evgeny Gagua at Mercury 7 years ago
parent
commit
3b4ed8f3ed
  1. 2
      lib/components/base/basicCamera.h
  2. 2
      lib/components/base/basicMediaSource.h
  3. 6
      lib/components/base/basicThread.cpp
  4. 1
      lib/components/object/objectCameraPTZ.cpp
  5. 14
      lib/components/object/objectStaticCamera.cpp
  6. 6
      lib/data/media/video/videoAVLIBSource.cpp
  7. 2
      lib/data/media/videoNode.cpp
  8. 8
      lib/gui/controls/OGLRadarWidget.cpp
  9. 2
      lib/gui/controls/targetDisplay.cpp

2
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;
};
};

2
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.

6
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 );
};

1
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;

14
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){
};
};
#undef LOG
#undef ERROR_LOG

6
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 ){

2
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();

8
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){

2
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){

Loading…
Cancel
Save