~ubuntu-branches/ubuntu/trusty/gstreamer1.0/trusty

« back to all changes in this revision

Viewing changes to libs/gst/controller/gstdirectcontrolbinding.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2012-09-14 09:04:41 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120914090441-1ul912ezvm3xfael
Tags: 0.11.94-1
* New upstream release:
  + debian/libgstreamer.symbols:
    - Update symbols file.
  + debian/control.in:
    - Build-depend on gtk-doc >= 1.12.
  + debian/patches/0001-netclientclock-simplify-by-using-g_socket_condition_.patch:
    - Dropped, merged upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
 
77
77
/* mapping functions */
78
78
 
79
 
#define DEFINE_CONVERT(type,Type,TYPE) \
 
79
#define DEFINE_CONVERT(type,Type,TYPE,ROUNDING_OP) \
80
80
static void \
81
81
convert_g_value_to_##type (GstDirectControlBinding *self, gdouble s, GValue *d) \
82
82
{ \
84
84
  g##type v; \
85
85
  \
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); \
89
89
} \
90
90
\
95
95
  g##type *d = (g##type *)d_; \
96
96
  \
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); \
99
99
}
100
100
 
101
101
 
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*/);
110
110
 
111
111
static void
112
112
convert_g_value_to_boolean (GstDirectControlBinding * self, gdouble s,
207
207
 
208
208
    GST_DEBUG ("  using type %s", g_type_name (base));
209
209
 
210
 
    // select mapping function
 
210
    /* select mapping function */
211
211
    switch (base) {
212
212
      case G_TYPE_INT:
213
213
        self->convert_g_value = convert_g_value_to_int;