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.

115 lines
3.2KB

  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 FFMPEG_RTP_H
  22. #define FFMPEG_RTP_H
  23. #include <stdint.h>
  24. #include "libavcodec/avcodec.h"
  25. #include "avformat.h"
  26. #define RTP_MIN_PACKET_LENGTH 12
  27. #define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
  28. int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
  29. /** return < 0 if unknown payload type */
  30. int rtp_get_payload_type(AVCodecContext *codec);
  31. typedef struct RTPDemuxContext RTPDemuxContext;
  32. typedef struct rtp_payload_data_s rtp_payload_data_s;
  33. RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, rtp_payload_data_s *rtp_payload_data);
  34. int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
  35. const uint8_t *buf, int len);
  36. void rtp_parse_close(RTPDemuxContext *s);
  37. int rtp_get_local_port(URLContext *h);
  38. int rtp_set_remote_url(URLContext *h, const char *uri);
  39. void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
  40. /**
  41. * some rtp servers assume client is dead if they don't hear from them...
  42. * so we send a Receiver Report to the provided ByteIO context
  43. * (we don't have access to the rtcp handle from here)
  44. */
  45. int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
  46. #define RTP_PT_PRIVATE 96
  47. #define RTP_VERSION 2
  48. #define RTP_MAX_SDES 256 /**< maximum text length for SDES */
  49. /* RTCP paquets use 0.5 % of the bandwidth */
  50. #define RTCP_TX_RATIO_NUM 5
  51. #define RTCP_TX_RATIO_DEN 1000
  52. /** Structure listing useful vars to parse RTP packet payload*/
  53. typedef struct rtp_payload_data_s
  54. {
  55. int sizelength;
  56. int indexlength;
  57. int indexdeltalength;
  58. int profile_level_id;
  59. int streamtype;
  60. int objecttype;
  61. char *mode;
  62. /** mpeg 4 AU headers */
  63. struct AUHeaders {
  64. int size;
  65. int index;
  66. int cts_flag;
  67. int cts;
  68. int dts_flag;
  69. int dts;
  70. int rap_flag;
  71. int streamstate;
  72. } *au_headers;
  73. int nb_au_headers;
  74. int au_headers_length_bytes;
  75. int cur_au_index;
  76. } rtp_payload_data_t;
  77. #if 0
  78. typedef enum {
  79. RTCP_SR = 200,
  80. RTCP_RR = 201,
  81. RTCP_SDES = 202,
  82. RTCP_BYE = 203,
  83. RTCP_APP = 204
  84. } rtcp_type_t;
  85. typedef enum {
  86. RTCP_SDES_END = 0,
  87. RTCP_SDES_CNAME = 1,
  88. RTCP_SDES_NAME = 2,
  89. RTCP_SDES_EMAIL = 3,
  90. RTCP_SDES_PHONE = 4,
  91. RTCP_SDES_LOC = 5,
  92. RTCP_SDES_TOOL = 6,
  93. RTCP_SDES_NOTE = 7,
  94. RTCP_SDES_PRIV = 8,
  95. RTCP_SDES_IMG = 9,
  96. RTCP_SDES_DOOR = 10,
  97. RTCP_SDES_SOURCE = 11
  98. } rtcp_sdes_type_t;
  99. #endif
  100. #endif /* FFMPEG_RTP_H */