Browse Source

Fixing Camera init

pull/7/head
Evgeny Gagua 4 months ago
parent
commit
9996a3c684
  1. 143
      lib/App/common/kernelModuleEmbedVideo.cpp
  2. 12
      lib/App/common/kernelModuleModemManager.cpp
  3. 44
      lib/App/common/streamHandler.cpp
  4. 3
      lib/data/media/video/videoAVLIBSource.cpp

143
lib/App/common/kernelModuleEmbedVideo.cpp

@ -489,7 +489,7 @@ void * kernelModuleEmbedVideo::webClientProc(void * ptr)
#ifdef HAVE_SMAL_PREVIEW_STREAMS #ifdef HAVE_SMAL_PREVIEW_STREAMS
}; };
#endif #endif
#ifdef DEBUG_EXTRA
#ifdef DEBUG_EXTRA_X
TLOG("VFEED Sent No Signal Image!"); TLOG("VFEED Sent No Signal Image!");
#endif #endif
} }
@ -1658,33 +1658,27 @@ bool kernelModuleEmbedVideo::validate()
bool RetVal = true; bool RetVal = true;
deviceNode ** tA = NULL; deviceNode ** tA = NULL;
uint32_t tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_ANALOG_STATIC_CAMERA, tA); uint32_t tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_ANALOG_STATIC_CAMERA, tA);
if (! tCNT)
{
tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_ANALOG_PTZ_CAMERA, tA);
if (! tCNT)
{
tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_IP_STATIC_CAMERA, tA);
if (! tCNT)
{
tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_IP_PTZ_CAMERA, tA);
if (! tCNT)
{
tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_IP_PRESET_CAMERA, tA);
if (! tCNT)
{
tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_ANALOG_PRESET_CAMERA, tA);
};
};
if( tCNT ){
for (uint32_t i = 0; i < tCNT; i++){
deviceNodeCamera * tCAM = (deviceNodeCamera *) tA[i];
if (! registerStream(tCAM->getCamStream(), tCAM->getFlipMode())){
RetVal = false;
// tCAM->set
continue;
}; };
}; };
free(tA);
tA = NULL;
#ifdef DEBUG_EXTRA
} else {
LOG("No Static Camera Defined/Enabled In the system!");
#endif
}; };
if (tCNT)
{
for (uint32_t i = 0; i < tCNT; i++)
{
tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_ANALOG_PTZ_CAMERA, tA);
if( tCNT ){
for (uint32_t i = 0; i < tCNT; i++){
deviceNodeCamera * tCAM = (deviceNodeCamera *) tA[i]; deviceNodeCamera * tCAM = (deviceNodeCamera *) tA[i];
if (! registerStream(tCAM->getCamStream(), tCAM->getFlipMode()))
{
if (! registerStream(tCAM->getCamStream(), tCAM->getFlipMode())){
RetVal = false; RetVal = false;
// tCAM->set // tCAM->set
continue; continue;
@ -1693,35 +1687,94 @@ bool kernelModuleEmbedVideo::validate()
free(tA); free(tA);
tA = NULL; tA = NULL;
#ifdef DEBUG_EXTRA #ifdef DEBUG_EXTRA
}
else
{
LOG("No Camera Defined/Enabled In the system!");
} else {
LOG("No Analog Static Camera Defined/Enabled In the system!");
#endif #endif
}; };
if (RetVal)
{
tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_IP_STATIC_CAMERA, tA);
if( tCNT ){
for (uint32_t i = 0; i < tCNT; i++){
deviceNodeCamera * tCAM = (deviceNodeCamera *) tA[i];
if (! registerStream(tCAM->getCamStream(), tCAM->getFlipMode())){
RetVal = false;
// tCAM->set
continue;
};
};
free(tA);
tA = NULL;
#ifdef DEBUG_EXTRA
} else {
LOG("No IP Static Camera Defined/Enabled In the system!");
#endif
};
tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_IP_PTZ_CAMERA, tA);
if( tCNT ){
for (uint32_t i = 0; i < tCNT; i++){
deviceNodeCamera * tCAM = (deviceNodeCamera *) tA[i];
if (! registerStream(tCAM->getCamStream(), tCAM->getFlipMode())){
RetVal = false;
// tCAM->set
continue;
};
};
free(tA);
tA = NULL;
#ifdef DEBUG_EXTRA
} else {
LOG("No IP PTZ Camera Defined/Enabled In the system!");
#endif
};
tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_IP_PRESET_CAMERA, tA);
if( tCNT ){
for (uint32_t i = 0; i < tCNT; i++){
deviceNodeCamera * tCAM = (deviceNodeCamera *) tA[i];
if (! registerStream(tCAM->getCamStream(), tCAM->getFlipMode())){
RetVal = false;
// tCAM->set
continue;
};
};
free(tA);
tA = NULL;
#ifdef DEBUG_EXTRA
} else {
LOG("No IP Preset Camera Defined/Enabled In the system!");
#endif
};
tCNT = deviceNodeFactory::getInstance()->fetchNodes(ARGUS_ANALOG_PRESET_CAMERA, tA);
if( tCNT ){
for (uint32_t i = 0; i < tCNT; i++){
deviceNodeCamera * tCAM = (deviceNodeCamera *) tA[i];
if (! registerStream(tCAM->getCamStream(), tCAM->getFlipMode())){
RetVal = false;
// tCAM->set
continue;
};
};
free(tA);
tA = NULL;
#ifdef DEBUG_EXTRA
} else {
LOG("No Analog Preset Camera Defined/Enabled In the system!");
#endif
};
if (RetVal){
DBC_INT_LIST tInvalidList; DBC_INT_LIST tInvalidList;
m_mStreamHandlersProtector.lock(); m_mStreamHandlersProtector.lock();
for (mapSTREAMHANDLERS::iterator idx = m_mapHANDLERS.begin(); idx != m_mapHANDLERS.end(); idx++)
{
if ((*idx).second != NULL)
{
if (! (*idx).second->validate())
{
for (mapSTREAMHANDLERS::iterator idx = m_mapHANDLERS.begin(); idx != m_mapHANDLERS.end(); idx++) {
if ((*idx).second != NULL){
if (! (*idx).second->validate()){
tInvalidList.push_back((*idx).first); tInvalidList.push_back((*idx).first);
}
}
};
};
}; };
m_mStreamHandlersProtector.unlock(); m_mStreamHandlersProtector.unlock();
if (tInvalidList.size())
{
for (DBC_INT_LIST::iterator idx = tInvalidList.begin(); idx != tInvalidList.end(); idx++)
{
if (unregisterStream(*idx))
{
if (tInvalidList.size()){
for (DBC_INT_LIST::iterator idx = tInvalidList.begin(); idx != tInvalidList.end(); idx++){
if (unregisterStream(*idx)){
registerStream(*idx); registerStream(*idx);
}
};
}; };
tInvalidList.clear(); tInvalidList.clear();
}; };

12
lib/App/common/kernelModuleModemManager.cpp

@ -355,20 +355,16 @@ void kernelModuleModemManager::m_fThreadProc(void)
break; break;
}; };
}; };
}
else
{
} else {
char ttB[65]; char ttB[65];
sprintf(ttB, "No Phone Book Record [%d]!", nCurrentPhoneBookId); sprintf(ttB, "No Phone Book Record [%d]!", nCurrentPhoneBookId);
LOG_ERROR(ttB); LOG_ERROR(ttB);
sessionStarted = false;
//sessionStarted = false;
setWM(MDM_IDLE_WM); setWM(MDM_IDLE_WM);
}; };
}
else
{
} else {
LOG("Finished Fetching all call rcpt or there no rcpt!"); LOG("Finished Fetching all call rcpt or there no rcpt!");
// sessionStarted = false;
nCurrentPhoneBookId = 0;
setWM(MDM_IDLE_WM); setWM(MDM_IDLE_WM);
}; };
break; break;

