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