user_app.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #pragma once
  2. #include <iostream>
  3. #include <signal.h>
  4. // ZLMediaKit
  5. #include "Util/logger.h"
  6. #include "Util/NoticeCenter.h"
  7. #include "Poller/EventPoller.h"
  8. #include "Player/PlayerProxy.h"
  9. #include "Rtmp/RtmpPusher.h"
  10. #include "Common/config.h"
  11. #include "Pusher/MediaPusher.h"
  12. #include "Extension/Frame.h"
  13. #include "Util/SqlPool.h"
  14. #include "Network/TcpClient.h"
  15. #include "Poller/Timer.h"
  16. #include "TCPClient.h"
  17. #include "inifile.h"
  18. #include <gst/gst.h>
  19. #include <vector>
  20. #include <map>
  21. #include "inference.h"
  22. #include "Stream.h"
  23. // dataType
  24. #include "SendLogin.h"
  25. #include "NettyServerCommandEnum.h"
  26. #include "NettyServerResultMsg.h"
  27. #include "NettyClientResultMsg.h"
  28. #include "SendLogin.h"
  29. #include "NettyClientCommandEnum.h"
  30. #include "InferData.h"
  31. using namespace toolkit;
  32. using namespace mediakit;
  33. using namespace inifile;
  34. using namespace std;
  35. #define ERR -1
  36. #define OK 0
  37. // 推理广播
  38. #define NOTICE_INFER "NOTICE_INFER"
  39. namespace MIVA
  40. {
  41. class UserApp
  42. {
  43. public:
  44. static std::shared_ptr<UserApp> CreateNew();
  45. UserApp();
  46. ~UserApp();
  47. int32_t Init(std::string appName);
  48. void Destroy();
  49. void StartTask();
  50. private:
  51. IniFile m_ini;
  52. std::string m_appName;
  53. const std::string m_configSrc = "../config/config.ini";
  54. private:
  55. // Natty
  56. std::string Netty_ip;
  57. int32_t Netty_port;
  58. std::string Netty_idName;
  59. // PIS
  60. std::string PIS_ip;
  61. int32_t PIS_port;
  62. std::string PIS_IdName;
  63. // Mysql
  64. std::string sql_ip;
  65. int32_t sql_port;
  66. std::string user;
  67. std::string password;
  68. std::string character;
  69. int device_id;
  70. private:
  71. // 负责链接Netty的Socker
  72. std::shared_ptr<TCPClient> m_tcpClient;
  73. std::list<Stream> DataList;
  74. Timer::Ptr m_timer0;
  75. private:
  76. void ListenInfer(int Source_id, int num);
  77. void ConnectNetty();
  78. void ReportData();
  79. };
  80. }