mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-22 19:41:00 +00:00
libcaption: fix bit set on indent preambles
style preambles look like: |P|0|0|1|C|0|ROW| |P|1|N|0|STYLE|U| and column preambles look like: |P|0|0|1|C|0|ROW| |P|1|N|1|CURSR|U| Both preambles go through eia608_row_pramble(), the value they pass as the x parameter is supposed to hold 4 bits, either 0|STYLE or 1|CURSR This value then gets bit-shifted by 1 and or'd in the second byte. The value is also and' with 0x1E to ensure it can't leak into the upper bits. The previous code resulted in x being a 5-bit value, 0x10 (0b10000). This resulted in outputting a style preamble, as 0x10 << 1 & 0x1E is 0b00000. When the indent was 0 (the usual case), this went undetected, but with any other value it resulted in no indent being applied, but the text getting colored or italicized. This patch fixes x to have the correct value of 0x8 | indent.
This commit is contained in:
parent
a3dafea688
commit
a7180e3995
2 changed files with 5 additions and 5 deletions
|
@ -53,7 +53,7 @@ eia608_row_pramble (int row, int chan, int x, int underline)
|
||||||
uint16_t
|
uint16_t
|
||||||
eia608_row_column_pramble (int row, int col, int chan, int underline)
|
eia608_row_column_pramble (int row, int col, int chan, int underline)
|
||||||
{
|
{
|
||||||
return eia608_row_pramble (row, chan, 0x10 | (col / 4), underline);
|
return eia608_row_pramble (row, chan, 0x8 | (col / 4), underline);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t
|
uint16_t
|
||||||
|
|
|
@ -73,8 +73,8 @@ fn test_one_timed_buffer_and_eos() {
|
||||||
(733_333_333.into(), 33_333_334.into(), [0x94, 0x20]), /* control doubled */
|
(733_333_333.into(), 33_333_334.into(), [0x94, 0x20]), /* control doubled */
|
||||||
(766_666_667.into(), 33_333_333.into(), [0x94, 0xae]), /* erase_non_displayed_memory */
|
(766_666_667.into(), 33_333_333.into(), [0x94, 0xae]), /* erase_non_displayed_memory */
|
||||||
(800_000_000.into(), 33_333_333.into(), [0x94, 0xae]), /* control doubled */
|
(800_000_000.into(), 33_333_333.into(), [0x94, 0xae]), /* control doubled */
|
||||||
(833_333_333.into(), 33_333_334.into(), [0x94, 0x40]), /* preamble */
|
(833_333_333.into(), 33_333_334.into(), [0x94, 0xd0]), /* preamble */
|
||||||
(866_666_667.into(), 33_333_333.into(), [0x94, 0x40]), /* control doubled */
|
(866_666_667.into(), 33_333_333.into(), [0x94, 0xd0]), /* control doubled */
|
||||||
(900_000_000.into(), 33_333_333.into(), [0xc8, 0xe5]), /* H e */
|
(900_000_000.into(), 33_333_333.into(), [0xc8, 0xe5]), /* H e */
|
||||||
(933_333_333.into(), 33_333_334.into(), [0xec, 0xec]), /* l l */
|
(933_333_333.into(), 33_333_334.into(), [0xec, 0xec]), /* l l */
|
||||||
(966_666_667.into(), 33_333_333.into(), [0xef, 0x80]), /* o, nil */
|
(966_666_667.into(), 33_333_333.into(), [0xef, 0x80]), /* o, nil */
|
||||||
|
@ -320,8 +320,8 @@ fn test_one_timed_buffer_and_eos_roll_up2() {
|
||||||
(1_033_333_333.into(), 33_333_334.into(), [0x94, 0x2c]), /* control doubled */
|
(1_033_333_333.into(), 33_333_334.into(), [0x94, 0x2c]), /* control doubled */
|
||||||
(1_066_666_667.into(), 33_333_333.into(), [0x94, 0x25]), /* roll_up_2 */
|
(1_066_666_667.into(), 33_333_333.into(), [0x94, 0x25]), /* roll_up_2 */
|
||||||
(1_100_000_000.into(), 33_333_333.into(), [0x94, 0x25]), /* control doubled */
|
(1_100_000_000.into(), 33_333_333.into(), [0x94, 0x25]), /* control doubled */
|
||||||
(1_133_333_333.into(), 33_333_334.into(), [0x94, 0xe0]), /* preamble */
|
(1_133_333_333.into(), 33_333_334.into(), [0x94, 0x70]), /* preamble */
|
||||||
(1_166_666_667.into(), 33_333_333.into(), [0x94, 0xe0]), /* control doubled */
|
(1_166_666_667.into(), 33_333_333.into(), [0x94, 0x70]), /* control doubled */
|
||||||
(1_200_000_000.into(), 33_333_333.into(), [0xc8, 0xe5]), /* H e */
|
(1_200_000_000.into(), 33_333_333.into(), [0xc8, 0xe5]), /* H e */
|
||||||
(1_233_333_333.into(), 33_333_334.into(), [0xec, 0xec]), /* l l */
|
(1_233_333_333.into(), 33_333_334.into(), [0xec, 0xec]), /* l l */
|
||||||
(1_266_666_667.into(), 33_333_333.into(), [0xef, 0x80]), /* o, nil */
|
(1_266_666_667.into(), 33_333_333.into(), [0xef, 0x80]), /* o, nil */
|
||||||
|
|
Loading…
Reference in a new issue