Browse Source

mekorot Linux

AGP
Evgeny Gagua 3 years ago
parent
commit
ca3a2e646a
  1. 1
      Linux_Workspace.vpw
  2. 301
      Projects/MEKOROT/MEKOROT.vpj
  3. 29
      Projects/MEKOROT/MEKOROT_Kernel.cpp
  4. 2
      Projects/MEKOROT/MEKOROT_Kernel.h
  5. 145
      Projects/MEKOROT/makefile
  6. 12
      lib/App/common/kernelModuleEmbedVideo.h
  7. 2
      lib/data/media/video/videoAVLIBDestination.h
  8. 9
      lib/data/media/videoNode.cpp
  9. 2
      lib/data/media/videoNode.h

1
Linux_Workspace.vpw

@ -16,6 +16,7 @@
<Project File="Projects/LRF_ServerSlim/LRF_ServerSlim.vpj"/>
<Project File="Projects/LRF_Slave/LRF_Slave.vpj"/>
<Project File="Projects/MastBaum/MastBaum.vpj"/>
<Project File="Projects/MEKOROT/MEKOROT.vpj"/>
<Project File="Projects/Pathfinder/Pathfinder.vpj"/>
<Project File="Projects/PRU_CORES/PRU_CORES.vpj"/>
<Project File="Projects/starProcDaemon/starProcDaemon.vpj"/>

301
Projects/MEKOROT/MEKOROT.vpj

@ -0,0 +1,301 @@
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
<Project
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir="."
BuildSystem="automakefile"
BuildMakeFile="makefile">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdMEKOROT"
CompilerConfigName="Latest Version"
Defines='"/DDEBUG" "/D__STDC_CONSTANT_MACROS" "/D_CLIENT_APPLICATION_" "/D_OPENCV_"'>
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec
CmdLine='g++ -c %xup %defd -g %~other -o "%bd%n%oe" %i %f'
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags`"/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %objs'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" CFG=%b'/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine='vsdebugio -prog "%o"'/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='"%o"'/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<Rules Name="Compile">
<Rule
InputExts="*.ada"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gnat -g -c -o "%bd%n.o" "%f"'/>
</Rule>
<Rule
InputExts="*.adb"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gnat -g -c -o "%bd%n.o" "%f"'/>
</Rule>
<Rule
InputExts="*.f"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gfortran -c -g -o "%bd%n.o" "%f"'/>
</Rule>
<Rule
InputExts="*.f90"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gfortran -c -g -o "%bd%n.o" "%f"'/>
</Rule>
<Rule
InputExts="*.d"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gdc -c -g -o "%bd%n.o" "%f"'/>
</Rule>
</Rules>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="Executable"/>
</List>
<Includes/>
<Libs PreObjects="0"/>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdMEKOROT"
CompilerConfigName="Latest Version"
Defines="">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i %f'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %objs'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" CFG=%b'/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine='vsdebugio -prog "%o"'/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine='"%o"'/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<Rules Name="Compile">
<Rule
InputExts="*.ada"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gnat -O -c -o "%bd%n.o" "%f"'/>
</Rule>
<Rule
InputExts="*.adb"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gnat -O -c -o "%bd%n.o" "%f"'/>
</Rule>
<Rule
InputExts="*.f"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gfortran -O -g -o "%bd%n.o" "%f"'/>
</Rule>
<Rule
InputExts="*.f90"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gfortran -O -g -o "%bd%n.o" "%f"'/>
</Rule>
<Rule
InputExts="*.d"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gdc -c -g -o "%bd%n.o" "%f"'/>
</Rule>
</Rules>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="Executable"/>
</List>
<Includes/>
<Libs PreObjects="0"/>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.scala;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d;*.m;*.mm;*.go;*.groovy;*.gsh"
GUID="{7BFA8002-50CB-47C8-BF36-ACD152905941}">
<F N="MEKOROT.cpp"/>
<F N="MEKOROT_Kernel.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.h++;*.inc;*.sh;*.cpy;*.if"
GUID="{5DF8373F-E1EC-4DDB-B059-B77F7B9E5A77}">
<F N="MEKOROT.h"/>
<F N="MEKOROT_Kernel.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"
GUID="{3035B6B2-0659-4BA1-B4A2-C828F5AD91A9}"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"
GUID="{4FE49E08-2255-4A0F-8579-AC28B29E3203}"/>
<Folder
Name="Other Files"
Filters=""
GUID="{6F385E8E-B9F1-46BB-9132-B8716B6EA883}">
<F
N="makefile"
Type="Makefile"/>
</Folder>
</Files>
<List Name="RTE">
</List>
</Project>

29
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 <io.h>
//#include <io.h>
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) {

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

145
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

12
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

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

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

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

Loading…
Cancel
Save