Commit ac37bdb9 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

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.
parent 31317fd6
......@@ -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: %"
......
......@@ -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: %"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment