mirror of https://github.com/mpv-player/mpv
Fix broken parse_time_size, it would cause MPlayer to parse its parameter twice,
e.g. "mplayer file -endpos 01" would try to play the file "01", too git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20009 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
050ff7d8bd
commit
798b104801
27
m_option.c
27
m_option.c
|
@ -1178,13 +1178,7 @@ m_option_type_t m_option_type_afmt = {
|
||||||
// Time or size (-endpos)
|
// Time or size (-endpos)
|
||||||
|
|
||||||
static int parse_time_size(m_option_t* opt,char *name, char *param, void* dst, int src) {
|
static int parse_time_size(m_option_t* opt,char *name, char *param, void* dst, int src) {
|
||||||
|
m_time_size_t ts;
|
||||||
if (dst == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
m_time_size_t* ts = dst;
|
|
||||||
ts->pos=0;
|
|
||||||
|
|
||||||
char unit[4];
|
char unit[4];
|
||||||
int a,b;
|
int a,b;
|
||||||
float d;
|
float d;
|
||||||
|
@ -1193,9 +1187,10 @@ static int parse_time_size(m_option_t* opt,char *name, char *param, void* dst, i
|
||||||
if (param == NULL || strlen(param) == 0)
|
if (param == NULL || strlen(param) == 0)
|
||||||
return M_OPT_MISSING_PARAM;
|
return M_OPT_MISSING_PARAM;
|
||||||
|
|
||||||
|
ts.pos=0;
|
||||||
/* End at size parsing */
|
/* End at size parsing */
|
||||||
if(sscanf(param, "%lf%3s", &end_at, unit) == 2) {
|
if(sscanf(param, "%lf%3s", &end_at, unit) == 2) {
|
||||||
ts->type = END_AT_SIZE;
|
ts.type = END_AT_SIZE;
|
||||||
if(!strcasecmp(unit, "b"))
|
if(!strcasecmp(unit, "b"))
|
||||||
;
|
;
|
||||||
else if(!strcasecmp(unit, "kb"))
|
else if(!strcasecmp(unit, "kb"))
|
||||||
|
@ -1205,11 +1200,11 @@ static int parse_time_size(m_option_t* opt,char *name, char *param, void* dst, i
|
||||||
else if(!strcasecmp(unit, "gb"))
|
else if(!strcasecmp(unit, "gb"))
|
||||||
end_at *= 1024*1024*1024;
|
end_at *= 1024*1024*1024;
|
||||||
else
|
else
|
||||||
ts->type = END_AT_NONE;
|
ts.type = END_AT_NONE;
|
||||||
|
|
||||||
if (ts->type == END_AT_SIZE) {
|
if (ts.type == END_AT_SIZE) {
|
||||||
ts->pos = end_at;
|
ts.pos = end_at;
|
||||||
return 1;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1227,9 +1222,11 @@ static int parse_time_size(m_option_t* opt,char *name, char *param, void* dst, i
|
||||||
return M_OPT_INVALID;
|
return M_OPT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
ts->type = END_AT_TIME;
|
ts.type = END_AT_TIME;
|
||||||
ts->pos = end_at;
|
ts.pos = end_at;
|
||||||
|
out:
|
||||||
|
if(dst)
|
||||||
|
*(m_time_size_t *)dst = ts;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue