Repository navigation
fix(tv): draw ASS subtitles over the whole video, not the title-safe area #1012
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
Open
Rhainland
wants to merge
4
commits into
Silo-Server:main
Choose a base branch
from
Rhainland:fix/tv-libass-overlay-full-frame
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+256
−39
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a46d4aa
fix(tv): draw ASS subtitles over the whole video, not the title-safe …
Rhainland b9f830d
fix(tv): keep the ASS overlay's edges visible while the controls are up
Rhainland 717f4ee
fix(player): keep the full-video ASS overlay clear of the phone's doc…
Rhainland 1cdb13b
fix(player): lay the canvas out again when the ASS overlay returns to…
Rhainland File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...src/androidUnitTest/kotlin/org/siloserver/silo/common/player/LibassOverlayGeometryTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| package org.siloserver.silo.common.player | ||
|
|
||
| import org.junit.Assert.assertEquals | ||
| import org.junit.Test | ||
|
|
||
| class LibassOverlayGeometryTest { | ||
| /** | ||
| * libass places ASS events in the script's own PlayRes space, scaled to | ||
| * the overlay it draws on, so the overlay must cover the whole video | ||
| * whatever insets the text-cue canvas takes. Rects are in the content | ||
| * frame's space; the result is in the canvas's. | ||
| */ | ||
| @Test | ||
| fun theAssOverlayCoversTheWholeVideoWhateverTheCanvasInsets() { | ||
| val video = SubtitleVideoRect(left = 0, top = 0, width = 1920, height = 1080) | ||
| val letterboxed = SubtitleVideoRect(left = 0, top = 140, width = 1920, height = 800) | ||
| data class Case(val name: String, val video: SubtitleVideoRect, val canvas: SubtitleVideoRect, val expected: SubtitleVideoRect?) | ||
| val cases = listOf( | ||
| Case("TV title-safe canvas", video, video.insetByTitleSafe(0.05f), | ||
| SubtitleVideoRect(left = -96, top = -54, width = 1920, height = 1080)), | ||
| Case("Bottom canvas reaching into the bar", letterboxed, letterboxed.copy(height = 940), | ||
| SubtitleVideoRect(left = 0, top = 0, width = 1920, height = 800)), | ||
| Case("title-safe Bottom canvas reaching into the bar", letterboxed, | ||
| letterboxed.insetByTitleSafe(0.05f).let { it.copy(height = 1080 - it.top) }, | ||
| SubtitleVideoRect(left = -96, top = -40, width = 1920, height = 800)), | ||
| Case("canvas is the video", video, video, null), | ||
| ) | ||
| for (case in cases) { | ||
| assertEquals(case.name, case.expected, libassOverlayRectInCanvas(case.video, case.canvas)) | ||
| } | ||
| // The phone's docked menu pads the canvas's right side; ASS stays left of it. | ||
| assertEquals( | ||
| SubtitleVideoRect(left = 0, top = 0, width = 1200, height = 800), | ||
| libassOverlayRectInCanvas(letterboxed, letterboxed.copy(height = 940), canvasPaddingRight = 720), | ||
| ) | ||
| } | ||
|
|
||
| /** | ||
| * While the TV's controls are up they pad the canvas's bottom so text cues | ||
| * rise above them. The full-video ASS overlay cannot rise, so only what | ||
| * lies below that line is hidden; its left, right and top edges stay | ||
| * visible. Result in the overlay's own coordinates, null for no clip. | ||
| */ | ||
| @Test | ||
| fun theControlsLiftHidesOnlyTheAssOverlayBelowIt() { | ||
| val titleSafeOverlay = SubtitleVideoRect(left = -96, top = -54, width = 1920, height = 1080) | ||
| data class Case(val name: String, val overlay: SubtitleVideoRect, val canvasHeight: Int, val paddingBottom: Int, val expected: Int?) | ||
| val cases = listOf( | ||
| Case("controls hidden", titleSafeOverlay, 972, 0, null), | ||
| Case("controls lift the title-safe canvas", titleSafeOverlay, 972, 378, 648), | ||
| Case("lift line below the video", SubtitleVideoRect(left = 0, top = 0, width = 1920, height = 800), 940, 100, null), | ||
| ) | ||
| for (case in cases) { | ||
| assertEquals(case.name, case.expected, libassOverlayVisibleHeight(case.overlay, case.canvasHeight, case.paddingBottom)) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.