comparison stream/freesdp/priv.h @ 19271:64d82a45a05d

introduce new 'stream' directory for all stream layer related components and split them from libmpdemux
author ben
date Mon, 31 Jul 2006 17:39:17 +0000
parents libmpdemux/freesdp/priv.h@ef667dd373e2
children a58943013e1d
comparison
equal deleted inserted replaced
19270:7d39b911f0bd 19271:64d82a45a05d
1 /*
2 This file is part of FreeSDP
3 Copyright (C) 2001,2002,2003 Federico Montesino Pouzols <fedemp@altern.org>
4
5 FreeSDP is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Benjamin Zores, (C) 2006
20 added support in parser for the a=control: lines.
21 added support in parser for the a=range: lines.
22 */
23
24 /**
25 * @file priv.h
26 *
27 * @short Common private header for both formatting and parsing modules.
28 **/
29
30 #ifndef FSDP_PRIV_H
31 #define FSDP_PRIV_H
32
33 #define _GNU_SOURCE
34
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <string.h>
38
39 #include "common.h"
40
41 #define NTP_EPOCH_OFFSET 2208988800UL
42
43 #define FSDP_MAX_LENGTH 2000
44
45 /* Tags for doxygen documentation */
46
47 /**
48 * @mainpage FreeSDP Library Reference Manual
49 * @section overview Overview (README)
50 * @verbinclude ../../README
51 *
52 **/
53
54 /**
55 * @example formatdemo.c
56 *
57 * A basic SDP descriptions formatter based on FreeSDP.
58 **/
59
60 /**
61 * @example parsedemo.c
62 *
63 * A basic SDP descriptions parser based on FreeSDP.
64 **/
65
66 /* Private routines declarations */
67
68 BEGIN_C_DECLS
69 /**
70 * @short bandwidth modifier
71 *
72 * Holds type of modifier and value. Also holds the literal bandwidth
73 * modifier if unknown.
74 **/
75 typedef struct
76 {
77 fsdp_bw_modifier_type_t b_mod_type;
78 unsigned long int b_value;
79 char *b_unknown_bw_modt;
80 } fsdp_bw_modifier_t;
81
82 /**
83 * @short a=rtpmap: attribute
84 *
85 * Holds payload type, enconding name, RTP clock rate, and encofing
86 * parameters.
87 **/
88 typedef struct
89 {
90 char *pt;
91 char *encoding_name;
92 unsigned int clock_rate;
93 char *parameters;
94 } fsdp_rtpmap_t;
95
96 /**
97 * @short Connection address specification
98 *
99 * Holds address (unicast or multicast) as well as TTL and number of
100 * ports, when it is an IP4 multicast address.
101 **/
102 typedef struct fsdp_connection_address_t_s
103 {
104 char *address;
105 unsigned int address_ttl;
106 unsigned int address_count;
107 } fsdp_connection_address_t;
108
109 /**
110 * @short Struct for each media in a session description.
111 **/
112 struct fsdp_media_description_t_s
113 {
114 /* from `m=<media> <port> <transport> <fmt list>' line */
115 fsdp_media_t media_type;
116 unsigned int port;
117 unsigned int port_count;
118 fsdp_transport_protocol_t transport;
119 char **formats;
120 unsigned int formats_count;
121 /* from i=<media title> */
122 char *i_title;
123 /* from `c=<network type> <address type> <connection address>' line
124 (optional) */
125 fsdp_network_type_t c_network_type;
126 fsdp_address_type_t c_address_type;
127 fsdp_connection_address_t c_address;
128 /* from `b=<modifier>:<bandwidth-value>' lines (optional) */
129 fsdp_bw_modifier_t *bw_modifiers;
130 unsigned int bw_modifiers_count;
131 /* from `k=<method>' or `k=<method>:<encryption key>' line
132 (optional) */
133 fsdp_encryption_method_t k_encryption_method;
134 char *k_encryption_content;
135 /* from `a=<attribute>' or `a=<attribute>:<value>' lines (opt) */
136 unsigned long int a_ptime;
137 unsigned long int a_maxptime;
138 /* rtpmap */
139 fsdp_rtpmap_t **a_rtpmaps;
140 unsigned int a_rtpmaps_count;
141 fsdp_orient_t a_orient;
142 fsdp_sendrecv_mode_t a_sendrecv_mode;
143
144 char **a_sdplangs;
145 unsigned int a_sdplangs_count;
146 char **a_langs;
147 unsigned int a_langs_count;
148
149 char **a_controls;
150 unsigned int a_controls_count;
151
152 char *a_range;
153
154 float a_framerate;
155 unsigned int a_quality;
156 char **a_fmtps;
157 unsigned int a_fmtps_count;
158 /* rtcp attribute */
159 unsigned int a_rtcp_port;
160 fsdp_network_type_t a_rtcp_network_type;
161 fsdp_address_type_t a_rtcp_address_type;
162 char *a_rtcp_address;
163 /* media attributes that are not directly supported */
164 char **unidentified_attributes;
165 unsigned int unidentified_attributes_count;
166 };
167
168 typedef struct fsdp_media_description_t_s fsdp_media_announcement_t;
169
170 /**
171 * @short Information for a repeat (struct for r= lines)
172 **/
173 typedef struct
174 {
175 /* times in seconds */
176 unsigned long int interval;
177 unsigned long int duration;
178 unsigned long int *offsets;
179 unsigned int offsets_count;
180 } fsdp_repeat_t;
181
182 /**
183 * @short Information about a time period
184 *
185 * The start and stop times as well as the information from the r=
186 * lines for a t= line are stored in this structures.
187 **/
188 typedef struct
189 {
190 time_t start;
191 time_t stop;
192 fsdp_repeat_t **repeats;
193 unsigned int repeats_count;
194 } fsdp_time_period_t;
195
196 /**
197 * @short Struct for session descriptions.
198 **/
199 struct fsdp_description_t_s
200 {
201 /* from v=... line */
202 unsigned int version;
203 /* from o=... line */
204 char *o_username;
205 char *o_session_id;
206 char *o_announcement_version;
207 fsdp_network_type_t o_network_type;
208 fsdp_address_type_t o_address_type;
209 char *o_address;
210 /* from s=... line */
211 char *s_name;
212 /* from i=... line (opt) */
213 char *i_information;
214 /* from u=... line (opt) */
215 char *u_uri;
216 /* from e=... lines (0 or more) */
217 const char **emails;
218 unsigned int emails_count;
219 /* from p=... lines (0 or more) */
220 const char **phones;
221 unsigned int phones_count;
222 /* from `c=<network type> <address type> <connection address>' line */
223 fsdp_network_type_t c_network_type;
224 fsdp_address_type_t c_address_type;
225 fsdp_connection_address_t c_address;
226 /* from `b=<modifier>:<bandwidth-value>' lines (optional) */
227 fsdp_bw_modifier_t *bw_modifiers;
228 unsigned int bw_modifiers_count;
229 /* from `t=<start time> <stop time>' lines (1 or more) */
230 /* from `r=<repeat interval> <active duration> <list of offsets from
231 start-time>' */
232 fsdp_time_period_t **time_periods;
233 unsigned int time_periods_count;
234 /* from `z=<adjustment time> <offset> <adjustment time> <offset>
235 ....' lines */
236 char *timezone_adj;
237 /* from `k=<method>' or `k=<method>:<encryption key>' line (opt) */
238 fsdp_encryption_method_t k_encryption_method;
239 char *k_encryption_content;
240 /* from `a=<attribute>' or `a=<attribute>:<value>' lines (opt) */
241 char *a_category;
242 char *a_keywords;
243 char *a_tool;
244 char *a_range;
245 /* rtpmap */
246 fsdp_rtpmap_t **a_rtpmaps;
247 unsigned int a_rtpmaps_count;
248 fsdp_sendrecv_mode_t a_sendrecv_mode;
249 fsdp_session_type_t a_type;
250 char *a_charset;
251
252 char **a_sdplangs;
253 unsigned int a_sdplangs_count;
254 char **a_langs;
255 unsigned int a_langs_count;
256
257 char **a_controls;
258 unsigned int a_controls_count;
259 /* from `m=<media> <port>/<number of ports> <transport> <fmt list>'
260 lines [one or more] */
261 fsdp_media_announcement_t **media_announcements;
262 unsigned int media_announcements_count;
263 /* session attributes that are not directly supported */
264 char **unidentified_attributes;
265 unsigned int unidentified_attributes_count;
266 };
267
268 #define MEDIA_RTPMAPS_MAX_COUNT 5
269 #define SDPLANGS_MAX_COUNT 5
270 #define SDPCONTROLS_MAX_COUNT 10
271 #define UNIDENTIFIED_ATTRIBUTES_MAX_COUNT 5
272
273 END_C_DECLS
274 #endif /* FSDP_PRIV_H */