stream_common.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * Copyright (C) 2011 Teluu Inc. (http://www.teluu.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #ifndef __PJMEDIA_STREAM_COMMON_H__
  19. #define __PJMEDIA_STREAM_COMMON_H__
  20. /**
  21. * @file stream_common.h
  22. * @brief Stream common functions.
  23. */
  24. #include <pjmedia/codec.h>
  25. #include <pjmedia/sdp.h>
  26. #include <pjmedia/rtp.h>
  27. #include <pjmedia/rtcp.h>
  28. PJ_BEGIN_DECL
  29. /**
  30. * This structure describes rtp/rtcp session information of the media stream.
  31. */
  32. typedef struct pjmedia_stream_rtp_sess_info
  33. {
  34. /**
  35. * The decode RTP session.
  36. */
  37. const pjmedia_rtp_session *rx_rtp;
  38. /**
  39. * The encode RTP session.
  40. */
  41. const pjmedia_rtp_session *tx_rtp;
  42. /**
  43. * The decode RTCP session.
  44. */
  45. const pjmedia_rtcp_session *rtcp;
  46. } pjmedia_stream_rtp_sess_info;
  47. #if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0
  48. /**
  49. * Structure of configuration settings for stream keepalive.
  50. */
  51. typedef struct pjmedia_stream_ka_config
  52. {
  53. /**
  54. * The number of keepalive to be sent after the stream is created.
  55. * When this is set to 0, keepalive will be sent once for NAT hole
  56. * punching if stream's use_ka is enabled.
  57. *
  58. * Default: PJMEDIA_STREAM_START_KA_CNT
  59. */
  60. unsigned start_count;
  61. /**
  62. * The keepalive sending interval after the stream is created.
  63. *
  64. * Default: PJMEDIA_STREAM_START_KA_INTERVAL_MSEC
  65. */
  66. unsigned start_interval;
  67. /**
  68. * The keepalive sending interval, after #start_count number keepalive
  69. * was sent.
  70. *
  71. * Default: PJMEDIA_STREAM_KA_INTERVAL (seconds)
  72. */
  73. unsigned ka_interval;
  74. } pjmedia_stream_ka_config;
  75. /**
  76. * Initialize the stream send keep-alive with default settings.
  77. *
  78. * @param cfg Stream send keep-alive structure to be initialized.
  79. */
  80. PJ_DECL(void)
  81. pjmedia_stream_ka_config_default(pjmedia_stream_ka_config *cfg);
  82. #endif
  83. /**
  84. * This is internal function for parsing SDP format parameter of specific
  85. * format or payload type, used by stream in generating stream info from SDP.
  86. *
  87. * @param pool Pool to allocate memory, if pool is NULL, the fmtp
  88. * string pointers will point to the original string in
  89. * the SDP media descriptor.
  90. * @param m The SDP media containing the format parameter to
  91. * be parsed.
  92. * @param pt The format or payload type.
  93. * @param fmtp The format parameter to store the parsing result.
  94. *
  95. * @return PJ_SUCCESS on success.
  96. */
  97. PJ_DECL(pj_status_t) pjmedia_stream_info_parse_fmtp(pj_pool_t *pool,
  98. const pjmedia_sdp_media *m,
  99. unsigned pt,
  100. pjmedia_codec_fmtp *fmtp);
  101. PJ_END_DECL
  102. #endif /* __PJMEDIA_STREAM_COMMON_H__ */