mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Fixed an off by one error and fixed iterating through the cues
This commit is contained in:
parent
26fe1dc238
commit
b87463a857
2 changed files with 16 additions and 13 deletions
|
|
@ -1,8 +1,5 @@
|
||||||
package com.google.android.exoplayer2.text.eia608;
|
package com.google.android.exoplayer2.text.eia608;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.text.Cue;
|
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
|
||||||
|
|
||||||
import android.text.Layout;
|
import android.text.Layout;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
|
@ -10,6 +7,9 @@ import android.text.style.CharacterStyle;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.text.Cue;
|
||||||
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
@ -73,7 +73,7 @@ import java.util.List;
|
||||||
* @return true if rolling was possible.
|
* @return true if rolling was possible.
|
||||||
*/
|
*/
|
||||||
public boolean rollUp() {
|
public boolean rollUp() {
|
||||||
if (row < 1) {
|
if (row <= 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setRow(row - 1);
|
setRow(row - 1);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,13 @@
|
||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer2.text.eia608;
|
package com.google.android.exoplayer2.text.eia608;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.text.style.BackgroundColorSpan;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.text.style.StyleSpan;
|
||||||
|
import android.text.style.UnderlineSpan;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.text.Cue;
|
import com.google.android.exoplayer2.text.Cue;
|
||||||
import com.google.android.exoplayer2.text.SubtitleDecoder;
|
import com.google.android.exoplayer2.text.SubtitleDecoder;
|
||||||
|
|
@ -24,14 +31,8 @@ import com.google.android.exoplayer2.text.SubtitleOutputBuffer;
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||||
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.text.style.BackgroundColorSpan;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
import android.text.style.StyleSpan;
|
|
||||||
import android.text.style.UnderlineSpan;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
|
@ -472,10 +473,12 @@ public final class Eia608Decoder implements SubtitleDecoder {
|
||||||
// from memory and from the display. The remaining rows of text are each rolled up into the
|
// from memory and from the display. The remaining rows of text are each rolled up into the
|
||||||
// next highest row in the window, leaving the base row blank and ready to accept new text.
|
// next highest row in the window, leaving the base row blank and ready to accept new text.
|
||||||
if (captionMode == CC_MODE_ROLL_UP) {
|
if (captionMode == CC_MODE_ROLL_UP) {
|
||||||
for (Eia608CueBuilder cue : cues) {
|
Iterator<Eia608CueBuilder> iterator = cues.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Eia608CueBuilder cue = iterator.next();
|
||||||
// Roll up all the other rows.
|
// Roll up all the other rows.
|
||||||
if (!cue.rollUp()) {
|
if (!cue.rollUp()) {
|
||||||
cues.remove(cue);
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentCue = new Eia608CueBuilder();
|
currentCue = new Eia608CueBuilder();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue