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.

92 lines
3.7KB

  1. /*
  2. * RTP definitions
  3. * Copyright (c) 2006 Ryan Martell <rdm4@martellventures.com>
  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. // this is a bit of a misnomer, because rtp & rtsp internal structures and prototypes are in here.
  22. #ifndef RTP_INTERNAL_H
  23. #define RTP_INTERNAL_H
  24. typedef int (*DynamicPayloadPacketHandlerProc) (struct RTPDemuxContext * s,
  25. AVPacket * pkt,
  26. uint32_t *timestamp,
  27. const uint8_t * buf,
  28. int len);
  29. typedef struct RTPDynamicProtocolHandler_s {
  30. // fields from AVRtpDynamicPayloadType_s
  31. const char enc_name[50]; /* XXX: still why 50 ? ;-) */
  32. enum CodecType codec_type;
  33. enum CodecID codec_id;
  34. // may be null
  35. int (*parse_sdp_a_line) (AVStream * stream,
  36. void *protocol_data,
  37. const char *line); ///< Parse the a= line from the sdp field
  38. void *(*open) (); ///< allocate any data needed by the rtp parsing for this dynamic data.
  39. void (*close)(void *protocol_data); ///< free any data needed by the rtp parsing for this dynamic data.
  40. DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet.
  41. struct RTPDynamicProtocolHandler_s *next;
  42. } RTPDynamicProtocolHandler;
  43. // moved out of rtp.c, because the h264 decoder needs to know about this structure..
  44. struct RTPDemuxContext {
  45. AVFormatContext *ic;
  46. AVStream *st;
  47. int payload_type;
  48. uint32_t ssrc;
  49. uint16_t seq;
  50. uint32_t timestamp;
  51. uint32_t base_timestamp;
  52. uint32_t cur_timestamp;
  53. int max_payload_size;
  54. struct MpegTSContext *ts; /* only used for MP2T payloads */
  55. int read_buf_index;
  56. int read_buf_size;
  57. /* used to send back RTCP RR */
  58. URLContext *rtp_ctx;
  59. char hostname[256];
  60. /* rtcp sender statistics receive */
  61. int64_t last_rtcp_ntp_time; // TODO: move into statistics
  62. int64_t first_rtcp_ntp_time; // TODO: move into statistics
  63. uint32_t last_rtcp_timestamp; // TODO: move into statistics
  64. /* rtcp sender statistics */
  65. unsigned int packet_count; // TODO: move into statistics (outgoing)
  66. unsigned int octet_count; // TODO: move into statistics (outgoing)
  67. unsigned int last_octet_count; // TODO: move into statistics (outgoing)
  68. int first_packet;
  69. /* buffer for output */
  70. uint8_t buf[RTP_MAX_PACKET_LENGTH];
  71. uint8_t *buf_ptr;
  72. /* special infos for au headers parsing */
  73. rtp_payload_data_t *rtp_payload_data; // TODO: Move into dynamic payload handlers
  74. /* dynamic payload stuff */
  75. DynamicPayloadPacketHandlerProc parse_packet; ///< This is also copied from the dynamic protocol handler structure
  76. void *dynamic_protocol_context; ///< This is a copy from the values setup from the sdp parsing, in rtsp.c don't free me.
  77. };
  78. extern RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler;
  79. #endif /* RTP_INTERNAL_H */