Utility Functions
ptsl Utilities - Utility functions for working with types
Working With Timecode and Footage
- ptsl.util.timecode_info(session_rate: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x71f95462e090>) Tuple[Fraction, bool]
For the given
SessionTimeCodeRateenumeration value, returns a library-agnostic description that can be used for time arithmetic.The first element in the return
tupleis the duration of a frame in the givensession_rateas a fractional number of seconds. The second element is a bool which is True if thesession_rateis drop-frame.- Parameters:
session_rate – The session rate value.
- Returns:
a Tuple of (frame duration, is drop frame)
- ptsl.util.feet_frames_info(feet_frames_rate: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x71f95462e7d0>) Fraction
For the given
SessionFeetFramesRateenumeration value, returns a library-agnostic description that can be used for time arithmetic.- Parameters:
feet_frames_rate – The session feet+frames rate value.
- Returns:
The duration of a frame in the given rate, as a fractional number
of seconds.
Working With Sample Rates and Pull Rates
- ptsl.util.sample_rate_info(sample_rate: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x71f95462c150>) int | None
Get the sample rate for a
SampleRateas an integer.Note
The
SR_Nonevalue will be returned as a None
- ptsl.util.sample_rate_enum(sample_rate: int | None) <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x71f95462c150>
Get the symbolic sample rate from the SampleRate enum from an integer.
Note
A sample_rate not in the enumeration will be returned as SR_None
- ptsl.util.pull_rate_info(rate_pull: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x71f95462ea10>) Tuple[int, int]
For the given
SessionRatePullenumeration value, returns a library-agnostic description that can be used for time arithmetic.Returns a Tuple where
retval[0]can be multiplied by 4% to give the 4% pull value (as when converting 24fps and 25fps playback), andretval[1]can be multiplied by 0.1% to give the 0.1% pull value (as when converting NTSC to integral frame rates).