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.
This commit is contained in:
Wim Taymans 2006-02-17 19:31:12 +00:00
parent 43db7b6e18
commit 9a55cf386e
2 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2006-02-17 Wim Taymans <wim@fluendo.com>
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_convert_src),
(gst_vorbisenc_convert_sink):
Use some more scaling functions.
2006-02-17 Tim-Philipp Müller <tim at centricular dot net> 2006-02-17 Tim-Philipp Müller <tim at centricular dot net>
* ext/cdparanoia/gstcdparanoiasrc.c: * ext/cdparanoia/gstcdparanoiasrc.c:

View file

@ -310,7 +310,7 @@ gst_vorbisenc_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value,
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
*dest_value = src_value * GST_SECOND / avg; *dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND, avg);
break; break;
default: default:
res = FALSE; res = FALSE;
@ -319,7 +319,7 @@ gst_vorbisenc_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value,
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
*dest_value = src_value * avg / GST_SECOND; *dest_value = gst_util_uint64_scale_int (src_value, avg, GST_SECOND);
break; break;
default: default:
res = FALSE; res = FALSE;
@ -358,7 +358,8 @@ gst_vorbisenc_convert_sink (GstPad * pad, GstFormat src_format,
if (byterate == 0) if (byterate == 0)
return FALSE; return FALSE;
*dest_value = src_value * GST_SECOND / byterate; *dest_value =
gst_util_uint64_scale_int (src_value, GST_SECOND, byterate);
break; break;
} }
default: default:
@ -373,7 +374,9 @@ gst_vorbisenc_convert_sink (GstPad * pad, GstFormat src_format,
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
if (vorbisenc->frequency == 0) if (vorbisenc->frequency == 0)
return FALSE; return FALSE;
*dest_value = src_value * GST_SECOND / vorbisenc->frequency; *dest_value =
gst_util_uint64_scale_int (src_value, GST_SECOND,
vorbisenc->frequency);
break; break;
default: default:
res = FALSE; res = FALSE;
@ -385,7 +388,9 @@ gst_vorbisenc_convert_sink (GstPad * pad, GstFormat src_format,
scale = bytes_per_sample; scale = bytes_per_sample;
/* fallthrough */ /* fallthrough */
case GST_FORMAT_DEFAULT: 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; break;
default: default:
res = FALSE; res = FALSE;