CEA-608: Position top-of-screen roll-up cues with bottom-line=row

Reasoning and screenshots here:
https://github.com/google/ExoPlayer/issues/7475#issuecomment-640770791

Issue: #7475
PiperOrigin-RevId: 315475888
This commit is contained in:
ibaker 2020-06-09 15:01:33 +01:00 committed by Ian Baker
parent d23ca7b11a
commit 947485e2b7
2 changed files with 9 additions and 6 deletions

View File

@ -122,8 +122,8 @@
* Ignore excess characters in CEA-608 lines (max length is 32) * Ignore excess characters in CEA-608 lines (max length is 32)
([#7341](https://github.com/google/ExoPlayer/issues/7341)). ([#7341](https://github.com/google/ExoPlayer/issues/7341)).
* Add support for WebVTT's `ruby-position` CSS property. * Add support for WebVTT's `ruby-position` CSS property.
* Don't assume CEA-608 captions are in the bottom half of the * Fix positioning for CEA-608 roll-up captions in the top half of screen
screen([#7475](https://github.com/google/ExoPlayer/issues/7475)). ([#7475](https://github.com/google/ExoPlayer/issues/7475)).
* DRM: * DRM:
* Add support for attaching DRM sessions to clear content in the demo app. * Add support for attaching DRM sessions to clear content in the demo app.
* Remove `DrmSessionManager` references from all renderers. * Remove `DrmSessionManager` references from all renderers.

View File

@ -946,7 +946,7 @@ public final class Cea608Decoder extends CeaDecoder {
int lineAnchor; int lineAnchor;
int line; 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)) { if (row > (BASE_ROW / 2)) {
lineAnchor = Cue.ANCHOR_TYPE_END; lineAnchor = Cue.ANCHOR_TYPE_END;
line = row - BASE_ROW; line = row - BASE_ROW;
@ -955,9 +955,12 @@ public final class Cea608Decoder extends CeaDecoder {
line -= 2; line -= 2;
} else { } else {
lineAnchor = Cue.ANCHOR_TYPE_START; 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 `row` of roll-up cues positions the bottom line (even for cues shown in the top
// the safe area. As a result no adjustment is necessary. // half of the screen), so we need to consider the number of rows in this cue. In
line = row; // 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( return new Cue(