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.

66 lines
2.5 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __ARGUS_ZLMEDIA_CONNECTOR_MODULE_HEADER__
  2. #define __ARGUS_ZLMEDIA_CONNECTOR_MODULE_HEADER__
  3. #include "../components/base/basicTypes.h"
  4. #include "../components/base/basicSettingsProvider.h"
  5. #include "../components/base/basicLogCollection.h"
  6. #include "../components/base/basicMutex.h"
  7. #include "../data/protocol/protocolZLMEDIA.h"
  8. //#include "../../alg/generic/md5.h"
  9. #include "rgooseModule.h"
  10. #define ZLMC_STAGE_INIT 0
  11. #define ZLMC_STAGE_START 1
  12. #define ZLM_STAGE_COLLECT_DATA 2
  13. #define ZLMC_STAGE_END 3
  14. #define ZLM_SECONDS_VALIDATE 5
  15. #define ZLM_10TH_SEC_RECORD_LENGTH 20 // 2 seconds
  16. #define ZLM_10TH_SEC_RECORD_SKEEP 20 // 2 seconds
  17. #define STORAGE_DIR_MODE 0x1FF
  18. #define STORAGE_FILE_MODE 0x1B6
  19. typedef struct S_ZL_RECORDER_SLOT{
  20. uint32_t m_uStreamID;
  21. uint32_t m_uVideoID;
  22. char m_sSrcBase[1024];
  23. char m_sDstBase[1024];
  24. char m_sDstName[40];
  25. uint32_t m_uPartNumber;
  26. bool m_bFinished;
  27. basicMutex * m_pMutex;
  28. uint32_t m_uSkeep;
  29. uint32_t m_uTimer;
  30. #ifdef __linux__
  31. pthread_t m_hThreadHandle;
  32. #else
  33. HANDLE m_hThreadHandle;
  34. #endif
  35. }ZL_RECORDER_SLOT;
  36. typedef vector<ZL_RECORDER_SLOT*> VECTOR_ZL_RECORDER_SLOTS;
  37. class argusModuleZLMedia: public argusKernelModule {
  38. private:
  39. uint8_t m_bCStage;
  40. basicLogCollection * m_pLog;
  41. DBC_MEDIA_SERVER_DATA m_sSettings;
  42. protocolZLMEDIA * m_pProtocol;
  43. //DBC_INT_LIST * m_pDefinedStreams;
  44. char m_pBasePath[1024];
  45. CSTR m_pVHostIP;
  46. time_t m_tTimeSeconds;
  47. void updateMRLs( void );
  48. VECTOR_ZL_RECORDER_SLOTS m_vRecorderSlots;
  49. bool startRecord( uint32_t evt_id, uint32_t chan, CSTR evtID, CSTR base );
  50. static void * m_fRecorder( void *ptr );
  51. CSTR createNewRecordFolder( CSTR seed );
  52. public:
  53. explicit argusModuleZLMedia( uint32_t id );
  54. ~argusModuleZLMedia();
  55. virtual bool validate();
  56. virtual void dispatchEvent( EVENT_CONTAINER *Evt );
  57. };
  58. #endif