Fixed CEA-708 issue where cues weren't updated at the appropriate times
As per the CEA-708-B specification, section 8.10.4, cues don't necessarily need either an ETX command or any of the C1 commands before being updated with the latest buffered content. While those commands do indicate that the cues should be updated immediately, the cues can also be updated after a service block has been processed if it appended text to the buffer. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=149673162
This commit is contained in:
parent
b6773dba05
commit
b84c84cc76
@ -285,19 +285,26 @@ public final class Cea708Decoder extends CeaDecoder {
|
||||
return;
|
||||
}
|
||||
|
||||
// The cues should be updated if we receive a C0 ETX command, any C1 command, or if after
|
||||
// processing the service block any text has been added to the buffer. See CEA-708-B Section
|
||||
// 8.10.4 for more details.
|
||||
boolean cuesNeedUpdate = false;
|
||||
|
||||
while (serviceBlockPacket.bitsLeft() > 0) {
|
||||
int command = serviceBlockPacket.readBits(8);
|
||||
if (command != COMMAND_EXT1) {
|
||||
if (command <= GROUP_C0_END) {
|
||||
handleC0Command(command);
|
||||
// If the C0 command was an ETX command, the cues are updated in handleC0Command.
|
||||
} else if (command <= GROUP_G0_END) {
|
||||
handleG0Character(command);
|
||||
cuesNeedUpdate = true;
|
||||
} else if (command <= GROUP_C1_END) {
|
||||
handleC1Command(command);
|
||||
// Cues are always updated after a C1 command
|
||||
cues = getDisplayCues();
|
||||
cuesNeedUpdate = true;
|
||||
} else if (command <= GROUP_G1_END) {
|
||||
handleG1Character(command);
|
||||
cuesNeedUpdate = true;
|
||||
} else {
|
||||
Log.w(TAG, "Invalid base command: " + command);
|
||||
}
|
||||
@ -308,15 +315,21 @@ public final class Cea708Decoder extends CeaDecoder {
|
||||
handleC2Command(command);
|
||||
} else if (command <= GROUP_G2_END) {
|
||||
handleG2Character(command);
|
||||
cuesNeedUpdate = true;
|
||||
} else if (command <= GROUP_C3_END) {
|
||||
handleC3Command(command);
|
||||
} else if (command <= GROUP_G3_END) {
|
||||
handleG3Character(command);
|
||||
cuesNeedUpdate = true;
|
||||
} else {
|
||||
Log.w(TAG, "Invalid extended command: " + command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cuesNeedUpdate) {
|
||||
cues = getDisplayCues();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleC0Command(int command) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user