Skip to content

Commit

Permalink
CEA-608: Position top-of-screen roll-up cues with bottom-line=row
Browse files Browse the repository at this point in the history
Reasoning and screenshots here:
#7475 (comment)

Issue: #7475
PiperOrigin-RevId: 315475888
  • Loading branch information
icbaker committed Jun 9, 2020
1 parent d23ca7b commit 947485e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@
* Ignore excess characters in CEA-608 lines (max length is 32)
([#7341](https://github.com/google/ExoPlayer/issues/7341)).
* Add support for WebVTT's `ruby-position` CSS property.
* Don't assume CEA-608 captions are in the bottom half of the
screen([#7475](https://github.com/google/ExoPlayer/issues/7475)).
* Fix positioning for CEA-608 roll-up captions in the top half of screen
([#7475](https://github.com/google/ExoPlayer/issues/7475)).
* DRM:
* Add support for attaching DRM sessions to clear content in the demo app.
* Remove `DrmSessionManager` references from all renderers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ public Cue build(@Cue.AnchorType int forcedPositionAnchor) {

int lineAnchor;
int line;
// Note: Row indices are in the range [1-15].
// Note: Row indices are in the range [1-15], Cue.line counts from 0 (top) and -1 (bottom).
if (row > (BASE_ROW / 2)) {
lineAnchor = Cue.ANCHOR_TYPE_END;
line = row - BASE_ROW;
Expand All @@ -955,9 +955,12 @@ public Cue build(@Cue.AnchorType int forcedPositionAnchor) {
line -= 2;
} else {
lineAnchor = Cue.ANCHOR_TYPE_START;
// Line indices from the top of the window start from 0, but we want a blank row to act as
// the safe area. As a result no adjustment is necessary.
line = row;
// The `row` of roll-up cues positions the bottom line (even for cues shown in the top
// half of the screen), so we need to consider the number of rows in this cue. In
// non-roll-up, we don't need any further adjustments because we leave the first line
// (cue.line=0) blank to act as the safe area, so positioning row=1 at Cue.line=1 is
// correct.
line = captionMode == CC_MODE_ROLL_UP ? row - (captionRowCount - 1) : row;
}

return new Cue(
Expand Down

0 comments on commit 947485e

Please sign in to comment.