Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCC: caption management refactoring #395

Merged
merged 13 commits into from Nov 9, 2023

Conversation

valnoel
Copy link
Collaborator

@valnoel valnoel commented Aug 16, 2023

SCC reader refactoring proposal, addressing #383 & #385 issues

@valnoel valnoel force-pushed the scc/buffer_management_refactoring branch from 82a097c to 9cc73bf Compare August 16, 2023 09:27
# Captions being displayed
self.active_caption: Optional[SccCaptionParagraph] = None
# Caption style (Pop-on, Roll-up, Paint-on) currently processed
self.current_style = SccCaptionStyle.Unknown
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we have a "default" style?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be this default style? It seems a bit tricky to choose...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I skimmed the 608 spec and couldn't find an obvious answer.

I would choose paint-on for now.

src/main/python/ttconv/scc/context.py Show resolved Hide resolved
# Buffered caption being built
self.buffered_caption = None
# Captions being displayed
self.active_caption: Optional[SccCaptionParagraph] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we start with a non-empty active caption, esp. if the default style is paint-on?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preferred to consider that nothing is displayed at start. And as the active caption is the caption being displayed, I choosed not the initialize it at start. That's why the "begin timecode" is set into the new_active_caption method.

Otherwise, we should initialize the active caption without "begin timecode", but it would mean that an active caption is ready but not currently displayed, which doesn't make sense for me.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the begin time code be set when the first printable character is displayed, instead of when the caption is instantiated?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to make the start of processing the same as the middle, i.e. there is always a front buffer and a back buffer active.

Maybe this is too much of a change for now. Let me know.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the begin time code be set when the first printable character is displayed, instead of when the caption is instantiated?

This is done for Paint-On only. The begin time must be set on EOC for Pop-On, and on CR for Roll-Up.

The idea is to make the start of processing the same as the middle, i.e. there is always a front buffer and a back buffer active.

I understand the idea, but I think we cannot start writing into buffers without a minimum of context (a style at least), otherwise we're moving away from the spirit of the 608 specification...

But if it's a prerequisite, the change shouldn't be too big...

Copy link
Contributor

@palemieux palemieux Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

608/708 are in fact streaming format (SCC added the timestamps) and a device could join the stream at any time and thus possibly in the middle of a caption.

What is the current behavior if we start parsing in the middle of a caption? A possible behavior is to do nothing until a style is specified -- is that what you have in mind? Maybe we should add this to the unit tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@palemieux I've changed the reader behavior so that it skips captions until a style is specified in 49d14db

Let me know what you think!

@palemieux
Copy link
Contributor

@atsampson @rktcc Your feedback would be welcome on this PR.

@palemieux
Copy link
Contributor

@atsampson @rktcc Did you have the opportunity to review? The plan is to merge this PR sometime next week.

Copy link
Contributor

@palemieux palemieux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

itt.scc looks incorrect when converted to TTML

@valnoel valnoel force-pushed the scc/buffer_management_refactoring branch from ec30c3a to e236a54 Compare November 9, 2023 08:40
@valnoel valnoel force-pushed the scc/buffer_management_refactoring branch from e236a54 to 6f98d79 Compare November 9, 2023 16:07
@valnoel valnoel merged commit 9b5bbc6 into sandflow:master Nov 9, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants