decklink: Use gst_clock_adjust_with_calibration() and unadjust_with_calibration()

Instead of hand-crafted versions of the same calculation. These
calculations are still too complicated though.
This commit is contained in:
Sebastian Dröge 2016-11-02 15:00:36 +02:00
parent 31317fd666
commit ac37bdb9ac
2 changed files with 6 additions and 18 deletions

View file

@ -483,15 +483,9 @@ convert_to_internal_clock (GstDecklinkVideoSink * self,
// according to our internal clock.
//
// For the duration we just scale
if (external > external_timestamp) {
guint64 diff = external - external_timestamp;
diff = gst_util_uint64_scale (diff, rate_d, rate_n);
*timestamp = internal - diff;
} else {
guint64 diff = external_timestamp - external;
diff = gst_util_uint64_scale (diff, rate_d, rate_n);
*timestamp = internal + diff;
}
*timestamp =
gst_clock_unadjust_with_calibration (NULL, external_timestamp,
internal, external, rate_n, rate_d);
GST_LOG_OBJECT (self,
"Converted %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT " (internal: %"

View file

@ -464,15 +464,9 @@ gst_decklink_video_src_convert_to_external_clock (GstDecklinkVideoSrc * self,
// according to our external clock.
//
// For the duration we just scale
if (internal > internal_timestamp) {
guint64 diff = internal - internal_timestamp;
diff = gst_util_uint64_scale (diff, rate_n, rate_d);
*timestamp = external - diff;
} else {
guint64 diff = internal_timestamp - internal;
diff = gst_util_uint64_scale (diff, rate_n, rate_d);
*timestamp = external + diff;
}
*timestamp =
gst_clock_adjust_with_calibration (NULL, internal_timestamp, internal,
external, rate_n, rate_d);
GST_LOG_OBJECT (self,
"Converted %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT " (external: %"