gstrtppayloads.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /* GStreamer
  2. * Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
  3. *
  4. * gstrtppayloads.h: various helper functions to deal with RTP payload
  5. * types.
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library 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. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  20. * Boston, MA 02110-1301, USA.
  21. */
  22. #ifndef __GST_RTPPAYLOADS_H__
  23. #define __GST_RTPPAYLOADS_H__
  24. #include <gst/gst.h>
  25. G_BEGIN_DECLS
  26. /**
  27. * GstRTPPayload:
  28. * @GST_RTP_PAYLOAD_PCMU: ITU-T G.711. mu-law audio (RFC 3551)
  29. * @GST_RTP_PAYLOAD_1016: RFC 3551 says reserved
  30. * @GST_RTP_PAYLOAD_G721: RFC 3551 says reserved
  31. * @GST_RTP_PAYLOAD_GSM: GSM audio
  32. * @GST_RTP_PAYLOAD_G723: ITU G.723.1 audio
  33. * @GST_RTP_PAYLOAD_DVI4_8000: IMA ADPCM wave type (RFC 3551)
  34. * @GST_RTP_PAYLOAD_DVI4_16000: IMA ADPCM wave type (RFC 3551)
  35. * @GST_RTP_PAYLOAD_LPC: experimental linear predictive encoding
  36. * @GST_RTP_PAYLOAD_PCMA: ITU-T G.711 A-law audio (RFC 3551)
  37. * @GST_RTP_PAYLOAD_G722: ITU-T G.722 (RFC 3551)
  38. * @GST_RTP_PAYLOAD_L16_STEREO: stereo PCM
  39. * @GST_RTP_PAYLOAD_L16_MONO: mono PCM
  40. * @GST_RTP_PAYLOAD_QCELP: EIA & TIA standard IS-733
  41. * @GST_RTP_PAYLOAD_CN: Comfort Noise (RFC 3389)
  42. * @GST_RTP_PAYLOAD_MPA: Audio MPEG 1-3.
  43. * @GST_RTP_PAYLOAD_G728: ITU-T G.728 Speech coder (RFC 3551)
  44. * @GST_RTP_PAYLOAD_DVI4_11025: IMA ADPCM wave type (RFC 3551)
  45. * @GST_RTP_PAYLOAD_DVI4_22050: IMA ADPCM wave type (RFC 3551)
  46. * @GST_RTP_PAYLOAD_G729: ITU-T G.729 Speech coder (RFC 3551)
  47. * @GST_RTP_PAYLOAD_CELLB: See RFC 2029
  48. * @GST_RTP_PAYLOAD_JPEG: ISO Standards 10918-1 and 10918-2 (RFC 2435)
  49. * @GST_RTP_PAYLOAD_NV: nv encoding by Ron Frederick
  50. * @GST_RTP_PAYLOAD_H261: ITU-T Recommendation H.261 (RFC 2032)
  51. * @GST_RTP_PAYLOAD_MPV: Video MPEG 1 & 2 (RFC 2250)
  52. * @GST_RTP_PAYLOAD_MP2T: MPEG-2 transport stream (RFC 2250)
  53. * @GST_RTP_PAYLOAD_H263: Video H263 (RFC 2190)
  54. *
  55. *
  56. * Standard predefined fixed payload types.
  57. *
  58. * The official list is at:
  59. * http://www.iana.org/assignments/rtp-parameters
  60. *
  61. * Audio:
  62. * reserved: 19
  63. * unassigned: 20-23,
  64. *
  65. * Video:
  66. * unassigned: 24, 27, 29, 30, 35-71, 77-95
  67. * Reserved for RTCP conflict avoidance: 72-76
  68. */
  69. typedef enum
  70. {
  71. /* Audio: */
  72. GST_RTP_PAYLOAD_PCMU = 0,
  73. GST_RTP_PAYLOAD_1016 = 1, /* RFC 3551 says reserved */
  74. GST_RTP_PAYLOAD_G721 = 2, /* RFC 3551 says reserved */
  75. GST_RTP_PAYLOAD_GSM = 3,
  76. GST_RTP_PAYLOAD_G723 = 4,
  77. GST_RTP_PAYLOAD_DVI4_8000 = 5,
  78. GST_RTP_PAYLOAD_DVI4_16000 = 6,
  79. GST_RTP_PAYLOAD_LPC = 7,
  80. GST_RTP_PAYLOAD_PCMA = 8,
  81. GST_RTP_PAYLOAD_G722 = 9,
  82. GST_RTP_PAYLOAD_L16_STEREO = 10,
  83. GST_RTP_PAYLOAD_L16_MONO = 11,
  84. GST_RTP_PAYLOAD_QCELP = 12,
  85. GST_RTP_PAYLOAD_CN = 13,
  86. GST_RTP_PAYLOAD_MPA = 14,
  87. GST_RTP_PAYLOAD_G728 = 15,
  88. GST_RTP_PAYLOAD_DVI4_11025 = 16,
  89. GST_RTP_PAYLOAD_DVI4_22050 = 17,
  90. GST_RTP_PAYLOAD_G729 = 18,
  91. /* Video: */
  92. GST_RTP_PAYLOAD_CELLB = 25,
  93. GST_RTP_PAYLOAD_JPEG = 26,
  94. GST_RTP_PAYLOAD_NV = 28,
  95. GST_RTP_PAYLOAD_H261 = 31,
  96. GST_RTP_PAYLOAD_MPV = 32,
  97. GST_RTP_PAYLOAD_MP2T = 33,
  98. GST_RTP_PAYLOAD_H263 = 34,
  99. /* BOTH */
  100. } GstRTPPayload;
  101. /* backward compatibility */
  102. #define GST_RTP_PAYLOAD_G723_63 16
  103. #define GST_RTP_PAYLOAD_G723_53 17
  104. #define GST_RTP_PAYLOAD_TS48 18
  105. #define GST_RTP_PAYLOAD_TS41 19
  106. #define GST_RTP_PAYLOAD_G723_63_STRING "16"
  107. #define GST_RTP_PAYLOAD_G723_53_STRING "17"
  108. #define GST_RTP_PAYLOAD_TS48_STRING "18"
  109. #define GST_RTP_PAYLOAD_TS41_STRING "19"
  110. /* Defining the above as strings, to make the declaration of pad_templates
  111. * easier. So if please keep these synchronized with the above.
  112. */
  113. #define GST_RTP_PAYLOAD_PCMU_STRING "0"
  114. #define GST_RTP_PAYLOAD_1016_STRING "1"
  115. #define GST_RTP_PAYLOAD_G721_STRING "2"
  116. #define GST_RTP_PAYLOAD_GSM_STRING "3"
  117. #define GST_RTP_PAYLOAD_G723_STRING "4"
  118. #define GST_RTP_PAYLOAD_DVI4_8000_STRING "5"
  119. #define GST_RTP_PAYLOAD_DVI4_16000_STRING "6"
  120. #define GST_RTP_PAYLOAD_LPC_STRING "7"
  121. #define GST_RTP_PAYLOAD_PCMA_STRING "8"
  122. #define GST_RTP_PAYLOAD_G722_STRING "9"
  123. #define GST_RTP_PAYLOAD_L16_STEREO_STRING "10"
  124. #define GST_RTP_PAYLOAD_L16_MONO_STRING "11"
  125. #define GST_RTP_PAYLOAD_QCELP_STRING "12"
  126. #define GST_RTP_PAYLOAD_CN_STRING "13"
  127. #define GST_RTP_PAYLOAD_MPA_STRING "14"
  128. #define GST_RTP_PAYLOAD_G728_STRING "15"
  129. #define GST_RTP_PAYLOAD_DVI4_11025_STRING "16"
  130. #define GST_RTP_PAYLOAD_DVI4_22050_STRING "17"
  131. #define GST_RTP_PAYLOAD_G729_STRING "18"
  132. #define GST_RTP_PAYLOAD_CELLB_STRING "25"
  133. #define GST_RTP_PAYLOAD_JPEG_STRING "26"
  134. #define GST_RTP_PAYLOAD_NV_STRING "28"
  135. #define GST_RTP_PAYLOAD_H261_STRING "31"
  136. #define GST_RTP_PAYLOAD_MPV_STRING "32"
  137. #define GST_RTP_PAYLOAD_MP2T_STRING "33"
  138. #define GST_RTP_PAYLOAD_H263_STRING "34"
  139. #define GST_RTP_PAYLOAD_DYNAMIC_STRING "[96, 127]"
  140. /**
  141. * GST_RTP_PAYLOAD_IS_DYNAMIC:
  142. * @pt: a payload type
  143. *
  144. * Check if @pt is a dynamic payload type.
  145. */
  146. #define GST_RTP_PAYLOAD_IS_DYNAMIC(pt) ((pt) >= 96 && (pt) <= 127)
  147. typedef struct _GstRTPPayloadInfo GstRTPPayloadInfo;
  148. /**
  149. * GstRTPPayloadInfo:
  150. * @payload_type: payload type, -1 means dynamic
  151. * @media: the media type(s), usually "audio", "video", "application", "text",
  152. * "message".
  153. * @encoding_name: the encoding name of @pt
  154. * @clock_rate: default clock rate, 0 = unknown/variable
  155. * @encoding_parameters: encoding parameters. For audio this is the number of
  156. * channels. NULL = not applicable.
  157. * @bitrate: the bitrate of the media. 0 = unknown/variable.
  158. *
  159. * Structure holding default payload type information.
  160. */
  161. struct _GstRTPPayloadInfo
  162. {
  163. guint8 payload_type;
  164. const gchar *media;
  165. const gchar *encoding_name;
  166. guint clock_rate;
  167. const gchar *encoding_parameters;
  168. guint bitrate;
  169. /*< private >*/
  170. gpointer _gst_reserved[GST_PADDING];
  171. };
  172. const GstRTPPayloadInfo * gst_rtp_payload_info_for_pt (guint8 payload_type);
  173. const GstRTPPayloadInfo * gst_rtp_payload_info_for_name (const gchar *media, const gchar *encoding_name);
  174. G_END_DECLS
  175. #endif /* __GST_RTPPAYLOADS_H__ */