user_app.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. using namespace toolkit;
  31. using namespace mediakit;
  32. using namespace inifile;
  33. using namespace std;
  34. #define ERR -1
  35. #define OK 0
  36. // 推理广播
  37. #define NOTICE_INFER "NOTICE_INFER"
  38. namespace MIVA
  39. {
  40. class UserApp
  41. {
  42. public:
  43. static std::shared_ptr<UserApp> CreateNew();
  44. UserApp();
  45. ~UserApp();
  46. int32_t Init(std::string appName);
  47. void Destroy();
  48. void StartTask();
  49. private:
  50. IniFile m_ini;
  51. std::string m_appName;
  52. const std::string m_configSrc = "../config/config.ini";
  53. private:
  54. // Natty
  55. std::string Netty_ip;
  56. int32_t Netty_port;
  57. std::string Netty_idName;
  58. // PIS
  59. std::string PIS_ip;
  60. int32_t PIS_port;
  61. std::string PIS_IdName;
  62. // Mysql
  63. std::string sql_ip;
  64. int32_t sql_port;
  65. std::string user;
  66. std::string password;
  67. std::string character;
  68. int device_id;
  69. private:
  70. // 负责链接Netty的Socker
  71. std::shared_ptr<TCPClient> m_tcpClient;
  72. std::list<Stream> DataList;
  73. Timer::Ptr m_timer0;
  74. private:
  75. void ListenInfer(int Source_id, int num);
  76. void ConnectNetty();
  77. };
  78. }