mirror of
https://github.com/mpv-player/mpv
synced 2025-03-20 02:09:52 +00:00
Add a 64 bit integer type to the suboption parser.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28794 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
b9102d0b06
commit
39bb720ef8
22
m_option.c
22
m_option.c
@ -162,13 +162,20 @@ static int parse_int(const m_option_t* opt,const char *name, char *param, void*
|
||||
return M_OPT_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
if(dst) VAL(dst) = tmp_int;
|
||||
if(dst) {
|
||||
if (opt->type->size == sizeof(int64_t))
|
||||
*(int64_t *)dst = tmp_int;
|
||||
else
|
||||
VAL(dst) = tmp_int;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char* print_int(const m_option_t* opt, const void* val) {
|
||||
opt = NULL;
|
||||
if (opt->type->size == sizeof(int64_t))
|
||||
return dup_printf("%"PRId64, *(const int64_t *)val);
|
||||
return dup_printf("%d",VAL(val));
|
||||
}
|
||||
|
||||
@ -185,6 +192,19 @@ const m_option_type_t m_option_type_int = {
|
||||
NULL
|
||||
};
|
||||
|
||||
const m_option_type_t m_option_type_int64 = {
|
||||
"Integer64",
|
||||
"",
|
||||
sizeof(int64_t),
|
||||
0,
|
||||
parse_int,
|
||||
print_int,
|
||||
copy_opt,
|
||||
copy_opt,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
// Float
|
||||
|
||||
#undef VAL
|
||||
|
@ -25,6 +25,7 @@ struct m_struct_st;
|
||||
// Simple types
|
||||
extern const m_option_type_t m_option_type_flag;
|
||||
extern const m_option_type_t m_option_type_int;
|
||||
extern const m_option_type_t m_option_type_int64;
|
||||
extern const m_option_type_t m_option_type_float;
|
||||
extern const m_option_type_t m_option_type_double;
|
||||
extern const m_option_type_t m_option_type_string;
|
||||
@ -152,6 +153,7 @@ extern const m_obj_params_t m_span_params_def;
|
||||
// FIXME: backward compatibility
|
||||
#define CONF_TYPE_FLAG (&m_option_type_flag)
|
||||
#define CONF_TYPE_INT (&m_option_type_int)
|
||||
#define CONF_TYPE_INT64 (&m_option_type_int64)
|
||||
#define CONF_TYPE_FLOAT (&m_option_type_float)
|
||||
#define CONF_TYPE_DOUBLE (&m_option_type_double)
|
||||
#define CONF_TYPE_STRING (&m_option_type_string)
|
||||
|
Loading…
Reference in New Issue
Block a user