77
77
/* mapping functions */
79
#define DEFINE_CONVERT(type,Type,TYPE) \
79
#define DEFINE_CONVERT(type,Type,TYPE,ROUNDING_OP) \
81
81
convert_g_value_to_##type (GstDirectControlBinding *self, gdouble s, GValue *d) \
86
86
s = CLAMP (s, 0.0, 1.0); \
87
v = pspec->minimum + (g##type) ((pspec->maximum - pspec->minimum) * s); \
87
v = pspec->minimum + (g##type) ROUNDING_OP ((pspec->maximum - pspec->minimum) * s); \
88
88
g_value_set_##type (d, v); \
95
95
g##type *d = (g##type *)d_; \
97
97
s = CLAMP (s, 0.0, 1.0); \
98
*d = pspec->minimum + (g##type) ((pspec->maximum - pspec->minimum) * s); \
98
*d = pspec->minimum + (g##type) ROUNDING_OP ((pspec->maximum - pspec->minimum) * s); \
102
DEFINE_CONVERT (int, Int, INT);
103
DEFINE_CONVERT (uint, UInt, UINT);
104
DEFINE_CONVERT (long, Long, LONG);
105
DEFINE_CONVERT (ulong, ULong, ULONG);
106
DEFINE_CONVERT (int64, Int64, INT64);
107
DEFINE_CONVERT (uint64, UInt64, UINT64);
108
DEFINE_CONVERT (float, Float, FLOAT);
109
DEFINE_CONVERT (double, Double, DOUBLE);
102
DEFINE_CONVERT (int, Int, INT, rint);
103
DEFINE_CONVERT (uint, UInt, UINT, rint);
104
DEFINE_CONVERT (long, Long, LONG, rint);
105
DEFINE_CONVERT (ulong, ULong, ULONG, rint);
106
DEFINE_CONVERT (int64, Int64, INT64, rint);
107
DEFINE_CONVERT (uint64, UInt64, UINT64, rint);
108
DEFINE_CONVERT (float, Float, FLOAT, /*NOOP*/);
109
DEFINE_CONVERT (double, Double, DOUBLE, /*NOOP*/);
112
112
convert_g_value_to_boolean (GstDirectControlBinding * self, gdouble s,