You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
3.9 KiB
143 lines
3.9 KiB
#ifndef __KERNEL_MODULE_EMBED_VIDEO_HEADER__
|
|
#define __KERNEL_MODULE_EMBED_VIDEO_HEADER__
|
|
#include "../../components/base/basicDualThread.h"
|
|
#include "../../components/base/basicEventHeap.h"
|
|
#include "../../components/base/basicMutex.h"
|
|
#include "kernelModule.h"
|
|
#include "streamHandler.h"
|
|
|
|
extern const char * m_pVideoScratchPath;
|
|
|
|
#define EVE_OUTPUT_PICTURES 1
|
|
#define EVE_OUTPUT_VIDEO 2
|
|
#define EVE_OUTPUT_PIC_AND_VID 3
|
|
|
|
#ifndef LRF_PROXY_ONLY
|
|
// #include "../../data/media/video/videoAVLIBDestination.h"
|
|
#include "../../components/base/basicMediaDestination.h"
|
|
#include "../../components/base/basicMediaSource.h"
|
|
|
|
typedef struct S_WEB_CLIENT_CTX
|
|
{
|
|
int m_iSocketFID;
|
|
int m_iEncoderPipe[2];
|
|
bool bValid;
|
|
bool initDone;
|
|
bool headerIsSent;
|
|
uint32_t mediaStreamId;
|
|
#ifdef HAVE_SMAL_PREVIEW_STREAMS
|
|
bool bPreviewMode;
|
|
#endif
|
|
streamHandler * m_pHandler;
|
|
kernelModuleEmbedVideo * ModulePtr;
|
|
} WEB_CLIENT_CTX;
|
|
|
|
typedef struct S_WEB_HANDLER
|
|
{
|
|
DWORD m_dwThreadID;
|
|
#ifdef __linux__
|
|
pthread_t m_hThreadHandle;
|
|
#else
|
|
HANDLE m_hThreadHandle;
|
|
#endif
|
|
WEB_CLIENT_CTX * CTX;
|
|
} WEB_HANDLER;
|
|
|
|
typedef vector<WEB_HANDLER *> vectorHANDLERS;
|
|
|
|
// typedef vector<STREAM_CTX*> vectorSTREAMS;
|
|
|
|
typedef struct S_STREAM_CAP
|
|
{
|
|
uint32_t stream_id;
|
|
uint32_t buffer_size;
|
|
uint8_t picture_buffer;
|
|
} STREAM_CAP;
|
|
|
|
typedef struct S_VIDEO_EVT
|
|
{
|
|
uint32_t dbid;
|
|
uint32_t frame;
|
|
} VIDEO_EVT;
|
|
|
|
typedef vector<uchar> compressedFRAME;
|
|
typedef map<uint32_t, compressedFRAME> mapSTREAMCAPS;
|
|
typedef map<uint32_t, cv::Mat> mapSTREAMMAPS;
|
|
|
|
|
|
class kernelModuleEmbedVideo : public kernelModule, public basicDualThread
|
|
{
|
|
private:
|
|
|
|
basicEventHeap * m_pEventHeap;
|
|
static void * webClientProc(void * ptr);
|
|
static void * viewClientProc(void * ptr);
|
|
int m_nSocketDescriptor;
|
|
basicMutex m_mWebHandlersProtector;
|
|
basicMutex m_mStreamHandlersProtector;
|
|
basicMutex m_mPictureProtector;
|
|
basicMutex m_mEncodedProtector;
|
|
vectorHANDLERS m_vHandlersPool;
|
|
DBC_MODULE_EMBED_VIDEO_DATA m_sEmbedVideoData;
|
|
mapSTREAMMAPS m_mapMATS;
|
|
mapSTREAMHANDLERS m_mapHANDLERS;
|
|
mapSTREAMCAPS m_mapCAPTURES;
|
|
uint8_t * n_pNoSignalData;
|
|
uint32_t m_nNoSignalSize;
|
|
#ifdef HAVE_SMAL_PREVIEW_STREAMS
|
|
mapSTREAMCAPS m_mapPREVIEWS;
|
|
uint8_t * n_pNoSignalSmallData;
|
|
uint32_t m_nNoSignalSmallSize;
|
|
#endif
|
|
cv::Mat m_mLogoPic;
|
|
cv::Mat m_mLogoMask;
|
|
char m_pBaseSavePath[PATH_MAX];
|
|
bool registerForMediaStream(uint32_t id, WEB_CLIENT_CTX *& CTX);
|
|
bool saveStreamPicture(uint32_t id);
|
|
bool saveStreamPicture(DBC_SNAPSHOT_DATA * ptr);
|
|
bool generateSavePicPath(CSTR MD5, CSTR Output);
|
|
|
|
basicMutex m_mViewHandlersProtector;
|
|
vectorHANDLERS m_vViewHandlersPool;
|
|
int m_nViewSocketDescriptor;
|
|
|
|
protected:
|
|
|
|
/* From Basic Dual Thread */
|
|
virtual void m_fThreadAProc(void);
|
|
virtual void m_fThreadBProc(void);
|
|
|
|
public:
|
|
|
|
explicit kernelModuleEmbedVideo(uint32_t moduleID);
|
|
virtual ~kernelModuleEmbedVideo();
|
|
/* From Kernel Module */
|
|
virtual bool reloadSettings();
|
|
virtual bool startService();
|
|
virtual bool stopService(bool force = false);
|
|
virtual bool dispatchEvent(EVENT_CONTAINER * Evt);
|
|
virtual bool validate();
|
|
/*
|
|
//from Media Destination
|
|
virtual bool pushFrame( AVFrame *Frame, void* src = NULL);
|
|
//virtual void pushFrame( cv::Mat* Frame, void* src = NULL);
|
|
virtual bool pushFrame( cv::Mat &Frame, void* src = NULL);
|
|
// Module Specific Functionality
|
|
*/
|
|
int getWidh(void);
|
|
int getHeight(void);
|
|
bool registerStream(uint32_t streamID, uint8_t flip_mode = 0);
|
|
bool unregisterStream(uint32_t streamID);
|
|
uint8_t getMediaMode(void);
|
|
friend class streamHandler;
|
|
};
|
|
#else //LRF_PROXY_ONLY
|
|
class kernelModuleEmbedVideo : public kernelModule{
|
|
public:
|
|
explicit kernelModuleEmbedVideo(uint32_t moduleID);
|
|
virtual ~kernelModuleEmbedVideo();
|
|
};
|
|
#endif //LRF_PROXY_ONLY
|
|
|
|
|
|
#endif
|