Mercurial > mplayer.hg
changeset 19093:aca5ce3701e9
Assume that missing streamcount means one stream, and missing mimetype
is audio. This seems to be used for some audio-only streams.
Fixes rtsp://ms.espectador.com/audio/app_metafiles/dol0606282.rm
author | rtogni |
---|---|
date | Fri, 14 Jul 2006 23:06:58 +0000 |
parents | 75f61cd2ad01 |
children | e84360ee61c9 |
files | libmpdemux/realrtsp/sdpplin.c |
diffstat | 1 files changed, 42 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/realrtsp/sdpplin.c Fri Jul 14 23:06:51 2006 +0000 +++ b/libmpdemux/realrtsp/sdpplin.c Fri Jul 14 23:06:58 2006 +0000 @@ -131,6 +131,7 @@ char *buf=xbuffer_init(32); char *decoded=xbuffer_init(32); int handled; + int got_mimetype; if (filter(*data, "m=", &buf)) { desc->id = strdup(buf); @@ -143,7 +144,17 @@ } *data=nl(*data); + got_mimetype = 0; + while (*data && **data && *data[0]!='m') { +#ifdef LOG + { + int len=strchr(*data,'\n')-(*data); + buf = xbuffer_copyin(buf, 0, *data, len+1); + buf[len]=0; + printf("libreal: sdpplin_stream: '%s'\n", buf); + } +#endif handled=0; @@ -198,6 +209,7 @@ desc->mime_type=strdup(buf); desc->mime_type_size=strlen(desc->mime_type); handled=1; + got_mimetype = 1; *data=nl(*data); } @@ -223,12 +235,20 @@ int len=strchr(*data,'\n')-(*data); buf = xbuffer_copyin(buf, 0, *data, len+1); buf[len]=0; - printf("libreal: sdpplin: not handled: '%s'\n", buf); + printf("libreal: sdpplin_stream: not handled: '%s'\n", buf); #endif *data=nl(*data); } } + if (!got_mimetype) { + mp_msg(MSGT_OPEN, MSGL_V, "libreal: sdpplin_stream: no mimetype\n"); + desc->mime_type = strdup("audio/x-pn-realaudio"); + desc->mime_type_size = strlen(desc->mime_type); + if (desc->stream_id) + mp_msg(MSGT_OPEN, MSGL_WARN, "libreal: sdpplin_stream: implicit mimetype for stream_id != 0, weird.\n"); + } + xbuffer_free(buf); xbuffer_free(decoded); @@ -244,6 +264,14 @@ int len; while (data && *data) { +#ifdef LOG + { + int len=strchr(data,'\n')-(data); + buf = xbuffer_copyin(buf, 0, data, len+1); + buf[len]=0; + printf("libreal: sdpplin: '%s'\n", buf); + } +#endif handled=0; @@ -254,10 +282,21 @@ #endif if (desc->stream && (stream->stream_id >= 0) && (stream->stream_id < desc->stream_count)) desc->stream[stream->stream_id]=stream; - else + else if (desc->stream) { - mp_msg(MSGT_OPEN, MSGL_ERR, "sdpplin: got 'm=', but 'a=StreamCount' is still unknown. Broken sdp?\n"); + mp_msg(MSGT_OPEN, MSGL_ERR, "sdpplin: bad stream_id %d (must be >= 0, < %d). Broken sdp?\n", + stream->stream_id, desc->stream_count); free(stream); + } else { + mp_msg(MSGT_OPEN, MSGL_V, "sdpplin: got 'm=', but 'a=StreamCount' is still unknown.\n"); + if (stream->stream_id == 0) { + desc->stream_count=1; + desc->stream=malloc(sizeof(sdpplin_stream_t*)); + desc->stream[0]=stream; + } else { + mp_msg(MSGT_OPEN, MSGL_ERR, "sdpplin: got 'm=', but 'a=StreamCount' is still unknown and stream_id != 0. Broken sdp?\n"); + free(stream); + } } continue; }