Mercurial > mplayer.hg
changeset 22712:c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
<smil> signature.
Fixes http://www.cartalk.com/Radio/Show/01.smil
author | rtogni |
---|---|
date | Sun, 18 Mar 2007 21:39:52 +0000 |
parents | 8a0c3f356efa |
children | 88b877974c8c |
files | playtreeparser.c |
diffstat | 1 files changed, 15 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/playtreeparser.c Sun Mar 18 21:21:38 2007 +0000 +++ b/playtreeparser.c Sun Mar 18 21:39:52 2007 +0000 @@ -474,8 +474,9 @@ } //Get entries from smil + src_line = line; line = NULL; - while((src_line = play_tree_parser_get_line(p)) != NULL) { + do { strstrip(src_line); if (line) { free(line); @@ -516,26 +517,30 @@ for (j = i; line[j]; j++) line[j] = line[j+1]; } - if (line[0]=='\0') - continue; + pos = line; + while (pos) { if (!entrymode) { // all entries filled so far - if (strncasecmp(line,"<video",6)==0 || strncasecmp(line,"<audio",6)==0 || strncasecmp(line,"<media",6)==0) { + while (pos=strchr(pos, '<')) { + if (strncasecmp(pos,"<video",6)==0 || strncasecmp(pos,"<audio",6)==0 || strncasecmp(pos,"<media",6)==0) { entrymode=1; + break; // Got a valid tag, exit '<' search loop } + pos++; + } } if (entrymode) { //Entry found but not yet filled - pos = strstr(line,"src="); // Is source present on this line + pos = strstr(pos,"src="); // Is source present on this line if (pos != NULL) { entrymode=0; s_start=pos+5; s_end=strchr(s_start,'"'); if (s_end == NULL) { mp_msg(MSGT_PLAYTREE,MSGL_V,"Error parsing this source line %s\n",line); - continue; + break; } if (s_end-s_start> 511) { mp_msg(MSGT_PLAYTREE,MSGL_V,"Cannot store such a large source %s\n",line); - continue; + break; } strncpy(source,s_start,s_end-s_start); source[(s_end-s_start)]='\0'; // Null terminate @@ -546,9 +551,11 @@ else play_tree_append_entry(last_entry,entry); last_entry = entry; + pos = s_end; } } - } + } + } while((src_line = play_tree_parser_get_line(p)) != NULL); if (line) free(line);