gst/base/gstbasesrc.c (gst_base_src_query): Clean up percent position reporting.

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

* gst/base/gstbasesrc.c (gst_base_src_query): Clean up percent
position reporting.
This commit is contained in:
Andy Wingo 2005-10-21 09:24:28 +00:00
parent c3fecfa6f8
commit 0e3178c111
3 changed files with 15 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2005-10-21 Andy Wingo <wingo@pobox.com>
* gst/base/gstbasesrc.c (gst_base_src_query): Clean up percent
position reporting.
2005-10-20 Wim Taymans <wim@fluendo.com> 2005-10-20 Wim Taymans <wim@fluendo.com>
* gst/gsterror.c: (gst_error_get_message): * gst/gsterror.c: (gst_error_get_message):

View file

@ -334,10 +334,11 @@ gst_base_src_query (GstPad * pad, GstQuery * query)
return TRUE; return TRUE;
case GST_FORMAT_PERCENT: case GST_FORMAT_PERCENT:
b = gst_base_src_get_size (src, &ui64); b = gst_base_src_get_size (src, &ui64);
i64 = GST_FORMAT_PERCENT_MAX; if (b && src->offset > ui64)
if (b) i64 = gst_util_uint64_scale (GST_FORMAT_PERCENT_MAX, src->offset,
i64 *= gst_guint64_to_gdouble (src->offset) ui64);
/ gst_guint64_to_gdouble (ui64); else
i64 = GST_FORMAT_PERCENT_MAX;
gst_query_set_position (query, GST_FORMAT_PERCENT, i64); gst_query_set_position (query, GST_FORMAT_PERCENT, i64);
return TRUE; return TRUE;
default: default:

View file

@ -334,10 +334,11 @@ gst_base_src_query (GstPad * pad, GstQuery * query)
return TRUE; return TRUE;
case GST_FORMAT_PERCENT: case GST_FORMAT_PERCENT:
b = gst_base_src_get_size (src, &ui64); b = gst_base_src_get_size (src, &ui64);
i64 = GST_FORMAT_PERCENT_MAX; if (b && src->offset > ui64)
if (b) i64 = gst_util_uint64_scale (GST_FORMAT_PERCENT_MAX, src->offset,
i64 *= gst_guint64_to_gdouble (src->offset) ui64);
/ gst_guint64_to_gdouble (ui64); else
i64 = GST_FORMAT_PERCENT_MAX;
gst_query_set_position (query, GST_FORMAT_PERCENT, i64); gst_query_set_position (query, GST_FORMAT_PERCENT, i64);
return TRUE; return TRUE;
default: default: