Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

99 wiersze
3.2KB

  1. #ifndef _sdp_options_h_
  2. #define _sdp_options_h_
  3. #include <stdint.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. struct sdp_options_t
  8. {
  9. int bundle;
  10. int rtcp_mux; // rtp/rtcp port muxer
  11. struct
  12. {
  13. int media; // SDP_M_MEDIA_AUDIO
  14. int setup; // SDP_A_SETUP_ACTPASS
  15. int proto; // SDP_M_PROTO_RTP_AVP
  16. int port[2];
  17. uint8_t payloads[16]; // payload list
  18. } m[8];
  19. int count; // media count
  20. };
  21. enum
  22. {
  23. SDP_A_SETUP_NONE,
  24. SDP_A_SETUP_ACTPASS, // client/server
  25. SDP_A_SETUP_PASSIVE, // server
  26. SDP_A_SETUP_ACTIVE, // client
  27. SDP_A_SETUP_HOLDCONN, // holdconn
  28. };
  29. /// @return SDP_A_SETUP_NONE/SDP_A_SETUP_PASSIVE/SDP_A_SETUP_ACTIVE/SDP_A_SETUP_xxx
  30. int sdp_option_setup_from(const char* setup);
  31. const char* sdp_option_setup_to(int setup);
  32. // RTP = xxxxxxx1 xxxxxxxx
  33. // UDP = xxxxxxxx xxxxx000
  34. // TCP = xxxxxxxx xxxxx001
  35. // DCCP = xxxxxxxx xxxxx010
  36. // SCTP = xxxxxxxx xxxxx011
  37. // Feedback = xxxxxxxx xxx1xxxx
  38. // SRTP = xxxxxxxx xx1xxxxx
  39. // TLS = xxxxxxxx x1xxxxxx
  40. // DTLS = xxxxxxxx 1xxxxxxx
  41. #define SDP_M_PROTO_TEST_RTP(proto) ( (proto) & 0x0100 )
  42. #define SDP_M_PROTO_TEST_UDP(proto) ( 0x000 == ((proto) & 0x07) ? 1 : 0 )
  43. #define SDP_M_PROTO_TEST_TCP(proto) ( 0x001 == ((proto) & 0x07) ? 1 : 0 )
  44. #define SDP_M_PROTO_TEST_FEEDBACK(proto)( (proto) & 0x10 )
  45. #define SDP_M_PROTO_TEST_SRTP(proto) ( (proto) & 0x20 )
  46. #define SDP_M_PROTO_TEST_TLS(proto) ( (proto) & 0x40 )
  47. #define SDP_M_PROTO_TEST_DTLS(proto) ( (proto) & 0x80 )
  48. enum
  49. {
  50. SDP_M_PROTO_UKNOWN = 0,
  51. SDP_M_PROTO_RTP_AVP = 0x0100, // rfc4566: RTP/AVP or RTP/AVP/UDP
  52. SDP_M_PROTO_RTP_AVPF = 0x0110, // rfc4585: RTP/AVPF
  53. SDP_M_PROTO_RTP_SAVP = 0x0120, // rfc3711: RTP/SAVP
  54. SDP_M_PROTO_RTP_SAVPF = 0x0130, // rfc5124: RTP/SAVPF
  55. SDP_M_PROTO_RTP_AVP_TCP = 0x0101, // rfc4571: TCP/RTP/AVP or RTP/AVP/TCP or RTP/TCP/AVP
  56. SDP_M_PROTO_RTP_AVPF_TCP = 0x0111, // rfc7850: TCP/RTP/AVPF
  57. SDP_M_PROTO_RTP_SAVP_TCP = 0x0121, // rfc7850: TCP/RTP/SAVP
  58. SDP_M_PROTO_RTP_SAVPF_TCP = 0x0131, // rfc7850: TCP/RTP/SAVPF
  59. SDP_M_PROTO_RTP_SAVP_DTLS_TCP = 0x01A1, // rfc7850: TCP/DTLS/RTP/SAVP
  60. SDP_M_PROTO_RTP_SAVPF_DTLS_TCP = 0x01B1, // rfc7850: TCP/DTLS/RTP/SAVPF
  61. SDP_M_PROTO_RTP_AVP_TCP_TLS = 0x0141, // rfc7850: TCP/TLS/RTP/AVP
  62. SDP_M_PROTO_RTP_AVPF_TCP_TLS = 0x0151, // rfc7850: TCP/TLS/RTP/AVPF
  63. SDP_M_PROTO_RTP_SAVP_TLS = 0x0160, // rfc5764: UDP/TLS/RTP/SAVP
  64. SDP_M_PROTO_RTP_SAVPF_TLS = 0x0170, // rfc5764: UDP/TLS/RTP/SAVPF
  65. SDP_M_PROTO_RTP_SAVP_TLS_DCCP = 0x0162, // rfc5764: DCCP/TLS/RTP/SAVP
  66. SDP_M_PROTO_RTP_SAVPF_TLS_DCCP = 0x0172, // rfc5764: DCCP/TLS/RTP/SAVPF
  67. SDP_M_PROTO_RAW = 0x0200, // raw
  68. SDP_M_PROTO_UDP = 0x0300, // rfc4566/rfc8866: udp
  69. SDP_M_PROTO_SCTP_DTLS = 0x0480, // rfc8841: UDP/DTLS/SCTP
  70. SDP_M_PROTO_SCTP_DTLS_TCP = 0x0481, // rfc8841: TCP/DTLS/SCTP
  71. SDP_M_PROTO_TCP = 0x0001, // rfc4145: TCP
  72. SDP_M_PROTO_TLS_TCP = 0x0041, // rfc8122: TCP/TLS
  73. };
  74. /// @return SDP_M_PROTO_RAW/SDP_M_PROTO_UDP/SDP_M_PROTO_RTP_AVP/SDP_M_PROTO_XXX
  75. int sdp_option_proto_from(const char* proto);
  76. const char* sdp_option_proto_to(int proto);
  77. int sdp_option_mode_from(const char* mode);
  78. const char* sdp_option_mode_to(int mode);
  79. int sdp_option_media_from(const char* media);
  80. const char* sdp_option_media_to(int media);
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif /* !_sdp_options_h_ */