gst/gstutils.c (gst_util_uint64_scale): New 3733t funct10n.

Original commit message from CVS:
2005-08-29  Andy Wingo  <wingo@pobox.com>

* gst/gstutils.c (gst_util_uint64_scale): New 3733t funct10n.
This commit is contained in:
Andy Wingo 2005-08-29 16:10:36 +00:00
parent 1a6117866f
commit 95e4e1382d
4 changed files with 24 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2005-08-29 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c (gst_util_uint64_scale): New 3733t funct10n.
2005-08-28 Andy Wingo <wingo@pobox.com>
* gst/gstutils.h (GST_BOILERPLATE_FULL): Prototype instance_init

2
common

@ -1 +1 @@
Subproject commit 7c93670c50de2b6e9d8edd31737c636192fbd831
Subproject commit 89d82b662da00096b70e70a7a102b294acaae6dd

View file

@ -273,6 +273,23 @@ gst_util_set_object_arg (GObject * object, const gchar * name,
}
}
/**
* gst_util_uint64_scale:
* @val: the number to scale
* @num: the numerator of the scale ratio
* @denom: the denominator of the scale ratio
*
* Scale @val by @num / @denom, trying to avoid overflows.
*
* Returns: @val * @num / @denom, trying to avoid overflows.
*/
guint64
gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom)
{
/* implement me with fixed point, if you care */
return val * (((double) num) / denom);
}
/* -----------------------------------------------------
*
* The following code will be moved out of the main

View file

@ -34,6 +34,8 @@ void gst_util_set_object_arg (GObject *object, const gchar *name, const gchar
void gst_util_dump_mem (const guchar *mem, guint size);
guint64 gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom);
void gst_print_pad_caps (GString *buf, gint indent, GstPad *pad);
void gst_print_element_args (GString *buf, gint indent, GstElement *element);