aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar rtogni <rtogni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-14 23:06:58 +0000
committerGravatar rtogni <rtogni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-14 23:06:58 +0000
commitee0a29934a4a5aee43e165eb701dbebbc8c33c3b (patch)
tree419374c986980f23c9580e6144c899e5763bf9c6
parentf0c3c22b57f681ac3089e03f7b511067bf72d507 (diff)
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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19098 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmpdemux/realrtsp/sdpplin.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/libmpdemux/realrtsp/sdpplin.c b/libmpdemux/realrtsp/sdpplin.c
index 80ba62bae1..1111fdca92 100644
--- a/libmpdemux/realrtsp/sdpplin.c
+++ b/libmpdemux/realrtsp/sdpplin.c
@@ -131,6 +131,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
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 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
}
*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 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
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 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
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 @@ sdpplin_t *sdpplin_parse(char *data) {
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 @@ sdpplin_t *sdpplin_parse(char *data) {
#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;
}