user_app.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /***** (C) Copyright, Shenzhen SUNWIN Intelligent Co.,Ltd. ******source file****
  2. * File name : user_app.h
  3. * Author : ShengYin Li
  4. * Brief :
  5. ********************************************************************************
  6. * modify
  7. * Version Date Author Described
  8. * V1.00 2021/05/21 ShengYin Li Created
  9. *******************************************************************************/
  10. #ifndef _USER_APP_H
  11. #define _USER_APP_H
  12. #include <string>
  13. #include <memory>
  14. #include "yuv_queue.h"
  15. #include "sdc_data_src.h"
  16. #include "sdc_os_api.h"
  17. #include "Encoder.h"
  18. #include <unistd.h>
  19. #include <fstream>
  20. #include "JpegQueue.h"
  21. #include "inifile.h"
  22. // live555
  23. #include "BasicUsageEnvironment.hh"
  24. #include "RTSPServer.hh"
  25. #include "liveMedia.hh"
  26. #include "BasicUsageEnvironment.hh"
  27. #include "GroupsockHelper.hh"
  28. #include "MJPEGVideoSource.h"
  29. namespace HWYolov3App
  30. {
  31. class ProtoBuffer;
  32. class IYuvDataSrc;
  33. class UserApp
  34. {
  35. public:
  36. virtual ~UserApp(void);
  37. UserApp(void);
  38. int32_t Init(std::string &appName);
  39. int32_t SetYuvChanAttr(sdc_yuv_channel_param_s &yuv_param);
  40. int32_t SubscribeYuvDataAndForward(std::shared_ptr<IYuvDataSrc> dataSrc);
  41. void Destroy(void);
  42. uint32_t GetYuvChannelId(void) const;
  43. void PretreatObjectData(SDC_SSD_OBJECT_INFO_S &data);
  44. SDC_SSD_INPUT_SIZE_S m_videoSize; // 输入模型的大小
  45. SDC_SSD_INPUT_SIZE_S m_inputSize; // 输入模型的大小
  46. std::string m_RtspSrc = "/tmp/live";
  47. std::string m_resultFifo = "/tmp/result";
  48. std::string m_streamName = "live";
  49. const std::string m_configSrc = "../config/config.ini";
  50. RTSPServer* m_rtspServer = NULL;
  51. int m_fdRtspSrc = -1;
  52. int m_fdResultFifo = -1;
  53. protected:
  54. // Yuv循环队列的默认大小为50
  55. static const int32_t MAX_YUV_BUF_NUM = 50;
  56. static float m_confidenceThres; // 置信度阈值
  57. private:
  58. UserApp(const UserApp&);
  59. UserApp& operator=(const UserApp&);
  60. UserApp(UserApp&&);
  61. UserApp& operator=(UserApp&&);
  62. // 处理线程函数
  63. static void* VideoSrvReadThrd(void *arg); // 视频服务线程
  64. static void* WatchdogThread(void *arg); // 系统资源监控
  65. static void* YuvDataProThrd(void *arg); // 数据处理线程
  66. static void* RtspServerThrd(void *arg); // RTSP服务器线程
  67. std::string m_appName;
  68. // ReceiveThread & ProcessThread
  69. pthread_t m_tidpPro;
  70. pthread_t m_tidpRecv;
  71. pthread_t m_tidpWatchdog;
  72. pthread_t m_tidpRtspServer;
  73. uint32_t m_yuvChnId;
  74. YuvQueue m_yuvQue; // 循环队列保存Yuv数据帧
  75. std::shared_ptr<IYuvDataSrc> m_dataSrc; // 指定数据源
  76. int m_fdFile;
  77. // 数据订阅
  78. int m_USER_DET_IMG_W = 960; // 指定订阅使用的检测分辨率宽
  79. int m_USER_DET_IMG_H = 544; // 指定订阅使用的检测分辨率高
  80. int m_USER_DET_FRAME_RATE = 25; // 指定订阅帧率
  81. int m_MODEL_INPUT_SIZE_WIDTH = 416; // 模型输入大小宽
  82. int m_MODEL_INPUT_SIZE_HEIGHT = 416; // 模型输入大小高
  83. };
  84. }
  85. #endif
  86. /******** (C) Copyright, Shenzhen SUNWIN Intelligent Co.,Ltd. ******** End *****/