Skip to content

Commit

Permalink
Update PTP profile enum
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmosys authored and MSStephen committed Jan 28, 2025
1 parent c740210 commit 0659d9c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/python/camdkit/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def _get_complete_dynamic_clip():
locked=True,
source=SynchronizationSourceEnum.PTP,
ptp=SynchronizationPTP(
"SMPTE-2059-2",
PTP_PROFILES[2],
1,
"00:11:22:33:44:55",
SynchronizationPTPPriorities(128, 128),
Expand Down
6 changes: 5 additions & 1 deletion src/main/python/camdkit/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
UINT48_MAX = 281474976710655 # 2^48 - 1

DEFAULT_SUB_FRAME = 0
PTP_PROFILES = ["SMPTE-2059-2", "IEEE-1588-Default"]
PTP_PROFILES = [
"IEEE Std 1588-2019",
"IEEE Std 802.1AS-2020",
"SMPTE ST2059-2:2021",
]

class Sampling(Enum):
STATIC = "Static" # Data that does not change for a Clip or across many Frames
Expand Down
5 changes: 3 additions & 2 deletions src/main/python/camdkit/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,9 @@ class TimingSynchronization(Parameter):
ptp: If the synchronization source is a PTP leader, then this object
contains:
- "profile": Specifies the PTP profile in use. This defines the operational
rules and parameters for synchronization. For example "SMPTE-2059-2" for
SMPTE 2110 based systems, or "IEEE-1588-Default" for industrial applications
rules and parameters for synchronization. For example "SMPTE ST2059-2:2021"
for SMPTE 2110 based systems, or "IEEE Std 1588-2019" or
"IEEE Std 802.1AS-2020" for industrial applications
- "domain": Identifies the PTP domain the device belongs to. Devices in the
same domain can synchronize with each other
- "leaderIdentity": The unique identifier (usually MAC address) of the
Expand Down
10 changes: 5 additions & 5 deletions src/test/python/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_serialize(self):
locked=True,
offsets=SynchronizationOffsets(1.0,2.0,3.0),
present=True,
ptp=SynchronizationPTP("SMPTE-2059-2",1,"00:11:22:33:44:55",
ptp=SynchronizationPTP(PTP_PROFILES[2],1,"00:11:22:33:44:55",
SynchronizationPTPPriorities(128, 128),
0.00000005, 0.000123, 100, "GNSS"),
source=SynchronizationSourceEnum.PTP
Expand Down Expand Up @@ -182,7 +182,7 @@ def test_serialize(self):
self.assertTupleEqual(d["timing"]["timecode"], ({ "hours":1,"minutes":2,"seconds":3,"frames":4,"format": { "frameRate": { "num": 24, "denom": 1 } } },
{ "hours":1,"minutes":2,"seconds":3,"frames":5,"format": { "frameRate": { "num": 24, "denom": 1 } } }))
sync_dict = { "present":True,"locked":True,"frequency":{ "num": 24000, "denom": 1001 },"source":"ptp",
"ptp": {"profile":"SMPTE-2059-2","domain":1,"leaderIdentity": "00:11:22:33:44:55",
"ptp": {"profile":PTP_PROFILES[2],"domain":1,"leaderIdentity": "00:11:22:33:44:55",
"leaderPriorities": { "priority1": 128, "priority2": 128 },
"leaderAccuracy": 0.00000005, "meanPathDelay": 0.000123, "vlan": 100, "timeSource": "GNSS"},
"offsets": {"translation":1.0,"rotation":2.0,"lensEncoders":3.0 } }
Expand Down Expand Up @@ -1136,7 +1136,7 @@ def test_synchronization_ptp(self):
sync = Synchronization(locked=True, source=SynchronizationSourceEnum.PTP, frequency=25)
clip = Clip()
sync.ptp = SynchronizationPTP()
sync.ptp.profile = "SMPTE-2059-2"
sync.ptp.profile = PTP_PROFILES[2]
sync.ptp.domain = 1
sync.ptp.leader_priorities = SynchronizationPTPPriorities(128,128)
sync.ptp.leader_accuracy = 0.00000005
Expand All @@ -1148,7 +1148,7 @@ def test_synchronization_ptp(self):
sync.ptp.leader_identity = "ab:CD:eF:23:45:67"
clip.timing_synchronization = (sync, )
sync.ptp.from_json({
"profile": "SMPTE-2059-2",
"profile": PTP_PROFILES[2],
"domain": 1,
"leaderIdentity": "00:11:22:33:44:55",
"leaderPriorities": {
Expand All @@ -1168,7 +1168,7 @@ def test_synchronization_ptp(self):
with self.assertRaises(ValueError):
sync.ptp.profile = "Invalid profile"
clip.timing_synchronization = (sync, )
sync.ptp.profile = "SMPTE-2059-2"
sync.ptp.profile = PTP_PROFILES[0]
with self.assertRaises(ValueError):
sync.ptp.domain = "1"
clip.timing_synchronization = (sync, )
Expand Down

0 comments on commit 0659d9c

Please sign in to comment.