From 0e3178c1112049512545452b9f34d77d78b66dca Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Fri, 21 Oct 2005 09:24:28 +0000 Subject: [PATCH] gst/base/gstbasesrc.c (gst_base_src_query): Clean up percent position reporting. Original commit message from CVS: 2005-10-21 Andy Wingo * gst/base/gstbasesrc.c (gst_base_src_query): Clean up percent position reporting. --- ChangeLog | 5 +++++ gst/base/gstbasesrc.c | 9 +++++---- libs/gst/base/gstbasesrc.c | 9 +++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index dfe2b7a7f5..34288258e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-10-21 Andy Wingo + + * gst/base/gstbasesrc.c (gst_base_src_query): Clean up percent + position reporting. + 2005-10-20 Wim Taymans * gst/gsterror.c: (gst_error_get_message): diff --git a/gst/base/gstbasesrc.c b/gst/base/gstbasesrc.c index 68e9d5bf89..cbceeafa18 100644 --- a/gst/base/gstbasesrc.c +++ b/gst/base/gstbasesrc.c @@ -334,10 +334,11 @@ gst_base_src_query (GstPad * pad, GstQuery * query) return TRUE; case GST_FORMAT_PERCENT: b = gst_base_src_get_size (src, &ui64); - i64 = GST_FORMAT_PERCENT_MAX; - if (b) - i64 *= gst_guint64_to_gdouble (src->offset) - / gst_guint64_to_gdouble (ui64); + if (b && src->offset > ui64) + i64 = gst_util_uint64_scale (GST_FORMAT_PERCENT_MAX, src->offset, + ui64); + else + i64 = GST_FORMAT_PERCENT_MAX; gst_query_set_position (query, GST_FORMAT_PERCENT, i64); return TRUE; default: diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 68e9d5bf89..cbceeafa18 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -334,10 +334,11 @@ gst_base_src_query (GstPad * pad, GstQuery * query) return TRUE; case GST_FORMAT_PERCENT: b = gst_base_src_get_size (src, &ui64); - i64 = GST_FORMAT_PERCENT_MAX; - if (b) - i64 *= gst_guint64_to_gdouble (src->offset) - / gst_guint64_to_gdouble (ui64); + if (b && src->offset > ui64) + i64 = gst_util_uint64_scale (GST_FORMAT_PERCENT_MAX, src->offset, + ui64); + else + i64 = GST_FORMAT_PERCENT_MAX; gst_query_set_position (query, GST_FORMAT_PERCENT, i64); return TRUE; default: