Skip to content

Commit 8d3d836

Browse files
authored
SCC reader: fix begin/end computation from SCC timestamp
#454
1 parent 69a59ee commit 8d3d836

File tree

4 files changed

+73
-76
lines changed

4 files changed

+73
-76
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, pull_request]
44

55
jobs:
66
run:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-22.04
88
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
99
steps:
1010

src/main/python/ttconv/scc/context.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,7 @@ def process_control_code(self, control_code: SccControlCode, time_code: SmpteTim
368368
elif control_code is SccControlCode.EDM:
369369
# Erase displayed captions
370370
if self.has_active_caption():
371-
if time_code is not None:
372-
# End time is exclusive in the model, set it to the next frame
373-
end_time_code = copy.copy(time_code)
374-
end_time_code.add_frames()
375-
else:
376-
end_time_code = time_code
377-
378-
self.push_active_caption_to_model(end_time_code)
371+
self.push_active_caption_to_model(time_code)
379372

380373
elif control_code is SccControlCode.ENM:
381374
# Erase buffered caption

src/main/python/ttconv/scc/line.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,16 @@ def process(self, context: SccContext) -> SmpteTimeCode:
109109

110110
debug = str(self.time_code) + "\t"
111111

112+
first = True
112113
for scc_word in self.scc_words:
114+
if not first:
115+
self.time_code.add_frames()
116+
first = False
113117

114118
if context.previous_word is not None and context.previous_word.value == scc_word.value and context.previous_word.is_code():
115119
context.previous_word = None
116120
continue
117121

118-
self.time_code.add_frames()
119-
120122
if scc_word.value == 0x0000:
121123
continue
122124

0 commit comments

Comments
 (0)