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.

93 lines
3.0KB

  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 AVFORMAT_RTP_H
  22. #define AVFORMAT_RTP_H
  23. #include "libavcodec/avcodec.h"
  24. #include "avformat.h"
  25. /** Structure listing useful vars to parse RTP packet payload*/
  26. typedef struct rtp_payload_data
  27. {
  28. int sizelength;
  29. int indexlength;
  30. int indexdeltalength;
  31. int profile_level_id;
  32. int streamtype;
  33. int objecttype;
  34. char *mode;
  35. /** mpeg 4 AU headers */
  36. struct AUHeaders {
  37. int size;
  38. int index;
  39. int cts_flag;
  40. int cts;
  41. int dts_flag;
  42. int dts;
  43. int rap_flag;
  44. int streamstate;
  45. } *au_headers;
  46. int nb_au_headers;
  47. int au_headers_length_bytes;
  48. int cur_au_index;
  49. } RTPPayloadData;
  50. typedef struct PayloadContext PayloadContext;
  51. typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
  52. #define RTP_MIN_PACKET_LENGTH 12
  53. #define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
  54. int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
  55. /** return < 0 if unknown payload type */
  56. int rtp_get_payload_type(AVCodecContext *codec);
  57. typedef struct RTPDemuxContext RTPDemuxContext;
  58. RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, RTPPayloadData *rtp_payload_data);
  59. void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
  60. RTPDynamicProtocolHandler *handler);
  61. int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
  62. const uint8_t *buf, int len);
  63. void rtp_parse_close(RTPDemuxContext *s);
  64. int rtp_get_local_port(URLContext *h);
  65. int rtp_set_remote_url(URLContext *h, const char *uri);
  66. void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
  67. /**
  68. * some rtp servers assume client is dead if they don't hear from them...
  69. * so we send a Receiver Report to the provided ByteIO context
  70. * (we don't have access to the rtcp handle from here)
  71. */
  72. int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
  73. #define RTP_PT_PRIVATE 96
  74. #define RTP_VERSION 2
  75. #define RTP_MAX_SDES 256 /**< maximum text length for SDES */
  76. /* RTCP paquets use 0.5 % of the bandwidth */
  77. #define RTCP_TX_RATIO_NUM 5
  78. #define RTCP_TX_RATIO_DEN 1000
  79. #endif /* AVFORMAT_RTP_H */