2 * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
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.
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.
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.
20 * Unless otherwise indicated, Source Code is licensed under MIT license.
21 * See further explanation attached in License Statement (distributed in the file
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:
31 * The above copyright notice and this permission notice shall be included in all
32 * copies or substantial portions of the Software.
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
43 #ifndef __GST_SDP_MESSAGE_H__
44 #define __GST_SDP_MESSAGE_H__
48 #include <gst/sdp/gstsdp.h>
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
59 * @sess_version: a version number for this announcement
60 * @nettype: the type of network. "IN" is defined to have the meaning
62 * @addrtype: the type of @addr.
63 * @addr: the globally unique address of the machine from which the session was
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.
81 * @nettype: the type of network. "IN" is defined to have the meaning
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
88 * The contents of the SDP "c=" field which contains connection data.
101 * The Conference Total bandwidth modifier.
103 #define GST_SDP_BWTYPE_CT "CT"
107 * The Application-Specific Maximum bandwidth modifier.
109 #define GST_SDP_BWTYPE_AS "AS"
111 * GST_SDP_BWTYPE_EXT_PREFIX:
113 * The extension prefix bandwidth modifier.
115 #define GST_SDP_BWTYPE_EXT_PREFIX "X-"
120 * RTCP bandwidth allocated to active data senders (RFC 3556).
124 #define GST_SDP_BWTYPE_RS "RS"
128 * RTCP bandwidth allocated to data receivers (RFC 3556).
132 #define GST_SDP_BWTYPE_RR "RR"
134 * GST_SDP_BWTYPE_TIAS:
136 * Transport Independent Application Specific Maximum bandwidth (RFC 3890).
140 #define GST_SDP_BWTYPE_TIAS "TIAS"
145 * @bwtype: the bandwidth modifier type
146 * @bandwidth: the bandwidth in kilobits per second
148 * The contents of the SDP "b=" field which specifies the proposed bandwidth to
149 * be used by the session or media.
158 * @start: start time for the conference. The value is the decimal
159 * representation of Network Time Protocol (NTP) time values in seconds
160 * @stop: stop time for the conference. The value is the decimal
161 * representation of Network Time Protocol (NTP) time values in seconds
162 * @repeat: repeat times for a session
164 * The contents of the SDP "t=" field which specify the start and stop times for
165 * a conference session.
175 * @time: the NTP time that a time zone adjustment happens
176 * @typed_time: the offset from the time when the session was first scheduled
178 * The contents of the SDP "z=" field which allows the sender to
179 * specify a list of time zone adjustments and offsets from the base
189 * @type: the encryption type
190 * @data: the encryption data
192 * The contents of the SDP "k=" field which is used to convey encryption
202 * @key: the attribute key
203 * @value: the attribute value or NULL when it was a property attribute
205 * The contents of the SDP "a=" field which contains a key/value pair.
214 * @media: the media type
215 * @port: the transport port to which the media stream will be sent
216 * @num_ports: the number of ports or -1 if only one port was specified
217 * @proto: the transport protocol
218 * @fmts: an array of #gchar formats
219 * @information: the media title
220 * @connections: array of #GstSDPConnection with media connection information
221 * @bandwidths: array of #GstSDPBandwidth with media bandwidth information
222 * @key: the encryption key
223 * @attributes: array of #GstSDPAttribute with the additional media attributes
225 * The contents of the SDP "m=" field with all related fields.
242 * @version: the protocol version
243 * @origin: owner/creator and session identifier
244 * @session_name: session name
245 * @information: session information
246 * @uri: URI of description
247 * @emails: array of #gchar with email addresses
248 * @phones: array of #gchar with phone numbers
249 * @connection: connection information for the session
250 * @bandwidths: array of #GstSDPBandwidth with bandwidth information
251 * @times: array of #GstSDPTime with time descriptions
252 * @zones: array of #GstSDPZone with time zone adjustments
253 * @key: encryption key
254 * @attributes: array of #GstSDPAttribute with session attributes
255 * @medias: array of #GstSDPMedia with media descriptions
257 * The contents of the SDP message.
267 GstSDPConnection connection;
276 /* Session descriptions */
277 GstSDPResult gst_sdp_message_new (GstSDPMessage **msg);
278 GstSDPResult gst_sdp_message_init (GstSDPMessage *msg);
279 GstSDPResult gst_sdp_message_uninit (GstSDPMessage *msg);
280 GstSDPResult gst_sdp_message_free (GstSDPMessage *msg);
282 GstSDPResult gst_sdp_message_parse_buffer (const guint8 *data, guint size, GstSDPMessage *msg);
283 gchar* gst_sdp_message_as_text (const GstSDPMessage *msg);
285 /* convert from/to uri */
286 GstSDPResult gst_sdp_message_parse_uri (const gchar *uri, GstSDPMessage *msg);
287 gchar* gst_sdp_message_as_uri (const gchar *scheme, const GstSDPMessage *msg);
290 gboolean gst_sdp_address_is_multicast (const gchar *nettype, const gchar *addrtype,
293 const gchar* gst_sdp_message_get_version (const GstSDPMessage *msg);
294 GstSDPResult gst_sdp_message_set_version (GstSDPMessage *msg, const gchar *version);
296 /* o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address> */
297 const GstSDPOrigin* gst_sdp_message_get_origin (const GstSDPMessage *msg);
298 GstSDPResult gst_sdp_message_set_origin (GstSDPMessage *msg, const gchar *username,
299 const gchar *sess_id, const gchar *sess_version,
300 const gchar *nettype, const gchar *addrtype,
303 /* s=<session name> */
304 const gchar* gst_sdp_message_get_session_name (const GstSDPMessage *msg);
305 GstSDPResult gst_sdp_message_set_session_name (GstSDPMessage *msg, const gchar *session_name);
307 /* i=<session description> */
308 const gchar* gst_sdp_message_get_information (const GstSDPMessage *msg);
309 GstSDPResult gst_sdp_message_set_information (GstSDPMessage *msg, const gchar *information);
312 const gchar* gst_sdp_message_get_uri (const GstSDPMessage *msg);
313 GstSDPResult gst_sdp_message_set_uri (GstSDPMessage *msg, const gchar *uri);
315 /* e=<email-address> */
316 guint gst_sdp_message_emails_len (const GstSDPMessage *msg);
317 const gchar* gst_sdp_message_get_email (const GstSDPMessage *msg, guint idx);
318 GstSDPResult gst_sdp_message_add_email (GstSDPMessage *msg, const gchar *email);
320 /* p=<phone-number> */
321 guint gst_sdp_message_phones_len (const GstSDPMessage *msg);
322 const gchar* gst_sdp_message_get_phone (const GstSDPMessage *msg, guint idx);
323 GstSDPResult gst_sdp_message_add_phone (GstSDPMessage *msg, const gchar *phone);
325 /* c=<nettype> <addrtype> <connection-address>[/<ttl>][/<number of addresses>] */
326 const GstSDPConnection* gst_sdp_message_get_connection (const GstSDPMessage *msg);
327 GstSDPResult gst_sdp_message_set_connection (GstSDPMessage *msg, const gchar *nettype,
328 const gchar *addrtype, const gchar *address,
329 guint ttl, guint addr_number);
330 /* b=<bwtype>:<bandwidth> */
331 guint gst_sdp_message_bandwidths_len (const GstSDPMessage *msg);
332 const GstSDPBandwidth* gst_sdp_message_get_bandwidth (const GstSDPMessage *msg, guint idx);
333 GstSDPResult gst_sdp_message_add_bandwidth (GstSDPMessage *msg, const gchar *bwtype,
335 /* t=<start-time> <stop-time> and
336 * r=<repeat interval> <active duration> <offsets from start-time> */
337 guint gst_sdp_message_times_len (const GstSDPMessage *msg);
338 const GstSDPTime* gst_sdp_message_get_time (const GstSDPMessage *msg, guint idx);
339 GstSDPResult gst_sdp_message_add_time (GstSDPMessage *msg, const gchar *start, const gchar *stop, const gchar **repeat);
341 /* z=<adjustment time> <offset> <adjustment time> <offset> .... */
342 guint gst_sdp_message_zones_len (const GstSDPMessage *msg);
343 const GstSDPZone* gst_sdp_message_get_zone (const GstSDPMessage *msg, guint idx);
344 GstSDPResult gst_sdp_message_add_zone (GstSDPMessage *msg, const gchar *adj_time,
345 const gchar *typed_time);
347 /* k=<method>[:<encryption key>] */
348 const GstSDPKey* gst_sdp_message_get_key (const GstSDPMessage *msg);
349 GstSDPResult gst_sdp_message_set_key (GstSDPMessage *msg, const gchar *type,
352 guint gst_sdp_message_attributes_len (const GstSDPMessage *msg);
353 const GstSDPAttribute* gst_sdp_message_get_attribute (const GstSDPMessage *msg, guint idx);
354 const gchar* gst_sdp_message_get_attribute_val (const GstSDPMessage *msg, const gchar *key);
355 const gchar* gst_sdp_message_get_attribute_val_n (const GstSDPMessage *msg, const gchar *key,
357 GstSDPResult gst_sdp_message_add_attribute (GstSDPMessage *msg, const gchar *key,
361 guint gst_sdp_message_medias_len (const GstSDPMessage *msg);
362 const GstSDPMedia* gst_sdp_message_get_media (const GstSDPMessage *msg, guint idx);
363 GstSDPResult gst_sdp_message_add_media (GstSDPMessage *msg, GstSDPMedia *media);
365 GstSDPResult gst_sdp_message_dump (const GstSDPMessage *msg);
367 /* Media descriptions */
368 GstSDPResult gst_sdp_media_new (GstSDPMedia **media);
369 GstSDPResult gst_sdp_media_init (GstSDPMedia *media);
370 GstSDPResult gst_sdp_media_uninit (GstSDPMedia *media);
371 GstSDPResult gst_sdp_media_free (GstSDPMedia *media);
373 gchar* gst_sdp_media_as_text (const GstSDPMedia *media);
375 /* m=<media> <port>/<number of ports> <proto> <fmt> ... */
376 const gchar* gst_sdp_media_get_media (const GstSDPMedia *media);
377 GstSDPResult gst_sdp_media_set_media (GstSDPMedia *media, const gchar *med);
379 guint gst_sdp_media_get_port (const GstSDPMedia *media);
380 guint gst_sdp_media_get_num_ports (const GstSDPMedia *media);
381 GstSDPResult gst_sdp_media_set_port_info (GstSDPMedia *media, guint port,
384 const gchar* gst_sdp_media_get_proto (const GstSDPMedia *media);
385 GstSDPResult gst_sdp_media_set_proto (GstSDPMedia *media, const gchar *proto);
387 guint gst_sdp_media_formats_len (const GstSDPMedia *media);
388 const gchar* gst_sdp_media_get_format (const GstSDPMedia *media, guint idx);
389 GstSDPResult gst_sdp_media_add_format (GstSDPMedia *media, const gchar *format);
391 /* i=<session description> */
392 const gchar* gst_sdp_media_get_information (const GstSDPMedia *media);
393 GstSDPResult gst_sdp_media_set_information (GstSDPMedia *media, const gchar *information);
395 /* c=<nettype> <addrtype> <connection-address>[/<ttl>][/<number of addresses>] */
396 guint gst_sdp_media_connections_len (const GstSDPMedia *media);
397 const GstSDPConnection* gst_sdp_media_get_connection (const GstSDPMedia *media, guint idx);
398 GstSDPResult gst_sdp_media_add_connection (GstSDPMedia *media, const gchar *nettype,
399 const gchar *addrtype, const gchar *address,
400 guint ttl, guint addr_number);
402 /* b=<bwtype>:<bandwidth> */
403 guint gst_sdp_media_bandwidths_len (const GstSDPMedia *media);
404 const GstSDPBandwidth* gst_sdp_media_get_bandwidth (const GstSDPMedia *media, guint idx);
405 GstSDPResult gst_sdp_media_add_bandwidth (GstSDPMedia *media, const gchar *bwtype,
408 /* k=<method>:<encryption key> */
409 const GstSDPKey* gst_sdp_media_get_key (const GstSDPMedia *media);
410 GstSDPResult gst_sdp_media_set_key (GstSDPMedia *media, const gchar *type,
413 guint gst_sdp_media_attributes_len (const GstSDPMedia *media);
414 const GstSDPAttribute * gst_sdp_media_get_attribute (const GstSDPMedia *media, guint idx);
415 const gchar* gst_sdp_media_get_attribute_val (const GstSDPMedia *media, const gchar *key);
416 const gchar* gst_sdp_media_get_attribute_val_n (const GstSDPMedia *media, const gchar *key,
418 GstSDPResult gst_sdp_media_add_attribute (GstSDPMedia *media, const gchar *key,
423 #endif /* __GST_SDP_MESSAGE_H__ */