video.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. #include <iostream>
  3. #include <list>
  4. #include "opencv2/highgui/highgui.hpp"
  5. #include "opencv2/imgproc/imgproc.hpp"
  6. #include "opencv2/dnn.hpp"
  7. #include "opencv2/opencv.hpp"
  8. #include "opencv2/highgui.hpp"
  9. #include "opencv2/imgcodecs/imgcodecs.hpp"
  10. #include "cnstream_frame_va.hpp"
  11. #include "device/mlu_context.h"
  12. // #include "cnstream_core.hpp"
  13. #include "cnstream_frame.hpp"
  14. #include "cnstream_module.hpp"
  15. #include "easyinfer/model_loader.h"
  16. #include "easytrack/easy_track.h"
  17. #include <time.h>
  18. #include <cstdlib>
  19. #include <dirent.h>
  20. #include <sys/types.h>
  21. #include <sys/stat.h>
  22. using namespace std;
  23. using namespace cv;
  24. using namespace cnstream;
  25. class video
  26. {
  27. private:
  28. std::string m_fileName;
  29. string m_enc_type;
  30. string m_outputDir;
  31. int m_fps;
  32. int m_cacheTime;
  33. list<Mat> m_frameBuffer;
  34. int m_count;
  35. int m_videoMaxTime;
  36. Size m_frameSize;
  37. std::shared_ptr<cv::VideoWriter> m_videoWriter;
  38. bool m_videoStart;
  39. public:
  40. video(const string &outputDir,const string &enc_type, const int fps, const int videoMaxTime,const int cacheTime,const Size& frameSize);
  41. ~video();
  42. void Destroy();
  43. bool capture(std::shared_ptr<cnstream::CNFrameInfo> &data);
  44. string getFileName();
  45. int getVideoFps();
  46. int getVideoTime();
  47. };