diff --git a/Projects/la_mojo/build b/Projects/la_mojo/build index 8c1e4e77..5181f2f3 100755 --- a/Projects/la_mojo/build +++ b/Projects/la_mojo/build @@ -7,7 +7,7 @@ #make clean -e "CFG=LRF_Proxy_ONLY" #make -e "CFG=LRF_Proxy_ONLY" -j$(nproc) -make clean -e "CFG=Debug86" +#make clean -e "CFG=Debug86" make -e "CFG=Debug86" -j$(nproc) #cd Debug86 #strip ./mojo_d diff --git a/Projects/la_mojo/la_mojo.vpj b/Projects/la_mojo/la_mojo.vpj index efa94c0e..25b41c8d 100644 --- a/Projects/la_mojo/la_mojo.vpj +++ b/Projects/la_mojo/la_mojo.vpj @@ -371,7 +371,7 @@ - + Query(tQBuf); + result = m_pDataStatistics->Query(tQBuf); + //result = m_pDataStorage->Query(tQBuf); if (result != NULL) { if (result->size() > 0) diff --git a/lib/App/common/deviceNodeCamera.cpp b/lib/App/common/deviceNodeCamera.cpp index 3be8cce4..d25e3a60 100644 --- a/lib/App/common/deviceNodeCamera.cpp +++ b/lib/App/common/deviceNodeCamera.cpp @@ -478,10 +478,14 @@ bool deviceNodeCamera::create() { sprintf(tURI, "http://%s%s", m_sCamData.ip, m_sCamData.onvif_ctrl); }; + LOG("PTZ BUILD URI"); + LOG(tURI); m_pProtocol = (protocolPTZ *) new protocolPTZ_ONVIF(tURI, m_sCamData.username, m_sCamData.password, m_sCamData.auth_mode); } else { + LOG("USE FULL PTZ URI"); + LOG(m_sCamData.onvif_ctrl); m_pProtocol = (protocolPTZ *) new protocolPTZ_ONVIF(m_sCamData.onvif_ctrl, m_sCamData.username, m_sCamData.password, m_sCamData.auth_mode); }; #ifdef DEBUG_EXTRA @@ -1267,10 +1271,14 @@ void deviceNodeCamera::m_fThreadProc(void) { sprintf(tURI, "http://%s%s", m_sCamData.ip, m_sCamData.onvif_ctrl); }; + LOG("PTZ URI CREATE"); + LOG( tURI ); m_pProtocol = (protocolPTZ *) new protocolPTZ_ONVIF(tURI, m_sCamData.username, m_sCamData.password, m_sCamData.auth_mode); } else { + LOG("PTZ USE"); + LOG( m_sCamData.onvif_ctrl ); m_pProtocol = (protocolPTZ *) new protocolPTZ_ONVIF(m_sCamData.onvif_ctrl, m_sCamData.username, m_sCamData.password, m_sCamData.auth_mode); }; #ifdef DEBUG_EXTRA diff --git a/lib/App/common/hardwareManager.cpp b/lib/App/common/hardwareManager.cpp index 8953066f..8aa390dc 100644 --- a/lib/App/common/hardwareManager.cpp +++ b/lib/App/common/hardwareManager.cpp @@ -1842,6 +1842,9 @@ DBC_INT_LIST * hardwareManager::requestResourcesByType(HARDWARE_PROVIDERS type) #include #include +#include +#include + bool hardwareManager::updateSysInfo(DBC_SYS_LOAD_INFO * ptr) { if (ptr == NULL) @@ -1903,36 +1906,28 @@ bool hardwareManager::updateSysInfo(DBC_SYS_LOAD_INFO * ptr) }; // const uint32_t MB = 1 << 10;//(1024 * 1024);// * 1024; - if (statvfs("/", &DI) == 0) - { + if( statvfs("/", &DI) == 0 ){ ptr->T_DISK = (DI.f_blocks * (unsigned long long) DI.f_frsize) >> 10; // / MB; // cDISK = ( DI.f_bavail * (unsigned long long) DI.f_bsize ) >> 10;// / MB; ptr->C_DISK = ptr->T_DISK - ((DI.f_bfree * (unsigned long long) DI.f_bsize) >> 10); ptr->disk = 100.0f * (float) ptr->C_DISK / (float) ptr->T_DISK; - } - else - { + } else { LOG_ERROR("Error while getting Disk Info!"); }; // Temperature reading ptr->temperature = -1; - if (fileExist("/sys/class/thermal")) - { + if (fileExist("/sys/class/thermal")){ char tB[128]; // Check first 8 zones to find CPU one - for (uint8_t i = 0; i < 8; i++) - { + for (uint8_t i = 0; i < 8; i++){ sprintf(tB, "/sys/class/thermal/thermal_zone%d", i); - if (fileExist(tB)) - { + if (fileExist(tB)){ sprintf(tB, "/sys/class/thermal/thermal_zone%d/type", i); - if (fileExist(tB)) - { + if (fileExist(tB)){ FILE * fd = fopen(tB, "r"); readLine(fd, tB, 128); fclose(fd); - if (strcasestr(tB, "cpu") != NULL || strcasestr(tB, "x86_pkg") != NULL || strcasestr(tB, "acpitz") != NULL) - { + if (strcasestr(tB, "cpu") != NULL || strcasestr(tB, "x86_pkg") != NULL || strcasestr(tB, "acpitz") != NULL){ sprintf(tB, "/sys/class/thermal/thermal_zone%d/temp", i); FILE * fd = fopen(tB, "r"); readLine(fd, tB, 128); @@ -1940,19 +1935,67 @@ bool hardwareManager::updateSysInfo(DBC_SYS_LOAD_INFO * ptr) ptr->temperature = ((float) atoll(tB)) / 1000.0f; break; }; - } - else - { + } else { continue; - } - } - else - { + }; + } else { break; - } + }; }; - }; - + }; + if ( ptr->temperature < 0 ) { + //still have problem to read temp + // last chance -> use lm-sensors + if( sensors_init(nullptr) == 0 ) { + int chip_nr = 0; + const sensors_chip_name* chip; + // 2. Iterate through all detected sensor chips + while ((chip = sensors_get_detected_chips(nullptr, &chip_nr)) != nullptr) { + //char chip_name_buf[256]; + //sensors_snprintf_chip_name(chip_name_buf, sizeof(chip_name_buf), chip); + //LOG( chip_name_buf ); + //LOG( chip->prefix ); + + int feat_nr = 0; + const sensors_feature* feature; + + // 3. Iterate through all features of the current chip + while ((feature = sensors_get_features(chip, &feat_nr)) != nullptr) { + // Filter strictly for Temperature Features + if (feature->type == SENSORS_FEATURE_TEMP) { + // Get the user-friendly label for this sensor (e.g., "Core 0", "CPU Temperature") + //char* label = sensors_get_label(chip, feature); + //LOG((label ? label : "Unknown")); + //if( label ) free( label ); // Must free the label returned by libsensors + // 4. Find the main subfeature containing the actual reading (input value) + const sensors_subfeature* subfeature = sensors_get_subfeature(chip, feature, SENSORS_SUBFEATURE_TEMP_INPUT); + if (subfeature != nullptr) { + double val = 0.0; + // 5. Inquiry the actual temperature reading + if ( sensors_get_value(chip, subfeature->number, &val) == 0 ) { + //char tB[128]; + //sprintf( tB, "T: %0.3f °C", val ); + //LOG( tB ); + if ( val > 0.0 ) { + ptr->temperature = ( float ) val; + break; + }; + } else { + LOG_ERROR("[Error reading value]"); + }; + } else { + LOG_ERROR("[No input channel found]"); + }; + }; + }; + if ( ptr->temperature > 0.0f ) { + break; + }; + }; + // 6. Clean up resources allocated by the library + sensors_cleanup(); + }; + }; return m_pDBC->updateServerUtilisation(ptr); } diff --git a/lib/App/common/kernelModuleEmbedVideo.h b/lib/App/common/kernelModuleEmbedVideo.h index 4f23c780..aa719902 100644 --- a/lib/App/common/kernelModuleEmbedVideo.h +++ b/lib/App/common/kernelModuleEmbedVideo.h @@ -8,7 +8,7 @@ extern const char * m_pVideoScratchPath; -//#define EVE_WORK_WITH_MEDIAMTX +#define EVE_WORK_WITH_MEDIAMTX #define EVE_OUTPUT_PICTURES 1 #define EVE_OUTPUT_VIDEO 2 diff --git a/lib/data/media/video/videoAVLIBSource.cpp b/lib/data/media/video/videoAVLIBSource.cpp index 948c4000..9e43bab3 100644 --- a/lib/data/media/video/videoAVLIBSource.cpp +++ b/lib/data/media/video/videoAVLIBSource.cpp @@ -286,7 +286,8 @@ bool videoAVLIBSource::_restart(void) { case AVLIB_SOURCE_DDSHOW: { - AVInputFormat * iformat = av_find_input_format("dshow"); + //const added for ffmpeg 60 + const AVInputFormat * iformat = av_find_input_format("dshow"); if ((RetVal = avformat_open_input(&m_pVideoState->m_pFormatCtx, m_pVideoState->m_pFileName, iformat, &m_pVideoState->m_pFormatOpts)) != 0) { char tB[2048]; @@ -379,7 +380,8 @@ bool videoAVLIBSource::_restart(void) LOG("YABABA-2!"); #endif /* find the video stream information */ - m_pVideoState->m_iVideoStreamID = av_find_best_stream(m_pVideoState->m_pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, &m_pVideoState->m_pVideoCodec, 0); + //cast ffmpeg 60 + m_pVideoState->m_iVideoStreamID = av_find_best_stream(m_pVideoState->m_pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, const_cast(&m_pVideoState->m_pVideoCodec), 0); if (m_pVideoState->m_iVideoStreamID == -1) { @@ -552,7 +554,7 @@ bool videoAVLIBSource::_open(char * URI, bool ShowDeviceMenu, float framerate, i // av_dict_set(&m_pVideoState->m_pFormatOpts, "show_video_crossbar_connection_dialog", "true", 0); // AVInputFormat * is Internal Const in CoDec Lib - AVInputFormat * iformat = av_find_input_format("dshow"); + const AVInputFormat * iformat = av_find_input_format("dshow"); // av_dict_set(&options, "pixel_format", "bgr24", 0); av_dict_set(&m_pVideoState->m_pFormatOpts, "timeout", "5000", 0); // AVDeviceInfoList *device_list; @@ -745,7 +747,7 @@ bool videoAVLIBSource::_open(char * URI, bool ShowDeviceMenu, float framerate, i LOG("YABABA-2!"); #endif /* find the video stream information */ - m_pVideoState->m_iVideoStreamID = av_find_best_stream(m_pVideoState->m_pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, &m_pVideoState->m_pVideoCodec, 0); + m_pVideoState->m_iVideoStreamID = av_find_best_stream(m_pVideoState->m_pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, const_cast(&m_pVideoState->m_pVideoCodec), 0); if (m_pVideoState->m_iVideoStreamID == -1) { @@ -804,12 +806,16 @@ bool videoAVLIBSource::_open(char * URI, bool ShowDeviceMenu, float framerate, i return false; }; + //ffmpeg 6 removes AV_CODEC_CAP_TRUNCATED and AV_CODEC_FLAG_TRUNCATED +#if (LIBAVCODEC_VERSION_MAJOR >= 60 ) +#else /* we do not send complete frames */ if (m_pVideoState->m_pVideoCodec->capabilities & AV_CODEC_CAP_TRUNCATED) { m_pVideoState->m_pCodecCtx->flags |= AV_CODEC_CAP_TRUNCATED; } +#endif // LIBAVCODEC_VERSION_MAJOR 60 #ifndef _NOAUDIO_ m_pVideoState->m_pAudioCtx = m_pVideoState->m_pFormatCtx->streams[m_pVideoState->m_iAudioStreamID]->codec; m_pVideoState->m_pAudioCodec = avcodec_find_decoder(m_pVideoState->m_pAudioCtx->codec_id); diff --git a/lib/data/media/video/videoLive555AVLibSource.cpp b/lib/data/media/video/videoLive555AVLibSource.cpp index 14ca9eee..2febe573 100644 --- a/lib/data/media/video/videoLive555AVLibSource.cpp +++ b/lib/data/media/video/videoLive555AVLibSource.cpp @@ -124,12 +124,13 @@ DummySink::DummySink(videoLIVE555Source * session, UsageEnvironment & env, Media }; m_pCodecContext = avcodec_alloc_context3(m_pCodec); - +#if (LIBAVCODEC_VERSION_MAJOR >= 60) +#else if (m_pCodec->capabilities & AV_CODEC_CAP_TRUNCATED) { m_pCodecContext->flags |= AV_CODEC_FLAG_TRUNCATED; // we do not send complete frames }; - +#endif // (LIBAVCODEC_VERSION_MAJOR >= 60) if ((m_sSubSession.videoWidth() > 0) && (m_sSubSession.videoHeight() > 0)) { m_nInWidth = m_sSubSession.videoWidth(); @@ -171,7 +172,8 @@ DummySink::DummySink(videoLIVE555Source * session, UsageEnvironment & env, Media if (m_pOutStream != NULL) { - AVCodec *codec = avcodec_find_decoder( m_pOutStream->codecpar->codec_id ); + // v60 + const AVCodec *codec = avcodec_find_decoder( m_pOutStream->codecpar->codec_id ); AVCodecContext * c = avcodec_alloc_context3( codec );//m_pOutStream->codec; c->codec_id = m_eCodecProbe; c->codec_type = AVMEDIA_TYPE_VIDEO; diff --git a/lib/data/media/video/videoLive555AVLibSource.h b/lib/data/media/video/videoLive555AVLibSource.h index 3be97002..8f4ad122 100644 --- a/lib/data/media/video/videoLive555AVLibSource.h +++ b/lib/data/media/video/videoLive555AVLibSource.h @@ -110,7 +110,8 @@ class DummySink : public MediaSink H264or5VideoFileSink * qtOut; FILE * m_pOutFile[2]; uint8_t m_nCurrentOutFile; - AVCodec * m_pCodec; + // const avlib v6 + const AVCodec * m_pCodec; AVCodecContext * m_pCodecContext; AVCodec * m_pOutCodec;