Rtpcommon.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef _RTPCOMMON_H_
  2. #define _RTPCOMMON_H_
  3. #include "GlobalVariable.h"
  4. #include <QList>
  5. /**
  6. * @brief UDP的状态
  7. *
  8. */
  9. enum class eUDPState
  10. {
  11. eUDP_None = 0, /* 未知状态 */
  12. eUDP_Init, /* 初始化 */
  13. eUDP_Opened, /* 已打开 */
  14. eUDP_Closed, /* 已关闭 */
  15. eUDP_Error /* 错误状态 */
  16. };
  17. /**
  18. 接收到的客户端结构体
  19. 这里的sessionID应该换成对比项ID加需要数据的对比项使用的通道信息,通过对比项ID加通道编号
  20. 找到对应的声卡通道
  21. */
  22. struct RtpRecvClientInfo_t
  23. {
  24. char clientIP[32]; /* 客户端IP */
  25. int clientPort; /* 客户端接收数据的UDP端口 */
  26. int compareItemID; /* 对比项ID */
  27. int compareItemRoadNum; /* 对比项的通道号 */
  28. int type; /* 包类型,0:Login,1:Heart,2:Logout */
  29. RtpRecvClientInfo_t();
  30. RtpRecvClientInfo_t(const RtpRecvClientInfo_t& other);
  31. RtpRecvClientInfo_t& operator=(const RtpRecvClientInfo_t& other);
  32. };
  33. /**
  34. * @brief 客户端信息结构体
  35. *
  36. */
  37. struct RtpSendClientInfo_t
  38. {
  39. QString localIP; /* 本地IP */
  40. int localPort = -1; /* 本地发送数据的UDP端口 */
  41. QString clientIP; /* 客户端IP */
  42. int clientPort = -1; /* 客户端接收数据的UDP端口 */
  43. // int compareItemID; /* 对比项ID */
  44. // int compareItemRoadNum; /* 对比项通道号 */
  45. OneSoundCardPCMInfo_t cardPCMInfo; /* 声卡PCM通道信息 */
  46. RtpSendClientInfo_t();
  47. RtpSendClientInfo_t(const RtpSendClientInfo_t& other);
  48. RtpSendClientInfo_t& operator=(const RtpSendClientInfo_t& other);
  49. };
  50. /**
  51. * @brief 客户端信息结构体,充当Rtp服务中客户端列表的键
  52. *
  53. */
  54. struct RtpClientKey_t
  55. {
  56. QString clientIP; /* 客户端IP */
  57. int clientPort; /* 客户端接收数据的UDP端口 */
  58. OneSoundCardPCMInfo_t cardPCMInfo; /* 声卡PCM通道信息 */
  59. RtpClientKey_t() = default;
  60. bool operator==(const RtpClientKey_t& other) const;
  61. bool operator<(const RtpClientKey_t& other) const;
  62. };
  63. #endif /* _RTPCOMMON_H_ */