gst/: Use utility method for scaling clocktime for fractional framerates.
authorMichael Smith <msmith@xiph.org>
Tue, 22 Nov 2005 16:19:36 +0000 (16:19 +0000)
committerMichael Smith <msmith@xiph.org>
Tue, 22 Nov 2005 16:19:36 +0000 (16:19 +0000)
Original commit message from CVS:
* gst/videorate/gstvideorate.c: (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_create):
Use utility method for scaling clocktime for fractional framerates.

ChangeLog
gst/videorate/gstvideorate.c
gst/videotestsrc/gstvideotestsrc.c

index 0b173a1..930efe0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-11-22  Michael Smith <msmith@fluendo.com>
+
+       * gst/videorate/gstvideorate.c: (gst_videorate_chain):
+       * gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_create):
+         Use utility method for scaling clocktime for fractional framerates.
+
 2005-11-22  Jan Schmidt  <thaytan@mad.scientist.com>
 
        * ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
@@ -39,6 +45,7 @@
        * gst-libs/gst/audio/audio.h:
          remove some deprecated functions
 
+>>>>>>> 1.2127
 2005-11-22  Andy Wingo  <wingo@pobox.com>
 
        * Update for gst_tag_setter API changes.
index 0ca1fe1..037e476 100644 (file)
@@ -507,12 +507,14 @@ gst_videorate_chain (GstPad * pad, GstBuffer * buffer)
             GST_BUFFER_SIZE (videorate->prevbuf));
         GST_BUFFER_TIMESTAMP (outbuf) = videorate->next_ts;
         videorate->out++;
-        videorate->next_ts =
-            videorate->first_ts +
-            (videorate->out * GST_SECOND *
-            videorate->to_rate_denominator / videorate->to_rate_numerator);
-        GST_BUFFER_DURATION (outbuf) =
-            videorate->next_ts - GST_BUFFER_TIMESTAMP (outbuf);
+        if (videorate->to_rate_numerator) {
+          videorate->next_ts =
+              videorate->first_ts +
+              gst_util_clocktime_scale (videorate->out * GST_SECOND,
+              videorate->to_rate_denominator, videorate->to_rate_numerator);
+          GST_BUFFER_DURATION (outbuf) =
+              videorate->next_ts - GST_BUFFER_TIMESTAMP (outbuf);
+        }
         /* adapt for looping */
         GST_BUFFER_TIMESTAMP (outbuf) -= videorate->segment_accum;
         gst_buffer_set_caps (outbuf, GST_PAD_CAPS (videorate->srcpad));
index 25318d9..1cab0a4 100644 (file)
@@ -459,14 +459,14 @@ gst_videotestsrc_create (GstPushSrc * psrc, GstBuffer ** buffer)
 
   GST_BUFFER_TIMESTAMP (outbuf) = src->timestamp_offset + src->running_time;
   if (src->rate_numerator != 0) {
-    GST_BUFFER_DURATION (outbuf) = GST_SECOND * src->rate_denominator /
-        src->rate_numerator;
+    GST_BUFFER_DURATION (outbuf) = gst_utils_clocktime_scale (GST_SECOND,
+        src->rate_denominator, src->rate_numerator);
   }
 
   src->n_frames++;
   if (src->rate_numerator != 0) {
-    src->running_time = src->n_frames * GST_SECOND * src->rate_denominator /
-        src->rate_numerator;
+    src->running_time = gst_utils_clocktime_scale (src->n_frames * GST_SECOND,
+        src->rate_denominator, src->rate_numerator);
   }
 
   *buffer = outbuf;