[Mplayer-cvslog] CVS: main m_option.c, 1.28, 1.29 m_option.h, 1.9, 1.10
Michael Niedermayer CVS
syncmail at mplayerhq.hu
Tue Feb 10 15:32:09 CET 2004
CVS change done by Michael Niedermayer CVS
Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv11590
Modified Files:
m_option.c m_option.h
Log Message:
m_option_type_double
Index: m_option.c
===================================================================
RCS file: /cvsroot/mplayer/main/m_option.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- m_option.c 13 Jan 2004 09:55:40 -0000 1.28
+++ m_option.c 10 Feb 2004 14:32:06 -0000 1.29
@@ -179,10 +179,10 @@
// 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 @@
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));
Index: m_option.h
===================================================================
RCS file: /cvsroot/mplayer/main/m_option.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- m_option.h 13 Aug 2003 16:44:39 -0000 1.9
+++ m_option.h 10 Feb 2004 14:32:06 -0000 1.10
@@ -11,6 +11,7 @@
extern m_option_type_t m_option_type_flag;
extern m_option_type_t m_option_type_int;
extern m_option_type_t m_option_type_float;
+extern m_option_type_t m_option_type_double;
extern m_option_type_t m_option_type_string;
extern m_option_type_t m_option_type_string_list;
extern m_option_type_t m_option_type_position;
@@ -78,6 +79,7 @@
#define CONF_TYPE_FLAG (&m_option_type_flag)
#define CONF_TYPE_INT (&m_option_type_int)
#define CONF_TYPE_FLOAT (&m_option_type_float)
+#define CONF_TYPE_DOUBLE (&m_option_type_double)
#define CONF_TYPE_STRING (&m_option_type_string)
#define CONF_TYPE_FUNC (&m_option_type_func)
#define CONF_TYPE_FUNC_PARAM (&m_option_type_func_param)
More information about the MPlayer-cvslog
mailing list