1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-30 02:52:10 +00:00

playlist: Support "Length" option in .pls playlist files

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33620 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2011-06-15 18:06:28 +00:00 committed by Uoti Urpala
parent d6e34fe91a
commit dbff0e49ba

View File

@ -334,8 +334,14 @@ parse_pls(play_tree_parser_t* p) {
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 @@ parse_pls(play_tree_parser_t* p) {
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);