Skip to content
Snippets Groups Projects
Commit 34a8f351 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

TSSource: use None instead of floats for default time values

t0 = 0 corresponds to an actual time, which is conceptually different
from an unspecified time, and some source elements may need to behave
differently for unspecified times.

For consistency we make the same default change for "end" as well.
parent 149e3496
No related branches found
No related tags found
1 merge request!71TSSource: use None instead of floats for default time values
......@@ -425,19 +425,20 @@ class TSSource(SourceElement):
"""
t0: float = 0
end: float = float("+inf")
t0: float | None = None
end: float | None = None
def __post_init__(self):
super().__post_init__()
t0 = self.t0 or 0
# FIXME should we be more careful about this?
# FIXME should this not be different by pad?
self.offset = {
p: Offset.fromsec(self.t0 - Offset.offset_ref_t0 / Time.SECONDS)
p: Offset.fromsec(t0 - Offset.offset_ref_t0 / Time.SECONDS)
for p in self.source_pads
}
# FIXME should this be different by pad?
if not isinf(self.end):
if self.end is not None and not isinf(self.end):
self.end_offset = Offset.fromsec(
self.end - Offset.offset_ref_t0 / Time.SECONDS
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment