diff --git a/ChangeLog b/ChangeLog index 8fe32c9bd0..d827f31c9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-11-24 Wim Taymans + + * gst/gstutils.c: (gst_util_uint64_scale), + (gst_util_uint64_scale_int): + Chain trivial case to _scale_int. + 2005-11-24 Wim Taymans * check/gst/gstutils.c: (GST_START_TEST), (gst_utils_suite): diff --git a/gst/gstutils.c b/gst/gstutils.c index d955719e59..7944006b6a 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -369,9 +369,19 @@ typedef union guint64 gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom) { - /* implement me with fixed point, if you care */ - return gst_gdouble_to_guint64 (gst_guint64_to_gdouble (val) * - ((gst_guint64_to_gdouble (num)) / gst_guint64_to_gdouble (denom))); + guint64 result; + + g_return_val_if_fail (denom != 0, G_MAXUINT64); + + if (num <= G_MAXINT32 && denom <= G_MAXINT32) { + result = gst_util_uint64_scale_int (val, (gint) num, (gint) denom); + } else { + /* implement me with fixed point, if you care */ + result = gst_gdouble_to_guint64 (gst_guint64_to_gdouble (val) * + ((gst_guint64_to_gdouble (num)) / gst_guint64_to_gdouble (denom))); + } + + return result; } /**