From 9a55cf386e4a3ab046484d5c3f51f90b955ebdbd Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 17 Feb 2006 19:31:12 +0000 Subject: [PATCH] ext/vorbis/vorbisenc.c: Use some more scaling functions. Original commit message from CVS: * ext/vorbis/vorbisenc.c: (gst_vorbisenc_convert_src), (gst_vorbisenc_convert_sink): Use some more scaling functions. --- ChangeLog | 6 ++++++ ext/vorbis/vorbisenc.c | 15 ++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f5e36c92f2..aa14d08eab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-02-17 Wim Taymans + + * ext/vorbis/vorbisenc.c: (gst_vorbisenc_convert_src), + (gst_vorbisenc_convert_sink): + Use some more scaling functions. + 2006-02-17 Tim-Philipp Müller * ext/cdparanoia/gstcdparanoiasrc.c: diff --git a/ext/vorbis/vorbisenc.c b/ext/vorbis/vorbisenc.c index 1e1756839e..4928d4d677 100644 --- a/ext/vorbis/vorbisenc.c +++ b/ext/vorbis/vorbisenc.c @@ -310,7 +310,7 @@ gst_vorbisenc_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value, case GST_FORMAT_BYTES: switch (*dest_format) { case GST_FORMAT_TIME: - *dest_value = src_value * GST_SECOND / avg; + *dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND, avg); break; default: res = FALSE; @@ -319,7 +319,7 @@ gst_vorbisenc_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value, case GST_FORMAT_TIME: switch (*dest_format) { case GST_FORMAT_BYTES: - *dest_value = src_value * avg / GST_SECOND; + *dest_value = gst_util_uint64_scale_int (src_value, avg, GST_SECOND); break; default: res = FALSE; @@ -358,7 +358,8 @@ gst_vorbisenc_convert_sink (GstPad * pad, GstFormat src_format, if (byterate == 0) return FALSE; - *dest_value = src_value * GST_SECOND / byterate; + *dest_value = + gst_util_uint64_scale_int (src_value, GST_SECOND, byterate); break; } default: @@ -373,7 +374,9 @@ gst_vorbisenc_convert_sink (GstPad * pad, GstFormat src_format, case GST_FORMAT_TIME: if (vorbisenc->frequency == 0) return FALSE; - *dest_value = src_value * GST_SECOND / vorbisenc->frequency; + *dest_value = + gst_util_uint64_scale_int (src_value, GST_SECOND, + vorbisenc->frequency); break; default: res = FALSE; @@ -385,7 +388,9 @@ gst_vorbisenc_convert_sink (GstPad * pad, GstFormat src_format, scale = bytes_per_sample; /* fallthrough */ case GST_FORMAT_DEFAULT: - *dest_value = src_value * scale * vorbisenc->frequency / GST_SECOND; + *dest_value = + gst_util_uint64_scale_int (src_value, + scale * vorbisenc->frequency, GST_SECOND); break; default: res = FALSE;