DetStreamPipe.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef __MAS_DET_STREAMPIPE_H
  2. #define __MAS_DET_STREAMPIPE_H
  3. #include "DetectorLib.h"
  4. #include "MAS_Definition.h"
  5. #include "StreamDef.h"
  6. #include "Locks.h"
  7. NAMESPACE_MAS_BEGIN
  8. class DetStreamPipe : public IStreamPipe, public tzc::OSThread {
  9. public:
  10. DetStreamPipe(TZ_INT rscID, TZ_INT detId, TZ_INT intype, const ExcepInfo & einfo);
  11. virtual ~DetStreamPipe();
  12. virtual TZ_INT Initialize(SPtr<DetectorLib> detLib, const std::string & initParam);
  13. virtual TZ_INT Dispose();
  14. virtual void SuperIsInactive(){};
  15. TZ_INT TurnOnGPU();
  16. TZ_INT TurnOffGPU();
  17. TZ_INT SetDetectCfg(const std::string& param);
  18. TZ_INT GetInputType() const;
  19. protected:
  20. virtual std::tuple<TZ_BOOL, TZ_BOOL> streamArrived(SPtr<StreamInfo> & streamInfo) override;
  21. private:
  22. virtual void Entry();
  23. static TZ_INT detCallback(SPtr<StreamInfo> & streamInfo, void * ctx);
  24. private:
  25. std::string m_detKey;
  26. TZ_INT m_iType;
  27. SPtr<DetectorLib> m_detLib;
  28. Detector * m_detector;
  29. std::list<SPtr<StreamInfo>> m_cacheInfo;
  30. tzc::Mutex m_lock;
  31. tzc::Semaphore m_detSema;
  32. };
  33. inline TZ_INT DetStreamPipe::GetInputType() const
  34. {
  35. return m_iType;
  36. }
  37. NAMESPACE_MAS_END
  38. #endif // __MAS_DET_STREAMPIPE_H