mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Tentative fix for roll-up row count
Issue: #3513 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177804505
This commit is contained in:
parent
fd938fb454
commit
a9c3ca1cfe
@ -29,6 +29,8 @@
|
||||
seek.
|
||||
* Use the same listener `MediaSourceEventListener` for all MediaSource
|
||||
implementations.
|
||||
* CEA-608: Fix handling of row count changes in roll-up mode
|
||||
([#3513](https://github.com/google/ExoPlayer/issues/3513)).
|
||||
|
||||
### 2.6.0 ###
|
||||
|
||||
|
@ -33,7 +33,6 @@ import com.google.android.exoplayer2.text.SubtitleInputBuffer;
|
||||
import com.google.android.exoplayer2.util.MimeTypes;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -185,7 +184,7 @@ public final class Cea608Decoder extends CeaDecoder {
|
||||
private final ParsableByteArray ccData;
|
||||
private final int packetLength;
|
||||
private final int selectedField;
|
||||
private final LinkedList<CueBuilder> cueBuilders;
|
||||
private final ArrayList<CueBuilder> cueBuilders;
|
||||
|
||||
private CueBuilder currentCueBuilder;
|
||||
private List<Cue> cues;
|
||||
@ -200,7 +199,7 @@ public final class Cea608Decoder extends CeaDecoder {
|
||||
|
||||
public Cea608Decoder(String mimeType, int accessibilityChannel) {
|
||||
ccData = new ParsableByteArray();
|
||||
cueBuilders = new LinkedList<>();
|
||||
cueBuilders = new ArrayList<>();
|
||||
currentCueBuilder = new CueBuilder(CC_MODE_UNKNOWN, DEFAULT_CAPTIONS_ROW_COUNT);
|
||||
packetLength = MimeTypes.APPLICATION_MP4CEA608.equals(mimeType) ? 2 : 3;
|
||||
switch (accessibilityChannel) {
|
||||
@ -230,8 +229,8 @@ public final class Cea608Decoder extends CeaDecoder {
|
||||
cues = null;
|
||||
lastCues = null;
|
||||
setCaptionMode(CC_MODE_UNKNOWN);
|
||||
setCaptionRowCount(DEFAULT_CAPTIONS_ROW_COUNT);
|
||||
resetCueBuilders();
|
||||
captionRowCount = DEFAULT_CAPTIONS_ROW_COUNT;
|
||||
repeatableControlSet = false;
|
||||
repeatableControlCc1 = 0;
|
||||
repeatableControlCc2 = 0;
|
||||
@ -434,16 +433,16 @@ public final class Cea608Decoder extends CeaDecoder {
|
||||
private void handleMiscCode(byte cc2) {
|
||||
switch (cc2) {
|
||||
case CTRL_ROLL_UP_CAPTIONS_2_ROWS:
|
||||
captionRowCount = 2;
|
||||
setCaptionMode(CC_MODE_ROLL_UP);
|
||||
setCaptionRowCount(2);
|
||||
return;
|
||||
case CTRL_ROLL_UP_CAPTIONS_3_ROWS:
|
||||
captionRowCount = 3;
|
||||
setCaptionMode(CC_MODE_ROLL_UP);
|
||||
setCaptionRowCount(3);
|
||||
return;
|
||||
case CTRL_ROLL_UP_CAPTIONS_4_ROWS:
|
||||
captionRowCount = 4;
|
||||
setCaptionMode(CC_MODE_ROLL_UP);
|
||||
setCaptionRowCount(4);
|
||||
return;
|
||||
case CTRL_RESUME_CAPTION_LOADING:
|
||||
setCaptionMode(CC_MODE_POP_ON);
|
||||
@ -451,6 +450,9 @@ public final class Cea608Decoder extends CeaDecoder {
|
||||
case CTRL_RESUME_DIRECT_CAPTIONING:
|
||||
setCaptionMode(CC_MODE_PAINT_ON);
|
||||
return;
|
||||
default:
|
||||
// Fall through.
|
||||
break;
|
||||
}
|
||||
|
||||
if (captionMode == CC_MODE_UNKNOWN) {
|
||||
@ -484,6 +486,9 @@ public final class Cea608Decoder extends CeaDecoder {
|
||||
case CTRL_DELETE_TO_END_OF_ROW:
|
||||
// TODO: implement
|
||||
break;
|
||||
default:
|
||||
// Fall through.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,8 +520,13 @@ public final class Cea608Decoder extends CeaDecoder {
|
||||
}
|
||||
}
|
||||
|
||||
private void setCaptionRowCount(int captionRowCount) {
|
||||
this.captionRowCount = captionRowCount;
|
||||
currentCueBuilder.setCaptionRowCount(captionRowCount);
|
||||
}
|
||||
|
||||
private void resetCueBuilders() {
|
||||
currentCueBuilder.reset(captionMode, captionRowCount);
|
||||
currentCueBuilder.reset(captionMode);
|
||||
cueBuilders.clear();
|
||||
cueBuilders.add(currentCueBuilder);
|
||||
}
|
||||
@ -594,12 +604,14 @@ public final class Cea608Decoder extends CeaDecoder {
|
||||
public CueBuilder(int captionMode, int captionRowCount) {
|
||||
preambleStyles = new ArrayList<>();
|
||||
midrowStyles = new ArrayList<>();
|
||||
rolledUpCaptions = new LinkedList<>();
|
||||
rolledUpCaptions = new ArrayList<>();
|
||||
captionStringBuilder = new SpannableStringBuilder();
|
||||
reset(captionMode, captionRowCount);
|
||||
reset(captionMode);
|
||||
setCaptionRowCount(captionRowCount);
|
||||
}
|
||||
|
||||
public void reset(int captionMode, int captionRowCount) {
|
||||
public void reset(int captionMode) {
|
||||
this.captionMode = captionMode;
|
||||
preambleStyles.clear();
|
||||
midrowStyles.clear();
|
||||
rolledUpCaptions.clear();
|
||||
@ -607,11 +619,13 @@ public final class Cea608Decoder extends CeaDecoder {
|
||||
row = BASE_ROW;
|
||||
indent = 0;
|
||||
tabOffset = 0;
|
||||
this.captionMode = captionMode;
|
||||
this.captionRowCount = captionRowCount;
|
||||
underlineStartPosition = POSITION_UNSET;
|
||||
}
|
||||
|
||||
public void setCaptionRowCount(int captionRowCount) {
|
||||
this.captionRowCount = captionRowCount;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return preambleStyles.isEmpty() && midrowStyles.isEmpty() && rolledUpCaptions.isEmpty()
|
||||
&& captionStringBuilder.length() == 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user