Commit 54b4df70 by Oliver Woodman

Merge branch 'RikHeijdens-eia-608-improvements' into dev-v2

parents 7a18738d a6ccedf7
......@@ -17,7 +17,6 @@ package com.google.android.exoplayer2.text.cea;
import com.google.android.exoplayer2.text.Cue;
import com.google.android.exoplayer2.text.Subtitle;
import java.util.Collections;
import java.util.List;
/**
......@@ -28,14 +27,10 @@ import java.util.List;
private final List<Cue> cues;
/**
* @param cue The subtitle cue.
* @param cues The subtitle cues.
*/
public CeaSubtitle(Cue cue) {
if (cue == null) {
cues = Collections.emptyList();
} else {
cues = Collections.singletonList(cue);
}
public CeaSubtitle(List<Cue> cues) {
this.cues = cues;
}
@Override
......@@ -56,7 +51,6 @@ import java.util.List;
@Override
public List<Cue> getCues(long timeUs) {
return cues;
}
}
......@@ -233,7 +233,7 @@ import com.google.android.exoplayer2.util.Util;
int anchorPosition = Math.round(parentWidth * cuePosition) + parentLeft;
textLeft = cuePositionAnchor == Cue.ANCHOR_TYPE_END ? anchorPosition - textWidth
: cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorPosition * 2 - textWidth) / 2
: anchorPosition;
: anchorPosition;
textLeft = Math.max(textLeft, parentLeft);
textRight = Math.min(textLeft + textWidth, parentRight);
} else {
......@@ -257,7 +257,7 @@ import com.google.android.exoplayer2.util.Util;
}
textTop = cueLineAnchor == Cue.ANCHOR_TYPE_END ? anchorPosition - textHeight
: cueLineAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorPosition * 2 - textHeight) / 2
: anchorPosition;
: anchorPosition;
if (textTop + textHeight > parentBottom) {
textTop = parentBottom - textHeight;
} else if (textTop < parentTop) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment