recorder.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include <memory>
  3. #include <string>
  4. #include <vector>
  5. #include <map>
  6. #include <list>
  7. // #include "cnstream_core.hpp"
  8. #include "cnstream_frame.hpp"
  9. #include "cnstream_module.hpp"
  10. #include "easyinfer/model_loader.h"
  11. #include "easytrack/easy_track.h"
  12. #include "video.hpp"
  13. namespace cnstream{
  14. // Pointer for frame info
  15. using CNFrameInfoPtr = std::shared_ptr<CNFrameInfo>;
  16. /// Pointer for infer object
  17. using CNInferObjectPtr = std::shared_ptr<CNInferObject>;
  18. class Recorder : public cnstream::Module, public cnstream::ModuleCreator<Recorder>
  19. {
  20. using super = cnstream::Module;
  21. private:
  22. Recorder(const Recorder &) = delete;
  23. Recorder &operator=(Recorder const &) = delete;
  24. std::shared_ptr<video> m_Video;
  25. int m_dst_width;
  26. int m_dst_height;
  27. int m_frame_rate;
  28. // 视频的最长时间
  29. int m_videoMaxTime;
  30. // 视频头尾缓存时间
  31. int m_cacheTime;
  32. string m_enc_type;
  33. string m_outputDir;
  34. map<std::string, std::shared_ptr<video>> m_videos;
  35. public:
  36. explicit Recorder(const std::string &name);
  37. bool Open(cnstream::ModuleParamSet paramSet) override;
  38. void Close() override;
  39. int Process(std::shared_ptr<cnstream::CNFrameInfo> data) override;
  40. };
  41. }