From: Claudio C. <kl...@us...> - 2006-12-26 14:14:13
|
Update of /cvsroot/xine/xine-plugin/src In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv15256 Modified Files: playlist.c Log Message: Check whether we got a RAM playlist instead of a SMIL playlist or a Ref list instead of an ASX playlist. Index: playlist.c =================================================================== RCS file: /cvsroot/xine/xine-plugin/src/playlist.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- playlist.c 24 Dec 2006 14:39:18 -0000 1.9 +++ playlist.c 26 Dec 2006 14:13:43 -0000 1.10 @@ -148,7 +148,7 @@ break; /* Skip "Ref" prefix */ if (!strncmp (line, "Ref", 3)) { - tmp = strchr (line, '='); + tmp = strchr (line+3, '='); if (tmp) line = tmp + 1; } @@ -184,9 +184,11 @@ static int asx_playlist_parse (FILE *fp, playlist_entry_t **list) { char buf[4096]; char *tag, *src, *begin; - int num = 0; + int got_tag = 0; + int num = 0; while ((tag = get_tag (fp, buf, sizeof(buf)))) { + got_tag = 1; if (!strncasecmp (tag, "ref ", 4)) { src = get_prop (tag+4, "href", 4) ? : get_prop (tag+4, "HREF", 4); if (src) { @@ -204,6 +206,20 @@ } } } + + if (!got_tag) { + /* No tags found? Maybe a references list. */ + rewind (fp); + while ((src = get_line (fp, buf, sizeof(buf)))) { + if (!strncmp (src, "Ref", 3)) { + src = strchr (src+3, '='); + if (src && *(src+1)) { + if (playlist_insert (list, src+1, 0)) + num++; + } + } + } + } return num; } @@ -211,9 +227,11 @@ static int smil_playlist_parse (FILE *fp, playlist_entry_t **list) { char buf[4096]; char *tag, *src, *begin; - int num = 0; + int got_tag = 0; + int num = 0; while ((tag = get_tag (fp, buf, sizeof(buf)))) { + got_tag = 1; if (!strncasecmp (tag, "audio ", 6) || !strncasecmp (tag, "video ", 6)) { src = get_prop (tag+6, "src", 3); if (src) { @@ -232,6 +250,12 @@ } } } + + if (!got_tag) { + /* No tags found? Maybe a RAM playlist. */ + rewind (fp); + return ram_playlist_parse (fp, list); + } return num; } |