44
lib/App/common/streamHandler.cpp

@ -202,6 +202,7 @@ bool streamHandler::create(dataBinder * ptr, uint32_t stremID)
case 'A': m_pSource = (basicMediaSource *) new videoAVLIBSource(&m_sSourceDesc); break; case 'A': m_pSource = (basicMediaSource *) new videoAVLIBSource(&m_sSourceDesc); break;
case 'D': case 'D':
{ {
/*
// Check Auth mode if basic - Override and use AVLIB // Check Auth mode if basic - Override and use AVLIB
// To Debug LIVE555 ONLY // To Debug LIVE555 ONLY
if (1 || tCAM->auth_mode == 0) if (1 || tCAM->auth_mode == 0)
@ -211,10 +212,15 @@ bool streamHandler::create(dataBinder * ptr, uint32_t stremID)
break; break;
} }
else else
{
{
m_pSource = (basicMediaSource *) new videoLIVE555Source(&m_sSourceDesc); m_pSource = (basicMediaSource *) new videoLIVE555Source(&m_sSourceDesc);
break; break;
};
};
*/
//m_pSource = (basicMediaSource *) new videoLIVE555Source(&m_sSourceDesc);
m_cSourceType = 'A'; // To use corect Destructor!
m_pSource = (basicMediaSource *) new videoAVLIBSource(&m_sSourceDesc);
break; break;
}; };
}; };
@ -254,43 +260,34 @@ bool streamHandler::create(dataBinder * ptr, uint32_t stremID)
{ {
sprintf(tMRL, "%s://%s:%s@%s:%d%s", m_sStreamData.mrl_proto, tCAM->username, tCAM->password, tCAM->ip, m_sStreamData.mrl_port, m_sStreamData.mrl); sprintf(tMRL, "%s://%s:%s@%s:%d%s", m_sStreamData.mrl_proto, tCAM->username, tCAM->password, tCAM->ip, m_sStreamData.mrl_port, m_sStreamData.mrl);
}; };
if (m_pSource->_open(tMRL, false, -1.0f, pix, m_sStreamData.width, m_sStreamData.height, tW, tH))
{
if (! m_pSource->attachDestination(this))
{
switch (m_cSourceType)
{
#ifdef DEBUG_EXTRA
LOG( tMRL );
#endif
if (m_pSource->_open(tMRL, false, -1.0f, pix, m_sStreamData.width, m_sStreamData.height, tW, tH)){
if (! m_pSource->attachDestination(this)){
switch (m_cSourceType){
case 'D': delete((videoLIVE555Source *) m_pSource); break; case 'D': delete((videoLIVE555Source *) m_pSource); break;
case 'A': delete((videoAVLIBSource *) m_pSource); break; case 'A': delete((videoAVLIBSource *) m_pSource); break;
}; };
m_pSource = NULL; m_pSource = NULL;
}
else
{
} else {
#ifdef DEBUG_EXTRA #ifdef DEBUG_EXTRA
LOG("Source is Connected to Output."); LOG("Source is Connected to Output.");
#endif #endif
}; };
}
else
{
} else {
LOG_ERROR("Can not Open Video Source!"); LOG_ERROR("Can not Open Video Source!");
switch (m_cSourceType)
{
switch (m_cSourceType) {
case 'D': delete((videoLIVE555Source *) m_pSource); break; case 'D': delete((videoLIVE555Source *) m_pSource); break;
case 'A': delete((videoAVLIBSource *) m_pSource); break; case 'A': delete((videoAVLIBSource *) m_pSource); break;
}; };
m_pSource = NULL; m_pSource = NULL;
}; };
}
else
{
} else {
LOG_ERROR("Video Source Stream Failure!"); LOG_ERROR("Video Source Stream Failure!");
}; };
free(tCAM); free(tCAM);
}
else
{
} else {
LOG_ERROR("Error Getting CAM Data!"); LOG_ERROR("Error Getting CAM Data!");
m_pSource = NULL; m_pSource = NULL;
return false; return false;
@ -298,8 +295,7 @@ bool streamHandler::create(dataBinder * ptr, uint32_t stremID)
}; };
}; };
if (m_pSource)
{
if ( m_pSource ){
#ifdef EVE_ENABLE_VIDEO #ifdef EVE_ENABLE_VIDEO
return initVideoOutput(); return initVideoOutput();
#else #else

3
lib/data/media/video/videoAVLIBSource.cpp

@ -1,6 +1,7 @@
#include "videoAVLIBSource.h" #include "videoAVLIBSource.h"
#ifndef LRF_PROXY_ONLY #ifndef LRF_PROXY_ONLY
//#define DEBUG_EXTRA
#include "libavutil/error.h" #include "libavutil/error.h"
@ -1173,4 +1174,6 @@ bool videoAVLIBSource::isFinished(void)
#undef LOG #undef LOG
#undef LOG_ERROR #undef LOG_ERROR
//#undef DEBUG_EXTRA
#endif //! LRF_PROXY_ONLY #endif //! LRF_PROXY_ONLY
Loading…
Cancel
Save