|
1 /* GStreamer |
|
2 * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com> |
|
3 * |
|
4 * This library is free software; you can redistribute it and/or |
|
5 * modify it under the terms of the GNU Library General Public |
|
6 * License as published by the Free Software Foundation; either |
|
7 * version 2 of the License, or (at your option) any later version. |
|
8 * |
|
9 * This library 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 GNU |
|
12 * Library General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Library General Public |
|
15 * License along with this library; if not, write to the |
|
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
17 * Boston, MA 02111-1307, USA. |
|
18 */ |
|
19 /* |
|
20 * Unless otherwise indicated, Source Code is licensed under MIT license. |
|
21 * See further explanation attached in License Statement (distributed in the file |
|
22 * LICENSE). |
|
23 * |
|
24 * Permission is hereby granted, free of charge, to any person obtaining a copy of |
|
25 * this software and associated documentation files (the "Software"), to deal in |
|
26 * the Software without restriction, including without limitation the rights to |
|
27 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
|
28 * of the Software, and to permit persons to whom the Software is furnished to do |
|
29 * so, subject to the following conditions: |
|
30 * |
|
31 * The above copyright notice and this permission notice shall be included in all |
|
32 * copies or substantial portions of the Software. |
|
33 * |
|
34 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
35 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
36 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
37 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
38 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
39 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
40 * SOFTWARE. |
|
41 */ |
|
42 |
|
43 #ifndef __GST_SDP_MESSAGE_H__ |
|
44 #define __GST_SDP_MESSAGE_H__ |
|
45 |
|
46 #include <glib.h> |
|
47 |
|
48 #include <gst/sdp/gstsdp.h> |
|
49 |
|
50 G_BEGIN_DECLS |
|
51 |
|
52 /** |
|
53 * GstSDPOrigin: |
|
54 * @username: the user's login on the originating host, or it is "-" |
|
55 * if the originating host does not support the concept of user ids. |
|
56 * @sess_id: is a numeric string such that the tuple of @username, @sess_id, |
|
57 * @nettype, @addrtype and @addr form a globally unique identifier for the |
|
58 * session. |
|
59 * @sess_version: a version number for this announcement |
|
60 * @nettype: the type of network. "IN" is defined to have the meaning |
|
61 * "Internet". |
|
62 * @addrtype: the type of @addr. |
|
63 * @addr: the globally unique address of the machine from which the session was |
|
64 * created. |
|
65 * |
|
66 * The contents of the SDP "o=" field which gives the originator of the session |
|
67 * (their username and the address of the user's host) plus a session id and |
|
68 * session version number. |
|
69 */ |
|
70 typedef struct { |
|
71 gchar *username; |
|
72 gchar *sess_id; |
|
73 gchar *sess_version; |
|
74 gchar *nettype; |
|
75 gchar *addrtype; |
|
76 gchar *addr; |
|
77 } GstSDPOrigin; |
|
78 |
|
79 /** |
|
80 * GstSDPConnection: |
|
81 * @nettype: the type of network. "IN" is defined to have the meaning |
|
82 * "Internet". |
|
83 * @addrtype: the type of @address. |
|
84 * @address: the address |
|
85 * @ttl: the time to live of the address |
|
86 * @addr_number: the number of layers |
|
87 * |
|
88 * The contents of the SDP "c=" field which contains connection data. |
|
89 */ |
|
90 typedef struct { |
|
91 gchar *nettype; |
|
92 gchar *addrtype; |
|
93 gchar *address; |
|
94 guint ttl; |
|
95 guint addr_number; |
|
96 } GstSDPConnection; |
|
97 |
|
98 /** |
|
99 * GST_SDP_BWTYPE_CT: |
|
100 * |
|
101 * The Conference Total bandwidth modifier. |
|
102 */ |
|
103 #define GST_SDP_BWTYPE_CT "CT" |
|
104 /** |
|
105 * GST_SDP_BWTYPE_AS: |
|
106 * |
|
107 * The Application-Specific Maximum bandwidth modifier. |
|
108 */ |
|
109 #define GST_SDP_BWTYPE_AS "AS" |
|
110 /** |
|
111 * GST_SDP_BWTYPE_EXT_PREFIX: |
|
112 * |
|
113 * The extension prefix bandwidth modifier. |
|
114 */ |
|
115 #define GST_SDP_BWTYPE_EXT_PREFIX "X-" |
|
116 |
|
117 /** |
|
118 * GST_SDP_BWTYPE_RS: |
|
119 * |
|
120 * RTCP bandwidth allocated to active data senders (RFC 3556). |
|
121 * |
|
122 * Since: 0.10.15 |
|
123 */ |
|
124 #define GST_SDP_BWTYPE_RS "RS" |
|
125 /** |
|
126 * GST_SDP_BWTYPE_RR: |
|
127 * |
|
128 * RTCP bandwidth allocated to data receivers (RFC 3556). |
|
129 * |
|
130 * Since: 0.10.15 |
|
131 */ |
|
132 #define GST_SDP_BWTYPE_RR "RR" |
|
133 |
|
134 /** |
|
135 * GstSDPBandwidth: |
|
136 * @bwtype: the bandwidth modifier type |
|
137 * @bandwidth: the bandwidth in kilobits per second |
|
138 * |
|
139 * The contents of the SDP "b=" field which specifies the proposed bandwidth to |
|
140 * be used by the session or media. |
|
141 */ |
|
142 typedef struct { |
|
143 gchar *bwtype; |
|
144 guint bandwidth; |
|
145 } GstSDPBandwidth; |
|
146 |
|
147 /** |
|
148 * GstSDPTime: |
|
149 * @start: start time for the conference. The value is the decimal |
|
150 * representation of Network Time Protocol (NTP) time values in seconds |
|
151 * @stop: stop time for the conference. The value is the decimal |
|
152 * representation of Network Time Protocol (NTP) time values in seconds |
|
153 * @repeat: repeat times for a session |
|
154 * |
|
155 * The contents of the SDP "t=" field which specify the start and stop times for |
|
156 * a conference session. |
|
157 */ |
|
158 typedef struct { |
|
159 gchar *start; |
|
160 gchar *stop; |
|
161 GArray *repeat; |
|
162 } GstSDPTime; |
|
163 |
|
164 /** |
|
165 * GstSDPZone: |
|
166 * @time: the NTP time that a time zone adjustment happens |
|
167 * @typed_time: the offset from the time when the session was first scheduled |
|
168 * |
|
169 * The contents of the SDP "z=" field which allows the sender to |
|
170 * specify a list of time zone adjustments and offsets from the base |
|
171 * time. |
|
172 */ |
|
173 typedef struct { |
|
174 gchar *time; |
|
175 gchar *typed_time; |
|
176 } GstSDPZone; |
|
177 |
|
178 /** |
|
179 * GstSDPKey: |
|
180 * @type: the encryption type |
|
181 * @data: the encryption data |
|
182 * |
|
183 * The contents of the SDP "k=" field which is used to convey encryption |
|
184 * keys. |
|
185 */ |
|
186 typedef struct { |
|
187 gchar *type; |
|
188 gchar *data; |
|
189 } GstSDPKey; |
|
190 |
|
191 /** |
|
192 * GstSDPAttribute: |
|
193 * @key: the attribute key |
|
194 * @value: the attribute value or NULL when it was a property attribute |
|
195 * |
|
196 * The contents of the SDP "a=" field which contains a key/value pair. |
|
197 */ |
|
198 typedef struct { |
|
199 gchar *key; |
|
200 gchar *value; |
|
201 } GstSDPAttribute; |
|
202 |
|
203 /** |
|
204 * GstSDPMedia: |
|
205 * @media: the media type |
|
206 * @port: the transport port to which the media stream will be sent |
|
207 * @num_ports: the number of ports or -1 if only one port was specified |
|
208 * @proto: the transport protocol |
|
209 * @fmts: an array of #gchar formats |
|
210 * @information: the media title |
|
211 * @connections: array of #GstSDPConnection with media connection information |
|
212 * @bandwidths: array of #GstSDPBandwidth with media bandwidth information |
|
213 * @key: the encryption key |
|
214 * @attributes: array of #GstSDPAttribute with the additional media attributes |
|
215 * |
|
216 * The contents of the SDP "m=" field with all related fields. |
|
217 */ |
|
218 typedef struct { |
|
219 gchar *media; |
|
220 guint port; |
|
221 guint num_ports; |
|
222 gchar *proto; |
|
223 GArray *fmts; |
|
224 gchar *information; |
|
225 GArray *connections; |
|
226 GArray *bandwidths; |
|
227 GstSDPKey key; |
|
228 GArray *attributes; |
|
229 } GstSDPMedia; |
|
230 |
|
231 /** |
|
232 * GstSDPMessage: |
|
233 * @version: the protocol version |
|
234 * @origin: owner/creator and session identifier |
|
235 * @session_name: session name |
|
236 * @information: session information |
|
237 * @uri: URI of description |
|
238 * @emails: array of #gchar with email addresses |
|
239 * @phones: array of #gchar with phone numbers |
|
240 * @connection: connection information for the session |
|
241 * @bandwidths: array of #GstSDPBandwidth with bandwidth information |
|
242 * @times: array of #GstSDPTime with time descriptions |
|
243 * @zones: array of #GstSDPZone with time zone adjustments |
|
244 * @key: encryption key |
|
245 * @attributes: array of #GstSDPAttribute with session attributes |
|
246 * @medias: array of #GstSDPMedia with media descriptions |
|
247 * |
|
248 * The contents of the SDP message. |
|
249 */ |
|
250 typedef struct { |
|
251 gchar *version; |
|
252 GstSDPOrigin origin; |
|
253 gchar *session_name; |
|
254 gchar *information; |
|
255 gchar *uri; |
|
256 GArray *emails; |
|
257 GArray *phones; |
|
258 GstSDPConnection connection; |
|
259 GArray *bandwidths; |
|
260 GArray *times; |
|
261 GArray *zones; |
|
262 GstSDPKey key; |
|
263 GArray *attributes; |
|
264 GArray *medias; |
|
265 } GstSDPMessage; |
|
266 |
|
267 /* Session descriptions */ |
|
268 GstSDPResult gst_sdp_message_new (GstSDPMessage **msg); |
|
269 GstSDPResult gst_sdp_message_init (GstSDPMessage *msg); |
|
270 GstSDPResult gst_sdp_message_uninit (GstSDPMessage *msg); |
|
271 GstSDPResult gst_sdp_message_free (GstSDPMessage *msg); |
|
272 |
|
273 GstSDPResult gst_sdp_message_parse_buffer (const guint8 *data, guint size, GstSDPMessage *msg); |
|
274 |
|
275 gchar* gst_sdp_message_as_text (const GstSDPMessage *msg); |
|
276 |
|
277 /* v=.. */ |
|
278 const gchar* gst_sdp_message_get_version (const GstSDPMessage *msg); |
|
279 GstSDPResult gst_sdp_message_set_version (GstSDPMessage *msg, const gchar *version); |
|
280 |
|
281 /* o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address> */ |
|
282 const GstSDPOrigin* gst_sdp_message_get_origin (const GstSDPMessage *msg); |
|
283 GstSDPResult gst_sdp_message_set_origin (GstSDPMessage *msg, const gchar *username, |
|
284 const gchar *sess_id, const gchar *sess_version, |
|
285 const gchar *nettype, const gchar *addrtype, |
|
286 const gchar *addr); |
|
287 |
|
288 /* s=<session name> */ |
|
289 const gchar* gst_sdp_message_get_session_name (const GstSDPMessage *msg); |
|
290 GstSDPResult gst_sdp_message_set_session_name (GstSDPMessage *msg, const gchar *session_name); |
|
291 |
|
292 /* i=<session description> */ |
|
293 const gchar* gst_sdp_message_get_information (const GstSDPMessage *msg); |
|
294 GstSDPResult gst_sdp_message_set_information (GstSDPMessage *msg, const gchar *information); |
|
295 |
|
296 /* u=<uri> */ |
|
297 const gchar* gst_sdp_message_get_uri (const GstSDPMessage *msg); |
|
298 GstSDPResult gst_sdp_message_set_uri (GstSDPMessage *msg, const gchar *uri); |
|
299 |
|
300 /* e=<email-address> */ |
|
301 guint gst_sdp_message_emails_len (const GstSDPMessage *msg); |
|
302 const gchar* gst_sdp_message_get_email (const GstSDPMessage *msg, guint idx); |
|
303 GstSDPResult gst_sdp_message_add_email (GstSDPMessage *msg, const gchar *email); |
|
304 |
|
305 /* p=<phone-number> */ |
|
306 guint gst_sdp_message_phones_len (const GstSDPMessage *msg); |
|
307 const gchar* gst_sdp_message_get_phone (const GstSDPMessage *msg, guint idx); |
|
308 GstSDPResult gst_sdp_message_add_phone (GstSDPMessage *msg, const gchar *phone); |
|
309 |
|
310 /* c=<nettype> <addrtype> <connection-address>[/<ttl>][/<number of addresses>] */ |
|
311 const GstSDPConnection* gst_sdp_message_get_connection (const GstSDPMessage *msg); |
|
312 GstSDPResult gst_sdp_message_set_connection (GstSDPMessage *msg, const gchar *nettype, |
|
313 const gchar *addrtype, const gchar *address, |
|
314 guint ttl, guint addr_number); |
|
315 /* b=<bwtype>:<bandwidth> */ |
|
316 guint gst_sdp_message_bandwidths_len (const GstSDPMessage *msg); |
|
317 const GstSDPBandwidth* gst_sdp_message_get_bandwidth (const GstSDPMessage *msg, guint idx); |
|
318 GstSDPResult gst_sdp_message_add_bandwidth (GstSDPMessage *msg, const gchar *bwtype, |
|
319 guint bandwidth); |
|
320 /* t=<start-time> <stop-time> and |
|
321 * r=<repeat interval> <active duration> <offsets from start-time> */ |
|
322 guint gst_sdp_message_times_len (const GstSDPMessage *msg); |
|
323 const GstSDPTime* gst_sdp_message_get_time (const GstSDPMessage *msg, guint idx); |
|
324 GstSDPResult gst_sdp_message_add_time (GstSDPMessage *msg, const gchar *start, const gchar *stop, const gchar **repeat); |
|
325 |
|
326 /* z=<adjustment time> <offset> <adjustment time> <offset> .... */ |
|
327 guint gst_sdp_message_zones_len (const GstSDPMessage *msg); |
|
328 const GstSDPZone* gst_sdp_message_get_zone (const GstSDPMessage *msg, guint idx); |
|
329 GstSDPResult gst_sdp_message_add_zone (GstSDPMessage *msg, const gchar *adj_time, |
|
330 const gchar *typed_time); |
|
331 |
|
332 /* k=<method>[:<encryption key>] */ |
|
333 const GstSDPKey* gst_sdp_message_get_key (const GstSDPMessage *msg); |
|
334 GstSDPResult gst_sdp_message_set_key (GstSDPMessage *msg, const gchar *type, |
|
335 const gchar *data); |
|
336 /* a=... */ |
|
337 guint gst_sdp_message_attributes_len (const GstSDPMessage *msg); |
|
338 const GstSDPAttribute* gst_sdp_message_get_attribute (const GstSDPMessage *msg, guint idx); |
|
339 const gchar* gst_sdp_message_get_attribute_val (const GstSDPMessage *msg, const gchar *key); |
|
340 const gchar* gst_sdp_message_get_attribute_val_n (const GstSDPMessage *msg, const gchar *key, |
|
341 guint nth); |
|
342 GstSDPResult gst_sdp_message_add_attribute (GstSDPMessage *msg, const gchar *key, |
|
343 const gchar *value); |
|
344 |
|
345 /* m=.. sections */ |
|
346 guint gst_sdp_message_medias_len (const GstSDPMessage *msg); |
|
347 const GstSDPMedia* gst_sdp_message_get_media (const GstSDPMessage *msg, guint idx); |
|
348 GstSDPResult gst_sdp_message_add_media (GstSDPMessage *msg, GstSDPMedia *media); |
|
349 |
|
350 GstSDPResult gst_sdp_message_dump (const GstSDPMessage *msg); |
|
351 |
|
352 /* Media descriptions */ |
|
353 GstSDPResult gst_sdp_media_new (GstSDPMedia **media); |
|
354 GstSDPResult gst_sdp_media_init (GstSDPMedia *media); |
|
355 GstSDPResult gst_sdp_media_uninit (GstSDPMedia *media); |
|
356 GstSDPResult gst_sdp_media_free (GstSDPMedia *media); |
|
357 |
|
358 gchar* gst_sdp_media_as_text (const GstSDPMedia *media); |
|
359 |
|
360 /* m=<media> <port>/<number of ports> <proto> <fmt> ... */ |
|
361 const gchar* gst_sdp_media_get_media (const GstSDPMedia *media); |
|
362 GstSDPResult gst_sdp_media_set_media (GstSDPMedia *media, const gchar *med); |
|
363 |
|
364 guint gst_sdp_media_get_port (const GstSDPMedia *media); |
|
365 guint gst_sdp_media_get_num_ports (const GstSDPMedia *media); |
|
366 GstSDPResult gst_sdp_media_set_port_info (GstSDPMedia *media, guint port, |
|
367 guint num_ports); |
|
368 |
|
369 const gchar* gst_sdp_media_get_proto (const GstSDPMedia *media); |
|
370 GstSDPResult gst_sdp_media_set_proto (GstSDPMedia *media, const gchar *proto); |
|
371 |
|
372 guint gst_sdp_media_formats_len (const GstSDPMedia *media); |
|
373 const gchar* gst_sdp_media_get_format (const GstSDPMedia *media, guint idx); |
|
374 GstSDPResult gst_sdp_media_add_format (GstSDPMedia *media, const gchar *format); |
|
375 |
|
376 /* i=<session description> */ |
|
377 const gchar* gst_sdp_media_get_information (const GstSDPMedia *media); |
|
378 GstSDPResult gst_sdp_media_set_information (GstSDPMedia *media, const gchar *information); |
|
379 |
|
380 /* c=<nettype> <addrtype> <connection-address>[/<ttl>][/<number of addresses>] */ |
|
381 guint gst_sdp_media_connections_len (const GstSDPMedia *media); |
|
382 const GstSDPConnection* gst_sdp_media_get_connection (const GstSDPMedia *media, guint idx); |
|
383 GstSDPResult gst_sdp_media_add_connection (GstSDPMedia *media, const gchar *nettype, |
|
384 const gchar *addrtype, const gchar *address, |
|
385 guint ttl, guint addr_number); |
|
386 |
|
387 /* b=<bwtype>:<bandwidth> */ |
|
388 guint gst_sdp_media_bandwidths_len (const GstSDPMedia *media); |
|
389 const GstSDPBandwidth* gst_sdp_media_get_bandwidth (const GstSDPMedia *media, guint idx); |
|
390 GstSDPResult gst_sdp_media_add_bandwidth (GstSDPMedia *media, const gchar *bwtype, |
|
391 guint bandwidth); |
|
392 |
|
393 /* k=<method>:<encryption key> */ |
|
394 const GstSDPKey* gst_sdp_media_get_key (const GstSDPMedia *media); |
|
395 GstSDPResult gst_sdp_media_set_key (GstSDPMedia *media, const gchar *type, |
|
396 const gchar *data); |
|
397 /* a=... */ |
|
398 guint gst_sdp_media_attributes_len (const GstSDPMedia *media); |
|
399 const GstSDPAttribute * gst_sdp_media_get_attribute (const GstSDPMedia *media, guint idx); |
|
400 const gchar* gst_sdp_media_get_attribute_val (const GstSDPMedia *media, const gchar *key); |
|
401 const gchar* gst_sdp_media_get_attribute_val_n (const GstSDPMedia *media, const gchar *key, |
|
402 guint nth); |
|
403 GstSDPResult gst_sdp_media_add_attribute (GstSDPMedia *media, const gchar *key, |
|
404 const gchar *value); |
|
405 |
|
406 G_END_DECLS |
|
407 |
|
408 #endif /* __GST_SDP_MESSAGE_H__ */ |