comparison libmpdemux/realrtsp/sdpplin.c @ 15930:f59fdc0d0d14

Do some sanity checks before writing stream information Patch by Sergio Gelato >Sergio dot Gelato at astro dot su dot se< and some additions by me
author rtognimp
date Wed, 06 Jul 2005 19:20:16 +0000
parents 06a9914af502
children 9bb26af4f477
comparison
equal deleted inserted replaced
15929:782c636d50c8 15930:f59fdc0d0d14
24 * 24 *
25 * sdp/sdpplin parser. 25 * sdp/sdpplin parser.
26 * 26 *
27 */ 27 */
28 28
29 #include "config.h"
29 #include "rmff.h" 30 #include "rmff.h"
30 #include "rtsp.h" 31 #include "rtsp.h"
31 #include "sdpplin.h" 32 #include "sdpplin.h"
32 #include "xbuffer.h" 33 #include "xbuffer.h"
34 #include "mp_msg.h"
33 35
34 /* 36 /*
35 #define LOG 37 #define LOG
36 */ 38 */
37 39
249 if (filter(data, "m=", &buf)) { 251 if (filter(data, "m=", &buf)) {
250 stream=sdpplin_parse_stream(&data); 252 stream=sdpplin_parse_stream(&data);
251 #ifdef LOG 253 #ifdef LOG
252 printf("got data for stream id %u\n", stream->stream_id); 254 printf("got data for stream id %u\n", stream->stream_id);
253 #endif 255 #endif
256 if (desc->stream && (stream->stream_id >= 0) && (stream->stream_id < desc->stream_count))
254 desc->stream[stream->stream_id]=stream; 257 desc->stream[stream->stream_id]=stream;
258 else
259 mp_msg(MSGT_OPEN, MSGL_ERR, "sdpplin: got 'm=', but 'a=StreamCount' is still unknown. Broken sdp?\n");
255 continue; 260 continue;
256 } 261 }
257 262
258 if(filter(data,"a=Title:buffer;",&buf)) { 263 if(filter(data,"a=Title:buffer;",&buf)) {
259 decoded=b64_decode(buf, decoded, &len); 264 decoded=b64_decode(buf, decoded, &len);
282 handled=1; 287 handled=1;
283 data=nl(data); 288 data=nl(data);
284 } 289 }
285 290
286 if(filter(data,"a=StreamCount:integer;",&buf)) { 291 if(filter(data,"a=StreamCount:integer;",&buf)) {
287 desc->stream_count=atoi(buf); 292 desc->stream_count=(unsigned int)atoi(buf);
288 desc->stream=malloc(sizeof(sdpplin_stream_t*)*desc->stream_count); 293 desc->stream=malloc(sizeof(sdpplin_stream_t*)*desc->stream_count);
289 handled=1; 294 handled=1;
290 data=nl(data); 295 data=nl(data);
291 } 296 }
292 297