diff options
author | michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-02-10 14:32:06 +0000 |
---|---|---|
committer | michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-02-10 14:32:06 +0000 |
commit | 2c82d5a1d85378dd0168914b3fb2ee5e0ef1abe7 (patch) | |
tree | 0ebe32cf2dad0d8341f04c25a4dcba1bbf6e375f /m_option.c | |
parent | fccc9cf57d0283975a84f9c4f49069f1710bf1b2 (diff) | |
download | mpv-2c82d5a1d85378dd0168914b3fb2ee5e0ef1abe7.tar.bz2 mpv-2c82d5a1d85378dd0168914b3fb2ee5e0ef1abe7.tar.xz |
m_option_type_double
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11948 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'm_option.c')
-rw-r--r-- | m_option.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/m_option.c b/m_option.c index c5478da73d..9aef34763d 100644 --- a/m_option.c +++ b/m_option.c @@ -179,10 +179,10 @@ m_option_type_t m_option_type_int = { // Float #undef VAL -#define VAL(x) (*(float*)(x)) +#define VAL(x) (*(double*)(x)) -static int parse_float(m_option_t* opt,char *name, char *param, void* dst, int src) { - float tmp_float; +static int parse_double(m_option_t* opt,char *name, char *param, void* dst, int src) { + double tmp_float; char* endptr; src = 0; @@ -230,6 +230,33 @@ static int parse_float(m_option_t* opt,char *name, char *param, void* dst, int s return 1; } +static char* print_double(m_option_t* opt, void* val) { + opt = NULL; + return dup_printf("%f",VAL(val)); +} + +m_option_type_t m_option_type_double = { + "Double", + "double precission floating point number or ratio (numerator[:/]denominator)", + sizeof(double), + 0, + parse_double, + print_double, + copy_opt, + copy_opt, + NULL, + NULL +}; + +#undef VAL +#define VAL(x) (*(float*)(x)) + +static int parse_float(m_option_t* opt,char *name, char *param, void* dst, int src) { + double tmp; + int r= parse_double(opt, name, param, &tmp, src); + if(r==1 && dst) VAL(dst) = tmp; +} + static char* print_float(m_option_t* opt, void* val) { opt = NULL; return dup_printf("%f",VAL(val)); |