Mercurial > mplayer.hg
changeset 33532:5a3aa408c9ad
Support "Length" option is .pls playlist files.
author | reimar |
---|---|
date | Wed, 15 Jun 2011 18:06:28 +0000 |
parents | 84ce059fae34 |
children | 3552dac79b1a |
files | playtreeparser.c |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/playtreeparser.c Wed Jun 15 09:28:20 2011 +0000 +++ b/playtreeparser.c Wed Jun 15 18:06:28 2011 +0000 @@ -334,8 +334,14 @@ num = pls_read_entry(line+6,&entries,&max_entry,&v); if(num < 0) mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line); - else - entries[num-1].length = strdup(v); + else { + char *end; + long val = strtol(v, &end, 10); + if (*end || (val <= 0 && val != -1)) + mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Invalid length value in entry %s\n",line); + else if (val > 0) + entries[num-1].length = strdup(v); + } } else mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Unknown entry type %s\n",line); line = play_tree_parser_get_line(p); @@ -348,6 +354,8 @@ mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding entry %s\n",entries[num].file); entry = play_tree_new(); play_tree_add_file(entry,entries[num].file); + if (entries[num].length) + play_tree_set_param(entry, "endpos", entries[num].length); free(entries[num].file); if(list) play_tree_append_entry(last_entry,entry);