gst/base/: fix more guint64<->gdouble conversions
authorThomas Vander Stichele <thomas@apestaart.org>
Wed, 12 Oct 2005 21:56:52 +0000 (21:56 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Wed, 12 Oct 2005 21:56:52 +0000 (21:56 +0000)
Original commit message from CVS:

* gst/base/gstbasesink.c: (gst_base_sink_handle_object):
* gst/base/gstbasesrc.c: (gst_base_src_query):
fix more guint64<->gdouble conversions

ChangeLog
gst/base/gstbasesink.c
gst/base/gstbasesrc.c
libs/gst/base/gstbasesink.c
libs/gst/base/gstbasesrc.c

index ae3dbd8..fa65b14 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-10-12  Thomas Vander Stichele  <thomas at apestaart dot org>
 
+       * gst/base/gstbasesink.c: (gst_base_sink_handle_object):
+       * gst/base/gstbasesrc.c: (gst_base_src_query):
+         fix more guint64<->gdouble conversions
+
+2005-10-12  Thomas Vander Stichele  <thomas at apestaart dot org>
+
        * Makefile.am:
          add win32-update target
        * win32/common/gstconfig.h:
index 7a11f87..0209612 100644 (file)
@@ -524,7 +524,8 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
         }
 
         /* use previous rate to calculate duration */
-        basesink->segment_accum += (duration / ABS (basesink->segment_rate));
+        basesink->segment_accum += gst_gdouble_to_guint64 (
+            (gst_guint64_to_gdouble (duration) / ABS (basesink->segment_rate)));
         /* then update the current segment */
         basesink->segment_rate = rate;
         basesink->segment_start = segment_start;
index 86633a0..72b6902 100644 (file)
@@ -338,7 +338,9 @@ gst_base_src_query (GstPad * pad, GstQuery * query)
         case GST_FORMAT_PERCENT:
           b = gst_base_src_get_size (src, &ui64);
           i64 = GST_FORMAT_PERCENT_MAX;
-          i64 *= b ? (src->offset / gst_guint64_to_gdouble (ui64)) : 1.0;
+          if (b)
+            i64 *= gst_guint64_to_gdouble (src->offset)
+                / gst_guint64_to_gdouble (ui64);
           gst_query_set_position (query, GST_FORMAT_PERCENT,
               i64, GST_FORMAT_PERCENT_MAX);
           return TRUE;
index 7a11f87..0209612 100644 (file)
@@ -524,7 +524,8 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad,
         }
 
         /* use previous rate to calculate duration */
-        basesink->segment_accum += (duration / ABS (basesink->segment_rate));
+        basesink->segment_accum += gst_gdouble_to_guint64 (
+            (gst_guint64_to_gdouble (duration) / ABS (basesink->segment_rate)));
         /* then update the current segment */
         basesink->segment_rate = rate;
         basesink->segment_start = segment_start;
index 86633a0..72b6902 100644 (file)
@@ -338,7 +338,9 @@ gst_base_src_query (GstPad * pad, GstQuery * query)
         case GST_FORMAT_PERCENT:
           b = gst_base_src_get_size (src, &ui64);
           i64 = GST_FORMAT_PERCENT_MAX;
-          i64 *= b ? (src->offset / gst_guint64_to_gdouble (ui64)) : 1.0;
+          if (b)
+            i64 *= gst_guint64_to_gdouble (src->offset)
+                / gst_guint64_to_gdouble (ui64);
           gst_query_set_position (query, GST_FORMAT_PERCENT,
               i64, GST_FORMAT_PERCENT_MAX);
           return TRUE;