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.
80 lines
2.5 KiB
80 lines
2.5 KiB
#ifndef __KERNEL_HELPER_MEDIA_MTX_HEADER__
|
|
#define __KERNEL_HELPER_MEDIA_MTX_HEADER__
|
|
|
|
#ifndef LRF_PROXY_ONLY
|
|
|
|
#include "dataBinder.h"
|
|
#include "../../components/base/basicThread.h"
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
#include <vector>
|
|
|
|
|
|
#define mtx_scratch_path "/dev/shm/argus/video_scratch"
|
|
|
|
typedef struct S_StreamDescRecord{
|
|
uint32_t cam_id;
|
|
uint64_t node_id;
|
|
uint32_t stream_id;
|
|
uint8_t status;
|
|
bool valid;
|
|
char source_uri[512];
|
|
}StreamDescRecord;
|
|
|
|
typedef std::vector<StreamDescRecord *> V_StreamDescRecords;
|
|
|
|
#define KH_STATUS_MTX_NA 0
|
|
#define KH_STATUS_MTX_INIT 1
|
|
#define KH_STATUS_MTX_AOK 2
|
|
#define KH_STATUS_MTX_ERR 255
|
|
|
|
#define KH_MTX_STREAM_LOADDED 0
|
|
#define KH_MTX_STREAM_REGISTERED 1
|
|
#define KH_MTX_STREAM_ONLINE 2
|
|
#define KH_MTX_STREAM_OFFLINE 3
|
|
#define KH_MTX_STREAM_ERROR 255
|
|
|
|
typedef struct S_StreamSegmentRecord{
|
|
bool keep;
|
|
VIDEO_SEGMENT_INFO SI;
|
|
}StreamSegmentRecord;
|
|
|
|
typedef std::map<uint64_t, StreamSegmentRecord *> M_StreamMap; // inodes -> info
|
|
typedef std::map<uint64_t, M_StreamMap *> M_VideoSegmentInfo; // stream_id -> map
|
|
|
|
|
|
class kernelHelperMediaMTX: public basicThread {
|
|
private:
|
|
basicLogCollection * m_pLog;
|
|
dataBinder * m_pDBC;
|
|
V_StreamDescRecords m_vStreamRecords;
|
|
M_VideoSegmentInfo m_mVideoSegments;
|
|
uint8_t m_bStatus;
|
|
char m_sWorkDir[512];
|
|
char m_sAppLogFile[512];
|
|
char m_sAppConfigFile[512];
|
|
char m_sRecordsBase[MAX_PATH_LEN];
|
|
off_t m_nLastLogSize;
|
|
bool m_bRecordMode;
|
|
bool loadConfig();
|
|
bool loadStreams();
|
|
StreamSegmentRecord * createSSR( uint32_t stream_id, uint32_t streamTSS, uint32_t streamTMS, CSTR path );
|
|
void deleteSSR( StreamSegmentRecord *ptr );
|
|
void validateSSR( StreamSegmentRecord *ptr );
|
|
protected:
|
|
virtual void m_fThreadProc(void);
|
|
public:
|
|
kernelHelperMediaMTX();
|
|
virtual ~kernelHelperMediaMTX();
|
|
bool create();
|
|
bool validateConfig();
|
|
bool assignStream( uint32_t stream_id );
|
|
bool updateConfig();
|
|
bool restart();
|
|
bool validateService();
|
|
uint8_t getStatus(){ return m_bStatus; };
|
|
};
|
|
|
|
#endif // ! LRF_PROXY_ONLY
|
|
#endif
|