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.

120 lines
3.3KB

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