mirror of
https://github.com/androidx/media.git
synced 2025-05-12 10:09:55 +08:00
Fixed foreground color midrow codes being handled as background colors
This commit is contained in:
parent
71d83f3e84
commit
35fa5e2ef7
@ -379,7 +379,7 @@ public final class Eia608Decoder implements SubtitleDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mid row changes.
|
// Mid row changes.
|
||||||
if ((ccData1 == 0x11 || ccData1 == 0x19) && ccData2 >= 0x20 && ccData2 <= 0x2F) {
|
if ((ccData1 == 0x11 || ccData1 == 0x19) && (ccData2 >= 0x20 && ccData2 <= 0x2F)) {
|
||||||
handleMidrowCode(ccData1, ccData2);
|
handleMidrowCode(ccData1, ccData2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,13 +531,18 @@ public final class Eia608Decoder implements SubtitleDecoder {
|
|||||||
private void handleMidrowCode(byte cc1, byte cc2) {
|
private void handleMidrowCode(byte cc1, byte cc2) {
|
||||||
boolean transparentOrUnderline = (cc2 & 0x1) != 0;
|
boolean transparentOrUnderline = (cc2 & 0x1) != 0;
|
||||||
int attribute = cc2 >> 1 & 0xF;
|
int attribute = cc2 >> 1 & 0xF;
|
||||||
if ((cc1 & 0x1) != 0) {
|
if ((cc1 & 0x1) == 0) {
|
||||||
// Background Color
|
// Background Color
|
||||||
currentCue.setCharacterStyle(new BackgroundColorSpan(transparentOrUnderline ?
|
currentCue.setCharacterStyle(new BackgroundColorSpan(transparentOrUnderline ?
|
||||||
COLOR_MAP[attribute] & TRANSPARENCY_MASK : COLOR_MAP[attribute]));
|
COLOR_MAP[attribute] & TRANSPARENCY_MASK : COLOR_MAP[attribute]));
|
||||||
} else {
|
} else {
|
||||||
// Foreground color
|
if (attribute < 7) {
|
||||||
currentCue.setCharacterStyle(new ForegroundColorSpan(COLOR_MAP[attribute]));
|
// Foreground color
|
||||||
|
currentCue.setCharacterStyle(new ForegroundColorSpan(COLOR_MAP[attribute]));
|
||||||
|
} else {
|
||||||
|
// Italics
|
||||||
|
currentCue.setCharacterStyle(new StyleSpan(STYLE_ITALIC));
|
||||||
|
}
|
||||||
if (transparentOrUnderline) {
|
if (transparentOrUnderline) {
|
||||||
// Text should be underlined
|
// Text should be underlined
|
||||||
currentCue.setCharacterStyle(new UnderlineSpan());
|
currentCue.setCharacterStyle(new UnderlineSpan());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user