Skip to content

Instantly share code, notes, and snippets.

@MaZderMind
Created December 27, 2018 14:13
Show Gist options
  • Save MaZderMind/5f60be9ebf4cbb499cae599dc3227469 to your computer and use it in GitHub Desktop.
Save MaZderMind/5f60be9ebf4cbb499cae599dc3227469 to your computer and use it in GitHub Desktop.
import sys
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstNet', '1.0')
from gi.repository import Gst, GstNet
ptp_domain = 0
ptp_interfaces = ['enp0s25']
print('initializing PTP-Subsystem for Network-Interface(s)', ptp_interfaces)
success = GstNet.ptp_init(GstNet.PTP_CLOCK_ID_NONE, ptp_interfaces)
if success:
print('successfully initializing PTP-Subsystem')
else:
print('failed to initializing PTP-Subsystem')
sys.exit(42)
ptp_clock = GstNet.PtpClock.new('PTP-Master', ptp_domain)
if ptp_clock != None:
print('obtained PTP-Clock for domain', ptp_domain)
else:
print('failed to obtain PTP-Clock')
sys.exit(42)
print('waiting for PTP-Clock to sync')
ptp_clock.wait_for_sync(Gst.CLOCK_TIME_NONE)
print('successfully synced PTP-Clock')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment