You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
3.5KB

  1. /*
  2. * RTP definitions
  3. * Copyright (c) 2002 Fabrice Bellard.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #ifndef RTP_H
  20. #define RTP_H
  21. #define RTP_MIN_PACKET_LENGTH 12
  22. #define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
  23. int rtp_init(void);
  24. int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
  25. int rtp_get_payload_type(AVCodecContext *codec);
  26. typedef struct RTPDemuxContext RTPDemuxContext;
  27. typedef struct rtp_payload_data_s rtp_payload_data_s;
  28. RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, int payload_type, rtp_payload_data_s *rtp_payload_data);
  29. int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
  30. const uint8_t *buf, int len);
  31. void rtp_parse_close(RTPDemuxContext *s);
  32. extern AVOutputFormat rtp_muxer;
  33. extern AVInputFormat rtp_demuxer;
  34. int rtp_get_local_port(URLContext *h);
  35. int rtp_set_remote_url(URLContext *h, const char *uri);
  36. void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
  37. extern URLProtocol rtp_protocol;
  38. #define RTP_PT_PRIVATE 96
  39. #define RTP_VERSION 2
  40. #define RTP_MAX_SDES 256 /* maximum text length for SDES */
  41. /* RTCP paquets use 0.5 % of the bandwidth */
  42. #define RTCP_TX_RATIO_NUM 5
  43. #define RTCP_TX_RATIO_DEN 1000
  44. /* Structure listing usefull vars to parse RTP packet payload*/
  45. typedef struct rtp_payload_data_s
  46. {
  47. int sizelength;
  48. int indexlength;
  49. int indexdeltalength;
  50. int profile_level_id;
  51. int streamtype;
  52. int objecttype;
  53. char *mode;
  54. /* mpeg 4 AU headers */
  55. struct AUHeaders {
  56. int size;
  57. int index;
  58. int cts_flag;
  59. int cts;
  60. int dts_flag;
  61. int dts;
  62. int rap_flag;
  63. int streamstate;
  64. } *au_headers;
  65. int nb_au_headers;
  66. int au_headers_length_bytes;
  67. int cur_au_index;
  68. } rtp_payload_data_t;
  69. typedef struct AVRtpPayloadType_s
  70. {
  71. int pt;
  72. const char enc_name[50]; /* XXX: why 50 ? */
  73. enum CodecType codec_type;
  74. enum CodecID codec_id;
  75. int clock_rate;
  76. int audio_channels;
  77. } AVRtpPayloadType_t;
  78. typedef struct AVRtpDynamicPayloadType_s /* payload type >= 96 */
  79. {
  80. const char enc_name[50]; /* XXX: still why 50 ? ;-) */
  81. enum CodecType codec_type;
  82. enum CodecID codec_id;
  83. } AVRtpDynamicPayloadType_t;
  84. #if 0
  85. typedef enum {
  86. RTCP_SR = 200,
  87. RTCP_RR = 201,
  88. RTCP_SDES = 202,
  89. RTCP_BYE = 203,
  90. RTCP_APP = 204
  91. } rtcp_type_t;
  92. typedef enum {
  93. RTCP_SDES_END = 0,
  94. RTCP_SDES_CNAME = 1,
  95. RTCP_SDES_NAME = 2,
  96. RTCP_SDES_EMAIL = 3,
  97. RTCP_SDES_PHONE = 4,
  98. RTCP_SDES_LOC = 5,
  99. RTCP_SDES_TOOL = 6,
  100. RTCP_SDES_NOTE = 7,
  101. RTCP_SDES_PRIV = 8,
  102. RTCP_SDES_IMG = 9,
  103. RTCP_SDES_DOOR = 10,
  104. RTCP_SDES_SOURCE = 11
  105. } rtcp_sdes_type_t;
  106. #endif
  107. extern AVRtpPayloadType_t AVRtpPayloadTypes[];
  108. extern AVRtpDynamicPayloadType_t AVRtpDynamicPayloadTypes[];
  109. #endif /* RTP_H */