From: Michael Smith Date: Tue, 22 Nov 2005 16:19:36 +0000 (+0000) Subject: gst/: Use utility method for scaling clocktime for fractional framerates. X-Git-Tag: 1.19.3~511^2~12493 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=deaee40dab66015b404de478f983bad65d1722bc;p=platform%2Fupstream%2Fgstreamer.git gst/: Use utility method for scaling clocktime for fractional framerates. 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. --- diff --git a/ChangeLog b/ChangeLog index 0b173a1..930efe0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-11-22 Michael Smith + + * 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 * 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 * Update for gst_tag_setter API changes. diff --git a/gst/videorate/gstvideorate.c b/gst/videorate/gstvideorate.c index 0ca1fe1..037e476 100644 --- a/gst/videorate/gstvideorate.c +++ b/gst/videorate/gstvideorate.c @@ -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)); diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index 25318d9..1cab0a4 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -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;