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.

45 lines
1.5 KiB

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. FRAME_QUEUE m_vTimeLapse;
  18. uint32_t m_nTimeLapse;
  19. uint32_t m_nTimeToSave;
  20. uint32_t m_nFrameLapse;
  21. uint32_t m_nFrameToSave;
  22. uint32_t m_nCurrentFrame;
  23. basicMutex m_mProtecor;
  24. CSTR m_pCurrentOutput;
  25. videoAVLIBDestination * m_pRealOutput;
  26. public:
  27. lapsedVideoRecorder();
  28. ~lapsedVideoRecorder();
  29. virtual void pushFrame( cv::Mat *Frame );
  30. virtual void dispatchEvent( basicEvent *Evt );
  31. void setTargetOutput( CSTR FileName );
  32. void setTimeLapse( uint32_t milliseconds );
  33. void setFrameLapse( uint32_t frames );
  34. bool beginOutput( CSTR FileName );
  35. bool continueOutput( void );
  36. bool finishOutput( void );
  37. bool getRecordStatus( void ){ return m_bOutputIsStarted; };
  38. uint32_t getCurrentFrame( void ){ return m_nCurrentFrame; };
  39. CSTR getOutputName( void ){ return m_pCurrentOutput; };
  40. };
  41. #endif