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

Propagate SubtitleDecoderExceptions to be reported through a callback… #1577

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

colinkho
Copy link
Contributor

… from TextOutput

@icbaker icbaker self-assigned this Jul 31, 2024
@icbaker icbaker self-requested a review July 31, 2024 08:45
@icbaker
Copy link
Collaborator

icbaker commented Jul 31, 2024

I realised after discussing this that, since 1.4.0-alpha02, subtitle decoding/parsing happens during extraction by default - and TextRenderer is basically just parsing an internally-defined Bundle (which shouldn't fail).

This means that any parsing errors due to invalid subtitle input data happen during extraction, rather than rendering. At the moment these bubble out as fatal errors (which is a behaviour change compared to 1.3.1 and earlier). We probably want to make these errors non-fatal (to match the previous behaviour more closely), and at the same time we can work out how to plumb them out so an app can receive them. At the moment I'm looking at this being done via a new SubtitleParser.EventListener interface, which would be added to a DefaultSubtitleParserFactory instance and passed into individual SubtitleParser instances, which would be responsible for directing any parsing-related errors to the listener (instead of letting them bubble out).

One question I have based on the interface you've proposed in the PR: What is the purpose of the Format field? At the moment a SubtitleParser instance doesn't have a Format object, so we wouldn't easily be able to pass this value into the proposed SubtitleParser.EventListener.onSubtitleParsingError(Exception) callback.

@colinkho
Copy link
Contributor Author

colinkho commented Aug 1, 2024

Thanks Ian. Not having Format should be ok for us given that we will get an Exception with a trace that we can log. If there's information we are missing after integrating with this new callback, I can raise a PR

Not directly impacting this PR but I am more concerned about

At the moment these bubble out as fatal errors (which is a behaviour change compared to 1.3.1 and earlier). We probably want to make these errors non-fatal (to match the previous behaviour more closely)

Is this something that will be done in this release?

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.

2 participants