mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 23:32:26 +00:00
64-bit -sb offsets patch by Andy Goth <unununium@openverse.com>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7115 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
e9d168f902
commit
e70976de89
@ -54,7 +54,7 @@
|
||||
{"frames", &play_n_frames_mf, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
|
||||
|
||||
// seek to byte/seconds position
|
||||
{"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
|
||||
{"sb", &seek_to_byte, CONF_TYPE_POSITION, CONF_MIN, 0, 0, NULL},
|
||||
{"ss", &seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, NULL},
|
||||
|
||||
// AVI specific: force non-interleaved mode
|
||||
|
44
cfgparser.c
44
cfgparser.c
@ -112,6 +112,9 @@ m_config_save_option(m_config_t* config, config_t* conf,char* opt, char *param)
|
||||
case CONF_TYPE_STRING_LIST :
|
||||
save[sl].param.as_pointer = *((char***)conf->p);
|
||||
break;
|
||||
case CONF_TYPE_POSITION :
|
||||
save[sl].param.as_off_t = *((off_t*)conf->p);
|
||||
break;
|
||||
default :
|
||||
mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Should never append in m_config_save_option : conf->type=%d\n",conf->type);
|
||||
}
|
||||
@ -196,6 +199,9 @@ m_config_revert_option(m_config_t* config, config_save_t* save) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CONF_TYPE_POSITION :
|
||||
*((off_t*)save->opt->p) = save->param.as_off_t;
|
||||
break;
|
||||
default :
|
||||
mp_msg(MSGT_CFGPARSER,MSGL_WARN,"Why do we reverse this : name=%s type=%d ?\n",save->opt->name,save->opt->type);
|
||||
}
|
||||
@ -425,7 +431,9 @@ static int config_read_option(m_config_t *config,config_t** conf_list, char *opt
|
||||
{
|
||||
int i=0,nconf = 0;
|
||||
long tmp_int;
|
||||
off_t tmp_off;
|
||||
double tmp_float;
|
||||
int dummy;
|
||||
int ret = -1;
|
||||
char *endptr;
|
||||
config_t* conf=NULL;
|
||||
@ -731,6 +739,42 @@ static int config_read_option(m_config_t *config,config_t** conf_list, char *opt
|
||||
case CONF_TYPE_PRINT:
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", (char *) conf[i].p);
|
||||
exit(1);
|
||||
case CONF_TYPE_POSITION:
|
||||
if (param == NULL)
|
||||
goto err_missing_param;
|
||||
|
||||
if (sscanf(param, sizeof(off_t) == sizeof(int) ?
|
||||
"%d%c" : "%lld%c", &tmp_off, dummy) != 1) {
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_ERR, "parameter must be an integer: %s\n", param);
|
||||
ret = ERR_OUT_OF_RANGE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (conf[i].flags & CONF_MIN)
|
||||
if (tmp_off < conf[i].min) {
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_ERR,
|
||||
(sizeof(off_t) == sizeof(int) ?
|
||||
"parameter must be >= %d: %s\n" :
|
||||
"parameter must be >= %lld: %s\n"),
|
||||
(off_t) conf[i].min, param);
|
||||
ret = ERR_OUT_OF_RANGE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (conf[i].flags & CONF_MAX)
|
||||
if (tmp_off > conf[i].max) {
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_ERR,
|
||||
(sizeof(off_t) == sizeof(int) ?
|
||||
"parameter must be <= %d: %s\n" :
|
||||
"parameter must be <= %lld: %s\n"),
|
||||
(off_t) conf[i].max, param);
|
||||
ret = ERR_OUT_OF_RANGE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
*((off_t *) conf[i].p) = tmp_off;
|
||||
ret = 1;
|
||||
break;
|
||||
default:
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Unknown config type specified in conf-mplayer.h!\n");
|
||||
break;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define CONF_TYPE_FUNC_FULL 7
|
||||
#define CONF_TYPE_SUBCONFIG 8
|
||||
#define CONF_TYPE_STRING_LIST 9
|
||||
#define CONF_TYPE_POSITION 10
|
||||
|
||||
|
||||
#define ERR_NOT_AN_OPTION -1
|
||||
@ -73,6 +74,7 @@ struct config_save {
|
||||
int as_int;
|
||||
float as_float;
|
||||
void* as_pointer;
|
||||
off_t* as_off_t;
|
||||
} param;
|
||||
char* opt_name;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user