Disposition.hpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #ifndef _DISPOSITION_HPP_
  2. #define _DISPOSITION_HPP_
  3. #include <iostream>
  4. #include "Util/util.h"
  5. #include "Util/logger.h"
  6. #include "Util/TimeTicker.h"
  7. #include "Poller/Timer.h"
  8. #include "inifile.h"
  9. using namespace std;
  10. using namespace toolkit;
  11. using namespace inifile;
  12. namespace gsd_ds{
  13. struct gsdRtsp{
  14. // rtsp
  15. int rtsp_post = 8554;
  16. int bitrate = 4000000;
  17. int iframeinterval = 50;
  18. std::string rtsp_uri = "/live";
  19. };
  20. class Disposition{
  21. private:
  22. Disposition(){
  23. Init();
  24. }
  25. public:
  26. using Ptr = std::shared_ptr<Disposition>;
  27. ~Disposition(){
  28. this->Destroy();
  29. }
  30. /**
  31. * @description: getPtr
  32. * @return {*}
  33. */
  34. static std::shared_ptr<Disposition> getPtr(){
  35. static Disposition::Ptr m_dispostion = nullptr;
  36. if(m_dispostion == nullptr) m_dispostion = std::shared_ptr<Disposition>(new Disposition);
  37. return m_dispostion;
  38. }
  39. /**
  40. * @description: 初始化
  41. * @param {*}
  42. * @return {*}
  43. */
  44. int8_t Init(){
  45. return 0;
  46. }
  47. /**
  48. * @description: 释放
  49. * @return {*}
  50. */
  51. void Destroy(){
  52. }
  53. /**
  54. * @description: 是否正常
  55. * @param {*}
  56. * @return {*}
  57. */
  58. bool isNormally(){
  59. return true;
  60. }
  61. /**
  62. * @description: 更新数据
  63. * @return {*}
  64. */
  65. int8_t updateData();
  66. /**
  67. * @description: getGsdIP
  68. * @return {*}
  69. */
  70. std::string getGsdIP();
  71. /**
  72. * @description: getGsdPort
  73. * @return {*}
  74. */
  75. int getGsdPort();
  76. /**
  77. * @description: getMysqlIP
  78. * @return {*}
  79. */
  80. std::string getMysqlIP();
  81. /**
  82. * @description: getMysqlPort
  83. * @return {*}
  84. */
  85. int getMysqlPort();
  86. /**
  87. * @description: getRtsp
  88. * @return {*}
  89. */
  90. gsdRtsp getRtsp();
  91. /**
  92. * @description: getUser
  93. * @return {*}
  94. */
  95. std::string getUser();
  96. /**
  97. * @description: getPassword
  98. * @return {*}
  99. */
  100. std::string getPassword();
  101. /**
  102. * @description: 获取outDir
  103. * @return {*}
  104. */
  105. std::string getOutDir();
  106. /**
  107. * @description: getFrameInterval
  108. * @return {*}
  109. */
  110. int getFrameInterval();
  111. /**
  112. * @description: setFrameInterval
  113. * @param {int} interval
  114. * @return {*}
  115. */
  116. void setFrameInterval(int interval);
  117. private:
  118. IniFile m_ini;
  119. // gsd
  120. std::string gsd_IP = "127.0.0.1";
  121. int gsd_Port = 9980;
  122. // mysql
  123. std::string mysql_IP = "127.0.0.1";
  124. int mysql_Port = 3306;
  125. // rtsp
  126. gsdRtsp gsdrtsp;
  127. std::string user = "root";
  128. std::string password = "sunwin2022";
  129. // video
  130. std::string outDir = "/opt/datas/video/";
  131. int frame_interval = 2;
  132. #ifndef RELEASE
  133. std::string ConfigFile = "../source/config/config.ini";
  134. #else
  135. std::string ConfigFile = "../config/config.ini";
  136. #endif
  137. };
  138. } // gsd_ds
  139. #endif