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