Update of /cvsroot/xine/xine-plugin/src In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv11595
Modified Files: playlist.c Log Message: Parse the "starttime" tag of ASX playlists, too. Index: playlist.c =================================================================== RCS file: /cvsroot/xine/xine-plugin/src/playlist.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- playlist.c 18 Dec 2006 21:39:04 -0000 1.6 +++ playlist.c 19 Dec 2006 11:16:48 -0000 1.7 @@ -102,6 +102,20 @@ return NULL; } +static int parse_time (const char *str) { + float h, m, s; + + if (!strncmp (str, "npt=", 4)) + str += 4; + else if (!strncmp (str, "smpte=", 6)) + str += 6; + + if (sscanf (str, "%f:%f:%f", &h, &m, &s ) == 3) + return (double)(h * 3600.0 + m * 60.0 + s) * 1000.0; + + return strtod (str, NULL) * 1000.0; +} + /******************************************************************************/ static int m3u_playlist_parse (FILE *fp, playlist_entry_t **list) { @@ -160,7 +174,7 @@ static int asx_playlist_parse (FILE *fp, playlist_entry_t **list) { char buf[4096]; - char *tag, *src; + char *tag, *src, *begin; int num = 0; while ((tag = get_tag (fp, buf, sizeof(buf)))) { @@ -172,40 +186,37 @@ free (src); } } + else if (!strncasecmp (tag, "starttime ", 10)) { + begin = get_prop (tag+10, "value", 5) ? : get_prop (tag+10, "VALUE", 5); + if (begin) { + if (*list) + (*list)->prev->start = parse_time (begin); + free (begin); + } + } } return num; } -static int smil_parse_time (const char *str) { - float h, m, s; - - if (!strncmp (str, "npt=", 4)) - str += 4; - else if (!strncmp (str, "smpte=", 6)) - str += 6; - - if (sscanf (str, "%f:%f:%f", &h, &m, &s ) == 3) - return (double)(h * 3600.0 + m * 60.0 + s) * 1000.0; - - return strtod (str, NULL) * 1000.0; -} - static int smil_playlist_parse (FILE *fp, playlist_entry_t **list) { char buf[4096]; char *tag, *src, *begin; - int start = 0, num = 0; + int num = 0; while ((tag = get_tag (fp, buf, sizeof(buf)))) { if (!strncasecmp (tag, "audio ", 6) || !strncasecmp (tag, "video ", 6)) { src = get_prop (tag+6, "src", 3); if (src) { + int start = 0; + begin = get_prop (tag+6, "clipBegin", 9) ? : get_prop (tag+6, "clip-begin", 10); if (begin) { - start = smil_parse_time (begin); + start = parse_time (begin); free (begin); } + if (playlist_insert (list, src, start)) num++; free (src); ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Xine-cvslog mailing list Xine-cvslog@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xine-cvslog