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.

46 lines
1.5 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __LAPSED_VIDEO_RECORDER_HEADER__
  2. #define __LAPSED_VIDEO_RECORDER_HEADER__
  3. #include <queue>
  4. #include "video/videoAVLIBDestination.h"
  5. #include "../../components/base/basicEventHandler.h"
  6. #include "../../components/base/basicMutex.h"
  7. #include "../../components/base/basicEventHeap.h"
  8. typedef struct S_FRAME_QUEUE_ITEM{
  9. long long TS;
  10. cv::Mat *FRAME;
  11. } FRAME_QUEUE_ITEM;
  12. typedef queue<FRAME_QUEUE_ITEM *> FRAME_QUEUE;
  13. class lapsedVideoRecorder : public basicMediaDestination, public basicEventHandler {
  14. private:
  15. bool m_bLapseByTime;
  16. bool m_bOutputIsStarted;
  17. basicLogCollection * m_pLog;
  18. FRAME_QUEUE m_vTimeLapse;
  19. uint32_t m_nTimeLapse;
  20. uint32_t m_nTimeToSave;
  21. uint32_t m_nFrameLapse;
  22. uint32_t m_nFrameToSave;
  23. uint32_t m_nCurrentFrame;
  24. basicMutex m_mProtecor;
  25. CSTR m_pCurrentOutput;
  26. videoAVLIBDestination * m_pRealOutput;
  27. public:
  28. lapsedVideoRecorder();
  29. ~lapsedVideoRecorder();
  30. virtual void pushFrame( cv::Mat *Frame );
  31. virtual void dispatchEvent(EVENT_CONTAINER*Evt );
  32. void setTargetOutput( CSTR FileName );
  33. void setTimeLapse( uint32_t milliseconds );
  34. void setFrameLapse( uint32_t frames );
  35. bool beginOutput( CSTR FileName );
  36. bool continueOutput( void );
  37. bool finishOutput( void );
  38. bool getRecordStatus( void ){ return m_bOutputIsStarted; };
  39. uint32_t getCurrentFrame( void ){ return m_nCurrentFrame; };
  40. CSTR getOutputName( void ){ return m_pCurrentOutput; };
  41. };
  42. #endif