Skip to content
Snippets Groups Projects
Commit d72adb41 authored by Bruce Flynn's avatar Bruce Flynn
Browse files

potential fix for seek_to

parent 7f441802
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ from edosl0util.headers import ( ...@@ -13,6 +13,7 @@ from edosl0util.headers import (
) )
from edosl0util import headers from edosl0util import headers
from edosl0util.timecode import dt_to_cds
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
...@@ -262,6 +263,7 @@ class PacketStream(object): ...@@ -262,6 +263,7 @@ class PacketStream(object):
Seek forward such that the next packet provided will be the first packet Seek forward such that the next packet provided will be the first packet
having a timestamp available in the secondary header >= stamp and apid. having a timestamp available in the secondary header >= stamp and apid.
""" """
target_tc = dt_to_cds(stamp)
# seek past partial groups # seek past partial groups
packet = self.next() packet = self.next()
while not packet.cds_timecode: while not packet.cds_timecode:
...@@ -269,7 +271,7 @@ class PacketStream(object): ...@@ -269,7 +271,7 @@ class PacketStream(object):
# seek to first packet => `stamp` # seek to first packet => `stamp`
current_tc = packet.cds_timecode current_tc = packet.cds_timecode
while current_tc < stamp: while current_tc < target_tc:
packet = self.next() packet = self.next()
current_tc = packet.cds_timecode or current_tc current_tc = packet.cds_timecode or current_tc
......
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