* Boston, MA 02111-1307, USA.
*/
+ /* TODO:
+ * - Find out what to do about the first n zero samples
+ * in the output.
+ */
+
/**
* SECTION:element-speexresample
*
gst_speex_fix_output_buffer (GstSpeexResample * resample, GstBuffer * outbuf,
guint diff)
{
- GstClockTime timediff =
- gst_util_uint64_scale (diff, GST_SECOND, resample->outrate);
+ GstClockTime timediff = GST_FRAMES_TO_CLOCK_TIME (diff, resample->outrate);
GST_LOG ("Adjusting buffer by %d samples", diff);
resample->offset -= diff;
resample->ts_offset -= diff;
resample->next_ts =
- gst_util_uint64_scale_int (resample->ts_offset, GST_SECOND,
- resample->outrate);
+ GST_FRAMES_TO_CLOCK_TIME (resample->ts_offset, resample->outrate);
}
}
* same timestamp as the incoming timestamp. */
resample->next_ts = timestamp;
resample->ts_offset =
- gst_util_uint64_scale_int (timestamp, resample->outrate, GST_SECOND);
+ GST_CLOCK_TIME_TO_FRAMES (timestamp, resample->outrate);
/* offset used to set as the buffer offset, this offset is always
* relative to the stream time, note that timestamp is not... */
stime = (timestamp - base->segment.start) + base->segment.time;
- resample->offset =
- gst_util_uint64_scale_int (stime, resample->outrate, GST_SECOND);
+ resample->offset = GST_CLOCK_TIME_TO_FRAMES (stime, resample->outrate);
}
}
resample->prev_ts = timestamp;
resample->offset += outsamples;
resample->ts_offset += outsamples;
resample->next_ts =
- gst_util_uint64_scale_int (resample->ts_offset, GST_SECOND,
- resample->outrate);
+ GST_FRAMES_TO_CLOCK_TIME (resample->ts_offset, resample->outrate);
GST_BUFFER_OFFSET_END (outbuf) = resample->offset;
/* we calculate DURATION as the difference between "next" timestamp
} else {
/* no valid offset know, we can still sortof calculate the duration though */
GST_BUFFER_DURATION (outbuf) =
- gst_util_uint64_scale_int (outsamples, GST_SECOND, resample->outrate);
+ GST_FRAMES_TO_CLOCK_TIME (outsamples, resample->outrate);
}
if (G_UNLIKELY (resample->need_discont)) {