Mercurial > mplayer.hg
comparison stream/realrtsp/sdpplin.c @ 29263:0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
author | diego |
---|---|
date | Wed, 13 May 2009 02:58:57 +0000 |
parents | e16088a911c1 |
children | c990a2cbfa8d |
comparison
equal
deleted
inserted
replaced
29262:7d545a6b8aff | 29263:0f1b5b68af32 |
---|---|
23 * | 23 * |
24 * | 24 * |
25 * sdp/sdpplin parser. | 25 * sdp/sdpplin parser. |
26 * | 26 * |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "stream/librtsp/rtsp.h" | 30 #include "stream/librtsp/rtsp.h" |
31 #include "sdpplin.h" | 31 #include "sdpplin.h" |
32 #include "xbuffer.h" | 32 #include "xbuffer.h" |
33 #include "mp_msg.h" | 33 #include "mp_msg.h" |
60 dtable['+'] = 62; | 60 dtable['+'] = 62; |
61 dtable['/'] = 63; | 61 dtable['/'] = 63; |
62 dtable['='] = 0; | 62 dtable['='] = 0; |
63 | 63 |
64 k=0; | 64 k=0; |
65 | 65 |
66 /*CONSTANTCONDITION*/ | 66 /*CONSTANTCONDITION*/ |
67 for (j=0; j<strlen(in); j+=4) | 67 for (j=0; j<strlen(in); j+=4) |
68 { | 68 { |
69 char a[4], b[4]; | 69 char a[4], b[4]; |
70 | 70 |
119 *out = xbuffer_copyin(*out, 0, in+flen, len-flen+1); | 119 *out = xbuffer_copyin(*out, 0, in+flen, len-flen+1); |
120 (*out)[len-flen]=0; | 120 (*out)[len-flen]=0; |
121 | 121 |
122 return len-flen; | 122 return len-flen; |
123 } | 123 } |
124 | 124 |
125 return 0; | 125 return 0; |
126 } | 126 } |
127 static sdpplin_stream_t *sdpplin_parse_stream(char **data) { | 127 static sdpplin_stream_t *sdpplin_parse_stream(char **data) { |
128 | 128 |
129 sdpplin_stream_t *desc=calloc(1,sizeof(sdpplin_stream_t)); | 129 sdpplin_stream_t *desc=calloc(1,sizeof(sdpplin_stream_t)); |
130 char *buf=xbuffer_init(32); | 130 char *buf=xbuffer_init(32); |
131 char *decoded=xbuffer_init(32); | 131 char *decoded=xbuffer_init(32); |
132 int handled; | 132 int handled; |
133 int got_mimetype; | 133 int got_mimetype; |
134 | 134 |
135 if (filter(*data, "m=", &buf)) { | 135 if (filter(*data, "m=", &buf)) { |
136 desc->id = strdup(buf); | 136 desc->id = strdup(buf); |
137 } else | 137 } else |
138 { | 138 { |
139 printf("sdpplin: no m= found.\n"); | 139 printf("sdpplin: no m= found.\n"); |
154 printf("libreal: sdpplin_stream: '%s'\n", buf); | 154 printf("libreal: sdpplin_stream: '%s'\n", buf); |
155 } | 155 } |
156 #endif | 156 #endif |
157 | 157 |
158 handled=0; | 158 handled=0; |
159 | 159 |
160 if(filter(*data,"a=control:streamid=",&buf)) { | 160 if(filter(*data,"a=control:streamid=",&buf)) { |
161 desc->stream_id=atoi(buf); | 161 desc->stream_id=atoi(buf); |
162 handled=1; | 162 handled=1; |
163 *data=nl(*data); | 163 *data=nl(*data); |
164 } | 164 } |
176 if (!desc->avg_packet_size) | 176 if (!desc->avg_packet_size) |
177 desc->avg_packet_size=desc->max_packet_size; | 177 desc->avg_packet_size=desc->max_packet_size; |
178 handled=1; | 178 handled=1; |
179 *data=nl(*data); | 179 *data=nl(*data); |
180 } | 180 } |
181 | 181 |
182 if(filter(*data,"a=StartTime:integer;",&buf)) { | 182 if(filter(*data,"a=StartTime:integer;",&buf)) { |
183 desc->start_time=atoi(buf); | 183 desc->start_time=atoi(buf); |
184 handled=1; | 184 handled=1; |
185 *data=nl(*data); | 185 *data=nl(*data); |
186 } | 186 } |
220 *data=nl(*data); | 220 *data=nl(*data); |
221 #ifdef LOG | 221 #ifdef LOG |
222 printf("mlti_data_size: %i\n", desc->mlti_data_size); | 222 printf("mlti_data_size: %i\n", desc->mlti_data_size); |
223 #endif | 223 #endif |
224 } | 224 } |
225 | 225 |
226 if(filter(*data,"a=ASMRuleBook:string;",&buf)) { | 226 if(filter(*data,"a=ASMRuleBook:string;",&buf)) { |
227 desc->asm_rule_book=strdup(buf); | 227 desc->asm_rule_book=strdup(buf); |
228 handled=1; | 228 handled=1; |
229 *data=nl(*data); | 229 *data=nl(*data); |
230 } | 230 } |
248 mp_msg(MSGT_OPEN, MSGL_WARN, "libreal: sdpplin_stream: implicit mimetype for stream_id != 0, weird.\n"); | 248 mp_msg(MSGT_OPEN, MSGL_WARN, "libreal: sdpplin_stream: implicit mimetype for stream_id != 0, weird.\n"); |
249 } | 249 } |
250 | 250 |
251 xbuffer_free(buf); | 251 xbuffer_free(buf); |
252 xbuffer_free(decoded); | 252 xbuffer_free(decoded); |
253 | 253 |
254 return desc; | 254 return desc; |
255 } | 255 } |
256 | 256 |
257 sdpplin_t *sdpplin_parse(char *data) { | 257 sdpplin_t *sdpplin_parse(char *data) { |
258 | 258 |
271 printf("libreal: sdpplin: '%s'\n", buf); | 271 printf("libreal: sdpplin: '%s'\n", buf); |
272 } | 272 } |
273 #endif | 273 #endif |
274 | 274 |
275 handled=0; | 275 handled=0; |
276 | 276 |
277 if (filter(data, "m=", &buf)) { | 277 if (filter(data, "m=", &buf)) { |
278 sdpplin_stream_t *stream=sdpplin_parse_stream(&data); | 278 sdpplin_stream_t *stream=sdpplin_parse_stream(&data); |
279 #ifdef LOG | 279 #ifdef LOG |
280 printf("got data for stream id %u\n", stream->stream_id); | 280 printf("got data for stream id %u\n", stream->stream_id); |
281 #endif | 281 #endif |
304 decoded=b64_decode(buf, decoded, &len); | 304 decoded=b64_decode(buf, decoded, &len); |
305 desc->title=strdup(decoded); | 305 desc->title=strdup(decoded); |
306 handled=1; | 306 handled=1; |
307 data=nl(data); | 307 data=nl(data); |
308 } | 308 } |
309 | 309 |
310 if(filter(data,"a=Author:buffer;",&buf)) { | 310 if(filter(data,"a=Author:buffer;",&buf)) { |
311 decoded=b64_decode(buf, decoded, &len); | 311 decoded=b64_decode(buf, decoded, &len); |
312 desc->author=strdup(decoded); | 312 desc->author=strdup(decoded); |
313 handled=1; | 313 handled=1; |
314 data=nl(data); | 314 data=nl(data); |
315 } | 315 } |
316 | 316 |
317 if(filter(data,"a=Copyright:buffer;",&buf)) { | 317 if(filter(data,"a=Copyright:buffer;",&buf)) { |
318 decoded=b64_decode(buf, decoded, &len); | 318 decoded=b64_decode(buf, decoded, &len); |
319 desc->copyright=strdup(decoded); | 319 desc->copyright=strdup(decoded); |
320 handled=1; | 320 handled=1; |
321 data=nl(data); | 321 data=nl(data); |
322 } | 322 } |
323 | 323 |
324 if(filter(data,"a=Abstract:buffer;",&buf)) { | 324 if(filter(data,"a=Abstract:buffer;",&buf)) { |
325 decoded=b64_decode(buf, decoded, &len); | 325 decoded=b64_decode(buf, decoded, &len); |
326 desc->abstract=strdup(decoded); | 326 desc->abstract=strdup(decoded); |
327 handled=1; | 327 handled=1; |
328 data=nl(data); | 328 data=nl(data); |
329 } | 329 } |
330 | 330 |
331 if(filter(data,"a=StreamCount:integer;",&buf)) { | 331 if(filter(data,"a=StreamCount:integer;",&buf)) { |
332 desc->stream_count=(unsigned int)atoi(buf); | 332 desc->stream_count=(unsigned int)atoi(buf); |
333 desc->stream=calloc(desc->stream_count, sizeof(sdpplin_stream_t*)); | 333 desc->stream=calloc(desc->stream_count, sizeof(sdpplin_stream_t*)); |
334 if (!desc->stream) desc->stream_count = 0; | 334 if (!desc->stream) desc->stream_count = 0; |
335 handled=1; | 335 handled=1; |
353 } | 353 } |
354 } | 354 } |
355 | 355 |
356 xbuffer_free(buf); | 356 xbuffer_free(buf); |
357 xbuffer_free(decoded); | 357 xbuffer_free(decoded); |
358 | 358 |
359 return desc; | 359 return desc; |
360 } | 360 } |
361 | 361 |
362 void sdpplin_free(sdpplin_t *description) { | 362 void sdpplin_free(sdpplin_t *description) { |
363 | 363 |