mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 04:56:24 +00:00
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:
parent
31317fd666
commit
ac37bdb9ac
2 changed files with 6 additions and 18 deletions
|
@ -483,15 +483,9 @@ convert_to_internal_clock (GstDecklinkVideoSink * self,
|
||||||
// according to our internal clock.
|
// according to our internal clock.
|
||||||
//
|
//
|
||||||
// For the duration we just scale
|
// For the duration we just scale
|
||||||
if (external > external_timestamp) {
|
*timestamp =
|
||||||
guint64 diff = external - external_timestamp;
|
gst_clock_unadjust_with_calibration (NULL, external_timestamp,
|
||||||
diff = gst_util_uint64_scale (diff, rate_d, rate_n);
|
internal, external, rate_n, rate_d);
|
||||||
*timestamp = internal - diff;
|
|
||||||
} else {
|
|
||||||
guint64 diff = external_timestamp - external;
|
|
||||||
diff = gst_util_uint64_scale (diff, rate_d, rate_n);
|
|
||||||
*timestamp = internal + diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (self,
|
GST_LOG_OBJECT (self,
|
||||||
"Converted %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT " (internal: %"
|
"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.
|
// according to our external clock.
|
||||||
//
|
//
|
||||||
// For the duration we just scale
|
// For the duration we just scale
|
||||||
if (internal > internal_timestamp) {
|
*timestamp =
|
||||||
guint64 diff = internal - internal_timestamp;
|
gst_clock_adjust_with_calibration (NULL, internal_timestamp, internal,
|
||||||
diff = gst_util_uint64_scale (diff, rate_n, rate_d);
|
external, 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (self,
|
GST_LOG_OBJECT (self,
|
||||||
"Converted %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT " (external: %"
|
"Converted %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT " (external: %"
|
||||||
|
|
Loading…
Reference in a new issue