Commit a6ccedf7 by Oliver Woodman

Merge branch 'eia-608-improvements' of git://github.com/RikHeijdens/ExoPlayer…

Merge branch 'eia-608-improvements' of git://github.com/RikHeijdens/ExoPlayer into RikHeijdens-eia-608-improvements
parents 7a18738d 98a5e199
...@@ -17,7 +17,6 @@ package com.google.android.exoplayer2.text.cea; ...@@ -17,7 +17,6 @@ package com.google.android.exoplayer2.text.cea;
import com.google.android.exoplayer2.text.Cue; import com.google.android.exoplayer2.text.Cue;
import com.google.android.exoplayer2.text.Subtitle; import com.google.android.exoplayer2.text.Subtitle;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
...@@ -28,14 +27,10 @@ import java.util.List; ...@@ -28,14 +27,10 @@ import java.util.List;
private final List<Cue> cues; private final List<Cue> cues;
/** /**
* @param cue The subtitle cue. * @param cues The subtitle cues.
*/ */
public CeaSubtitle(Cue cue) { public CeaSubtitle(List<Cue> cues) {
if (cue == null) { this.cues = cues;
cues = Collections.emptyList();
} else {
cues = Collections.singletonList(cue);
}
} }
@Override @Override
...@@ -56,7 +51,6 @@ import java.util.List; ...@@ -56,7 +51,6 @@ import java.util.List;
@Override @Override
public List<Cue> getCues(long timeUs) { public List<Cue> getCues(long timeUs) {
return cues; return cues;
} }
} }
...@@ -233,7 +233,7 @@ import com.google.android.exoplayer2.util.Util; ...@@ -233,7 +233,7 @@ import com.google.android.exoplayer2.util.Util;
int anchorPosition = Math.round(parentWidth * cuePosition) + parentLeft; int anchorPosition = Math.round(parentWidth * cuePosition) + parentLeft;
textLeft = cuePositionAnchor == Cue.ANCHOR_TYPE_END ? anchorPosition - textWidth textLeft = cuePositionAnchor == Cue.ANCHOR_TYPE_END ? anchorPosition - textWidth
: cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorPosition * 2 - textWidth) / 2 : cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorPosition * 2 - textWidth) / 2
: anchorPosition; : anchorPosition;
textLeft = Math.max(textLeft, parentLeft); textLeft = Math.max(textLeft, parentLeft);
textRight = Math.min(textLeft + textWidth, parentRight); textRight = Math.min(textLeft + textWidth, parentRight);
} else { } else {
...@@ -257,7 +257,7 @@ import com.google.android.exoplayer2.util.Util; ...@@ -257,7 +257,7 @@ import com.google.android.exoplayer2.util.Util;
} }
textTop = cueLineAnchor == Cue.ANCHOR_TYPE_END ? anchorPosition - textHeight textTop = cueLineAnchor == Cue.ANCHOR_TYPE_END ? anchorPosition - textHeight
: cueLineAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorPosition * 2 - textHeight) / 2 : cueLineAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorPosition * 2 - textHeight) / 2
: anchorPosition; : anchorPosition;
if (textTop + textHeight > parentBottom) { if (textTop + textHeight > parentBottom) {
textTop = parentBottom - textHeight; textTop = parentBottom - textHeight;
} else if (textTop < parentTop) { } 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