diff --git a/Linux_Workspace.vpw b/Linux_Workspace.vpw index fe3a06f4..78842a0d 100644 --- a/Linux_Workspace.vpw +++ b/Linux_Workspace.vpw @@ -16,6 +16,7 @@ + diff --git a/Projects/MEKOROT/MEKOROT.vpj b/Projects/MEKOROT/MEKOROT.vpj new file mode 100644 index 00000000..bbe5e9ac --- /dev/null +++ b/Projects/MEKOROT/MEKOROT.vpj @@ -0,0 +1,301 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Projects/MEKOROT/MEKOROT_Kernel.cpp b/Projects/MEKOROT/MEKOROT_Kernel.cpp index fb5f09a5..2d0e6132 100644 --- a/Projects/MEKOROT/MEKOROT_Kernel.cpp +++ b/Projects/MEKOROT/MEKOROT_Kernel.cpp @@ -3,6 +3,21 @@ #define LOG( X ) m_pLog->Log( "KRNL", this, X ) #define LOG_ERROR( X ) m_pLog->Log( "KRNL", this, _LOG_ERROR, X ) + +typedef struct _KEY_EVENT_RECORD { + BOOL bKeyDown; + WORD wRepeatCount; + WORD wVirtualKeyCode; + WORD wVirtualScanCode; + union { + WCHAR UnicodeChar; + CHAR AsciiChar; + } uChar; + DWORD dwControlKeyState; +} KEY_EVENT_RECORD; + + + bool getconchar(KEY_EVENT_RECORD& krec) { DWORD cc, NOF; INPUT_RECORD irec; @@ -25,7 +40,13 @@ bool getconchar(KEY_EVENT_RECORD& krec) { } return false; //future ???? }; - +/* + +do + c = getchar(); +while (isspace(c)); + +*/ mekorotKernel::mekorotKernel(config_setting_t* ptr) : basicEngine(), basicThread(), basicMediaDestination(), protocolLGS_2D() { m_pLog = basicLogCollection::getInstance(); @@ -774,7 +795,7 @@ void mekorotKernel::m_fThreadProc(void){ }; }; }; -#include +//#include void mekorotKernel::reg_event( uint8_t devID, float az, float el, float ra, CSTR path ) { FILE* fd; fd = fopen(m_sFSReportName, "a+"); @@ -1051,7 +1072,7 @@ bool mekorotKernel::react(uint8_t devID, protocolPackage* Package){ return true; }; -void mekorotKernel::pushFrame(cv::Mat &Frame, void* src) { +bool mekorotKernel::pushFrame(cv::Mat &Frame, void* src) { //if (src == NULL) { // return; //}; @@ -1119,7 +1140,9 @@ void mekorotKernel::pushFrame(cv::Mat &Frame, void* src) { // Assemble Final Frame; m_nCLoopMask = 0xFFFFFFFF; //}; + return true; }; + return false; }; bool mekorotKernel::copyFrame(cv::Mat& Frame) { diff --git a/Projects/MEKOROT/MEKOROT_Kernel.h b/Projects/MEKOROT/MEKOROT_Kernel.h index 11b4a117..715643c2 100644 --- a/Projects/MEKOROT/MEKOROT_Kernel.h +++ b/Projects/MEKOROT/MEKOROT_Kernel.h @@ -161,7 +161,7 @@ class mekorotKernel: public basicEngine, public basicThread, public basicMediaDe explicit mekorotKernel( config_setting_t *ptr=NULL ); virtual ~mekorotKernel(); virtual bool init(void); - virtual void pushFrame(cv::Mat &Frame, void* src = NULL); + virtual bool pushFrame(cv::Mat &Frame, void* src = NULL); bool copyFrame(cv::Mat &Frame); }; diff --git a/Projects/MEKOROT/makefile b/Projects/MEKOROT/makefile new file mode 100644 index 00000000..fdf4a462 --- /dev/null +++ b/Projects/MEKOROT/makefile @@ -0,0 +1,145 @@ +# SlickEdit generated file. Do not edit this file except in designated areas. + +# Make command to use for dependencies +MAKE=make +RM=rm +MKDIR=mkdir + +# -----Begin user-editable area----- + +# -----End user-editable area----- + +# If no configuration is specified, "Debug" will be used +ifndef CFG +CFG=Debug +endif + +# +# Configuration: Debug +# +ifeq "$(CFG)" "Debug" +OUTDIR=Debug +OUTFILE=$(OUTDIR)/MEKOROT +CFG_INC= +CFG_LIB= +CFG_OBJ= +COMMON_OBJ=$(OUTDIR)/MEKOROT.o $(OUTDIR)/MEKOROT_Kernel.o +OBJ=$(COMMON_OBJ) $(CFG_OBJ) +ALL_OBJ=$(OUTDIR)/MEKOROT.o $(OUTDIR)/MEKOROT_Kernel.o + +COMPILE=g++ -c "-DDEBUG" "-D__STDC_CONSTANT_MACROS" "-D_CLIENT_APPLICATION_" "-D_OPENCV_" -g -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< +LINK=g++ -g -o "$(OUTFILE)" $(ALL_OBJ) +COMPILE_ADA=gnat -g -c -o "$(OUTDIR)/$(*F).o" "$<" +COMPILE_ADB=gnat -g -c -o "$(OUTDIR)/$(*F).o" "$<" +COMPILE_F=gfortran -c -g -o "$(OUTDIR)/$(*F).o" "$<" +COMPILE_F90=gfortran -c -g -o "$(OUTDIR)/$(*F).o" "$<" +COMPILE_D=gdc -c -g -o "$(OUTDIR)/$(*F).o" "$<" + +# Pattern rules +$(OUTDIR)/%.o : %.d + $(COMPILE_D) + +$(OUTDIR)/%.o : %.f90 + $(COMPILE_F90) + +$(OUTDIR)/%.o : %.f + $(COMPILE_F) + +$(OUTDIR)/%.o : %.cpp + $(COMPILE) + +$(OUTDIR)/%.o : %.ada + $(COMPILE_ADA) + +$(OUTDIR)/%.o : %.adb + $(COMPILE_ADB) + +# Build rules +all: $(OUTFILE) + +$(OUTFILE): $(OUTDIR) $(OBJ) + $(LINK) + +$(OUTDIR): + $(MKDIR) -p "$(OUTDIR)" + +# Rebuild this project +rebuild: cleanall + @$(MAKE) -f "$(strip $(MAKEFILE_LIST))" $(MAKEFLAGS) all + +# Clean this project +clean: + $(RM) -f $(OUTFILE) + $(RM) -f $(OBJ) + +# Clean this project and all dependencies +cleanall: clean +endif + +# +# Configuration: Release +# +ifeq "$(CFG)" "Release" +OUTDIR=Release +OUTFILE=$(OUTDIR)/MEKOROT +CFG_INC= +CFG_LIB= +CFG_OBJ= +COMMON_OBJ=$(OUTDIR)/MEKOROT.o $(OUTDIR)/MEKOROT_Kernel.o +OBJ=$(COMMON_OBJ) $(CFG_OBJ) +ALL_OBJ=$(OUTDIR)/MEKOROT.o $(OUTDIR)/MEKOROT_Kernel.o + +COMPILE=g++ -c -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< +LINK=g++ -o "$(OUTFILE)" $(ALL_OBJ) +COMPILE_ADA=gnat -O -c -o "$(OUTDIR)/$(*F).o" "$<" +COMPILE_ADB=gnat -O -c -o "$(OUTDIR)/$(*F).o" "$<" +COMPILE_F=gfortran -O -g -o "$(OUTDIR)/$(*F).o" "$<" +COMPILE_F90=gfortran -O -g -o "$(OUTDIR)/$(*F).o" "$<" +COMPILE_D=gdc -c -g -o "$(OUTDIR)/$(*F).o" "$<" + +# Pattern rules +$(OUTDIR)/%.o : %.d + $(COMPILE_D) + +$(OUTDIR)/%.o : %.f90 + $(COMPILE_F90) + +$(OUTDIR)/%.o : %.f + $(COMPILE_F) + +$(OUTDIR)/%.o : %.cpp + $(COMPILE) + +$(OUTDIR)/%.o : %.ada + $(COMPILE_ADA) + +$(OUTDIR)/%.o : %.adb + $(COMPILE_ADB) + +# Build rules +all: $(OUTFILE) + +$(OUTFILE): $(OUTDIR) $(OBJ) + $(LINK) + +$(OUTDIR): + $(MKDIR) -p "$(OUTDIR)" + +# Rebuild this project +rebuild: cleanall + @$(MAKE) -f "$(strip $(MAKEFILE_LIST))" $(MAKEFLAGS) all + +# Clean this project +clean: + $(RM) -f $(OUTFILE) + $(RM) -f $(OBJ) + +# Clean this project and all dependencies +cleanall: clean +endif + +# +# include dependencies: +# +$(OUTDIR)/MEKOROT.o: MEKOROT.cpp MEKOROT.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/object/objectConsoleLoggingService.h ../../lib/components/object/objectFileLoggingService.h MEKOROT_Kernel.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicMediaDestination.h ../../lib/components/base/basicThread.h ../../lib/data/media/lapsedVideoRecorder.h ../../lib/data/media/videoNode.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/data/protocol/protocolLGS2D.h ../../lib/data/protocol/protocolPTZ_ONVIF.h ../../lib/data/storage/storageProvider.h ../../lib/hardware/uart/serialPort.h +$(OUTDIR)/MEKOROT_Kernel.o: MEKOROT_Kernel.cpp MEKOROT_Kernel.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicMediaDestination.h ../../lib/components/base/basicThread.h ../../lib/data/media/lapsedVideoRecorder.h ../../lib/data/media/videoNode.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/data/protocol/protocolLGS2D.h ../../lib/data/protocol/protocolPTZ_ONVIF.h ../../lib/data/storage/storageProvider.h ../../lib/hardware/uart/serialPort.h diff --git a/lib/App/common/kernelModuleEmbedVideo.h b/lib/App/common/kernelModuleEmbedVideo.h index 3276b3af..d0ec166a 100644 --- a/lib/App/common/kernelModuleEmbedVideo.h +++ b/lib/App/common/kernelModuleEmbedVideo.h @@ -1,12 +1,12 @@ #ifndef __KERNEL_MODULE_EMBED_VIDEO_HEADER__ #define __KERNEL_MODULE_EMBED_VIDEO_HEADER__ #include "kernelModule.h" -#include "../components/base/basicMutex.h" -#include "../components/base/basicDualThread.h" -#include "../components/base/basicEventHeap.h" -//#include "../data/media/video/videoAVLIBDestination.h" -#include "../components/base/basicMediaSource.h" -#include "../components/base/basicMediaDestination.h" +#include "../../components/base/basicMutex.h" +#include "../../components/base/basicDualThread.h" +#include "../../components/base/basicEventHeap.h" +//#include "../../data/media/video/videoAVLIBDestination.h" +#include "../../components/base/basicMediaSource.h" +#include "../../components/base/basicMediaDestination.h" #define HAVE_SMAL_PREVIEW_STREAMS diff --git a/lib/data/media/video/videoAVLIBDestination.h b/lib/data/media/video/videoAVLIBDestination.h index 34b546ec..730d8715 100644 --- a/lib/data/media/video/videoAVLIBDestination.h +++ b/lib/data/media/video/videoAVLIBDestination.h @@ -141,7 +141,7 @@ class videoAVLIBDestination : public basicMediaDestination { //bool attachBus(mediaBus *Bus); bool setSize(int Width, int Height); bool setFPS(int); - virtual void pushFrame(cv::Mat *Frame, void *src = NULL); + virtual bool pushFrame(cv::Mat *Frame, void *src = NULL); bool create( CSTR URI, int fps=-1, int w=-1, int h=-1); //void setError(bool A, CSTR BOBO = ""); virtual void startRecord( CSTR fileName ); diff --git a/lib/data/media/videoNode.cpp b/lib/data/media/videoNode.cpp index c748d709..8669c173 100644 --- a/lib/data/media/videoNode.cpp +++ b/lib/data/media/videoNode.cpp @@ -29,8 +29,8 @@ void videoNode::stopConveyour(void){ m_pCurrentMat = NULL; }; }; -void videoNode::pushFrame(cv::Mat *Frame, void *src ){ - if(m_bThreadStatus != TH_WORKING) return; +bool videoNode::pushFrame(cv::Mat *Frame, void *src ){ + if(m_bThreadStatus != TH_WORKING) return false; if( m_pMatProtector->try_lock() ){ if (m_nRecorderCounter) { m_nRecorderCounter--; @@ -50,8 +50,11 @@ void videoNode::pushFrame(cv::Mat *Frame, void *src ){ m_bNewDataArival = true; }; m_pMatProtector->unlock(); - }; + return true; + }; + return false; }; + void videoNode::m_fThreadProc(){ m_bThreadStatus = TH_WORKING; diff --git a/lib/data/media/videoNode.h b/lib/data/media/videoNode.h index 1901abab..63d38062 100644 --- a/lib/data/media/videoNode.h +++ b/lib/data/media/videoNode.h @@ -34,7 +34,7 @@ class videoNode : public basicMediaDestination, public basicThread { CSTR takeSnapshot( void); CSTR getCurrentRecordName(void) { return m_sCurrentRecordName; }; uint32_t getCurrentRecordIndex(void) { return m_nRecordedFramesCount; }; - virtual void pushFrame( cv::Mat *Frame, void *src = NULL ); + virtual bool pushFrame( cv::Mat *Frame, void *src = NULL ); bool attachVideoAnalyzer( basicVideoAnalyzer *BVA ); void connect( basicMediaDestination *V); void disconnect( basicMediaDestination *V);